CN114154474A - Data export method, system, computer device and readable storage medium - Google Patents

Data export method, system, computer device and readable storage medium Download PDF

Info

Publication number
CN114154474A
CN114154474A CN202111424277.3A CN202111424277A CN114154474A CN 114154474 A CN114154474 A CN 114154474A CN 202111424277 A CN202111424277 A CN 202111424277A CN 114154474 A CN114154474 A CN 114154474A
Authority
CN
China
Prior art keywords
data
file
template
export
report
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111424277.3A
Other languages
Chinese (zh)
Inventor
陈哲文
范渊
刘博�
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
DBAPPSecurity Co Ltd
Original Assignee
DBAPPSecurity Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by DBAPPSecurity Co Ltd filed Critical DBAPPSecurity Co Ltd
Priority to CN202111424277.3A priority Critical patent/CN114154474A/en
Publication of CN114154474A publication Critical patent/CN114154474A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/186Templates

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to a data export method, a system, a computer device and a readable storage medium, wherein the data export method comprises the following steps: receiving a report generation request, verifying the request through an interface, generating a report task, and asynchronously calling the report task; loading a configuration file and a template file according to the generated report task, analyzing and executing an expression in the configuration file to obtain original data; and calling a related target technology according to the template file, rendering the original data to the template file through the target technology, and generating a report file to export. Through the method and the device, the problems that the export effect is single, the data acquisition mode is single, and the complex effect display cannot be realized are solved, the data can be collected in multiple modes, multiple export files are supported, the export of the complex effect is also supported by configuring different template files, in the export process, developers do not need to pay attention to the file generation process, and the export can be completed only by configuring the files.

Description

