Report generation method and apparatus
By dynamically generating requirement template files and automatically populating them with business data, the problem of low generation efficiency and quality caused by fixed report templates has been solved, achieving efficient and accurate report generation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA CONSTRUCTION BANK
- Filing Date
- 2022-09-27
- Publication Date
- 2026-06-05
Smart Images

Figure CN115618838B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a report generation method and apparatus. Background Technology
[0002] Currently, many industries generate a large amount of user behavior data, business process data, and aggregated data based on this data during the operation of their business systems. Due to business management needs, it is often necessary to embed this data into a pre-set template to generate a report with a fixed format.
[0003] Since the above templates are usually fixed, when the reporting requirements change, it is necessary to manually modify the above templates or create new templates to generate reports that meet the actual needs of users.
[0004] However, with the development of the times, the data in future business systems will grow explosively, and the report requirements will become more complex and varied, with diverse content. For example, there may be multiple image display items in the requirement template. Therefore, manually creating or modifying the template is not only extremely labor-intensive, but also carries a certain risk of errors, resulting in low efficiency and quality of report generation. Summary of the Invention
[0005] This invention provides a report generation method and device, which can effectively improve the efficiency and quality of report generation.
[0006] In a first aspect, the present invention provides a report generation method, the method comprising:
[0007] Obtain the user requirements file, and determine the object style and object attributes of the target report based on the user requirements file. The user requirements file is used to describe the form and content of the target report required by the user.
[0008] Using the object style template generated based on the object style and the object attribute template generated based on the object attributes, a requirement template file corresponding to the target report is generated;
[0009] When there are multiple image display items in the requirement template file, the business data corresponding to the target report is obtained, the image list objects in the business data are traversed in a loop, the image codes corresponding to each image list object are obtained, and the image codes corresponding to each image list object and the text data in the business data are filled into the requirement template file to generate the target report.
[0010] In one feasible implementation, determining the object style and object attributes of the target report based on the user requirements document includes:
[0011] Analyze the keywords in the user requirements document, and determine the object style and object attributes of the target report based on the keywords in the user requirements document;
[0012] The object style includes, but is not limited to, font type, font size, font color, paragraph format, and table style; the object attributes are used to display text data and / or images including, but not limited to, name, age, location, time, and business volume.
[0013] In one feasible implementation, before generating the requirement template file corresponding to the target report using the object style template generated based on the object style and the object attribute template generated based on the object attributes, the method further includes:
[0014] Determine the metadata corresponding to the object style, and determine the metadata corresponding to the object attributes;
[0015] Based on the metadata corresponding to the object style, the object style template is generated in the form of key-value pairs; wherein, the key name in the object style template is the object style name identified by the Freemarker tag;
[0016] Based on the metadata corresponding to the object attribute, the object attribute template is generated in the form of key-value pairs; wherein, the key name in the object attribute template is the object attribute name marked with the Freemarker tag.
[0017] In one feasible implementation, when there is an image display item in the requirement template file, the business data corresponding to the target report is obtained using FreeMarker technology, the image code corresponding to the image display item is obtained from the business data, and then filled into the image data tag in the requirement template file.
[0018] In one feasible implementation, it further includes:
[0019] When the requirement template file does not contain an image display item, the business data corresponding to the target report is obtained using FreeMarker technology and filled into the requirement template file to generate the target report.
[0020] In one feasible implementation, it further includes:
[0021] When a change is detected in the user requirement document, the object style template and / or the object attribute template are modified according to the changes in the user requirement document.
[0022] Update the requirement template file based on the modified object style template and / or the object attribute template.
[0023] In a second aspect, the present invention provides a report generation apparatus, the apparatus comprising:
[0024] The determination module is used to obtain the user requirement file and, based on the user requirement file, determine the object style and object attributes of the target report. The user requirement file is used to describe the form and content of the target report required by the user.
[0025] The template generation module is used to generate a requirement template file corresponding to the target report using an object style template generated based on the object style and an object attribute template generated based on the object attributes.
[0026] The report generation module is used to obtain the business data corresponding to the target report when there are multiple image display items in the requirement template file, loop through the image list objects in the business data, obtain the image code corresponding to each image list object, and fill the requirement template file with the image code corresponding to each image list object and the text data in the business data to generate the target report.
[0027] In one feasible implementation, the determining module is used to:
[0028] Analyze the keywords in the user requirements document, and determine the object style and object attributes of the target report based on the keywords in the user requirements document;
[0029] The object style includes, but is not limited to, font type, font size, font color, paragraph format, and table style; the object attributes are used to display text data and / or images including, but not limited to, name, age, location, time, and business volume.
[0030] In one feasible implementation, the template generation module is used for:
[0031] Determine the metadata corresponding to the object style, and determine the metadata corresponding to the object attributes;
[0032] Based on the metadata corresponding to the object style, the object style template is generated in the form of key-value pairs; wherein, the key name in the object style template is the object style name identified by the Freemarker tag;
[0033] Based on the metadata corresponding to the object attribute, the object attribute template is generated in the form of key-value pairs; wherein, the key name in the object attribute template is the object attribute name marked with the Freemarker tag.
[0034] In one feasible implementation, the report generation module is further configured to:
[0035] When there is an image display item in the requirement template file, the business data corresponding to the target report is obtained using FreeMarker technology. The image code corresponding to the image display item is obtained from the business data and filled into the image data tag in the requirement template file.
[0036] In one feasible implementation, the report generation module is further configured to:
[0037] When the requirement template file does not contain an image display item, the business data corresponding to the target report is obtained using FreeMarker technology and filled into the requirement template file to generate the target report.
[0038] In one feasible implementation, a template update module is also included, for:
[0039] When a change is detected in the user requirement document, the object style template and / or the object attribute template are modified according to the changes in the user requirement document.
[0040] Update the requirement template file based on the modified object style template and / or the object attribute template.
[0041] Thirdly, the present invention provides an electronic device, comprising: at least one processor and a memory;
[0042] The memory stores computer-executed instructions;
[0043] The at least one processor executes computer execution instructions stored in the memory, causing the at least one processor to perform the report generation method as provided in the first aspect.
[0044] Fourthly, the present invention provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the report generation method as provided in the first aspect.
[0045] Fifthly, the present invention provides a computer program product, including a computer program that, when executed by a processor, implements the report generation method as provided in the first aspect.
[0046] The report generation method and apparatus provided by this invention can dynamically generate the required requirement template file based on the user's requirement file. Since different requirement files can generate different requirement template files, when user requirements change, only a new user requirement file needs to be provided to automatically generate the required requirement template file. Furthermore, when the requirement template file contains multiple image display items, by obtaining the business data corresponding to the target report, iterating through the image list objects in the business data, obtaining the image codes corresponding to each image list object, and filling the requirement template file with the image codes corresponding to each image list object and the text data in the business data, the target report can be obtained, thereby improving the efficiency and quality of report generation. Attached Figure Description
[0047] Figure 1 This is a flowchart illustrating a report generation method provided in an embodiment of the present invention. Figure 1 ;
[0048] Figure 2 This is a flowchart illustrating a report generation method provided in an embodiment of the present invention. Figure 2 ;
[0049] Figure 3 This is a flowchart illustrating a report generation method provided in an embodiment of the present invention. Figure 3 ;
[0050] Figure 4 This is a schematic diagram of a program module of a report generation device provided in an embodiment of the present invention;
[0051] Figure 5 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0052] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention. Furthermore, although the disclosure in this invention is presented according to one or several exemplary examples, it should be understood that each aspect of these disclosures can also constitute a complete implementation on its own.
[0053] It should be noted that the brief descriptions of terminology in this invention are merely for the convenience of understanding the embodiments described below, and are not intended to limit the embodiments of this invention. Unless otherwise stated, these terms should be understood in their ordinary and common meaning.
[0054] In this invention, the terms "first," "second," etc., used in the specification, claims, and accompanying drawings are used to distinguish similar or related objects or entities, and do not necessarily imply a specific order or sequence, unless otherwise specified. It should be understood that such terms can be used interchangeably where appropriate, for example, in situations where the invention can be implemented in an order other than those given in the illustrations or description of embodiments.
[0055] Furthermore, the terms “comprising” and “having”, and any variations thereof, are intended to cover but not exclusively include, for example, a product or device that includes a series of components is not necessarily limited to those that are explicitly listed, but may include other components that are not explicitly listed or that are inherent to such product or device.
[0056] The term "module" as used in this invention refers to any known or subsequently developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and / or software code capable of performing the functions associated with that element.
[0057] With the trend of economic globalization and increasingly fierce market competition, the information technology needs of more and more enterprises are growing rapidly. This generates a large amount of user behavior data, business process data, and the calculation processes and results summaries based on this data in application systems across many industries. Due to business needs or management requirements, it is often necessary to embed this data into pre-set templates to generate a report with a fixed format.
[0058] Since the aforementioned templates are typically fixed, changes in reporting requirements necessitate manual modification or the creation of new templates to generate reports that meet actual user needs. However, with continuous business expansion, the business and data within the application system are likely to experience explosive growth in the future, leading to complex and variable reporting requirements and diverse data content. For example, a template might contain multiple image display items. Therefore, manually creating or modifying templates is not only extremely labor-intensive but also carries a certain risk of errors, resulting in low report generation efficiency and quality.
[0059] To address the aforementioned technical problems, this invention provides a report generation method. For scenarios where user requirements frequently change, only a user requirement file needs to be provided, and the required requirement template file can be dynamically generated. Furthermore, when the requirement template file contains multiple image display items, by obtaining the business data corresponding to the target report, iterating through the image list objects in the business data, obtaining the image codes corresponding to each image list object, and filling the requirement template file with the image codes corresponding to each image list object and the text data in the business data, the target report can be obtained, effectively improving the efficiency and quality of report generation. Detailed embodiments are described below.
[0060] Reference Figure 1 , Figure 1 This is a flowchart illustrating a report generation method provided in an embodiment of the present invention. Figure 1 In one feasible implementation, the report generation method includes:
[0061] S101. Obtain the user requirements document and, based on the user requirements document, determine the object style and object attributes of the target report.
[0062] In this embodiment, the aforementioned user requirement document describes the form and content of the target report required by the user. By performing requirement object modeling analysis based on the user requirement document, the object style and object attributes of the target report required by the user can be determined.
[0063] In one feasible implementation, the object style and object attributes of the target report can be determined by analyzing the keywords in the aforementioned user requirements document.
[0064] The aforementioned object styles are style descriptions for the target report, including but not limited to font type, font size, font color, paragraph format, and table styles.
[0065] The aforementioned object attributes describe the attribute values for the target report, including but not limited to name, age, location, time, and business volume. Optionally, the aforementioned object attributes can also be images used to display name, age, location, time, and business volume.
[0066] S102. Using the object style template generated based on the object style and the object attribute template generated based on the object attributes, generate the requirement template file corresponding to the target report.
[0067] In one feasible implementation, after determining the object style and object attributes of the target report, an object style template can be generated based on the object style, and an object attribute template can be generated based on the object attributes.
[0068] For example, the above object style template may include various attribute names and the styles corresponding to each attribute name. For example, the above object style template may include the following attribute names: report title name, report date, first chapter title name, etc.; the style corresponding to the report title name may be: 10-point font, red background, centered; the style corresponding to the report date may be 8-point font, centered; the style corresponding to the first chapter title name may be: 8-point font, left-aligned, etc.
[0069] In one feasible implementation, the aforementioned requirement template file can be generated by composing the object style template and the object attribute template.
[0070] S103. When there are multiple image display items in the requirement template file, obtain the business data corresponding to the target report, iterate through the image list objects in the business data, obtain the image code corresponding to each image list object, and fill the requirement template file with the image code corresponding to each image list object and the text data in the business data to generate the target report.
[0071] In one feasible implementation, after generating the aforementioned requirement template file, the FreeMarker engine can parse and obtain the business data corresponding to the target report and automatically populate it into the aforementioned requirement template file, thereby generating a target report with specific style and content data.
[0072] In some embodiments of the present invention, when using Freemarker technology to obtain business data corresponding to the target report and populate it into the requirement template file, it is determined whether the requirement template file contains image display items; when the requirement template file contains two or more image display items, the image list object in the business data is traversed in a loop to obtain the base64 encoding corresponding to each image display item, and the base64 encoding corresponding to each image display item is filled into the image data tag in the requirement template file.
[0073] When the requirement template file contains only one image display item, the base64 encoding corresponding to the image display item is obtained from the business data, and the base64 encoding corresponding to the image display item is filled into the image data tag in the requirement template file.
[0074] If the image display item is not present in the requirement template file, the above business data can be directly filled into the requirement template file to generate the target report.
[0075] In one embodiment, the content of the aforementioned target report may include text, images, etc. The number of image files may be multiple.
[0076] In one feasible implementation, when there are multiple image files, a unified list tag approach can be used for replacement. This involves iterating through the image list object on the server, retrieving its corresponding base64 encoded content, and filling it into the corresponding template. <imagedata>Within the tags. For text processing or single image files, you can directly replace their corresponding tag objects.
[0077] Base64 is one of the methods for representing binary data based on 64 printable characters. It is a common encoding method used to transmit 8-bit byte code. The process of converting binary data into characters can be used to transmit longer identification information in the HTTP environment. Base64 encoding is unreadable and requires decoding to read.
[0078] The report generation method provided in this embodiment allows users to flexibly configure user requirement files according to actual needs. Based on these user requirement files, a requirement template file can be dynamically generated. For scenarios where user requirements change frequently, the requirement template file can be adjusted in real time to achieve efficient report output. In addition, when there are multiple image display items in the requirement template file, the business data corresponding to the target report is obtained, the image list objects in the business data are iterated, the image codes corresponding to each image list object are obtained, and the image codes corresponding to each image list object are filled into the requirement template file along with the text data in the business data, effectively improving the efficiency and quality of report generation.
[0079] Based on the content described in the above embodiments, referring to Figure 2 , Figure 2 This is a flowchart illustrating a report generation method provided in an embodiment of the present invention. Figure 2 In one feasible implementation, the report generation method includes:
[0080] Obtain the user requirements document, which details the form and content of the target report required by the user. Based on the user requirements document, perform requirement object modeling and analysis to determine the object style and object attributes of the target report required by the user.
[0081] The aforementioned object styles describe the style of the target report, including but not limited to font type, font size, font color, paragraph formatting, and table styles. The aforementioned object attributes describe the attribute values of the target report, including but not limited to name, age, location, time, and business volume.
[0082] After determining the object style and object attributes of the target report, determine the metadata corresponding to the object style and the metadata corresponding to the object attributes.
[0083] Based on the metadata corresponding to the object style, the object style template is generated in the form of key-value pairs; wherein, the key name in the object style template is the object style name marked with the Freemarker tag, and the key value is obtained from the business data through a backend service request.
[0084] Based on the metadata corresponding to the object attributes, the object attribute template is generated in the form of key-value pairs; wherein, the key name in the object attribute template is the object attribute name marked with the Freemarker tag, and the key value is obtained from the business data through a backend service request.
[0085] Based on the object style template and the object attribute template mentioned above, a requirement template file corresponding to the target report is generated. The FreeMarker engine parses and obtains the business data corresponding to the target report, and automatically populates it into the requirement template file, thereby generating a target report with style and content data.
[0086] FreeMarker is a template engine, a general-purpose tool that uses templates and the data to be modified to generate output text (HTML web pages, emails, configuration files, source code, etc.). It's a Java class library component that can be embedded in the development product. Templates are written in FreeMarker Template Language (FTL) format. Within the template, you can focus on how to present the data, while outside the template, you can focus on what data to display.
[0087] The report generation method provided in this embodiment can dynamically generate the requirement template file needed by the user, thereby meeting the scenario of frequent changes in user requirements, realizing efficient report output, and effectively improving the efficiency and quality of report generation.
[0088] Based on the content described in the above embodiments, referring to Figure 3 , Figure 3 This is a flowchart illustrating a report generation method provided in an embodiment of the present invention. Figure 3 In one feasible implementation, the report generation method includes:
[0089] S301. Based on the user requirements document, determine the object style and object attributes of the target report.
[0090] S302. Generate an object style template based on the object style, and generate an object attribute template based on the object attributes.
[0091] S303. Generate the requirement template file corresponding to the target report based on the object style template and the object attribute template.
[0092] S304. Generate the target report based on the business data corresponding to the requirement template file and the target report.
[0093] S305. When a change is detected in the user requirement document, modify the object style template and / or the object attribute template according to the changes in the user requirement document.
[0094] S306. Update the requirement template file according to the modified object style template and / or object attribute template. Return to execution S304.
[0095] In this embodiment of the invention, if the user's requirements change, the user only needs to adjust the user requirements file to change the requirements template file.
[0096] Specifically, when it is detected that the user requirement file only changes the style of the object, only the object style template can be changed, while the object attribute template can be directly reused, which can greatly improve the efficiency of the entire report template creation process.
[0097] In some embodiments of the present invention, after generating the aforementioned requirement template file, products with similar or identical data can select similar data templates, requiring only a change in the correspondence between data and templates. Thus, the same business data can correspond to multiple templates as needed, generating different reports and achieving efficient template reuse. Based on the content described in the above embodiments, the present invention also provides a report generation device, referring to... Figure 4 , Figure 4 This is a schematic diagram of a program module for a report generation device provided in an embodiment of the present invention. The report generation device includes:
[0098] The determination module 401 is used to obtain a user requirement document and, based on the user requirement document, determine the object style and object attributes of the target report. The user requirement document describes the form and content of the target report required by the user.
[0099] The template generation module 402 is used to generate a requirement template file corresponding to the target report by using an object style template generated based on the object style and an object attribute template generated based on the object attributes.
[0100] The report generation module 403 is used to obtain the business data corresponding to the target report when there are multiple image display items in the requirement template file, loop through the image list objects in the business data, obtain the image code corresponding to each image list object, and fill the requirement template file with the image code corresponding to each image list object and the text data in the business data to generate the target report.
[0101] In some embodiments, the determining module 401 is used to:
[0102] Analyze the keywords in the user requirements document, and determine the object style and object attributes of the target report based on the keywords in the user requirements document;
[0103] The object style includes, but is not limited to, font type, font size, font color, paragraph format, and table style; the object attributes are used to display text data and / or images including, but not limited to, name, age, location, time, and business volume.
[0104] In some embodiments, the template generation module 402 is used for:
[0105] Determine the metadata corresponding to the object style, and determine the metadata corresponding to the object attributes;
[0106] Based on the metadata corresponding to the object style, the object style template is generated in the form of key-value pairs; wherein, the key name in the object style template is the object style name identified by the Freemarker tag;
[0107] Based on the metadata corresponding to the object attribute, the object attribute template is generated in the form of key-value pairs; wherein, the key name in the object attribute template is the object attribute name marked with the Freemarker tag.
[0108] In some embodiments, the report generation module 403 is further configured to:
[0109] When there is an image display item in the requirement template file, the business data corresponding to the target report is obtained using FreeMarker technology. The image code corresponding to the image display item is obtained from the business data and filled into the image data tag in the requirement template file.
[0110] In some embodiments, the report generation module 403 is further configured to:
[0111] When the requirement template file does not contain an image display item, the business data corresponding to the target report is obtained using FreeMarker technology and filled into the requirement template file to generate the target report.
[0112] In some embodiments, the report generation apparatus further includes a template updating module, used for:
[0113] When a change is detected in the user requirement document, the object style template and / or the object attribute template are modified according to the changes in the user requirement document.
[0114] Update the requirement template file based on the modified object style template and / or the object attribute template.
[0115] The report generation device provided in this embodiment of the invention can dynamically generate the required template file based on the user's requirement file. Since different requirement files can generate different template files, when user requirements change, only a new user requirement file needs to be provided to automatically generate the required template file. Furthermore, when the template file contains multiple image display items, by obtaining the business data corresponding to the target report, iterating through the image list objects in the business data, obtaining the image codes corresponding to each image list object, and filling the template file with the image codes and text data from the business data, the target report can be obtained, thereby improving the efficiency and quality of report generation.
[0116] It should be noted that the specific execution of the determination module 401, template generation module 402, and report generation module 403 in this embodiment of the invention can be found in the [reference needed]. Figures 1 to 3 The relevant content in the illustrated embodiment will not be repeated here.
[0117] Furthermore, based on the content described in the above embodiments, this embodiment of the invention also provides an electronic device, which includes at least one processor and a memory; wherein the memory stores computer execution instructions; the at least one processor executes the computer execution instructions stored in the memory to implement the various steps of the report generation method as described in the above embodiments, which will not be repeated here.
[0118] To better understand the embodiments of the present invention, please refer to... Figure 5 , Figure 5 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention.
[0119] like Figure 5 As shown, the electronic device 50 of this embodiment includes: a processor 501 and a memory 502; wherein:
[0120] Memory 502 is used to store instructions executed by the computer;
[0121] The processor 501 is used to execute computer execution instructions stored in the memory to implement the various steps of the report generation method as described in the above embodiments. These will not be repeated here, but you can refer to the relevant descriptions in the foregoing method embodiments for details.
[0122] Alternatively, the memory 502 can be either standalone or integrated with the processor 501.
[0123] When the memory 502 is set up independently, the device also includes a bus 503 for connecting the memory 502 and the processor 501.
[0124] Furthermore, based on the content described in the above embodiments, this embodiment of the invention also provides a computer-readable storage medium storing computer-executable instructions. When the processor executes the computer-executable instructions, it can implement the various steps of the report generation method described in the above embodiments, which will not be repeated here.
[0125] Furthermore, based on the content described in the above embodiments, this embodiment of the invention also provides a computer program product, including a computer program. When the computer program is executed by a processor, it can implement the various steps of the report generation method described in the above embodiments, which will not be repeated here.
[0126] In the several embodiments provided by this invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or modules, and may be electrical, mechanical, or other forms.
[0127] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0128] Furthermore, the functional modules in the various embodiments of this invention can be integrated into one processing unit, or each module can exist physically separately, or two or more modules can be integrated into one unit. The unit integrating the above modules can be implemented in hardware or in the form of hardware plus software functional units.
[0129] The integrated modules described above, implemented as software functional modules, can be stored in a computer-readable storage medium. These software functional modules, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of the present invention.
[0130] It should be understood that the aforementioned processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly manifested as execution by a hardware processor, or execution by a combination of hardware and software modules within the processor.
[0131] The memory may include high-speed RAM, and may also include non-volatile storage (NVM), such as at least one disk storage device, and may also be a USB flash drive, external hard drive, read-only memory, disk or optical disc, etc.
[0132] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0133] The aforementioned storage medium can be implemented from any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The storage medium can be any available medium accessible to general-purpose or special-purpose computers.
[0134] An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Alternatively, the storage medium can be an integral part of the processor. Both the processor and the storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and storage medium can exist as discrete components in an electronic device or host device.
[0135] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0136] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.< / imagedata>
Claims
1. A report generation method, characterized in that, The method includes: Obtain the user requirements file, and determine the object style and object attributes of the target report based on the user requirements file. The user requirements file is used to describe the form and content of the target report required by the user. Determine the metadata corresponding to the object style and the metadata corresponding to the object attributes; generate an object style template in key-value pair format based on the metadata corresponding to the object style; generate an object attribute template in key-value pair format based on the metadata corresponding to the object attributes; wherein, the key name in the object style template is the object style name marked with the Freemarker tag; the key name in the object attribute template is the object attribute name marked with the Freemarker tag. Using the object style template generated based on the object style and the object attribute template generated based on the object attributes, a requirement template file corresponding to the target report is generated; When there are multiple image display items in the requirement template file, the business data corresponding to the target report is obtained, the image list objects in the business data are traversed in a loop, the image codes corresponding to each image list object are obtained, and the image codes corresponding to each image list object and the text data in the business data are filled into the requirement template file to generate the target report.
2. The method according to claim 1, characterized in that, The step of determining the object style and object attributes of the target report based on the user requirements document includes: Analyze the keywords in the user requirements document, and determine the object style and object attributes of the target report based on the keywords in the user requirements document; The object style includes, but is not limited to, font type, font size, font color, paragraph format, and table style; the object attributes are used to display text data and / or images including, but not limited to, name, age, location, time, and business volume.
3. The method according to claim 1, characterized in that, Also includes: When there is an image display item in the requirement template file, the business data corresponding to the target report is obtained using FreeMarker technology. The image code corresponding to the image display item is obtained from the business data and filled into the image data tag in the requirement template file.
4. The method according to claim 1, characterized in that, Also includes: When the requirement template file does not contain an image display item, the business data corresponding to the target report is obtained using FreeMarker technology and filled into the requirement template file to generate the target report.
5. The method according to any one of claims 1 to 4, characterized in that, Also includes: When a change is detected in the user requirement document, the object style template and / or the object attribute template are modified according to the changes in the user requirement document. Update the requirement template file based on the modified object style template and / or the object attribute template.
6. A report generation device, characterized in that, The device includes: The determination module is used to obtain the user requirement file and, based on the user requirement file, determine the object style and object attributes of the target report. The user requirement file is used to describe the form and content of the target report required by the user. A template generation module is used to determine the metadata corresponding to the object style and the metadata corresponding to the object attributes; generate an object style template in key-value pair format based on the metadata corresponding to the object style; generate an object attribute template in key-value pair format based on the metadata corresponding to the object attributes; and generate a requirement template file corresponding to the target report using the object style template generated based on the object style and the object attribute template generated based on the object attributes; wherein, the key name in the object style template is the object style name marked with a Freemarker tag; and the key name in the object attribute template is the object attribute name marked with a Freemarker tag. The report generation module is used to obtain the business data corresponding to the target report when there are multiple image display items in the requirement template file, loop through the image list objects in the business data, obtain the image code corresponding to each image list object, and fill the requirement template file with the image code corresponding to each image list object and the text data in the business data to generate the target report.
7. An electronic device, characterized in that, include: At least one processor and memory; The memory stores computer-executed instructions; The at least one processor executes computer execution instructions stored in the memory, causing the at least one processor to perform the report generation method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, implement the report generation method as described in any one of claims 1 to 5.
9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the report generation method according to any one of claims 1 to 5.