Report generation method and device, electronic equipment and storage medium
By using modular and structured design of components and indicator controls in the report generation system, the problem of high cost and low efficiency caused by frequent adjustments to report templates has been solved, and efficient generation and user-customizable report templates have been achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- KINGDEE DEEKING CLOUDCOMPUTING CO LTD
- Filing Date
- 2025-12-30
- Publication Date
- 2026-05-01
AI Technical Summary
In the existing report generation process, report templates need to be adjusted frequently, resulting in high development costs and low efficiency, and failing to support rapid configuration by non-developers.
By setting corresponding sub-components for each data type and associating at least one sub-component with an indicator control, the system selects the target indicator control from the indicator control pool to generate a report template based on the report generation requirements. The system then uses the control tree structure to generate the report file and supports user-defined template content configuration.
It improves the efficiency of report template generation, reduces design costs, reduces the workload of developers, and supports customized configurations for non-developers.
Smart Images

Figure CN121958413A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of data processing technology, and in particular relates to a report generation method, apparatus, electronic device and storage medium. Background Technology
[0002] With the development of data processing technology, there is often a need to view large amounts of indicator-based data. To facilitate the viewing of indicator-based data, indicator-based reports can be used to summarize and display this data. In this process, indicator-based report generation systems play a crucial role.
[0003] In related technologies, indicator-based report generation systems are often based on a report template hard-coded on the front end. Business indicators are configured in the report template, various types of placeholders are set up, the acquired report data is associated with the business indicators in the report template, the business indicators are copied according to the report data, and the copied business indicator data is filled into the corresponding placeholders according to the type of the copied business indicator to generate the report.
[0004] However, the number of indicators is large and they are subject to change based on policies and industry developments. Therefore, the corresponding report templates also need to be adjusted accordingly. Since the current report templates are hard-coded, generating new templates requires developers to redesign them, which is costly and inefficient. Summary of the Invention
[0005] The purpose of this application is to provide a report generation method, apparatus, electronic device, and storage medium, which aims to solve the problems of high cost and low efficiency in traditional report generation processes.
[0006] A first aspect of this application provides a report generation method, the method comprising: In response to a report generation requirement, at least one target metric control is selected from the control pool, and each metric control is associated with at least one child component of a certain type. A report template is generated based on the at least one target indicator control, using a control tree structure. A report file is generated based on the report template.
[0007] In some embodiments, generating a report template in the form of a control tree based on the at least one target indicator control includes: Based on the template identifier of the report template to be generated, a root control identifier is set for each target indicator control, and the root control identifier is used to characterize the report template to which the target indicator control belongs; Based on the structure of the control tree, set the parent control identifier for each target indicator control; For each target indicator control, set the sorting field of the target indicator control according to its sorting position in the report template; The report template is composed of at least one of the target indicator controls that have been configured.
[0008] In some embodiments, generating a report file based on the report template includes: Starting from the root control identifier of the report template, traverse the control tree corresponding to the report template according to the sorting position of the target indicator controls; For each target indicator control encountered during the traversal, at least one child component associated with the target indicator control is queried based on the control identifier of the target indicator control. According to the order of the sub-components, the implementation class corresponding to the type of each sub-component is called in turn to obtain the page data fragment corresponding to the sub-component; The report file is obtained by concatenating the page data fragments corresponding to multiple sub-components.
[0009] In some embodiments, selecting at least one target metric control from the control pool according to the report generation requirements includes: Based on multiple sample indicator reports, select at least one target indicator control from the control pool that matches the report generation requirements of the sample indicator reports; or, Receive the user's selection operation, and based on the user's selection operation, select at least one target indicator control corresponding to the selection operation from the control pool.
[0010] In some embodiments, after generating a report template based on the at least one target metric control in a control tree structure, the method further includes: Display preview information corresponding to the report template; In response to receiving an adjustment operation for the report template, the adjustment is performed on any target indicator control based on the adjustment operation, including an add operation, a delete operation, and a hide operation; Generate the revised report template.
[0011] In some embodiments, prior to selecting at least one target metric control from the control pool based on the report generation requirements, the method further includes: A pool of sub-components is generated based on the data types in multiple sample indicator reports. At least one sub-component in the sub-component pool is combined to obtain at least one indicator control; The control pool is composed of multiple of the aforementioned indicator controls.
[0012] In some embodiments, generating a component pool based on the data types in multiple sample indicator reports includes: Parse the multiple sample indicator reports to obtain the data types used by the multiple sample indicator reports; Based on the data type, set the display order, title, type, and control data source interface address of the data type within the control to obtain the child component corresponding to the data type.
[0013] A second aspect of this application provides a report generation apparatus, the apparatus comprising: The selection unit is used to select at least one target indicator control from the control pool in response to a report generation requirement, and each indicator control is associated with at least one type of child component. The template generation unit is used to generate a report template based on the at least one target indicator control in a control tree structure. The report generation unit is used to generate a report file based on the report template.
[0014] In some embodiments, the template generation unit is configured to: set a root control identifier for each target indicator control based on the template identifier of the report template to be generated, wherein the root control identifier is used to characterize the report template to which the target indicator control belongs; set a parent control identifier for each target indicator control based on the structure of the control tree; set a sorting field for each target indicator control according to its sorting position in the report template; and assemble at least one target indicator control that has been configured to form the report template.
[0015] In some embodiments, the report generation unit is configured to traverse the control tree corresponding to the report template, starting from the root control identifier of the report template and according to the sorting position of the target indicator controls; for each target indicator control traversed, query at least one sub-component associated with the target indicator control according to the control identifier of the target indicator control; sequentially call the implementation class corresponding to the type of each sub-component according to the sorting of the sub-components to obtain the page data fragment corresponding to the sub-component; and concatenate the page data fragments corresponding to multiple sub-components to obtain the report file.
[0016] In some embodiments, the selection unit is configured to select, from the control pool, at least one target indicator control that matches the report generation requirements of the sample indicator reports, based on a plurality of sample indicator reports; or... The selection unit is used to receive the user's selection operation and, based on the user's selection operation, select at least one target indicator control corresponding to the selection operation from the control pool.
[0017] In some embodiments, the apparatus further includes: The display unit is used to display preview information corresponding to the report template; An adjustment unit is configured to respond to receiving an adjustment operation for the report template, and adjust any target indicator control based on the adjustment operation, wherein the adjustment operation includes an add operation, a delete operation, and a hide operation; The report generation unit is also used to generate an adjusted report template.
[0018] In some embodiments, the apparatus further includes: The sub-component generation unit is used to generate a sub-component pool based on the data types in multiple sample indicator reports; The control generation unit is used to combine at least one sub-component in the sub-component pool to obtain at least one indicator control; and to form the control pool by combining multiple indicator controls.
[0019] In some embodiments, the sub-component generation unit is used to parse the plurality of sample indicator reports to obtain the data type used by the plurality of sample indicator reports; and based on the data type, set the display order, title, type and control data source interface address of the data type in the control to obtain the sub-component corresponding to the data type.
[0020] A third aspect of this application provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the report generation method described above.
[0021] A fourth aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the report generation method described above.
[0022] A fifth aspect of this application provides a computer program product that, when run on an electronic device, causes the electronic device to perform the report generation method described above.
[0023] The beneficial effects of the embodiments of the present invention compared with the prior art are as follows: In this embodiment, by setting a corresponding sub-component for each data type and associating at least one sub-component with an indicator control, when a report template needs to be generated, at least one relevant target indicator control can be selected from the indicator control pool according to the report generation requirements. This at least one target indicator control is then used to generate a report template, enabling the generation of a report file based on the template. This eliminates the need for hard coding when generating the report template, improving generation efficiency and reducing design costs. Furthermore, since existing indicator controls can be combined and configured, they can be reused in various report templates, reducing the workload for developers. The modular and structured nature of the indicator controls supports user-defined template content, allowing configuration by non-developers to meet customer customization needs. Attached Figure Description
[0024] Figure 1 A flowchart illustrating a report generation method provided by an exemplary embodiment is shown; Figure 2 A schematic diagram of a process for generating a report template is shown in an exemplary embodiment; Figure 3 A flowchart illustrating a report generation method provided by an exemplary embodiment is shown; Figure 4 A flowchart illustrating the process of generating a report file based on a report template, provided by an exemplary embodiment, is shown. Figure 5 A schematic diagram illustrating a process for adjusting a report template provided by an exemplary embodiment is shown; Figure 6 A schematic diagram of a method flow for a control pool provided in an exemplary embodiment is shown; Figure 7 A schematic diagram of the structure types included in a report provided by an exemplary embodiment is shown; Figure 8 A schematic diagram of a sub-component type provided in an exemplary embodiment is shown; Figure 9 A flowchart illustrating a method for generating indicator controls provided by an exemplary embodiment is shown; Figure 10 A hierarchical model of a report template provided in an exemplary embodiment is shown; Figure 11 A schematic diagram of the structure of a report generation apparatus provided in an exemplary embodiment is shown; Figure 12 A schematic diagram of the structure of an electronic device provided in an exemplary embodiment is shown. Detailed Implementation
[0025] To make the technical problems, technical solutions, and beneficial effects to be solved by this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and are not intended to limit the scope of this application.
[0026] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0027] With the development of data processing technology, it is often necessary to view large amounts of indicator-based data. For example, some financial and tax assessment reports consist of many financial and tax indicators, such as enterprise information, personal income tax declaration risk monitoring, and tax incentive risk monitoring.
[0028] To facilitate the viewing of indicator-based data, indicator-based reports can be used to summarize and display this data. In this process, the indicator-based report generation system plays a crucial role.
[0029] In some embodiments, the indicator-based report generation system is often based on a report template hard-coded in the front end. Business indicators are configured in the report template, various types of placeholders are set up, the acquired report data is associated with the business indicators in the report template, the business indicators are copied according to the report data, and the copied business indicator data is filled into the corresponding placeholders according to the type of the copied business indicator to generate the report.
[0030] The display formats for different indicators vary widely, including plain text, tables, charts, and maps. Depending on the industry and region, the number and types of indicators included in indicator-based reports also differ. Therefore, indicator-based report generation systems need to support different report templates tailored to different industries and regions.
[0031] However, the number of indicators is large and subject to change based on policies and industry developments; therefore, the corresponding report templates also need to be adjusted accordingly. In some embodiments, developing a new template requires re-coding and implementing a new report template. This process prevents efficient reuse of existing model logic from both the front-end and back-end, resulting in long development cycles and high costs, from user design and requirements planning to online development. Furthermore, because the report model is hard-coded, the entire implementation of the new report template requires developers, and there is no support for quick implementation by non-developers.
[0032] In summary, since the current report template is a hard-coded template, generating a new report template requires developers to redesign it, which is costly and inefficient.
[0033] To improve the efficiency and reduce the cost of report template generation, this application provides a method, apparatus, electronic device, and storage medium for report generation. By setting corresponding sub-components for each data type and associating at least one sub-component with an indicator control, when a report template needs to be generated, at least one relevant target indicator control can be selected from an indicator control pool according to the report generation requirements. This at least one target indicator control is then used to generate a report template, enabling the generation of report files based on the template. This eliminates the need for hard coding during report template generation, improving efficiency and reducing design costs. Furthermore, since existing indicator controls can be combined and configured, they can be reused in various report templates, reducing the workload of developers. The modular and structured nature of the indicator controls supports user-defined template content and allows configuration by non-developers, meeting customized customer needs.
[0034] For ease of understanding, the relevant content of the report generation method design provided in this application is explained below.
[0035] Sub-component: Used to display a single type of data, responsible for generating a fragment of page data containing a single character, such as a HyperText Markup Language Fragment (HTML). In this application, it is the smallest granular, indivisible unit. It is a pluggable extension point containing the backend implementation class and the frontend Cascading Style Sheets (CSS). This sub-component can include indicator types such as text, tables, charts (pie charts, line charts, bar charts, etc.), and maps.
[0036] Controls are business-level composite components that are structurally combined from multiple sub-components. For example, an "asset indicator control" includes a title, numerical value, text, and trend chart.
[0037] The report generation method provided in this application will be described below with reference to specific embodiments. See also Figure 1 The diagram illustrates a flowchart of a report generation method provided by an exemplary embodiment. This method is applied to electronic devices, not as a limitation.
[0038] S101, in response to a report generation request, the electronic device selects at least one target indicator control from the control pool according to the report generation request, and each indicator control is associated with at least one type of child component.
[0039] The electronic device selects at least one target indicator control from the control pool based on different report generation requirements. These report generation requirements can be user-inputted requirements or requirements summarized by the electronic device based on historical industry, regional, or other information.
[0040] Accordingly, in some embodiments, the electronic device selects at least one target indicator control from the control pool that matches the report generation requirements of the sample indicator reports based on a pool of multiple sample indicator reports.
[0041] The electronic device analyzes and abstracts multiple sample indicator reports to obtain the report generation requirements corresponding to each industry, region, and other information in these multiple sample indicator reports. The electronic device obtains the industry, region, and other information corresponding to this electronic report, and based on this industry, region, and other information, matches the report generation requirements corresponding to the industry, region, and other information in similar sample indicator reports, thereby determining at least one target indicator control that matches the report generation requirement.
[0042] In other embodiments, the electronic device receives a user's selection operation and, based on the user's selection operation, selects at least one target indicator control corresponding to the selection operation from the control pool. In this implementation, the at least one target indicator control is selected from the control pool according to the user's selection operation. This allows for more flexible configuration of the target indicator control according to requirements.
[0043] One point to note is that when a user selects a target indicator control, the required indicator control may not be available in the control pool. In this case, the developer workflow can be triggered to generate the corresponding indicator control. See [link to relevant documentation] for details. Figure 2 This illustrates a flowchart of a report template generation process provided by an exemplary embodiment. Figure 2 As shown, the user configures the report template. The user inputs and selects the target indicator control through the selection operation. The system checks whether the selected indicator control exists in the control pool. If the indicator control does not exist, a control generation instruction is generated to instruct the generation of the indicator control. If the indicator control exists, the subsequent steps of generating the report template based on the target indicator control are executed.
[0044] S102, the electronic device generates a report template based on the at least one target indicator control in a control tree structure.
[0045] In the control hierarchy of this application, the indicator control (bd_section) has its structure defined by a variety of fields. For example, these include a unique control identifier (sectionId) to uniquely identify the indicator control; a parent control identifier (parentSectionId) to construct a tree structure; a root control identifier (rootSectionId) to identify the report template to which the control belongs; and a sorting field (seq) to identify the sorting field of the indicator control under the same parent control identifier.
[0046] The electronic device sets the relevant parameters of each target indicator control based on the report template to which the at least one target indicator control belongs, and obtains the corresponding generated report template. See also Figure 3 This illustrates a flowchart of a report generation method provided by an exemplary embodiment. Figure 3 As shown, the process includes implementations S1021-S1024, including: S1021, the electronic device sets the root control identifier for each target indicator control based on the template identifier of the report template to be generated. The root control identifier is used to characterize the report template to which the target indicator control belongs.
[0047] The electronic device obtains the template identifier of the report template to be generated and sets the template identifier as the root control identifier of the target indicator control.
[0048] S1022, The electronic device sets the parent control identifier for each target indicator control based on the structure of the control tree.
[0049] The electronic device sets the parent control identifier corresponding to the tree structure according to the preset tree structure.
[0050] S1023, For each target indicator control, the electronic device sets the sorting field of the target indicator control according to its sorting position in the report template.
[0051] The sorting position is used to indicate the position of the target indicator control in the tree structure. This position can be set by the user or automatically generated. In this embodiment, the method of obtaining this position is not specifically limited.
[0052] S1024, the electronic device assembles at least one of the target indicator controls that have been set up into the report template.
[0053] The electronic device comprises at least one target indicator control that completes the settings into the report template.
[0054] It should be noted that users can also choose whether the data corresponding to any indicator control in the report template is visible. Accordingly, the indicator control also includes a visibility field. When the indicator control is visible, the visibility field can be true, and when the indicator control is not visible, the visibility field can be false.
[0055] S103, the electronic device generates a report file based on this report template.
[0056] The electronic device iterates through the report template. For each metric control encountered, it queries its corresponding child component and calls the implementation class of each child component to complete the rendering. The target metric control in this report template does not contain rendering functionality; it exists only as a container for the child component (bd_content). The electronic device can call the report generation engine to iterate through the report template. See also... Figure 4 This illustrates an exemplary embodiment of a process for generating a report file based on a report template. For example... Figure 4 As shown, this process can be implemented through the following steps S1031-S1034, including: S1031, the electronic device starts from the root control identifier of the report template and traverses the control tree corresponding to the report template according to the sorting position of the target indicator control.
[0057] The electronic device starts from the root control identifier (rootSectionIds) of the template report and traverses the target indicator control in sequence according to the sort field (seq) corresponding to each target indicator control.
[0058] S1032, for each target indicator control traversed, the electronic device queries at least one child component associated with the target indicator control based on the control identifier of the target indicator control.
[0059] For each target indicator control encountered, the electronic device queries at least one sub-control associated with the control identifier (sectionId) based on the control identifier (sectionId) of the target indicator control.
[0060] It should be noted that after the electronic device traverses to the target indicator control, it can first determine the visible function field of the target indicator control. If the visible function field of the target indicator control indicates that the target indicator control is a visible control (visible = true), then continue to execute step S1032; if the visible function field of the target indicator control indicates that the target indicator control is an invisible control (visible = false), then no further operations will be performed on the target indicator control.
[0061] Another point to note is that for each sub-component, the user can also set the visibility state of the sub-component as needed. Accordingly, if the sub-component is a visible sub-component (visible = true), then step S103 is executed; if the sub-component is an invisible sub-component (visible = false), then no further operations are performed on the sub-component.
[0062] S1033, the electronic device sequentially calls the implementation class corresponding to the type of each sub-component according to the order of the sub-components to obtain the page data fragment corresponding to that sub-component.
[0063] For each sub-component, which includes a backend implementation class and frontend CSS, in this step, the electronic device calls the backend implementation class corresponding to the sub-component, and uses the backend implementation class to convert the page data into standardized page data (HTML) fragments.
[0064] S1034, the electronic device splices together multiple page data fragments corresponding to the sub-component to obtain the report file.
[0065] The electronic device sequentially concatenates page data fragments corresponding to multiple sub-components to obtain a completed page data content block corresponding to each target indicator control. The page data content blocks generated from multiple chapters are then sequentially concatenated into a complete report file. The report file format supports unified encapsulation (CSS inline or external links) and can be set as needed. In this embodiment, the report file format is not specifically limited. For example, the file format can be PDF or online preview, etc.
[0066] For different target indicator controls, the generated page data content blocks can be displayed separately or integrated into a single display page. In this embodiment, no specific limitation is made in this regard.
[0067] For example, a cover control typically includes sub-components such as a background image, title text, and date text. The generated page data block uses absolute positioning to create a single-page display, and is positioned as the cover page, first in the order of the page. A table of contents control includes a chapter title table sub-component and a page number text sub-component. During the initial rendering, the starting page number of each chapter is recorded, and the data source parameters of the "page number text sub-component" in the table of contents are dynamically replaced to generate table of contents page data with actual page numbers, positioned as the second page.
[0068] For other indicator controls: multiple child components of types such as icons, text, and risk warnings can be nested, supporting complex layouts and interactions.
[0069] It should be noted that, in some embodiments, the electronic device displays a preview of the report template; in response to receiving an adjustment operation for the report template, it adjusts any target indicator control based on the adjustment operation, including adding, deleting, or hiding operations; and generates the adjusted report template. See also Figure 5 The illustration shows a schematic diagram of a process for adjusting a report template according to an exemplary embodiment. When a user selects a report template preview, the preview shows multiple target indicator controls and their layout order within the report template. If an adjustment operation is received from the user, the report template is adjusted accordingly. If no corresponding adjustment operation is received, a report file is generated.
[0070] The adjustment operation may include, but is not limited to, adding, deleting, hiding, and reordering operations. In this embodiment, no specific limitations are imposed.
[0071] In this embodiment, by setting a corresponding sub-component for each data type and associating at least one sub-component with an indicator control, when a report template needs to be generated, at least one relevant target indicator control can be selected from the indicator control pool according to the report generation requirements. This at least one target indicator control is then used to generate a report template, enabling the generation of a report file based on the template. This eliminates the need for hard coding when generating the report template, improving generation efficiency and reducing design costs. Furthermore, since existing indicator controls can be combined and configured, they can be reused in various report templates, reducing the workload for developers. The modular and structured nature of the indicator controls supports user-defined template content, allowing configuration by non-developers to meet customer customization needs.
[0072] In this embodiment, the indicator control does not include rendering functionality; it exists only as a container for the child component (bd_content). To enable users to configure the required report templates based on existing indicator controls, a control pool needs to be built before generating the report template. See [link to relevant documentation]. Figure 6 This illustrates a schematic diagram of a method flow for a control pool provided by an exemplary embodiment. This method is applied to electronic devices, not as a limitation.
[0073] S601, Electronic devices generate a pool of sub-components based on the data types in multiple sample indicator reports.
[0074] The electronic device parses multiple sample indicator reports to obtain multiple structures for the sample indicator row reports, for example, see [link to relevant documentation]. Figure 7This includes the cover, overall situation, table of contents, title, indicators, etc. For each indicator, further analysis is performed to obtain the data type used by the sample indicator report, and a corresponding sub-component pool is generated based on this data type. Accordingly, in some embodiments, the electronic device parses the multiple sample indicator reports to obtain the data type used by the multiple sample indicator reports; based on this data type, the display order, title, type, and control data source interface address of the data type within the control are set to obtain the sub-component corresponding to the data type.
[0075] In this embodiment, the child component (bd_content) is associated with the indicator control through the parent control identifier. The content to be displayed under each control is defined. Key fields for each child component include: the child component's display order within the control (seq), the visible function field (visible), the child component title (title), the child component type (contentEnum), and the control's data source interface address (dsurl).
[0076] See Figure 8 This sub-component type includes text, tables, pie charts, bar charts, line charts, risk warnings, maps, etc. Each sub-component type (contentEnum) corresponds to a backend implementation class responsible for converting the data into standardized HTML. Fragment. For example, the risk warning sub-component: parses the risk level, risk items, response suggestions, and policy basis from the data source, and generates a format including style and structure. Risk card; Chart components (such as bar charts): Extract data from the data source based on parameters, construct a structured data object of class ECharts, and generate a chart container and initialization script. Fragment; Text component: directly renders the title and content, supports rich text formatting; Table component: converts data into HTML.
[0077] Each fragment is self-contained, can be rendered independently, or can be combined with container controls.
[0078] S602, the electronic device combines at least one sub-component from the sub-component pool to obtain at least one indicator control.
[0079] The electronic device combines at least one sub-component from the sub-component pool according to user needs to obtain indicator controls. See also Figure 9 The diagram illustrates a flowchart of a method for generating indicator controls provided by an exemplary embodiment. Figure 9 As shown, select the corresponding sub-component according to the requirements. If the sub-component exists in the sub-component pool, select the sub-component to form an indicator control and add the formed indicator control to the control pool. If the sub-component does not exist in the sub-component pool, the required sub-component will be developed by the developers.
[0080] S603, the electronic device combines multiple of these indicator controls into a control pool.
[0081] It should be noted that this control pool generation process can be implemented using the developer's electronic device. See also Figure 10 This illustrates a hierarchical model of a report template provided in an exemplary embodiment. For example... Figure 10 As shown, this layered model includes a component layer, a control layer, a template layer, and a report layer. The component and control layers can be implemented using the developer's electronic device. The template layer, used for configuration combination and fine-tuning, can be implemented using the electronic device of staff unfamiliar with development. The report layer, used for downloading and fine-tuning report files, can be implemented using the user's electronic device. This layering of different functions eliminates the need for developer intervention when generating templates and reports; template configuration can be achieved directly using the existing control and component pools, reducing development costs and template generation difficulty.
[0082] In this embodiment, by setting a corresponding sub-component for each data type and associating at least one sub-component with an indicator control, when a report template needs to be generated, at least one relevant target indicator control can be selected from the indicator control pool according to the report generation requirements. This at least one target indicator control is then used to generate a report template, enabling the generation of a report file based on the template. This eliminates the need for hard coding when generating the report template, improving generation efficiency and reducing design costs. Furthermore, since existing indicator controls can be combined and configured, they can be reused in various report templates, reducing the workload for developers. The modular and structured nature of the indicator controls supports user-defined template content, allowing configuration by non-developers to meet customer customization needs.
[0083] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0084] See Figure 11 The diagram illustrates a structural schematic of a report generation apparatus provided in this application, comprising various units used to perform the steps described in the above embodiments. See also... Figure 11 The report generation device includes: Selection unit 1101 is used to select at least one target indicator control from the control pool in response to a report generation requirement, and each indicator control is associated with at least one type of child component; Template generation unit 1102 is used to generate a report template based on the at least one target indicator control in a control tree structure; The report generation unit 1103 is used to generate a report file based on the report template.
[0085] In some embodiments, the template generation unit 1102 is configured to: set a root control identifier for each target indicator control based on the template identifier of the report template to be generated, wherein the root control identifier is used to characterize the report template to which the target indicator control belongs; set a parent control identifier for each target indicator control based on the structure of the control tree; set a sorting field for each target indicator control according to its sorting position in the report template; and assemble the at least one target indicator control with the configured settings into the report template.
[0086] In some embodiments, the report generation unit 1103 is configured to traverse the control tree corresponding to the report template, starting from the root control identifier of the report template and according to the sorting position of the target indicator controls; for each target indicator control traversed, query at least one sub-component associated with the target indicator control according to the control identifier of the target indicator control; sequentially call the implementation class corresponding to the type of each sub-component according to the sorting of the sub-components to obtain the page data fragment corresponding to the sub-component; and concatenate multiple page data fragments corresponding to the sub-components to obtain the report file.
[0087] In some embodiments, the selection unit 1101 is configured to select, from the control pool, at least one target indicator control that matches the report generation requirements of the sample indicator reports, based on a plurality of sample indicator reports; or... The selection unit 1101 is used to receive the user's selection operation and, based on the user's selection operation, select at least one target indicator control corresponding to the selection operation from the control pool.
[0088] In some embodiments, the device further includes: The display unit is used to show preview information corresponding to the report template; An adjustment unit is used to respond to receiving an adjustment operation for the report template, and to adjust any target indicator control based on the adjustment operation, including an add operation, a delete operation, and a hide operation; The report generation unit 1103 is also used to generate the adjusted report template.
[0089] In some embodiments, the device further includes: The sub-component generation unit is used to generate a sub-component pool based on the data types in multiple sample indicator reports; The control generation unit is used to combine at least one sub-component in the sub-component pool to obtain at least one indicator control; and to combine multiple indicator controls to form the control pool.
[0090] In some embodiments, the sub-component generation unit is used to parse the plurality of sample indicator reports to obtain the data type used by the plurality of sample indicator reports; and based on the data type, to set the display order, title, type and control data source interface address of the data type in the control to obtain the sub-component corresponding to the data type.
[0091] In this embodiment, by setting a corresponding sub-component for each data type and associating at least one sub-component with an indicator control, when a report template needs to be generated, at least one relevant target indicator control can be selected from the indicator control pool according to the report generation requirements. This at least one target indicator control is then used to generate a report template, enabling the generation of a report file based on the template. This eliminates the need for hard coding when generating the report template, improving generation efficiency and reducing design costs. Furthermore, since existing indicator controls can be combined and configured, they can be reused in various report templates, reducing the workload for developers. The modular and structured nature of the indicator controls supports user-defined template content, allowing configuration by non-developers to meet customer customization needs.
[0092] Figure 12 This is a schematic diagram of an electronic device provided in an exemplary embodiment of this application. (As shown...) Figure 12 As shown, the electronic device 12 of this embodiment includes: a processor 120, a memory 121, and a computer program 122 stored in the memory 121 and executable on the processor 120, such as a report generation program. When the processor 120 executes the computer program 122, it implements the steps in the various report generation method embodiments described above, for example... Figure 5 Steps S501 to S504 are shown. Alternatively, when the processor 120 executes the computer program 122, it implements the functions of each unit in the above-described device embodiments, for example... Figure 11 The functions of units 1101 to 1103 are shown.
[0093] For example, the computer program 122 can be divided into one or more units, which are stored in the memory 121 and executed by the processor 120 to complete this application. The one or more units can be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program 122 in the electronic device 12. For example, the computer program 122 can be divided into a selection unit 1301, a template generation unit 1302, and a report generation unit, with the specific functions of each module as follows: Selection unit 1101 is used to select at least one target indicator control from the control pool in response to a report generation requirement, and each indicator control is associated with at least one type of child component; Template generation unit 1102 is used to generate a report template based on the at least one target indicator control in a control tree structure; The report generation unit 1103 is used to generate a report file based on the report template.
[0094] The electronic device 12 can be any electronic device with control functions. The electronic device 12 may include, but is not limited to, a processor 120 and a memory 121. Those skilled in the art will understand that... Figure 12 This is merely an example of electronic device 12 and does not constitute a limitation on electronic device 12. It may include more or fewer components than shown, or combine certain components, or different components. For example, electronic device 12 may also include input / output devices, network access devices, buses, etc.
[0095] The processor 120 may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0096] The memory 121 can be an internal storage unit of the electronic device 12, such as a hard disk or RAM. The memory 121 can also be an external storage device of the electronic device 12, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. Furthermore, the memory 121 can include both internal and external storage units of the electronic device 12. The memory 121 is used to store the computer program and other programs and data required by the terminal device. The memory 121 can also be used to temporarily store data that has been output or will be output.
[0097] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0098] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0099] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0100] In the embodiments provided in this application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components 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 through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0101] The units described as separate components may or may not be physically separate. The components shown as units 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 units can be selected to achieve the purpose of this embodiment according to actual needs.
[0102] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0103] If the integrated module / unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.
[0104] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps described in the above method embodiments.
[0105] This application also provides a computer program product that, when run on a mobile terminal, enables the mobile terminal to implement the steps described in the various method embodiments above.
[0106] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application 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 of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application. The structure supports extended attributes such as pagination and sorting. It's worth noting that all child components are generated...
Claims
1. A report generation method, characterized in that, The method includes: In response to a report generation requirement, at least one target metric control is selected from the control pool, and each metric control is associated with at least one child component of a certain type. A report template is generated based on the at least one target indicator control, using a control tree structure. A report file is generated based on the report template.
2. The method as described in claim 1, characterized in that, The step of generating a report template in the form of a control tree based on the at least one target indicator control includes: Based on the template identifier of the report template to be generated, a root control identifier is set for each target indicator control, and the root control identifier is used to characterize the report template to which the target indicator control belongs; Based on the structure of the control tree, set the parent control identifier for each target indicator control; For each target indicator control, set the sorting field of the target indicator control according to its sorting position in the report template; The report template is composed of at least one of the target indicator controls that have been configured.
3. The method as described in claim 1, characterized in that, The process of generating a report file based on the report template includes: Starting from the root control identifier of the report template, traverse the control tree corresponding to the report template according to the sorting position of the target indicator controls; For each target indicator control encountered during the traversal, at least one child component associated with the target indicator control is queried based on the control identifier of the target indicator control. According to the order of the sub-components, the implementation class corresponding to the type of each sub-component is called in turn to obtain the page data fragment corresponding to the sub-component; The report file is obtained by concatenating the page data fragments corresponding to multiple sub-components.
4. The method as described in claim 1, characterized in that, The step of selecting at least one target metric control from the control pool according to the report generation requirements includes: Based on multiple sample indicator reports, select at least one target indicator control from the control pool that matches the report generation requirements of the sample indicator reports; or, Receive the user's selection operation, and based on the user's selection operation, select at least one target indicator control corresponding to the selection operation from the control pool.
5. The method according to any one of claims 1-4, characterized in that, After generating a report template based on the at least one target indicator control in a control tree structure, the method further includes: Display preview information corresponding to the report template; In response to receiving an adjustment operation for the report template, the adjustment is performed on any target indicator control based on the adjustment operation, including an add operation, a delete operation, and a hide operation; Generate the revised report template.
6. The method according to any one of claims 1-4, characterized in that, Prior to selecting at least one target metric control from the control pool based on the report generation requirements, the method further includes: A pool of sub-components is generated based on the data types in multiple sample indicator reports. At least one sub-component in the sub-component pool is combined to obtain at least one indicator control; The control pool is composed of multiple of the aforementioned indicator controls.
7. The method as described in claim 6, characterized in that, The generation of a sub-component pool based on the data types in multiple sample indicator reports includes: Parse the multiple sample indicator reports to obtain the data types used by the multiple sample indicator reports; Based on the data type, set the display order, title, type, and control data source interface address of the data type within the control to obtain the child component corresponding to the data type.
8. A report generation device, characterized in that, The device includes: The selection unit is used to select at least one target indicator control from the control pool in response to a report generation requirement, and each indicator control is associated with at least one type of child component. The template generation unit is used to generate a report template based on the at least one target indicator control in a control tree structure. The report generation unit is used to generate a report file based on the report template.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the report generation method as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the report generation method as described in any one of claims 1 to 7.