Data export method, system, computer device and readable storage medium
Technical Field
The present application relates to the field of software technologies, and in particular, to a data export method, system, computer device, and readable storage medium.
Background
With the higher attention of government and enterprises to data, the display of the data becomes a demand which cannot be avoided by software design, the data information can be rapidly acquired through reasonable and effective data display, and the value of the data is furthest exerted.
At present, the traditional data export is generally presented in a simple mode of word, excel, html and pdf, the export effect is single, correspondingly, the data acquisition mode is single, the sensitivity of the intelligent safety platform for the AiLPHA big data of a plurality of users to the data is high, the display requirements for the data in the project are various, the traditional data export cannot meet the actual requirements of the users at all, meanwhile, the traditional mode needs to call a large amount of repeated API operations for exporting the data, the API calls few documents, if complex effects need to be realized, great efforts are needed for research and development, the effects are unknown, and the development is also uncertain.
Disclosure of Invention
The embodiment of the application provides a data export method, a data export system, computer equipment and a readable storage medium, and aims to at least solve the problems that the export effect is single, the data acquisition mode is single, and the complex effect display cannot be realized in the related technology.
In a first aspect, an embodiment of the present application provides a data export method, including:
receiving a report generation request, verifying the request through an interface, generating a report task, and asynchronously calling the report task;
loading a configuration file and a template file according to the generated report task, analyzing and executing an expression used for collecting data in the configuration file to obtain original data;
and calling a target technology related to the template file according to the template file, rendering the original data to the template file through the target technology, and generating a report file for export.
In some of these embodiments, the raw data comprises picture data, and the deriving the picture data comprises:
defining an html template by Freemarker, and operating the html template through PhantomJS to generate an html file;
screenshot is conducted on the page of the html file to obtain a screenshot file;
and inserting the screenshot file into the template file to obtain an image file for export.
In some embodiments, the template file is a word template, and the step of exporting based on the word template includes:
defining a framework of a word template in advance by using a poi-tl technology;
carrying out value taking on the original data according to a poi-tl expression;
and rendering the original data to the word template by using a built-in API of the poi-tl to obtain a report file for export.
In some embodiments, the step of parsing and executing the expression for collecting data in the configuration file comprises:
and analyzing and executing the expression in the configuration file by using a Spring expression language.
In some embodiments, the expression in the configuration file for collecting data can be expanded in a customized manner.
In a second aspect, an embodiment of the present application provides a data export system, including:
the receiving module is used for receiving a report generation request, verifying the request through an interface, generating a report task and asynchronously calling the report task;
the loading module is used for loading a configuration file and a template file according to the generated report task, analyzing and executing an expression used for acquiring data in the configuration file, and obtaining original data;
and the export module is used for calling a target technology related to the template file according to the template file, rendering the original data to the template file through the target technology, and generating a report file for export.
In some embodiments, the expression in the configuration file for collecting data can be expanded in a customized manner.
In some embodiments, the template file is a word template, and the export module specifically includes:
the system comprises a defining unit, a setting unit and a processing unit, wherein the defining unit is used for defining a framework of a word template in advance by using a poi-tl technology;
the value taking unit is used for taking values of the original data according to the poi-tl expression;
and the rendering unit is used for rendering the original data to the word template by using a built-in API of the poi-tl to obtain a report file for exporting.
In a third aspect, an embodiment of the present application provides a computer device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor, when executing the computer program, implements the data export method according to the first aspect.
In a fourth aspect, the present application provides a readable storage medium, on which a computer program is stored, which when executed by a processor implements the data export method as described in the first aspect above.
Compared with the related art, the data export method provided by the embodiment of the application generates the report request and generates the report task through interface verification, loads the configuration file and the template file according to the report task, analyzes and executes the expression which can be automatically expanded in the configuration file and is used for collecting the data to obtain the original data, renders the original data on the template file through the target technology, binds the template file and the data to generate the final report file to be exported, solves the problems that the export effect is single, the data collection mode is single and the complex effect display cannot be realized in the related technology, realizes the collection of the data by using multiple modes, can customize the mode for collecting the data, simultaneously supports multiple export files, has simpler data export operation, and developers do not need to pay attention to the file generation process in the export process, the field export can be completed only by configuration, and the export of complex effects is also supported by configuring different template files.
The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below to provide a more thorough understanding of the application.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
FIG. 1 is a flow chart of a data export method according to a first embodiment of the present application;
FIG. 2 is a block diagram of a data export system according to a second embodiment of the present application;
fig. 3 is a hardware configuration diagram of a computer device according to a third embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be described and illustrated below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments provided in the present application without any inventive step are within the scope of protection of the present application.
It is obvious that the drawings in the following description are only examples or embodiments of the present application, and that it is also possible for a person skilled in the art to apply the present application to other similar contexts on the basis of these drawings without inventive effort. Moreover, it should be appreciated that in the development of any such actual implementation, as in any engineering or design project, numerous implementation-specific decisions must be made to achieve the developers' specific goals, such as compliance with system-related and business-related constraints, which may vary from one implementation to another.
Reference in the specification to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the specification. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of ordinary skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments without conflict.
Unless defined otherwise, technical or scientific terms referred to herein shall have the ordinary meaning as understood by those of ordinary skill in the art to which this application belongs. Reference to "a," "an," "the," and similar words throughout this application are not to be construed as limiting in number, and may refer to the singular or the plural. The present application is directed to the use of the terms "including," "comprising," "having," and any variations thereof, which are intended to cover non-exclusive inclusions; for example, a process, method, system, article, or apparatus that comprises a list of steps or modules (elements) is not limited to the listed steps or elements, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus. Reference to "connected," "coupled," and the like in this application is not intended to be limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The term "plurality" as referred to herein means two or more. "and/or" describes an association relationship of associated objects, meaning that three relationships may exist, for example, "A and/or B" may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. Reference herein to the terms "first," "second," "third," and the like, are merely to distinguish similar objects and do not denote a particular ordering for the objects.
A Spring Expression Language (Spring Expression Language, abbreviated as Spring) is a powerful Expression Language that supports query and operation runtime object navigation graph functions. Its syntax is similar to that of a conventional EL but provides additional functionality, most notably function calls and simple string template functions. The expression language supports text expressions, Boolean and relational operators, regular expressions, class expressions, access properties, arrays, lists, maps, method calls, call constructors, user-defined functions, relational operators, set projections, set filters, template expressions, and the like.
A POI-tl (POI template language) is a Word template engine based on the Apache POI, and doing Anything Anywhere in the document (Do analyzing author) is a feature of POI-tl.
Freemarker mapping Language (FTL) is a Template engine: a generic tool for generating output text (HTML web pages, e-mails, configuration files, source code, etc.) based on templates and data to be changed, which is not end-user oriented, but a Java class library, a component that programmers can embed into the products they develop.
PhantomJS is a JavaScript API based on webkit, which uses QtWebkit as the function of a core browser, uses webkit to compile, interpret and execute JavaScript codes, and does anything on the webkit browser, which can be realized, and can be understood as not only a hidden browser, but also provides operations such as a CSS selector, supporting Web standards, DOM operation, JSON, HTML5, Canvas, SVG and the like, and also provides operations for processing file I/O, so that a user can read and write files to an operating system and the like. PhantomJS can be used very widely, such as Web monitoring, Web page screenshot, browser-free Web testing, page access automation, and the like.
The first embodiment of the application provides a data export method. Fig. 1 is a flowchart of a data export method according to an embodiment of the present application, and as shown in fig. 1, the flowchart includes the following steps:
step S101, receiving a report generation request, verifying the request through an interface, generating a report task, and asynchronously calling the report task;
the asynchronous call is a method which can continue the operation without waiting for the return value of the called function, some processes in the computer are time-consuming, when calling the processing code, if the calling party stands there and waits for the processing code, the program performance can be seriously influenced, the problems can be easily solved by the asynchronous call, namely, the whole initialization process is put into a single thread, the main thread starts the thread and then goes down, the main window is displayed instantly, and the initialization process can be understood to be automatically completed at the back.
Step S102, loading a configuration file and a template file according to the generated report task, analyzing and executing an expression used for collecting data in the configuration file, and obtaining original data;
the configuration file is a json file defining a data collection mode, a user-defined data collection mode can be realized only by defining a json format through a data collection interface, it can be understood that a json loading tool loads the configuration file and the template file into a memory of a computer, different data collection modes are distinguished through types by utilizing the json file, a corresponding SpEL expression in the configuration file is analyzed, and a corresponding java code is called for data collection, wherein the specific codes are as follows:
Figure BDA0003377652320000051
Figure BDA0003377652320000061
it should be noted that the field name is used for value taking, the field type is used for defining a data collection mode, and the fields methodName, url, and template are defined in a frame corresponding to the type for analyzing a corresponding SpEL expression, and can be extended by a user, and it can be understood that all the fields explained above are necessarily present. And other fields in the code are self-defined fields according to service scenes, and can be valued in a mode of name { $ field }.
Step S103, calling a target technology related to the template file according to the template file, rendering the original data to the template file through the target technology, and generating a report file to export.
The different template files call different target technologies, and the target technologies comprise Poi-tl, Freemarker, PhantomJS and the like.
Through the steps, the interface verifies the received report generation request, generates the report task, loads the configuration file and the template file according to the report task, analyzes and executes an expression which can be automatically expanded in the configuration file and is used for collecting data, so as to collect the original data, renders the original data on the template file through the target technology, binds the template file and the original data, generates the final report file to export, solves the problems that the export effect is single, the data collection mode is single, the complex effect display cannot be realized in the related technology, realizes the collection of data by using a plurality of modes, can customize the mode for data collection, simultaneously supports a plurality of export files, and has simpler data export operation, in the export process, developers do not need to pay attention to the file generation process, only configuration is needed to complete the field export, and the export of complex effects is supported by configuring different template files.
In some embodiments, the step of parsing and executing the expression for collecting data in the configuration file comprises:
and analyzing and executing the expression in the configuration file by using a Spring expression language.
In this embodiment, a Spring expression language (abbreviated as Spring) is a key of the configuration file, the configuration file is used to define a data acquisition mode, a data acquisition path is defined by a custom json file (that is, the configuration file), and the Spring is used to analyze and execute an expression used for acquiring data in the json file to obtain the original data.
It should be noted that data collection is divided into ordinary data collection and generation of pictures, and the ordinary data collection includes collection of http interfaces, methods (call methods), statics (static data), mysql (database query), es (elastic search query), and other data. The specific mode of generating the picture is to customize an html template file, generate the html file by using PhantomJS after data collection is finished, perform webpage screenshot and finally output the picture. The data collection mode supports self-definition according to actual conditions, and the self-defined data collection mode can be realized only by realizing the json format defined by the data collection interface so as to support rapid expansion.
In some embodiments, the expression in the configuration file for collecting data can be expanded in a customized manner.
In some of these embodiments, the raw data comprises picture data, and the deriving the picture data comprises:
defining an html template by Freemarker, and operating the html template through PhantomJS to generate an html file;
in the embodiment, the Freemarker is a technical scheme for defining the html template, and because the Freemarker data binding is simple and convenient, and meanwhile, rich functions are built in and can be used by developers, almost all html effects can be realized by using the Freemarker, and only data are required to be transmitted in actual operation.
Screenshot is conducted on the page of the html file to obtain a screenshot file;
and inserting the screenshot file into the template file to obtain an image file for export.
PhantomJS is a technical solution for generating various complex data display charts and effects. The html template is defined by Freemarker, and the defined html template can be run by the function of the PhantomJS built-in QtWebKit core browser to generate the html file. And then, the generated page can be subjected to screenshot by using a webpage screenshot scheme supported by PhantomJS, and the screenshot is inserted into the template file to be inserted, so that the export of various data display effects is realized.
In some embodiments, the template file is a word template, and the step of exporting based on the word template includes:
defining a framework of a word template in advance by using a poi-tl technology;
carrying out value taking on the original data according to a poi-tl expression;
and rendering the original data to the word template by using a built-in API of the poi-tl to obtain a report file for export.
In this embodiment, the poi-tl is a solution of the word template file, and supports tags such as text, picture, list, chart, If Condition judgment, and the like. The method includes the steps that any effect of a word page can be achieved by using a tag provided by a poi-tl, various complex effects generated by a word can be achieved only by defining the tag and transmitting binding data, it can be understood that value is taken for original data collected in a data collection stage according to a poi-tl expression, and meanwhile APIs (application programming interfaces) such as poi-tl internal judgment, circulation, picture insertion, automatic production chapter information and the like are used for rendering a word template, so that the original data and the word template are bound, and a report file is generated to be exported.
It should be noted that the steps illustrated in the above-described flow diagrams or in the flow diagrams of the figures may be performed in a computer system, such as a set of computer-executable instructions, and that, although a logical order is illustrated in the flow diagrams, in some cases, the steps illustrated or described may be performed in an order different than here.
The second embodiment of the present application further provides a data export system, which is used to implement the foregoing embodiments and preferred embodiments, and the description of the system that has been already made is omitted. As used hereinafter, the terms "module," "unit," "subunit," and the like may implement a combination of software and/or hardware for a predetermined function. While the system described in the embodiments below is preferably implemented in software, implementations in hardware, or a combination of software and hardware are also possible and contemplated.
Fig. 2 is a block diagram of a data export system according to a second embodiment of the present application, and as shown in fig. 2, the system includes:
the receiving module 10 is configured to receive a report generation request, verify the request through an interface, generate a report task, and asynchronously invoke the report task;
the loading module 20 is configured to load a configuration file and a template file according to the generated report task, and analyze and execute an expression for acquiring data in the configuration file to obtain original data;
and the expression used for collecting data in the configuration file can be expanded in a user-defined mode.
And the export module 30 is configured to invoke a target technology related to the template file according to the template file, render the original data to the template file through the target technology, and generate a report file for export.
In this embodiment, the interface verifies the received report generation request, generates the report task, loads the configuration file and the template file according to the report task, parses and executes an expression which can be expanded by itself and is used for collecting data, so as to collect the original data, renders the original data onto the template file by the target technology, binds the template file and the original data, generates the final report file for export, solves the problems that the export effect is single, the data collection mode is single, and the complex effect display cannot be realized in the related technology, realizes the collection of data by using multiple modes, can customize the mode for data collection, simultaneously supports multiple export files, and has simple data export operation, in the export process, developers do not need to pay attention to the file generation process, only configuration is needed to complete the field export, and the export of complex effects is supported by configuring different template files.
In some embodiments, the template file is a word template, and the export module 30 specifically includes:
the system comprises a defining unit, a setting unit and a processing unit, wherein the defining unit is used for defining a framework of a word template in advance by using a poi-tl technology;
the value taking unit is used for taking values of the original data according to the poi-tl expression;
and the rendering unit is used for rendering the original data to the word template by using a built-in API of the poi-tl to obtain a report file for exporting.
And performing value taking on the original data collected in the data collection stage according to a poi-tl expression, and simultaneously rendering the word template by using APIs such as poi-tl internal judgment, circulation, picture insertion, automatic chapter production information and the like, so that the original data and the word template are bound, and the report file is generated to be exported.
In some of these embodiments, the raw data comprises picture data, the derivation module 30 comprises a first derivation unit comprising:
the generation subunit is used for defining an html template by Freemarker and operating the html template through PhantomJS to generate an html file;
the screenshot subunit is used for screenshot on the page of the html file to obtain a screenshot file;
and the first exporting subunit is used for inserting the screenshot file into the template file to obtain a picture file for exporting.
PhantomJS is a technical solution for generating various complex data display charts and effects. The html template is defined by Freemarker, and the defined html template can be run by the function of the PhantomJS built-in QtWebKit core browser to generate the html file. And then, the generated page can be subjected to screenshot by using a webpage screenshot scheme supported by PhantomJS, and the screenshot is inserted into the template file to be inserted, so that the export of various data display effects is realized.
In some embodiments, the load module is further configured to:
and analyzing and executing the expression in the configuration file by using a Spring expression language.
The method comprises the steps that a Spring expression language (SpEL for short) is the key of a configuration file, the configuration file is used for defining a data acquisition mode, a data acquisition way is defined through a self-defined json file (namely the configuration file), and the SpEL is used for analyzing and executing an expression used for acquiring data in the json file to obtain the original data.
It should be noted that data collection is divided into ordinary data collection and generation of pictures, and the ordinary data collection includes collection of http interfaces, methods (call methods), statics (static data), mysql (database query), es (elastic search query), and other data. The specific mode of generating the picture is to customize an html template file, generate the html file by using PhantomJS after data collection is finished, perform webpage screenshot and finally output the picture. The data collection mode supports self-definition according to actual conditions, and the self-defined data collection mode can be realized only by realizing the json format defined by the data collection interface so as to support rapid expansion.
The above modules may be functional modules or program modules, and may be implemented by software or hardware. For a module implemented by hardware, the modules may be located in the same processor; or the modules can be respectively positioned in different processors in any combination.
In addition, the data derivation method described in the embodiment of the present application with reference to fig. 1 may be implemented by a computer device. Fig. 3 is a hardware structure diagram of a computer device according to an embodiment of the present application.
The computer device may include a processor 32 and a memory 33 storing computer program instructions.
Specifically, the processor 32 may include a Central Processing Unit (CPU), or A Specific Integrated Circuit (ASIC), or may be configured to implement one or more Integrated circuits of the embodiments of the present Application.
Memory 33 may include, among other things, mass storage for data or instructions. By way of example, and not limitation, memory 33 may include a Hard Disk Drive (Hard Disk Drive, abbreviated to HDD), a floppy Disk Drive, a Solid State Drive (SSD), flash memory, an optical Disk, a magneto-optical Disk, magnetic tape, or a Universal Serial Bus (USB) Drive or a combination of two or more of these. Memory 33 may include removable or non-removable (or fixed) media, where appropriate. The memory 33 may be internal or external to the data processing apparatus, where appropriate. In a particular embodiment, the memory 33 is a Non-Volatile (Non-Volatile) memory. In particular embodiments, Memory 33 includes Read-Only Memory (ROM) and Random Access Memory (RAM). The ROM may be mask-programmed ROM, Programmable ROM (PROM), Erasable PROM (EPROM), Electrically Erasable PROM (EEPROM), Electrically rewritable ROM (EAROM), or FLASH Memory (FLASH), or a combination of two or more of these, where appropriate. The RAM may be a Static Random-Access Memory (SRAM) or a Dynamic Random-Access Memory (DRAM), where the DRAM may be a Fast Page Mode Dynamic Random-Access Memory (FPMDRAM), an Extended data output Dynamic Random-Access Memory (EDODRAM), a Synchronous Dynamic Random-Access Memory (SDRAM), and the like.
Memory 33 may be used to store or cache various data files for processing and/or communication use, as well as possibly computer program instructions for execution by processor 32.
The processor 32 implements any of the data derivation methods in the above embodiments by reading and executing computer program instructions stored in the memory 33.
In some of these embodiments, the computer device may also include a communication interface 34 and a bus 31. As shown in fig. 3, the processor 32, the memory 33, and the communication interface 34 are connected via a bus 31 to complete communication therebetween.
The communication interface 34 is used for realizing communication among modules, devices, units and/or equipment in the embodiment of the present application. The communication interface 34 may also enable communication with other components such as: the data communication is carried out among external equipment, image/data acquisition equipment, a database, external storage, an image/data processing workstation and the like.
The bus 31 comprises hardware, software, or both coupling the components of the computer device to each other. Bus 31 includes, but is not limited to, at least one of the following: data Bus (Data Bus), Address Bus (Address Bus), Control Bus (Control Bus), Expansion Bus (Expansion Bus), and Local Bus (Local Bus). By way of example, and not limitation, Bus 31 may include an Accelerated Graphics Port (AGP) or other Graphics Bus, an Enhanced Industry Standard Architecture (EISA) Bus, a Front-Side Bus (Front Side Bus), an FSB (FSB), a Hyper Transport (HT) Interconnect, an ISA (ISA) Bus, an InfiniBand (InfiniBand) Interconnect, a Low Pin Count (LPC) Bus, a memory Bus, a microchannel Architecture (MCA) Bus, a PCI (Peripheral Component Interconnect) Bus, a PCI-Express (PCI-X) Bus, a Serial Advanced Technology Attachment (SATA) Bus, a Video Electronics Bus (audio Association) Bus, abbreviated VLB) bus or other suitable bus or a combination of two or more of these. Bus 31 may include one or more buses, where appropriate. Although the description of the embodiments of the present application shows specific buses, the present application contemplates any suitable buses or interconnects.
The computer device may execute the data export method in the embodiment of the present application based on the acquired computer program, thereby implementing the data export method described in conjunction with fig. 1.
In addition, in combination with the data export method in the foregoing embodiments, the embodiments of the present application may provide a readable storage medium to implement. The readable storage medium having stored thereon computer program instructions; the computer program instructions, when executed by a processor, implement any of the data derivation methods in the embodiments described above.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method of data derivation, comprising:
receiving a report generation request, verifying the request through an interface, generating a report task, and asynchronously calling the report task;
loading a configuration file and a template file according to the generated report task, analyzing and executing an expression used for collecting data in the configuration file to obtain original data;
and calling a target technology related to the template file according to the template file, rendering the original data to the template file through the target technology, and generating a report file for export.
2. The data derivation method of claim 1, wherein the raw data comprises picture data, and the deriving the picture data comprises:
defining an html template by Freemarker, and operating the html template through PhantomJS to generate an html file;
screenshot is conducted on the page of the html file to obtain a screenshot file;
and inserting the screenshot file into the template file to obtain an image file for export.
3. The data export method of claim 1, wherein the template file is a word template, and the step of exporting based on the word template comprises:
defining a framework of a word template in advance by using a poi-tl technology;
carrying out value taking on the original data according to a poi-tl expression;
and rendering the original data to the word template by using a built-in API of the poi-tl to obtain a report file for export.
4. The data derivation method of claim 1, wherein the step of parsing and executing the expression in the configuration file for collecting data comprises:
and analyzing and executing the expression in the configuration file by using a Spring expression language.
5. The data derivation method of claim 1, wherein the expression in the configuration file used to collect data is custom extensible.
6. A data export system, comprising:
the receiving module is used for receiving a report generation request, verifying the request through an interface, generating a report task and asynchronously calling the report task;
the loading module is used for loading a configuration file and a template file according to the generated report task, analyzing and executing an expression used for acquiring data in the configuration file, and obtaining original data;
and the export module is used for calling a target technology related to the template file according to the template file, rendering the original data to the template file through the target technology, and generating a report file for export.
7. The data export system of claim 6, wherein the expression in the configuration file for collecting data is custom extensible.
8. The data export system of claim 6, wherein the template file is a word template, and the export module specifically comprises:
the system comprises a defining unit, a setting unit and a processing unit, wherein the defining unit is used for defining a framework of a word template in advance by using a poi-tl technology;
the value taking unit is used for taking values of the original data according to the poi-tl expression;
and the rendering unit is used for rendering the original data to the word template by using a built-in API of the poi-tl to obtain a report file for exporting.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the data derivation method according to any of claims 1 to 5 when executing the computer program.
10. A readable storage medium on which a computer program is stored, which program, when being executed by a processor, is adapted to carry out the data deriving method according to any one of claims 1 to 5.
CN202111424277.3A 2021-11-26 2021-11-26 Data export method, system, computer device and readable storage medium Pending CN114154474A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111424277.3A CN114154474A (en) 2021-11-26 2021-11-26 Data export method, system, computer device and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111424277.3A CN114154474A (en) 2021-11-26 2021-11-26 Data export method, system, computer device and readable storage medium

