Disclosure of Invention
The invention provides a report processing system and method for overcoming the defect that report data is easy to be abnormal when a report database applies complex business logic to process report data in the prior art.
The invention solves the technical problems through the following technical scheme:
a report processing system comprises a report database, a Job server and a distribution processing server;
the Job server is used for sending an order synchronization command to the report database, and the report database stores at least one order number;
the report database is used for receiving the order synchronization command and reading order data corresponding to the order number from an external server according to the order number;
the Job server is also used for reading the order number from the report database and distributing the order number to the distribution processing server;
the distribution processing server is used for reading order data corresponding to the distribution order number from the report database according to the distributed distribution order number;
the distribution processing server is further used for calculating according to preset calculation rules and order data corresponding to the distributed order numbers to obtain calculation results, and sending the calculation results to the report database, and the report database is used for counting the calculation results to obtain reports.
Preferably, the number of the distributed processing servers is multiple.
Preferably, the Job server is further configured to distribute the order numbers to the distribution processing servers on an average according to the number of the order numbers.
Preferably, the Job server is further configured to generate a prompt message when the number of the order numbers exceeds a preset number, where the prompt message includes information prompting to increase the number of the distribution processing servers.
Preferably, the report processing system further comprises a monitoring server, the Job server is further configured to send the order number to the monitoring server, the distribution processing server is further configured to send the distribution order number to the monitoring server, and the monitoring server is configured to monitor the distribution processor according to the order number and the distribution order number and obtain a monitoring result.
Preferably, the distributed processing server is further configured to generate a processing log according to the calculation result, and send the processing log to the monitoring server, and the monitoring server is configured to analyze the processing log and generate alarm information.
Preferably, the Job server is further configured to send an order synchronization command to the report database at regular time;
and/or the Job server is also used for reading the order number from the report database at regular time.
Preferably, the Job server is further configured to filter the read order numbers, and remove invalid order numbers to obtain final order numbers.
A report processing method comprises the following steps:
the Job server sends an order synchronization command to the report database, and the report database stores at least one order number;
the report database receives the order synchronization command and reads order data corresponding to the order number from an external server according to the order number;
the Job server reads the order number from the report database and distributes the order number to a distribution processing server;
the distribution processing server reads order data corresponding to the distribution order number from the report database according to the distributed distribution order number;
the distribution processing server calculates according to a preset calculation rule and order data corresponding to the distribution order number to obtain a calculation result, and sends the calculation result to the report database;
and the report database counts the calculation result to obtain a report.
Preferably, the step of sending the order synchronization command to the report database by the Job server includes:
the Job server sends an order synchronization command to the report database at regular time;
and/or the presence of a gas in the atmosphere,
the step of reading the order number from the report database by the Job server comprises the following steps:
the Job server reads the order number from the report database at regular time;
and/or the presence of a gas in the gas,
when the number of the distribution processing servers is plural, the step of assigning the order number to the distribution processing server includes:
the Job server distributes the order numbers to the distribution processing server according to the number of the order numbers in an average way; the Job server generates prompt information when the number of the order numbers exceeds a preset number, wherein the prompt information comprises information for prompting the increase of the number of the distribution processing servers;
and/or the presence of a gas in the atmosphere,
the step of reading the order data corresponding to the distribution order number from the report database by the distribution processing server according to the distributed distribution order number further comprises the following steps:
the Job server sends the order number to a monitoring server, the distribution processing server sends the distribution order number to the monitoring server, and the monitoring server monitors the distribution processor according to the order number and the distribution order number and obtains a monitoring result.
The positive progress effects of the invention are as follows:
the order synchronization command is sent to the report database through the Job server, after the report database receives the order synchronization command, all order data corresponding to the order number are read from an external server according to the order number, the Job server reads the order number from the report database and distributes the order number to the distribution processing server, the distribution processing server can process the distributed order number, the order data corresponding to the distributed order number are calculated according to a preset calculation rule, a calculation result is obtained, and the report database is used for counting the calculation result to obtain a report. The invention separates the data processing calculation rule in the report database from the data, and sets the calculation rule in a special distributed processing server for processing, thereby improving the processing speed, relieving the data processing pressure of the report database, and avoiding the problem that the report database is easy to be abnormal when complex business logic is applied to process report data.
Detailed Description
The invention is further illustrated by the following examples, which are not intended to limit the scope of the invention.
Example 1
The present embodiment provides a report processing system, as shown in fig. 1, the report processing system includes a report database 1, a Job server 2, adistribution processing server 3, and a monitoring server 4.
The Job server 2 is used for sending order synchronization commands to the report database 1, and the report database 1 stores at least one order number.
The report database 1 is used for receiving the order synchronization command and reading order data corresponding to the order number from the external server according to the order number.
The Job server 2 is also used to read the order number from the report database and also to assign the order number to thedistribution processing server 3.
Because the order numbers in the report database can be continuously updated, including increasing or modifying, and the like, in order to realize continuous processing of orders corresponding to the order numbers in the report database, the Job server 2 is also used for regularly sending order synchronization commands to the report database 1; the Job server 2 is also used to read order numbers from the statement database 1 at regular times.
Thedistribution processing server 3 is used for reading order data corresponding to the distributed order number from the report database 1 according to the distributed order number.
Thedistribution processing server 3 is further configured to perform calculation according to the preset calculation rule and the order data corresponding to the distributed order number to obtain a calculation result, and is further configured to send the calculation result to the report database 1, and the report database 1 is configured to count the calculation result to obtain a report.
In order to increase the processing speed, the number of thedistribution processing servers 3 is plural, and the Job server 2 is also configured to equally distribute the order number to thedistribution processing servers 3 according to the number of the order numbers.
In order to exert the processing capacity of eachdistributed processing server 3, a preset allocation rule may be set such that the number of order numbers is allocated to each distributed processing server on an average according to the principle of average allocation, or the order numbers may be allocated according to the processing capacity of each distributed processing server according to actual conditions.
In order to further increase the processing speed, the number of thedistribution processing servers 3 may be increased according to actual requirements, and the Job server 2 is further configured to generate a prompt message when the number of the order numbers exceeds a preset number, where the prompt message includes information for prompting to increase the number of thedistribution processing servers 3, so as to flexibly remind a manager of newly adding the distribution processing servers.
The Job server 2 is also used for sending an order number to the monitoring server 4, thedistribution processing server 3 is also used for sending a distribution order number to the monitoring server 4, and the monitoring server 4 is used for monitoring thedistribution processor 3 according to the order number and the distribution order number and obtaining a monitoring result.
Thedistributed processing server 3 is further configured to generate a processing log according to the calculation result, and send the processing log to the monitoring server 4, and the monitoring server 4 is configured to analyze the processing log to generate alarm information.
The monitoring server 4 records and analyzes the processing logs of thedistributed processing server 3 in real time, judges possible faults, and can send fault calls or short messages through a telephone system and send mails to related management personnel through a mail system to realize effective monitoring.
The Job server 2 is also configured to filter the read order numbers and remove the invalid order numbers to obtain the final order number. Invalid data is removed, and the working efficiency is further improved.
After the report database 1 receives the order synchronization command, the report database 1 is responsible for reading order data from different data sources in an external server, and arranging the order data into a data format required by report processing, and the data in the converted format can be written into an order table in the report database 1 to prepare basic data for the report.
The Job server 2 reads order numbers to be processed from the order form, and distributes the order numbers to different distribution processing servers for data processing in different batches, so that the processing and read-write data pressure of each distribution processing server and the report database can be balanced.
In this embodiment, the type of the report is taken as a commission report, the distribution processor calculates an order commission corresponding to each order number according to commission logic, and finally sends the calculated order commission data of each order number to the report database, and the report database summarizes the order commission, and classifies and summarizes to form a report according to commissions with different dimensions (such as star level, region, dealer dimension, and the like).
And calculating order commission comparison data and data absolute values of different dimensions according to different dimensions, and sending the mails to related personnel.
In this embodiment, the Job server sends an order synchronization command to the report database, the report database reads all order data corresponding to the order number from the external server according to the order number after receiving the order synchronization command, the Job server reads the order number from the report database and distributes the order number to the distribution processing server, the distribution processing server can process the distributed order number, calculate the order data corresponding to the distributed order number according to a preset calculation rule and obtain a calculation result, and the report database is configured to count the calculation result to obtain a report.
The data processing and calculating rule in the report database is separated from the data, the calculating rule is set in the special distributed processing server for processing, the processing speed is improved, the data processing pressure of the report database is relieved, the number of a plurality of distributed processing servers can be set according to requirements, the number of the processing servers is flexibly increased according to prompt information, the processing speed of processing large-batch data is further improved, and the problem that the report database is easy to generate abnormity when complex business logic is applied to processing report data is avoided.
Example 2
The embodiment provides a report processing method, which is implemented by using the report processing system.
As shown in fig. 2, the report processing method includes the following steps:
step 201, the Job server sends an order synchronization command to a report database at regular time.
Step 202, the report database is used for receiving the order synchronization command and reading order data corresponding to the order number from the external server according to the order number.
Step 203, the Job server reads the order number from the report database at regular time.
And step 204, the Job server screens the read order numbers, and removes the invalid order numbers to obtain the final order numbers.
And step 205, the Job server distributes the order number to the distribution processing server according to the preset distribution rule and sends the order number to the monitoring server.
And step 206, the distribution processing server reads order data corresponding to the distribution order number from the report database according to the distributed distribution order number and sends the distribution order number to the monitoring server.
And step 207, the distribution processing server calculates according to a preset calculation rule and order data corresponding to the distributed order number to obtain a calculation result.
And step 208, the distributed processing server generates a processing log according to the calculation result and sends the processing log to the monitoring server.
And step 209, the distributed processing server sends the calculation result to a report database, and the report database counts the calculation result to obtain a report.
And step 210, the monitoring server monitors the distribution processor according to the order number and the distributed order number to obtain a monitoring result, analyzes and processes the log, and generates alarm information.
In this embodiment, the order synchronization command is sent to the report database by the Job server, after receiving the order synchronization command, the report database reads all order data corresponding to the order number from the external server according to the order number, the Job server reads the order number from the report database and distributes the order number to the distribution processing server, the distribution processor can process the distributed order number, calculate the order data corresponding to the distributed order number according to a preset calculation rule and obtain a calculation result, and the report database is used for counting the calculation result to obtain a report.
The embodiment separates the data processing calculation rule from the data in the report database, sets the calculation rule in a special distribution processing server for processing, improves the processing speed, relieves the data processing pressure of the report database, can also set the number of a plurality of distribution processing servers according to the requirement, and flexibly increases the number of the processing servers according to the prompt information, so as to further improve the processing speed of processing mass data, and avoid the problem that the report database is easy to have abnormity when complex business logic is applied to process report data.
While specific embodiments of the invention have been described above, it will be appreciated by those skilled in the art that this is by way of example only, and that the scope of the invention is defined by the appended claims. Various changes or modifications to these embodiments may be made by those skilled in the art without departing from the principle and spirit of this invention, and these changes and modifications are within the scope of this invention.