Report generation method, device, equipment and storage medium
By executing the export task thread in a distributed database and copying the data to a transactional database, using its index query speed, the problem of low report generation efficiency in distributed databases is solved, and a method of quickly generating reports is realized.
Patent Information
- Application Number
- CN202111340466.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-12
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2041-11-12
AI Technical Summary
When querying and exporting large amounts of data in distributed databases, the report generation efficiency is inefficient and cannot meet business needs.
By executing export task threads in distributed databases, obtaining calculation result data and copying them to transactional databases, taking advantage of the fast index query speed of transactional databases, generating reports and processing data in batches to improve stability and reliability sex.
It significantly reduces the report generation time from 18.5 days to about 5-6 hours, meets the report generation efficiency requirements and improves resource utilization.
Smart Images

Figure CN114036180B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and in particular to a report generation method, device, equipment and storage medium. Background Art
[0002] With the development of electronic information technology, more and more business processes can be completed by electronic devices. Specifically, data can be uploaded to electronic devices and processed uniformly by electronic devices. In some business areas, a large amount of data is generated every day. Over time, the amount of data can even reach terabytes (TB) or petabytes (PB). In order to alleviate the pressure of data storage, at this stage, a large amount of data is stored in a distributed database.
[0003] In business processing, data needs to be used to generate reports, so data needs to be queried and exported from distributed databases. However, when a large amount of data needs to be queried and exported, it takes a very long time to query and export data in distributed databases, resulting in low efficiency in report generation. Summary of the invention
[0004] The embodiments of the present application provide a report generation method, apparatus, device and storage medium, which can improve the efficiency of report generation.
[0005] In a first aspect, an embodiment of the present application provides a report generation method, comprising: establishing a first export task thread in response to a received first report export request; executing the first export task thread, calculating the business data in a distributed database storing the business data, and obtaining first calculation result data; copying the first report candidate data to a transactional database, the first report candidate data including the first calculation result data, or the first report candidate data including the first calculation result data and business data; querying the first target data indicated by the first export task thread in the first report candidate data of the transactional database, calling a report generation tool, and generating a first target report based on the first target data obtained by the query.
[0006] In some possible embodiments, copying the report candidate data to the transactional database includes: determining the amount of data to be processed in a single batch according to the data processing performance of the first export task thread; and copying the first report candidate data to the transactional database in batches according to the amount of data to be processed in a single batch.
[0007] In some possible embodiments, a report generation tool is called to generate a first target report based on the first target data obtained by the query, including: dividing the first target data obtained by the query according to a preset splitting dimension to obtain at least one group of first target data; calling the report template indicated by the first export task thread, filling each group of first target data into the report template respectively, and calling the report generation tool to generate a first target report corresponding to each group of first target data.
[0008] In some possible embodiments, the splitting dimension includes one or more of the following: user dimension, user attribute dimension, and data attribute dimension.
[0009] In some possible embodiments, the method further includes: in the case of having an idle thread, in response to a received second report export request, establishing a second export task thread; executing the second export task thread in parallel with the first export task thread, calculating the business data in a distributed database storing the business data to obtain second calculation result data; copying the second report candidate data to a transactional database, the second report candidate data including the second calculation result data, or the second report candidate data including the second calculation result data and the business data; querying the second target data indicated by the second export task thread in the second report candidate data of the transactional database, calling a report generation tool, and generating a second target report based on the second target data obtained by the query.
[0010] In some possible embodiments, after calling the report generation tool to generate the first target report according to the first target data obtained by querying, the method further includes: deleting the first report candidate data in the transactional database.
[0011] In some possible embodiments, the method further includes: polling the first export task thread in response to an interrupt instruction; when polling determines that the first export task thread is executing a thread program, changing the task state of the first export task thread to a cancel state to interrupt the first export task thread.
[0012] In a second aspect, an embodiment of the present application provides a report generating device, comprising: a thread establishing module, used to establish a first export task thread in response to a received first report export request; a calculation module, used to execute the first export task thread, calculate the business data in a distributed database storing the business data, and obtain first calculation result data; a copying module, used to copy the first report candidate data to a transactional database, the first report candidate data including the first calculation result data, or the first report candidate data including the first calculation result data and business data; a processing module, used to query the first target data indicated by the first export task thread in the first report candidate data of the transactional database, call the report generation tool, and generate a first target report according to the first target data obtained by the query.
[0013] In a third aspect, an embodiment of the present application provides a report generating device, comprising: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the report generating method of the first aspect is implemented.
[0014] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the report generation method of the first aspect is implemented.
[0015] The embodiments of the present application provide a report generation method, apparatus, device and storage medium. In response to a first report export request, a first export task thread can be established, and the report generation can be realized by executing the thread. The first export task thread is executed to calculate the business data in a distributed database storing the business data to obtain the first calculation result data. By storing and calculating the business data in a distributed database, the storage and computing pressure is dispersed, and the time required for business operations is reduced. The first report candidate data obtained by calculation is copied to a transactional database, the data is queried and exported in the transactional database, and the report generation tool is called to generate the first target report. The advantage of the fast index query speed in the transactional database is utilized to reduce the time required for querying data, thereby reducing the time spent on report generation and improving the efficiency of report generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0017] Figure 1 A flowchart of an embodiment of a report generation method provided by the present application;
[0018] Figure 2 A flowchart of another embodiment of the report generation method provided by the present application;
[0019] Figure 3 A flowchart of another embodiment of the report generation method provided by the present application;
[0020] Figure 4 A flowchart of another embodiment of the report generation method provided by the present application;
[0021] Figure 5 A schematic diagram of an example of the logical principle of report generation provided in an embodiment of the present application;
[0022] Figure 6 A schematic diagram of an embodiment of a report generating device provided by the present application;
[0023] Figure 7 A schematic diagram of another embodiment of the report generating device provided by the present application;
[0024] Figure 8 A schematic diagram of another embodiment of the report generating device provided by the present application;
[0025] Fig. 9 A structural schematic diagram of an embodiment of the report generating device provided in this application. DETAILED DESCRIPTION
[0026] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0027] With the development of electronic information technology, more and more businesses no longer need manual processing. Business data can be uploaded to electronic devices for unified processing. In some business areas, such as the financial field, a large amount of data is generated every day. Over time, the amount of data can even reach terabytes (TB) or petabytes (PB). In order to alleviate the pressure of data storage, a large amount of data is stored in a distributed database. Distributed databases can basically meet the storage and computing requirements of data. However, in the process of business processing, it is necessary to use data to generate reports, so it is necessary to query and export data from distributed databases. However, it takes a long time to query and export data in distributed databases. When a large amount of data needs to be queried and exported, the efficiency of report generation is very low.
[0028] For example, assuming that the data of 200,000 users needs to be queried and exported in a distributed database, it takes 7 seconds to query the data of a single user in the distributed database, and 1 second to export and generate a report. In this case, it takes about 18.5 days to query the data of 200,000 users and export and generate a report, which cannot meet the efficiency requirements for report generation.
[0029] The embodiments of the present application provide a report generation method, apparatus, device, and storage medium, and the application fields of the report generation method, apparatus, device, and storage medium are not limited here. For example, the report generation method, apparatus, device, and storage medium provided in the embodiments of the present application can be applied to the financial field, the medical field, the transportation field, the network technology field, etc., and are not limited here. In the report generation method, apparatus, device, and storage medium provided in the embodiments of the present application, the storage and calculation of business data are performed in a distributed database, and the query and export of data are performed in a transactional database to reduce the time required for querying and exporting a large amount of data to generate reports, thereby improving the efficiency of report generation.
[0030] The report generation method, apparatus, device and storage medium are described in turn below.
[0031] The present application provides a report generation method, which can be applied to a report generation device or equipment, that is, can be executed by the report generation device or equipment. Figure 1 This is a flow chart of an embodiment of the report generation method provided by this application. Figure 1 As shown, the report generation method may include steps S101 to S104.
[0032] In step S101, in response to a received first report export request, a first export task thread is established.
[0033] The first report export request may be any report export request. The report export request may be used to request the export of a report. The first report export request may be a request input by a user to a report generating device or apparatus, or may be a request sent by a user to a report generating device or apparatus through a user terminal, which is not limited here. In some examples, the first report export request may include requirements for the report to be exported, etc., which is not limited here.
[0034] In response to the first report export request, the task corresponding to the first report export request is loaded on the thread to form a first export task thread. Specifically, the report generation device or equipment receives the first report export request, identifies the request type of the first report export request, etc., instantiates the thread model, and assigns the task corresponding to the first report export request to the thread for execution. Before executing step S101, the report generation device or equipment may pre-register an external request interface, which is used to receive the report export request.
[0035] In step S102, a first export task thread is executed to calculate the business data in a distributed database storing the business data to obtain first calculation result data.
[0036] The first export task thread is executed, and the task data corresponding to the first export task thread can be inserted into the transactional database for recording, so as to facilitate searching when needed.
[0037] The first export task thread is executed, calling the distributed database, and performing data calculations in the distributed database. The distributed database is used to store business data and perform business data calculations. The type of distributed database is not limited here. For example, the distributed database can be a distributed database that uses Massively Parallel Processing (MPP) combined with GreenPlum technology, namely GP technology. In a distributed database, business data shards are stored on nodes in a cluster of distributed databases. According to the calculation rules indicated by the first export task thread, the computing nodes in the cluster of distributed databases can be used to disperse the computing pressure to meet the storage requirements and computing requirements of business data.
[0038] The type of business data can be determined according to business scenarios, business needs, etc., and is not limited here. For example, in the financial fund management business scenario, business data may include user accounts, user account assets, user invested assets, user withdrawn assets, etc., which are not limited here. The first calculation result data is the data obtained by using the business data to perform the calculation rules indicated by the first export task thread. The calculation of business data in the distributed database can be performed according to the calculation rules indicated by the first export task thread, which is not limited here. The calculation rules indicated by the first export task thread can be determined according to the task corresponding to the first export task, that is, the task corresponding to the first report export request, which is not limited here. For example, the business data includes user account assets, and the first report export request requests to export a report including the data of the user account asset change rate. Correspondingly, the calculation rules indicated by the first export task thread include the change rate calculation rules. The user account asset data can be used in the distributed database to calculate according to the change rate calculation rules to obtain the user account asset change rate data, and the user account asset change rate can be used as the first calculation result data.
[0039] In step S103, the first report candidate data is copied to the transactional database.
[0040] The first report candidate data includes data in the report requested to be exported by the first report export request. In some examples, the first report candidate data may include first calculation result data. In other examples, the first report candidate data may include first calculation result data and business data.
[0041] The transactional database is called to copy the candidate data of the first report into the transactional database. The query of data in the transactional database is performed by index query, which is faster and can reach millisecond level. The type of transactional database is not limited here, for example, the transactional database may include Oracle database.
[0042] In step S104, the first target data indicated by the first export task thread is searched in the first report candidate data of the transactional database, a report generation tool is called, and a first target report is generated according to the first target data obtained by the search.
[0043] The first report candidate data is copied to the transactional database, that is, the first report candidate data is stored in the transactional database. In the transactional database, the index can be used to query data, which improves the speed of data query and reduces the time spent on data query. The first target data indicated by the first export task thread is the data required to generate the first target report. The first report candidate data includes the first target data. The first target data obtained by the query can be filled into the report template, and the report generation tool is called to generate the first target report. The first target report includes the first target data.
[0044] The report generation tool may be a third-party software tool or a tool provided by the operating system, which is not limited here. The report generation tool is used to generate a report file, that is, the first target report can be displayed in various file formats.
[0045] The number of first target reports is not limited here, and the number of first target reports can be one or more. The format of the first target report is not limited here, and the format of the first target report can be selected by calling a report generation tool. For example, the format of the first target report can include Word format, Excel format, PDF format, etc.
[0046] In some examples, after generating the first target report based on the first target data obtained from the query, the first report alternative data may be deleted in the transactional database to release storage resources of the transactional database, avoid affecting the process of generating other reports, and improve the report generation efficiency in multi-report generation scenarios.
[0047] In an embodiment of the present application, in response to a first report export request, a first export task thread may be established, and report generation may be achieved by executing the thread. The first export task thread is executed to calculate the business data in a distributed database storing the business data to obtain first calculation result data. By storing and calculating business data in a distributed database, the storage and computing pressures are dispersed, and the time required for business operations is reduced. The first report candidate data obtained by calculation is copied to a transactional database, data is queried and exported in the transactional database, and a report generation tool is called to generate a first target report, which takes advantage of the fast index query speed in the transactional database, reduces the time required for querying data, and thereby reduces the time spent on report generation, thereby improving the efficiency of report generation.
[0048] For example, using the report generation method in the embodiment of the present application, it takes about 5 to 6 hours to query the data of 200,000 users and export and generate reports, which greatly reduces the time spent on report generation and can meet the efficiency requirements of report generation.
[0049] In some embodiments, in order to ensure the stability and reliability of the report generation process, when the data volume is large, the first report data may be copied to the transactional database in batches. Figure 2 The present invention provides a flow chart of another embodiment of the report generation method. Figure 2 and Figure 1 The difference is that Figure 1 Step S103 in the above example can be specifically broken down into Figure 2 Step S1031 and step S1032 in .
[0050] In step S1031, the amount of data to be processed in a single batch is determined according to the data processing performance of the first export task thread.
[0051] The data processing performance of the report generation device or equipment will affect the data processing capability of the export task thread, and the data processing capability of the export task thread will affect the amount of data that can be copied from the distributed database to the transactional database at one time. In order to avoid the report generation process being stuck or blocked due to too much data being copied at one time, the amount of data processed in a single batch can be determined in advance based on the data processing performance of the first export task thread. The amount of data processed in a single batch is within the capacity of the data processing performance of the first export task thread. The data processing performance of the first export task thread is positively correlated with the data processing performance of the report generation device or equipment, and the amount of data processed in a single batch is positively correlated with the processing performance of the first export task thread.
[0052] In step S1032, the first report candidate data is copied to the transactional database in batches according to the data volume to be processed in a single batch.
[0053] Each batch copies the first report candidate data of a single batch of data to the transactional database. In some examples, the number of batches required to copy the first report candidate data from the distributed database to the transactional database can be pre-calculated. The ratio of the data volume of the first report candidate data to the data volume processed in a single batch can be calculated. If the ratio is an integer, the ratio is used as the number of batches required to copy the first report candidate data from the distributed database to the transactional database; if the ratio is not an integer, the ratio can be rounded, and the integer part obtained by rounding plus one can be used as the number of batches required to copy the first report candidate data from the distributed database to the transactional database.
[0054] By copying the first report candidate data from the distributed database to the transactional database in batches, it is possible to avoid freezes or blockages in the report generation process, thereby improving the stability and reliability of the report generation process.
[0055] In some embodiments, personalized reports can be generated based on demand. Figure 3 The present invention provides a flow chart of another embodiment of the report generation method. Figure 3 and Figure 1 The difference is that Figure 1 Step S104 in the above example can be specifically broken down into the following steps: Figure 3 Step S1041 and step S1042 in .
[0056] In step S1041, the first target data obtained by the query is divided according to a preset splitting dimension to obtain at least one group of first target data.
[0057] The amount of the first target data obtained by the query is still large, and the first target data includes multiple data, and the data is still relatively messy. The splitting dimension can be set in advance, and the first target data can be grouped according to the splitting dimension.
[0058] In some examples, the splitting dimension includes one or more of the following: user dimension, user attribute dimension, and data attribute dimension. The user dimension is the dimension of the user. The first target data is divided according to the user dimension, and a group of first target data after division may correspond to one customer. The user attribute dimension may include the dimension of user attributes. The user attribute may characterize the nature of the user. The first target data is divided according to the user attribute dimension. The user attributes of the users corresponding to a group of first target data are the same. For example, the user attribute is age. The first target data is divided according to the user attribute dimension. The ages of the users corresponding to the group of first target data after division are in the same age range. The data attribute dimension may include the dimension of data attributes. The data attribute may characterize the nature of the data. The first target data is divided according to the data attribute dimension. The data attributes of the data corresponding to a group of first target data are the same. For example, the data attribute is asset valuation. The first target data is divided according to asset valuation. The asset valuations corresponding to the group of first target data after division are in the same valuation range.
[0059] In step S1042, the report template indicated by the first export task thread is called, each group of first target data is filled into the report template respectively, and the report generation tool is called to generate the first target report corresponding to each group of first target data.
[0060] The report template specifies the location of each data item, and each group of first target data can be filled into the report template according to the format of the report template. A group of first target data filled into the report template can generate a first target report.
[0061] The first target data is split according to the splitting dimension, and the first target report is obtained by filling in each group of the split first target data. The first target report is the first target report corresponding to the splitting dimension, which is more targeted and realizes personalization and customization of the report.
[0062] In some embodiments, more than two export task threads may be executed concurrently to improve the concurrency of the report generation task. Figure 4 The present invention is a flowchart of another embodiment of the report generation method provided by the present application. Figure 4 and Figure 1 The difference is that Figure 4 The report generation method shown may further include steps S105 to S108.
[0063] In step S105, in the case where there is an idle thread, in response to the received second report export request, a second export task thread is established.
[0064] When the report generation device or apparatus has idle threads, multiple export task threads can be executed in parallel. The number of threads that can be executed in parallel by the report generation device or apparatus is related to the thread execution performance of the report generation device.
[0065] The second report export request is any report export request different from the first report export request. The second report export request may be a request input by a user to a report generating device or apparatus, or may be a request sent by a user to a report generating device or apparatus through a user terminal, which is not limited here. In some examples, the second report export request may include requirements for the report to be exported, etc., which is not limited here.
[0066] In response to the second report export request, the task corresponding to the second report export request is loaded on the thread to form a second export task thread. Specifically, the report generating device or apparatus receives the second report export request, identifies the request type of the second report export request, etc., instantiates the thread model, and assigns the task corresponding to the second report export request to the thread for execution.
[0067] In step S106, the second export task thread is executed in parallel with the first export task thread, and the business data is calculated in a distributed database storing the business data to obtain second calculation result data.
[0068] The first export task thread and the second export task thread can be executed in parallel. The second calculation result data is the data obtained by using the business data to perform the calculation rules indicated by the second export task thread. The calculation of business data in the distributed database can be performed according to the calculation rules indicated by the second export task thread, which is not limited here. The calculation rules indicated by the second export task thread can be determined according to the task corresponding to the second export task, that is, the task corresponding to the second report export request, which is not limited here. The specific content of step S106 can refer to the relevant description of the above step S102, which will not be repeated here.
[0069] In step S107, the second report candidate data is copied to the transactional database.
[0070] The second report candidate data includes data in the report requested to be exported by the second report export request. In some examples, the second report candidate data includes second calculation result data. In other examples, the second report candidate data includes second calculation result data and business data.
[0071] The specific content of step S107 can refer to the relevant description of the above step S103, which will not be repeated here.
[0072] In step S108, the second target data indicated by the second export task thread is searched in the second report candidate data of the transactional database, a report generation tool is called, and a second target report is generated according to the second target data obtained by the search.
[0073] The second report candidate data is copied to the transactional database, that is, the second report candidate data is stored in the transactional database. In the transactional database, the index can be used to query data, which improves the speed of data query and reduces the time spent on data query. The second target data indicated by the second export task thread is the data required to generate the second target report. The second report candidate data includes the second target data. The second target data obtained by the query can be filled into the report template, and the report generation tool is called to generate the second target report. The second target report includes the second target data. The specific content of the report generation tool can be found in the relevant description in the above embodiment, which will not be repeated here.
[0074] The number of the second target reports is not limited here, and the number of the second target reports can be one or more. The format of the first target report is not limited here either, for example, the format of the second target report can include Word format, Excel format, PDF format, etc.
[0075] In some examples, after generating the second target report based on the second target data obtained from the query, the second report alternative data can be deleted in the transactional database to release storage resources of the transactional database, avoid affecting the process of generating other reports, and improve the report generation efficiency in multi-report generation scenarios.
[0076] The specific content of the processing related to the second target report can refer to the relevant description of the processing related to the first target report in the above embodiment, which will not be repeated here.
[0077] In the case of an idle thread, a third export task thread, a fourth export task thread, etc. can also be established and executed, and the specific method is basically the same as the establishment and execution of the first export task thread and the second export task thread, which will not be repeated here. In the embodiment of the present application, multiple threads can be used to generate reports concurrently, so that resources can be fully utilized when waiting for input and output (i.e., IO), thereby improving resource utilization and efficiency of report generation.
[0078] In some embodiments, in the event of an operation such as an erroneous report export request, the report generation process can be interrupted to avoid resource occupation caused by erroneous operations. Specifically, the report generation device or equipment responds to the interrupt instruction and polls the first export task thread. When the polling determines that the first export task thread is executing a thread program, the task state of the first export task thread is changed to a cancel state to interrupt the first export task thread. The task state of the first export task thread is changed to a cancel state, and the first export task thread is interrupted, that is, the report generation process is interrupted. In an embodiment of the present application, the report generation process is interrupted by changing the task state of the export task thread, thereby avoiding long-term occupation of resources due to erroneous operations, being able to interrupt the report generation process in a timely manner, and improving resource utilization of the report generation process.
[0079] For the sake of convenience, the logical principle of the report generation method of the embodiment of the present application is illustrated here. The report generation method in the embodiment of the present application may include request reception, task management, thread scheduling, task execution, data calculation, data replication, report filling, file export and interrupt processing. Figure 5 A schematic diagram of an example of the logical principle of report generation provided in the embodiment of the present application. Figure 5 As shown, the request receiving may be the responsibility of the request controller, which may complete the registration of the external request interface, the receiving of the report export request, the identification of the report export request type, and the instantiation of the thread model.
[0080] The task management may insert record data that can characterize the task indicated by the report export request into the transactional database according to the task indicated by the report export request. The record data may include task record data or thread record data, etc., which is not limited here.
[0081] Thread scheduling can be handled by the thread scheduler. Task management can call the thread scheduler to create a thread corresponding to the task indicated by the report export request, thereby assigning the task indicated by the report export request to the thread for execution. Task execution can be implemented by the task executor, which can execute threads, connect to distributed databases, and perform data calculations in the distributed databases.
[0082] After the data calculation is completed, the task manager can connect to the transactional database to replicate the data, and copy the data in the distributed database to the transactional database in batches.
[0083] Query and export data from transactional databases, fill in reports with the exported data, and generate more than one file based on user dimensions.
[0084] In some cases, the generated files may be compressed and packaged, and a compressed package of the compressed and packaged files may be outputted finally.
[0085] In some cases, if a report export request is sent incorrectly, the task corresponding to the report export request can be interrupted by interrupting the processing.
[0086] The report generation method in the embodiment of the present application may use Java as the program development language to improve the readability of the program and the scalability of the report generation method.
[0087] The present application also provides a report generation device. Figure 6 This is a schematic diagram of an embodiment of the report generation device provided by the present application. Figure 6As shown, the report generation device 200 may include a thread establishment module 201 , a calculation module 202 , a replication module 203 and a processing module 204 .
[0088] The thread establishing module 201 may be used to establish a first export task thread in response to a received first report export request.
[0089] The calculation module 202 may be used to execute a first export task thread, calculate the business data in a distributed database storing the business data, and obtain first calculation result data.
[0090] The copy module 203 may be used to copy the first report candidate data to the transactional database.
[0091] The first report candidate data includes the first calculation result data. Alternatively, the first report candidate data includes the first calculation result data and business data.
[0092] The processing module 204 may be used to query the first target data indicated by the first export task thread in the first report candidate data of the transactional database, call a report generation tool, and generate a first target report according to the first target data obtained by the query.
[0093] In an embodiment of the present application, in response to a first report export request, a first export task thread may be established, and report generation may be achieved by executing the thread. The first export task thread is executed to calculate the business data in a distributed database storing the business data to obtain first calculation result data. By storing and calculating business data in a distributed database, the storage and computing pressures are dispersed, and the time required for business operations is reduced. The first report candidate data obtained by calculation is copied to a transactional database, data is queried and exported in the transactional database, and a report generation tool is called to generate a first target report, which takes advantage of the fast index query speed in the transactional database, reduces the time required for querying data, and thereby reduces the time spent on report generation, thereby improving the efficiency of report generation.
[0094] In some examples, the above-mentioned copy module 203 can be used to: determine the amount of data processed in a single batch according to the data processing performance of the first export task thread; and copy the first report candidate data to the transactional database in batches according to the amount of data processed in a single batch.
[0095] In some examples, the processing module 204 may be used to: divide the first target data obtained by the query according to a preset splitting dimension to obtain at least one group of first target data; call the report template indicated by the first export task thread, fill each group of first target data into the report template respectively, and call the report generation tool to generate a first target report corresponding to each group of first target data.
[0096] In some examples, the splitting dimensions include one or more of the following: user dimension, user attribute dimension, and data attribute dimension.
[0097] In some examples, the thread establishment module 201 may also be used to establish a second export task thread in response to a received second report export request when there is an idle thread.
[0098] The calculation module 202 may also be used to execute a second export task thread in parallel with the first export task thread, calculate the business data in a distributed database storing the business data, and obtain second calculation result data.
[0099] The copy module 203 may also be used to copy the second report candidate data to a transactional database.
[0100] The second report candidate data includes the second calculation result data. Alternatively, the second report candidate data includes the second calculation result data and business data.
[0101] The processing module 204 is also used to query the second target data indicated by the second export task thread in the second report candidate data of the transactional database, call the report generation tool, and generate a second target report according to the second target data obtained by the query.
[0102] Figure 7 A schematic diagram of another embodiment of the report generating device provided by the present application. Figure 7 and Figure 6 The difference is that Figure 7 The report generating apparatus 200 shown may further include a deletion module 205 .
[0103] The deletion module 205 may be used to delete the first report candidate data in the transactional database.
[0104] Figure 8 This is a schematic diagram of another embodiment of the report generating device provided by the present application. Figure 8 and Figure 6 The difference is that Figure 8 The report generation device 200 shown may further include a polling module 207 and an interrupt module 208 .
[0105] The polling module 207 may be configured to poll the first export task thread in response to an interrupt instruction.
[0106] The interrupt module 208 may be used to change the task state of the first export task thread to a cancel state to interrupt the first export task thread when it is determined through polling that the first export task thread is executing a thread program.
[0107] The present application also provides a report generating device. Fig. 9 This is a schematic diagram of the structure of an embodiment of the report generation device provided by the present application. Fig. 9 As shown, the report generating device 300 includes a memory 301 , a processor 302 , and a computer program stored in the memory 301 and executable on the processor 302 .
[0108] In an example, the processor 302 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0109] The memory 301 may include a read-only memory (ROM), a random access memory (RAM), a disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Therefore, generally, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the report generation method in the embodiment of the present application.
[0110] The processor 302 runs a computer program corresponding to the executable program code by reading the executable program code stored in the memory 301 , so as to implement the report generation method in the above embodiment.
[0111] In one example, the report generating device 300 may further include a communication interface 303 and a bus 304. Fig. 9 As shown, the memory 301, the processor 302, and the communication interface 303 are connected via a bus 304 and communicate with each other.
[0112] The communication interface 303 is mainly used to realize the communication between the modules, devices, units and / or equipment in the embodiment of the present application. The communication interface 303 can also be used to access input devices and / or output devices.
[0113] The bus 304 includes hardware, software, or both, coupling the components of the report generating device 300 to each other. By way of example and not limitation, the bus 304 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a Memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-E) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses or a combination of two or more of the above. Where appropriate, the bus 304 may include one or more buses. Although embodiments of the present application describe and illustrate a particular bus, the present application contemplates any suitable bus or interconnect.
[0114] The present application also provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the report generation method in the above embodiment can be implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. Among them, the above-mentioned computer-readable storage medium may include a non-transitory computer-readable storage medium, such as a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc., which is not limited here.
[0115] It should be clear that each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. For device embodiments, equipment embodiments, and computer-readable storage medium embodiments, the relevant parts can refer to the description part of the method embodiment. The present application is not limited to the specific steps and structures described above and shown in the figures. Those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application. In addition, for the sake of brevity, a detailed description of known method technologies is omitted here.
[0116] The above reference is according to the method of the embodiment of the present application, the flow chart of the device (system) and the computer program product and / or the block diagram described various aspects of the present application.It should be understood that each square box in the flow chart and / or the block diagram and the combination of each square box in the flow chart and / or the block diagram can be realized by computer program instructions.These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the realization of the function / action specified in one or more square boxes of the flow chart and / or the block diagram.Such a processor can be but is not limited to a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit.It can also be understood that each square box in the block diagram and / or the flow chart and the combination of the square boxes in the block diagram and / or the flow chart can also be realized by the dedicated hardware that performs the specified function or action, or can be realized by the combination of dedicated hardware and computer instructions.
[0117] Those skilled in the art should understand that the above embodiments are exemplary rather than restrictive. Different technical features appearing in different embodiments can be combined to achieve beneficial effects. Based on the study of the drawings, the specification and the claims, those skilled in the art should be able to understand and implement other variations of the disclosed embodiments. In the claims, the term "comprising" does not exclude other devices or steps; the quantifier "one" does not exclude multiple; the terms "first" and "second" are used to indicate names rather than to indicate any specific order. Any figure marks in the claims should not be understood as limiting the scope of protection. The functions of multiple parts appearing in the claims can be implemented by a single hardware or software module. The appearance of certain technical features in different dependent claims does not mean that these technical features cannot be combined to achieve beneficial effects.
Claims
1. A report generation method, characterized in that: include: In response to the received first report export request, establishing a first export task thread; Execute the first export task thread, calculate the business data in a distributed database storing the business data, and obtain first calculation result data; Copying first report candidate data to a transactional database, wherein the first report candidate data includes the first calculation result data, or the first report candidate data includes the first calculation result data and the business data; Searching the first target data indicated by the first export task thread in the first report candidate data of the transactional database, calling a report generation tool, and generating a first target report according to the first target data obtained by the query; The calling of the report generation tool to generate a first target report according to the first target data obtained by querying includes: Divide the first target data obtained by the query according to a preset splitting dimension to obtain at least one group of the first target data; Call the report template indicated by the first export task thread, fill each group of the first target data into the report template respectively, call the report generation tool, and generate the first target report corresponding to each group of the first target data.
2. The method according to claim 1, characterized in that: The step of copying the report candidate data to the transactional database includes: Determine the amount of data to be processed in a single batch according to the data processing performance of the first export task thread; The first report candidate data is copied to the transactional database in batches according to the single batch processing data volume.
3. The method according to claim 1, characterized in that The splitting dimensions include one or more of the following: User dimension, user attribute dimension, and data attribute dimension.
4. The method according to claim 1, characterized in that: Also includes: In the case of having an idle thread, in response to receiving a second report export request, establishing a second export task thread; Executing the second export task thread in parallel with the first export task thread, calculating the business data in a distributed database storing the business data, and obtaining second calculation result data; Copying the second report candidate data to the transactional database, the second report candidate data including the second calculation result data, or the second report candidate data including the second calculation result data and the business data; The second target data indicated by the second export task thread is searched in the second report candidate data of the transactional database, the report generation tool is called, and a second target report is generated according to the second target data obtained by the query.
5. The method according to claim 1, characterized in that After the report generation tool is called to generate the first target report according to the first target data obtained through the query, the method further includes: The first report candidate data is deleted in the transactional database.
6. The method according to claim 1, characterized in that Also includes: In response to the interrupt instruction, polling the first export task thread; When it is determined through polling that the first export task thread is executing a thread program, the task state of the first export task thread is changed to a cancel state to interrupt the first export task thread.
7. A report generation device, characterized in that: include: A thread establishment module, used for establishing a first export task thread in response to a received first report export request; A calculation module, used to execute the first export task thread, calculate the business data in a distributed database storing the business data, and obtain first calculation result data; A copy module, used for copying first report candidate data to a transactional database, wherein the first report candidate data includes the first calculation result data, or the first report candidate data includes the first calculation result data and the business data; A processing module, configured to query the first report candidate data of the transactional database for first target data indicated by the first export task thread, call a report generation tool, and generate a first target report according to the first target data obtained by the query; The processing module is used to: divide the first target data obtained by query according to a preset splitting dimension to obtain at least one group of the first target data; Call the report template indicated by the first export task thread, fill each group of the first target data into the report template respectively, call the report generation tool, and generate the first target report corresponding to each group of the first target data.
8. A report generation device, characterized in that: include: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the report generation method according to any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the report generation method according to any one of claims 1 to 6 is implemented.