Publications (1)

Publication Number Publication Date
CN114154474A true CN114154474A (en) 2022-03-08

Family

ID=80458069

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111424277.3A Pending CN114154474A (en) 2021-11-26 2021-11-26 Data export method, system, computer device and readable storage medium

Country Status (1)

Country Link
CN (1) CN114154474A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114372445A (en) * 2022-03-21 2022-04-19 奇安信科技集团股份有限公司 Document generation method and device, electronic equipment and medium
CN114970486A (en) * 2022-07-13 2022-08-30 港胜技术服务(深圳)有限公司 Method, apparatus and medium for generating PDF reports for software test results

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114372445A (en) * 2022-03-21 2022-04-19 奇安信科技集团股份有限公司 Document generation method and device, electronic equipment and medium
CN114372445B (en) * 2022-03-21 2022-08-12 奇安信科技集团股份有限公司 Document generation method and device, electronic equipment and medium
CN114970486A (en) * 2022-07-13 2022-08-30 港胜技术服务(深圳)有限公司 Method, apparatus and medium for generating PDF reports for software test results

Similar Documents

Publication Publication Date Title
CN114154474A (en) Data export method, system, computer device and readable storage medium
US9588941B2 (en) Context-based visualization generation
CN107729246B (en) Auxiliary test method, device and equipment for target application and storage medium
CN112083920A (en) Front-end page design method, device, storage medium and equipment
US20150143348A1 (en) Hybrid dynamic code compiling device, method, and service system thereof
CN110321504B (en) Page processing method and device
US20220350857A1 (en) Methods and systems for browser extension used to generate relative xpath, absolute xpath and/or css selectors
CN113126986A (en) Dynamic data-based form item rendering method, system, equipment and storage medium
CN109783752A (en) Page loading method and device, electronic equipment and computer readable storage medium
CN111309317A (en) Code automation method and device for realizing data visualization
CN113382083A (en) Webpage screenshot method and device
US20120072823A1 (en) Natural language assertion
CN112434012A (en) Front-end multistage condition screening method, system, equipment and storage medium based on React
CN105824647A (en) Form page generating method and device
CN109828759A (en) Code compiling method, device, computer installation and storage medium
CN103914479A (en) Resource request matching method and device
CN112486459A (en) Activity page generation method and device, computer equipment and readable storage medium
CN113641594B (en) Cross-terminal automatic testing method and related device
CN113204706B (en) Data screening and extracting method and system based on MapReduce
CN113741878A (en) GraphQL-based interface construction method and system, electronic equipment and storage medium
CN111666201A (en) Regression testing method, device, medium and electronic equipment
CN113094286B (en) Page test method and device, storage medium and electronic equipment
CN114662094A (en) Method and apparatus for identifying hardware performance counter events
CN112800078A (en) Lightweight text labeling method, system, equipment and storage medium based on javascript
CN112433778A (en) Mobile equipment page display method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination