Report generation method, device, computer equipment and storage medium
By detecting and responding to changes in configuration information of computer system security reports, and automatically obtaining and inputting parameters and data required to generate reports, the inefficiency problem of manually adjusting templates and codes in the prior art is solved, and the efficiency and flexibility of report generation is improved.
Patent Information
- Application Number
- CN202111095163.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-17
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2041-09-17
AI Technical Summary
In the generation of computer system security reports, word templates and codes need to be manually adjusted when configuration information is changed, resulting in low report generation efficiency.
By detecting the configuration information changes of the target report, obtain the changed configuration information, automatically obtain the business parameters and statistical data used to generate the report, and enter it into the preset report template to generate the target report.
It realizes automatic update of report generation parameters and data when configuration information changes, improves the efficiency and flexibility of report generation and reduces maintenance costs.
Smart Images

Figure CN113850065B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network security technology, and in particular to a report generation method, apparatus, computer equipment and storage medium. Background Art
[0002] With the development of science and technology, the application scope of computer systems is becoming more and more extensive. Whether the computer system is used safely or not is becoming more and more important.
[0003] In the related art, a computer system security report is generated by constructing a word template in advance. For example, the character position and character mark can be set in advance in the word template, and then the character mark in the word template is parsed in the program, and finally the character mark is replaced with the data corresponding to the character position to obtain the target report.
[0004] However, when the configuration information for generating a report changes, usually the only way is to manually change the relevant information of the pre-set word template and manually adjust the code for generating the report, resulting in low report generation efficiency. Summary of the invention
[0005] Based on this, it is necessary to provide a report generation method, apparatus, computer device and storage medium that can improve the efficiency of generating reports in response to the above technical problems.
[0006] A report generation method, the method comprising:
[0007] If a change in the configuration information reported by the target is detected, the changed configuration information is obtained;
[0008] According to the changed configuration information, obtain the business parameters and target statistical data used to generate the target report;
[0009] The target statistical data and the display parameters of the target report are input into a preset report template to obtain a target report.
[0010] In one of the embodiments, the configuration information at least includes a release time and an update identifier;
[0011] If a change in the configuration information reported by the target is detected, obtaining the changed configuration information includes:
[0012] Detecting the configuration information of the target report at a preset time interval, and if it is detected that the update identifier of the configuration information of the target report is a target update identifier, determining whether the release time in the configuration information corresponding to the target update identifier has changed;
[0013] If the publishing time is changed, the changed publishing time is obtained.
[0014] In one embodiment, the method further comprises:
[0015] The changed release time is used as the start time of the report generation operation;
[0016] When the start time is reached, the steps of obtaining business parameters and target statistical data for generating a target report, inputting the target statistical data and display parameters of the target report into a preset report template, and obtaining the target report are executed.
[0017] In one embodiment, obtaining the business parameters and target statistical data for generating the target report includes:
[0018] Get the target file for generating the target report;
[0019] Parsing the target file to obtain at least one target report file structure table;
[0020] Parsing each of the target report file structure tables to obtain a display type corresponding to the target report file structure table, display attribute information corresponding to the display type, and a data interface corresponding to the display type;
[0021] Obtain target statistical data in the preset statistical database by calling the data interface;
[0022] The business parameters of the target report are obtained according to the display attribute information corresponding to at least one of the display types.
[0023] In one of the embodiments, the configuration information includes a statistical start time and a statistical end time;
[0024] The acquiring target statistical data in the preset statistical database by calling the data interface includes:
[0025] Determine the target statistics start time and the target statistics end time according to the changed configuration information;
[0026] Determine the target statistical time range according to the target statistical start time and the target statistical end time;
[0027] By calling the data interface, the target statistical data within the target statistical time range is obtained in the preset statistical database.
[0028] In one embodiment, before the step of obtaining the target file for generating the target report, the method further includes:
[0029] In response to a configuration operation by a user, determining service parameters and data interface information of the target report;
[0030] A target file is generated according to the service parameters, data interface information and the initial report file structure table of the target report.
[0031] In one embodiment, the business parameter of the target report includes display attribute information of at least one display type, and the display type includes a graphic type, a text type, and a list type;
[0032] The generating of the target file according to the service parameters, data interface information and the initial report file structure table of the target report includes:
[0033] Acquire display attribute information and data interface information corresponding to the display type included in the business parameters;
[0034] Input the display attribute information and data interface information into the initial report file structure table to obtain a target report file structure table corresponding to the corresponding display type;
[0035] According to the target report file structure table, a target file is obtained.
[0036] In one of the embodiments, the display attribute information includes empty display attribute information;
[0037] The method further comprises:
[0038] The blank display attribute information is input into the initial report file structure table to obtain a blank display target report file structure table.
[0039] In one embodiment, parsing each target report file structure table includes:
[0040] In response to a configuration operation by a user, determining a parsing order of target report file structure tables corresponding to a plurality of display types;
[0041] According to the parsing order, each target report file structure table is parsed in turn.
[0042] A report generating device, comprising:
[0043] A detection module, for obtaining the changed configuration information if a change in the configuration information reported by the target is detected;
[0044] An acquisition module, used to acquire business parameters and target statistical data for generating a target report according to the changed configuration information;
[0045] The target report generation module is used to input the target statistical data and the display parameters of the target report into a preset report template to obtain the target report.
[0046] In one embodiment, the configuration information at least includes a release time and an update identifier; accordingly, the detection module includes:
[0047] a detection unit, configured to detect the configuration information of the target report at a preset time interval, and if it is detected that the update identifier of the configuration information of the target report is a target update identifier, determine whether the release time in the configuration information corresponding to the target update identifier has changed;
[0048] The acquiring unit is used to acquire the changed publishing time if the publishing time is changed.
[0049] In one embodiment, the device further comprises:
[0050] A start time determination module, used to use the changed release time as the start time for generating a report;
[0051] The execution module is used to execute the steps of obtaining business parameters and target statistical data for generating a target report when the start time is reached, inputting the target statistical data and display parameters of the target report into a preset report template, and obtaining the target report.
[0052] In one embodiment, the acquisition module includes:
[0053] A target file acquisition unit, used for acquiring a target file for generating a target report;
[0054] A first parsing unit, configured to parse the target file to obtain at least one target report file structure table;
[0055] A second parsing unit is used to parse each of the target report file structure tables to obtain a display type corresponding to the target report file structure table, display attribute information corresponding to the display type, and a data interface corresponding to the display type;
[0056] A calling unit, configured to obtain target statistical data from the preset statistical database by calling the data interface;
[0057] The business parameter determination unit is used to obtain the business parameters of the target report according to the display attribute information corresponding to at least one of the display types.
[0058] In one embodiment, the configuration information includes a statistical start time and a statistical end time; accordingly, the calling unit includes:
[0059] A time determination subunit, used to determine a target statistics start time and a target statistics end time according to the changed configuration information;
[0060] A time range determination subunit, used to determine a target statistical time range according to the target statistical start time and the target statistical end time;
[0061] The statistical subunit is used to obtain target statistical data within the target statistical time range in the preset statistical database by calling the data interface.
[0062] In one embodiment, the device further comprises:
[0063] A response module, used to determine the service parameters and data interface information of the target report in response to the configuration operation of the user;
[0064] The target file generation module is used to generate a target file according to the business parameters, data interface information and initial report file structure table of the target report.
[0065] In one embodiment, the business parameters of the target report include display attribute information of at least one display type, and the display type includes a graphic type, a text type, and a list type; accordingly, the target file generation module includes:
[0066] An interface information acquisition unit, used to acquire display attribute information and data interface information corresponding to the display type included in the business parameters;
[0067] A report file structure table obtaining unit, used for inputting the display attribute information and the data interface information into the initial report file structure table to obtain a target report file structure table corresponding to the corresponding display type;
[0068] The target file obtaining unit is used to obtain the target file according to the target report file structure table.
[0069] In one of the embodiments, the display attribute information includes empty display attribute information;
[0070] The device further comprises: a blank display acquisition module, which is used to input the blank display attribute information into the initial report file structure table to obtain a blank display target report file structure table.
[0071] In one of the embodiments, the second parsing unit is specifically used to determine the parsing order of the target report file structure tables corresponding to multiple display types in response to the user's configuration operation; and parse each target report file structure table in turn according to the parsing order.
[0072] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0073] If a change in the configuration information reported by the target is detected, the changed configuration information is obtained;
[0074] According to the changed configuration information, obtain the business parameters and target statistical data used to generate the target report;
[0075] The target statistical data and the display parameters of the target report are input into a preset report template to obtain a target report.
[0076] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:
[0077] If a change in the configuration information reported by the target is detected, the changed configuration information is obtained;
[0078] According to the changed configuration information, obtain the business parameters and target statistical data used to generate the target report;
[0079] The target statistical data and the display parameters of the target report are input into a preset report template to obtain a target report.
[0080] The report generation method, apparatus, computer equipment and storage medium described above, when detecting a change in the configuration information of the target report, obtain the changed configuration information; based on the changed configuration information, obtain the business parameters and target statistical data used to generate the target report; input the target statistical data and the display parameters of the target report into a preset report template to obtain the target report. By real-time monitoring of changes in configuration information and automatically inputting the business parameters and statistical data used to generate the report into a preset report template after detecting a change in configuration information, the target report can be obtained efficiently and quickly, thereby improving the flexibility and scalability of report generation and reducing maintenance costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0081] Figure 1 A schematic diagram of a report generation method in one embodiment;
[0082] Figure 2 A flowchart of a step of determining whether a release time has been changed in one embodiment;
[0083] Figure 3 A flowchart of the steps of generating a target report in one embodiment;
[0084] Figure 4A schematic flow chart of a business parameter step for generating a target report in an embodiment;
[0085] Figure 5 A schematic diagram of a flow chart of a step of obtaining target statistical data in one embodiment;
[0086] Figure 6 A schematic diagram of a process for generating a target file in one embodiment;
[0087] Figure 7 A schematic flow chart of a step of generating a target file in another embodiment;
[0088] Figure 8 A schematic diagram of a flow chart of the steps of parsing a target report file structure table in one embodiment;
[0089] Fig. 9 A schematic diagram of configuration information of a target report in one embodiment;
[0090] Fig.10 It is a structural block diagram of a report generating device in one embodiment;
[0091] Fig.11 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0092] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0093] In one embodiment, Figure 1 As shown, a report generation method is provided. This embodiment uses the method applied to a report generation device as an example. It can be understood that the method can also be applied to a server, and can also be applied to a system including a report generation device and a server, and is implemented through the interaction between the report generation device and the server. The above-mentioned report generation device can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers and portable wearable devices. The server can be implemented as an independent server or a server cluster composed of multiple servers. In this embodiment, the identification method includes the following steps:
[0094] Step 101: If a change in the configuration information reported by the target is detected, the changed configuration information is obtained.
[0095] Specifically, the target report can be a target report generated by the security monitoring platform of the target system when detecting the network security of the target system. That is, the target report can be a report generated by the security monitoring platform for the monitored network security events. The target system can be any system that will be applied in the actual application scenario, such as an enterprise management system, etc.; the security monitoring platform can be any security management system, and the network security events can include but are not limited to the following: vulnerabilities, website availability, website tampering, web page phishing, threat intelligence, web page vulnerability exploits, malware, denial of service attacks, network attacks, and malicious file detection. The configuration information of the target report is information related to the generation process of the target report, for example, it can include the release time of the target report, the type of the target report, etc. The configuration information of the target report can be determined according to the actual application scenario and user needs.
[0096] Optionally, the report generation device can detect whether the configuration information of multiple types of target reports has changed. When the report generation device detects that the configuration information of the target report of a target type has changed, it will obtain the changed configuration information corresponding to each type of report. The types of target reports include daily reports, weekly reports, monthly reports, quarterly reports, and annual reports.
[0097] In a possible implementation, the report generation device may determine the order of detecting whether the configuration information of each type of target report has changed according to the actual application scenario. In this way, the report generation device may detect whether the configuration information of each type of target report has changed in sequence according to the detection order.
[0098] In another possible implementation, the report generating device may detect whether the configuration information of each type of target report has been changed according to a random order, that is, perform a traversal query on the configuration information of each type of target report.
[0099] Step 102: Obtain business parameters and target statistical data for generating a target report according to the changed configuration information.
[0100] Specifically, the report generating device obtains target statistical data for generating the target report and the business parameters of the target report according to the acquired configuration information of the changed target report. The business parameters of the target report may be display parameters.
[0101] Step 103, input the target statistical data and display parameters of the target report into a preset report template to obtain the target report.
[0102] The preset report template may be a word template or other types of templates, such as a PDF template, etc. The preset report template contains common information applicable to different target reports.
[0103] Specifically, the report generating device uses the acquired target statistical data as data included in the target report, adjusts the display form of the data included in the target report according to the business parameters of the target report, and obtains the target report.
[0104] The report generation method described above, when detecting a change in the configuration information of the target report, obtains the changed configuration information; based on the changed configuration information, obtains the business parameters and target statistical data used to generate the target report; inputs the target statistical data and the display parameters of the target report into a preset report template to obtain the target report. By real-time monitoring of changes in configuration information and automatically inputting the business parameters and statistical data used to generate the report into a preset report template after detecting a change in configuration information, the target report can be obtained efficiently and quickly, thereby improving the flexibility and scalability of report generation and reducing maintenance costs.
[0105] In one embodiment, since the configuration information is related to the generation process of the target report, the configuration information may include multiple types of information. For example, the configuration information may include the release time information and update identifier of the target report. The release time is the online time of the target report, that is, the time when the target report is sent to each report receiver. Since in actual application scenarios, the time when the report generation device obtains the data used to generate the target report is relatively small compared to the time interval between the report generation and the report generation, the time when the task target statistical data is obtained can be the release time. The update identifier (update) is used to indicate whether the configuration information corresponding to the update identifier has changed. For example, if update=1, it means that the configuration information corresponding to update=1 has changed. If update=0, it means that the configuration information corresponding to update=1 has not changed.
[0106] Accordingly, if Figure 2 As shown, the execution process of step 101 "if a change in the configuration information reported by the target is detected, obtaining the changed configuration information" includes:
[0107] Step 201 , detecting the configuration information of the target report at a preset time interval, and if it is detected that the update identifier of the configuration information of the target report is a target update identifier, determining whether the release time in the configuration information corresponding to the target update identifier is changed.
[0108] The preset time interval may be determined according to the actual application scenario, for example, 30 seconds. The target type target report includes one or more of daily report, weekly report, monthly report, quarterly report and annual report.
[0109] Specifically, the report generating device determines whether the configuration information of each type of target report has changed at a preset time interval (e.g., 30 seconds). If the report generating device detects that the update flag in the configuration information of at least one type of target report is a target update flag (e.g., update=1), it is determined that the configuration information of the target report of this type has changed. In this way, the report generating device can determine whether the release time in the configuration information of the target report of this type has changed.
[0110] For example, various types of target reports include daily reports, weekly reports, monthly reports, quarterly reports, and annual reports. If the report generating device detects that the update flag of the configuration information of the daily report is 1, and the update flag of the configuration information of the monthly report is also 1, then the configuration information of the target report of the target type is the configuration information of the daily report and the configuration information of the monthly report. In this way, the report generating device can determine whether the release time of the daily report has changed, and whether the release time of the monthly report has changed.
[0111] Step 202: If the publishing time is changed, the changed publishing time is obtained.
[0112] Specifically, the report generating device may extract the initial release time of the target type that has not changed from the preset database. If the report generating device determines that the initial release time is different from the target release time, it may be determined that the target release time has changed, so that the report generating device may obtain the release time in the configuration information after the change, that is, the target release time.
[0113] In this embodiment, by monitoring whether the release time in the configuration information has changed through the report generation device, and configuring the start time of the target report generation operation to the changed release time, a two-layer scheduling design can be implemented, the target report generation logic is clearer, and the risk of manual maintenance can be avoided.
[0114] In one embodiment, Figure 3 As shown, the report generating method further includes:
[0115] Step 301: Use the changed publishing time as the start time for generating a report.
[0116] Specifically, the report generating device can update the changed release time to the start time of the target report generation operation. That is to say, there are two layers of scheduling in the report generating device. The first layer of scheduling is that the report generating device detects whether the configuration information of each type of target report has changed; the second layer of scheduling is to generate the target report. In this way, the report generating device can update the changed release time to the start time of the second layer of scheduling.
[0117] Step 302, when the start time is reached, execute the step of obtaining business parameters and target statistical data for generating a target report, inputting the target statistical data and display parameters of the target report into a preset report template, and obtaining the target report.
[0118] Specifically, the report generating device updates the start time of the target report generating operation according to the obtained release time of the changed target report. When the report generating device detects that the start time has been reached, it executes the steps of obtaining the business parameters and target statistical data for generating the target report, inputting the target statistical data and the display parameters of the target report into a preset report template, and obtaining the target report.
[0119] Optionally, if the report generating device detects that the start time has been reached, then after the report generating device performs a parsing operation on the target file, the report generating device can obtain at least one target report file structure table. That is, the report generating device can obtain a target report file structure table corresponding to at least one display type by parsing the target file. If the target file contains target report file structure tables of multiple display types, then after the report generating device performs a parsing operation on the target file, the report generating device can obtain target report file structure tables of multiple display types, and the specific parsing order can be determined by the report generating device according to the actual application scenario. If the target file contains only one target report file structure table of one display type, then after the report generating device performs a parsing operation on the target file, the report generating device can only obtain one target report file structure table of one display type.
[0120] In a possible implementation, the process of parsing the target file by the report generating device is actually the process of parsing at least one dict object contained in the target file by the report generating device. That is to say, a target report file structure table of a display type contains a dict object, and for target report file structure tables of different display types, the dict object is the corresponding display target. For example, for a list display type, the dict object is a list; for a text display type, the dict object is a text; for a graphic display type, the dict object is a graphic.
[0121] In this embodiment, by monitoring changes in configuration information and updating the start time of report generation after detecting changes in configuration information, the monitoring scheduling can be separated from the report generation scheduling, thereby improving the efficiency of report generation; by obtaining the target file, the flexibility and scalability of report generation can be improved, thereby reducing maintenance costs.
[0122] In one embodiment, Figure 4As shown, the specific execution process of the step "obtaining business parameters and target statistical data for generating a target report" includes:
[0123] Step 401, obtaining a target file for generating a target report.
[0124] Specifically, the target file is an executable file, which can be generated according to the requirements of the actual application scenario. The target file contains a report file structure table of at least one display type configured by the user. The target file can be represented by (report_setting.json). The display type includes a graphic type, a text type, and a list type. The graphic type can include a bar chart, a pie chart, and the like.
[0125] Step 402: parse the target file to obtain at least one target report file structure table.
[0126] Specifically, since the target file is an executable file, after the report generating device detects that the configuration information of the target report has changed, it can obtain the executable file configured by the user for generating the target report. Each report file structure table (json structure table) corresponds to a display type of the report. The report generating device parses the target file, that is, determines the display type configured for the target report corresponding to the target file.
[0127] Optionally, after detecting that the release time in the configuration information of the target report has changed, the report generating device may use the changed release time as the start time of the report generating operation. In this way, when the report generating device detects that the start time of the report generating operation has arrived, the target file for generating the target report may be obtained, and the target file may be parsed to start the execution of the target file. In this way, the report generating device may obtain the target report file structure table corresponding to the display type configured for the target report contained in the target file.
[0128] For example, the target report file structure table acquired by the report generating device may be a target report file structure table corresponding to the text display type. Then, the target report file structure table corresponding to the text display type may be as follows:
[0129]
[0130] Step 403: parse each target report file structure table to obtain the display type corresponding to the target report file structure table, the display attribute information corresponding to the display type, and the data interface corresponding to the display type.
[0131] Specifically, the report generating device parses each target report file structure table and can obtain display attribute information corresponding to multiple display types, that is, the report generating device can obtain display attribute information (attribute) and data interface information (interface) corresponding to each display type that meets the user's statistical needs.
[0132] Optionally, the display type includes a graphic type, a text type and a list type, and the graphic type may include a bar chart, a pie chart and the like. Thus, the display attribute information of the list type may include the table name, the number of lists, the name information of each cell in the list, the font size information of each cell in the list, etc. The display attribute information of the text type may include the font size information, the font black mark, the font bold mark and the like.
[0133] For example, the target report file structure table obtained by the report generation device may be the target report file structure table corresponding to the text display type. Then, the display attribute information corresponding to the text display type may be: the font size information is 0.5 inches, the font is not bold, the font is not italic, and the font size is 12px. The data interface corresponding to the text display type is "text class assembly interface-template".
[0134] Step 404, obtaining target statistical data from a preset statistical database by calling a data interface.
[0135] Specifically, the report generating device acquires statistical data that meets the configuration information of the target report from the preset statistical database corresponding to the different display types by calling the data interface corresponding to each display type, that is, the target statistical data.
[0136] Step 405: Obtain the business parameters of the target report according to the display attribute information corresponding to at least one display type.
[0137] Specifically, since the business parameters of the target report include display attribute information corresponding to each display type configured for the target report, the report generating device parses each target report file structure table to obtain display attribute information corresponding to each display type that meets the user's statistical requirements, that is, obtains the business parameters of the target report. The business parameters of the target report include display attribute information corresponding to one display type or display attribute information corresponding to multiple display types.
[0138] In this embodiment, by parsing the target file by the report generating device, a display type that meets the user's statistical requirements and display attribute information corresponding to the display type can be obtained.
[0139] In one embodiment, since the configuration information of the target report is related to the generation of the target report, the configuration information also includes the statistical start time and the statistical end time; accordingly, Figure 5 As shown, the specific processing process of the step "obtaining target statistical data in a preset statistical database by calling a data interface" includes:
[0140] Step 501, determining a target statistics start time and a target statistics end time according to the changed configuration information.
[0141] Specifically, the report generating device can obtain the changed configuration information and determine the target statistics start time and the target statistics end time, that is, determine the target statistics start time and the target statistics end time that meet the user's statistical requirements.
[0142] Step 502: determine the target statistical time range according to the target statistical start time and the target statistical end time.
[0143] Specifically, for daily target reports, the statistical start time is 0:00 every day, the statistical end time is 24:00 every day, and the target statistical time range is 0:00 every day to 24:00 every day; for weekly target reports, the statistical start time is 0:00 every Monday, and the statistical end time is 24:00 every Sunday, and the target statistical time range is 0:00 every Monday to 24:00 every Sunday; for other types of target reports (such as monthly reports, quarterly reports, annual reports, etc.), the process of determining the statistical start time, statistical end time and target statistical time range is similar to the above process and will not be repeated here.
[0144] It should be noted that the report generation device can determine the target statistical time range for obtaining target statistical data based on the statistical start time and statistical end time in the configuration information of each type of target report. In other words, the report generation device can determine the time range for obtaining data based on the statistical start time and statistical end time.
[0145] Step 503: Obtain target statistical data within a target statistical time range from a preset statistical database by calling a data interface.
[0146] Specifically, the report generating device may acquire the target statistical data within the target statistical time range in the preset database corresponding to each display type by calling the data interface corresponding to each display type.
[0147] In one embodiment, the method further comprises:
[0148] Step 601: In response to a user's configuration operation, determine the service parameters and data interface information of a target report.
[0149] Specifically, in response to the user's operation of configuring service parameters, the report generation device can determine the specific type and specific value of the service parameters of the target report. The service parameters of the target report can include service parameters of multiple display types. In response to the user's operation of configuring service parameters, the report generation device determines the service parameters of the display type that meet the user's needs and the data interface information corresponding to the display type.
[0150] Step 602: Generate a target file according to the service parameters of the target report, the data interface information, and the initial report file structure table.
[0151] Specifically, the initial report file structure table can be an initial template of a JSON structure table. For example, the initial report file structure table can be [{"interface":"interface","attribute":{}},{},{}…].
[0152] Among them, "interface" represents the service parameters corresponding to the display type of the target report, and "attribute" can be the data interface corresponding to the display type of the target report. The report generation device inputs the specific information of the service parameters of the target report and the data interface into the initial report file structure table to form multiple JSON structure tables. In this way, the report generation device can save the multiple JSON structure tables to an independent file (report_setting.json) to obtain an executable target file.
[0153] In this embodiment, by responding to the user's operation of configuring service parameters, a JSON structure table can be designed according to the user's actual statistical requirements, and this JSON structure can also be extended according to the user's actual needs, or the corresponding "interface" (data interface) and "attribute" (display attribute information corresponding to the display type) in the JSON structure can be modified and adjusted to fully meet the user's needs.
[0154] In one embodiment, the service parameters of the target report include display attribute information of at least one display type, and the display types include one or more of graphic type, text type, and list type; correspondingly, in response to the user's operation of configuring service parameters, the report generation device can determine the display type and the display attribute information of the display type. As Figure 7 shown, the specific processing process of the step "Generate a target file according to the service parameters of the target report, the data interface information, and the initial report file structure table" includes:
[0155] Step 701: Obtain the display attribute information corresponding to the display type included in the service parameters and the data interface information.
[0156] Specifically, in response to the user's business parameter configuration operation, the report generation device can obtain display attribute information corresponding to multiple display types, that is, the report generation device can obtain display attribute information and data interface information corresponding to each display type that meets the user's statistical needs. Display types may include graphic types, text types, and list types. Graphic types may include bar charts, pie charts, and other types. The display attribute information of the list type may include the table name, the number of lists, the name information of each cell in the list, the font size information of each cell text in the list, and the like. The display attribute information of the text type may include font size information, a black font mark, a bold font mark, and the like. The data interface information may include a text class assembly interface-template, event_pie_or_bar--bar chart / pie chart type statistics template, and event_company_lists-list type statistics template.
[0157] Step 702: Input the display attribute information and the data interface information into the initial report file structure table to obtain the target report file structure table corresponding to the corresponding display type.
[0158] Specifically, the report generating device inputs display attributes and data interface information corresponding to one display type, or display attribute information and data interface information corresponding to multiple display types into the initial report file structure table to obtain a target report file structure table corresponding to each display type.
[0159] For example, the target report file structure table corresponding to the text display type can be as follows:
[0160]
[0161] In a possible implementation, the target report file structure table of the graphic display type and the target report file structure table of the list display type are as follows:
[0162]
[0163]
[0164]
[0165]
[0166] Step 703, obtaining the target file according to the target report file structure table.
[0167] Specifically, if the report generating device determines the business parameters of one display type in response to the user's business parameter configuration operation, the report generating device can obtain the target file according to the target report file structure table corresponding to one display type. If the report generating device determines the business parameters of multiple display types in response to the user's business parameter configuration operation, the report generating device can obtain the target file (report_setting.json) according to the target report file structure table corresponding to multiple display types.
[0168] In this embodiment, by responding to the user's business parameter configuration operation, a JSON structure table can be designed according to the user's actual statistical needs. The JSON structure can also be expanded according to the user's actual needs, or the corresponding interface and attribute information in the JSON structure can be modified and adjusted to fully meet user needs.
[0169] In one embodiment, the display attribute information includes empty display attribute information; accordingly, the report generation method further includes: inputting the empty display attribute information into the initial report file structure table to obtain an empty display target report file structure table.
[0170] Specifically, the report generation device determines the display type that needs to be displayed blank according to the configuration operation of the user's business parameters. In this way, the report generation device can input the blank display attribute information into the initial report file structure table of the display type that needs to be displayed blank, and obtain the target report file structure table of the blank display. The target report file structure table of the blank display indicates that this display type only displays the frame and does not fill in the actual data. If the target report file structure table of the list display type is blank display, it means that the list only displays the frame of the list and does not display the specific data that needs to be entered in the list.
[0171] For example, the report generating device determines, in response to the user's business parameter configuration operation, at least one display type business parameter that meets the user's statistical needs. For example, the report generating device obtains the business parameter of the text display type and the business parameter of the list display type, and determines that the business parameter of the text display type includes empty display attribute information. In this way, the business parameter of the text display type corresponds to the target report file structure table of the empty display, which can be specifically as follows:
[0172]
[0173] It should be noted that ("is_null_show") is the display identifier of the empty display attribute information. If "is_null_show" is 1, it means that the display type corresponding to the display type is displayed normally; if "is_null_show" is 2, it means that the display type corresponding to the display type is a null display.
[0174] In this embodiment, by determining the empty display attribute information corresponding to each display type, when the statistical dimension and value are no data, a no-data picture and a no-data empty list can be placed in the placeholder position. When the user changes the display requirements, the conversion between the empty display and the display can be realized by adjusting the value of the display identifier corresponding to the empty display attribute information, which is more flexible.
[0175] In one embodiment, Figure 8 As shown, the specific processing process of the step "for each target report file structure table, parsing the target report file structure table" includes:
[0176] Step 801: In response to a configuration operation by a user, determine a parsing order of target report file structure tables corresponding to a plurality of display types.
[0177] Specifically, the report generating device can obtain the parsing order of the target baby file structure table corresponding to each display type through the user's business parameter configuration operation, that is, through the order in which the user inputs the business parameters of each display type.
[0178] Step 802: parse each target report file structure table in turn according to the parsing order.
[0179] The disclosed embodiment can separate the real-time monitoring of whether the configuration information of various types of target reports has changed from the user-defined target report generation process through a two-layer scheduling design. Among them, the user-defined target report is generated based on the configuration operation of the user-defined business parameters. In this way, when the first-layer scheduling monitors that the configuration information of the target report has changed, it can update the start time of the second-layer scheduling in real time. The second-layer scheduling completes the target report generation according to the start time set for each round. The generation method is mainly through classifying statistics of different dimensions and designing and generating a json structure table. When the second-layer periodic report scheduling is started, the dict objects in the json structure table are sequentially parsed, and the statistical data, pictures, and lists are automatically input into the word template to generate the target report.
[0180] The report generation method provided by the embodiment of the present disclosure separates the automatic monitoring of periodic configuration changes from the generation of report scheduling by setting up a two-layer scheduling, so that the logic is clear. In addition, the periodic configuration changes are automatically monitored through the first-layer periodic scheduling, and the second-layer scheduling report start time is refreshed to avoid the risk of manual maintenance. By designing a JSON structure table and storing it in an independent file, the program can automatically generate periodic reports by sequentially traversing the dict objects in the JSON structure table; in addition, by setting empty business parameters in the attribute, such as is_null_show, empty data items can be selectively presented in the report according to customer needs. Thereby improving the flexibility and scalability of periodic report generation, and avoiding the problem of simultaneous modification of word templates and programs due to the addition, deletion, and change of statistical items, thereby reducing maintenance costs.
[0181] like Fig. 9 As shown, the configuration information of each type of target report is stored in a pre-set configuration information database, and the configuration information of each type of target report includes report type (such as daily report, weekly report, monthly report, quarterly report, annual report), statistical start time, statistical end time, release time, generation status mark and update mark. Among them, the report type indicates which type of target report is generated, and the corresponding record field is t_type; the statistical start time and statistical end time are mainly used for the start time and end time of the relevant statistical data in the target report, and the corresponding record fields are start_time and end_time; the release time represents the time when the target report corresponding to this record is generated, and the corresponding record field is publish_time; the generation status mark indicates whether the target report of this type needs to be generated, and the corresponding record field is status (such as status is 0, indicating that the target report of this type does not need to be generated; status is 1, indicating that the target report of this type needs to be generated); whether the record information is updated is a hidden field. When the corresponding record is changed, the update mark corresponding field update value is 1, otherwise it is 0.
[0182] It should be understood that although Figure 1-9 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1-9 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.
[0183] In one embodiment, Fig.10 As shown, a report generating device is provided, comprising:
[0184] Detection module 901, acquisition module 902, target report generation module 903, wherein:
[0185] The detection module 901 is used to obtain the changed configuration information if it is detected that the configuration information reported by the target is changed;
[0186] An acquisition module 902 is used to acquire business parameters and target statistical data for generating a target report according to the changed configuration information;
[0187] The target report generation module 903 is used to input the target statistical data and the display parameters of the target report into a preset report template to obtain a target report.
[0188] For the specific definition of the report generating device, please refer to the definition of the report generating method above, which will not be repeated here. Each module in the above report generating device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0189] In one embodiment, the configuration information at least includes a release time and an update identifier; accordingly, the detection module includes:
[0190] a detection unit, configured to detect the configuration information reported by the target at a preset time interval, and if it is detected that the update identifier of the configuration information reported by the target is a target update identifier, determine whether the release time in the configuration information corresponding to the target update identifier has changed;
[0191] The obtaining unit is used to obtain the changed publishing time if the publishing time is changed.
[0192] In one embodiment, the device further comprises:
[0193] A start time determination module is used to use the changed release time as the start time for generating a report;
[0194] The execution module is used to execute the steps of obtaining business parameters and target statistical data for generating a target report when the start time is reached, inputting the target statistical data and display parameters of the target report into a preset report template, and obtaining the target report.
[0195] In one embodiment, the acquisition module includes:
[0196] A target file acquisition unit, used for acquiring a target file for generating a target report;
[0197] A first parsing unit, used to parse the target file to obtain at least one target report file structure table;
[0198] A second parsing unit is used to parse each target report file structure table to obtain a display type corresponding to the target report file structure table, display attribute information corresponding to the display type, and a data interface corresponding to the display type;
[0199] A calling unit, used to obtain target statistical data in a preset statistical database by calling a data interface;
[0200] The business parameter determination unit is used to obtain the business parameters of the target report according to the display attribute information corresponding to at least one display type.
[0201] In one embodiment, the configuration information includes a statistical start time and a statistical end time; accordingly, the calling unit includes:
[0202] The time determination subunit is used to determine the target statistics start time and the target statistics end time according to the changed configuration information;
[0203] The time range determination subunit is used to determine the target statistical time range according to the target statistical start time and the target statistical end time;
[0204] The statistical subunit is used to obtain target statistical data within a target statistical time range in a preset statistical database by calling a data interface.
[0205] In one embodiment, the device further comprises:
[0206] A response module, used to determine the service parameters and data interface information of the target report in response to the configuration operation of the user;
[0207] The target file generation module is used to generate the target file according to the business parameters of the target report, data interface information and the initial report file structure table.
[0208] In one embodiment, the business parameters of the target report include display attribute information of at least one display type, and the display type includes a graphic type, a text type, and a list type; accordingly, the target file generation module includes:
[0209] An interface information acquisition unit, used to acquire display attribute information and data interface information corresponding to the display type included in the business parameters;
[0210] A report file structure table obtaining unit is used to input display attribute information and data interface information into an initial report file structure table to obtain a target report file structure table corresponding to a corresponding display type;
[0211] The target file obtaining unit is used to obtain the target file according to the target report file structure table.
[0212] In one of the embodiments, the display attribute information includes empty display attribute information;
[0213] The device also includes: a blank display acquisition module, which is used to input the blank display attribute information into the initial report file structure table to obtain the blank display target report file structure table.
[0214] In one of the embodiments, the second parsing unit is specifically configured to determine a parsing order of target report file structure tables corresponding to a plurality of display types in response to a configuration operation of a user; and parse each target report file structure table in turn according to the parsing order.
[0215] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.11 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store relevant data of the target report. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a report generation method is implemented.
[0216] Those skilled in the art will understand that Fig.11 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0217] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0218] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0219] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0220] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0221] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A report generation method, characterized in that: The method comprises: If a change in configuration information of the target report is detected, the changed configuration information is acquired, wherein the configuration information is information related to the generation process of the target report, and the configuration information includes release time information of the target report, the type of the target report, and an update identifier; According to the changed configuration information, business parameters and target statistical data for generating a target report are acquired, wherein the business parameters of the target report include display attribute information of at least one display type, and the business parameters of the target report are display parameters; Inputting the target statistical data and display parameters of the target report into a preset report template to obtain a target report; The obtaining of the business parameters and target statistical data for generating the target report includes: Acquire a target file for generating a target report; parse the target file to obtain at least one target report file structure table; parse each of the target report file structure tables to obtain a display type corresponding to the target report file structure table, display attribute information corresponding to the display type, and a data interface corresponding to the display type; acquire target statistical data in a preset statistical database by calling the data interface; obtain business parameters of the target report based on display attribute information corresponding to at least one of the display types, wherein the target report file structure table includes display type, display attribute information, and data interface information.
2. The method according to claim 1, characterized in that: The configuration information at least includes a release time and an update identifier; if a change in the configuration information reported by the target is detected, obtaining the changed configuration information includes: Detecting the configuration information of the target report at a preset time interval, and if it is detected that the update identifier of the configuration information of the target report is a target update identifier, determining whether the release time in the configuration information corresponding to the target update identifier has changed; If the publishing time is changed, the changed publishing time is obtained.
3. The method according to claim 2, characterized in that The method further comprises: The changed release time is used as the start time of the report generation operation; When the start time is reached, the steps of obtaining business parameters and target statistical data for generating a target report, inputting the target statistical data and display parameters of the target report into a preset report template, and obtaining the target report are executed.
4. The method according to claim 1, characterized in that The configuration information includes the statistical start time and the statistical end time; The acquiring target statistical data in the preset statistical database by calling the data interface includes: Determine the target statistics start time and the target statistics end time according to the changed configuration information; Determine the target statistical time range according to the target statistical start time and the target statistical end time; By calling the data interface, the target statistical data within the target statistical time range is obtained in the preset statistical database.
5. The method according to claim 1, characterized in that Before the step of obtaining the target file for generating the target report, the method further includes: In response to a configuration operation by a user, determining service parameters and data interface information of the target report; A target file is generated according to the service parameters, data interface information and the initial report file structure table of the target report.
6. The method according to claim 5, characterized in that The display type includes a graphic type, a text type and a list type; the target file is generated according to the business parameters, data interface information and the initial report file structure table of the target report, including: Acquire display attribute information and data interface information corresponding to the display type included in the business parameters; Input the display attribute information and data interface information into the initial report file structure table to obtain a target report file structure table corresponding to the corresponding display type; According to the target report file structure table, a target file is obtained.
7. The method according to claim 6, characterized in that The display attribute information includes empty display attribute information; The method further comprises: The blank display attribute information is input into the initial report file structure table to obtain a blank display target report file structure table.
8. The method according to claim 1, characterized in that: The parsing of each target report file structure table includes: In response to a configuration operation by a user, determining a parsing order of target report file structure tables corresponding to a plurality of display types; According to the parsing order, each target report file structure table is parsed in turn.
9. A report generating device, characterized in that: The device comprises: A detection module, configured to obtain the changed configuration information if a change in configuration information of a target report is detected, wherein the configuration information is information related to a generation process of the target report, and includes release time information of the target report, a type of the target report, and an update identifier; An acquisition module, used for acquiring business parameters and target statistical data for generating a target report according to the changed configuration information, wherein the business parameters of the target report include display attribute information of at least one display type, and the business parameters of the target report are display parameters; A target report generation module, used for inputting the target statistical data and display parameters of the target report into a preset report template to obtain a target report; The acquisition module is specifically used to: acquire a target file for generating a target report; parse the target file to obtain at least one target report file structure table; parse each target report file structure table to obtain a display type corresponding to the target report file structure table, display attribute information corresponding to the display type, and a data interface corresponding to the display type; acquire target statistical data in a preset statistical database by calling the data interface; and acquire business parameters of the target report based on display attribute information corresponding to at least one of the display types, wherein the target report file structure table includes display type, display attribute information, and data interface information.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Report file generation method and device, computer equipment and storage medium
CN113076731A