CN111488731B - File generation method, device, computer equipment and storage medium - Google Patents

File generation method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN111488731B
CN111488731B CN202010294733.6A CN202010294733A CN111488731B CN 111488731 B CN111488731 B CN 111488731B CN 202010294733 A CN202010294733 A CN 202010294733A CN 111488731 B CN111488731 B CN 111488731B
Authority
CN
China
Prior art keywords
file
target
name
script
preset
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.)
Active
Application number
CN202010294733.6A
Other languages
Chinese (zh)
Other versions
CN111488731A (en
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.)
Shenzhen Qianhai Huanrong Lianyi Information Technology Service Co Ltd
Original Assignee
Shenzhen Qianhai Huanrong Lianyi Information Technology Service 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 Shenzhen Qianhai Huanrong Lianyi Information Technology Service Co Ltd filed Critical Shenzhen Qianhai Huanrong Lianyi Information Technology Service Co Ltd
Priority to CN202010294733.6A priority Critical patent/CN111488731B/en
Publication of CN111488731A publication Critical patent/CN111488731A/en
Application granted granted Critical
Publication of CN111488731B publication Critical patent/CN111488731B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/151Transformation

Abstract

The embodiment of the application discloses a file generation method, a device, computer equipment and a storage medium, wherein the method comprises the following steps: generating a preset template file according to the file module selected by the user and the style of the file module; extracting target file data corresponding to the target file name from a preset database by using a Python script based on the target file name, and filling the extracted target file data into the preset template file; calling a script file conversion tool to convert the filled preset template file to obtain a target script file; and calling Jenkins, creating a target task taking the name of the target file as a parameter, and executing the target script file according to the target task to generate a target report file. According to the method and the device for generating the target report file, the file generation flow is optimized, the target report file is automatically generated by setting the template file, a large amount of manpower can be saved, and the file generation efficiency can be improved.

Description

File generation method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and apparatus for generating a file, a computer device, and a storage medium.
Background
In the prior art, test files or report files are generally generated manually or obtained through a complicated generation process by a traditional file generation tool (for example, sonarqube), the obtained files have no complete and unified file format, when the number of generated files reaches one order of magnitude, the purpose of high-efficiency processing cannot be achieved by the manual or traditional generation method, a great deal of manpower and material resources are generally spent, with the continuous innovation of technology, the continuous increase of the number of files, and the traditional method of manually generating the files cannot meet the current business demands and developments.
Disclosure of Invention
In view of the above, embodiments of the present application provide a method, an apparatus, a computer device, and a storage medium for automatically generating a target report file by setting a template file, which can save a lot of manpower and improve file generation efficiency.
In one aspect, an embodiment of the present application provides a file generating method, where the method includes:
generating a preset template file according to the file module selected by the user and the style of the file module;
extracting target file data corresponding to the target file name from a preset database by using a Python script based on the target file name, and filling the extracted target file data into the preset template file;
calling a script file conversion tool to convert the filled preset template file to obtain a target script file;
and calling Jenkins, creating a target task taking the name of the target file as a parameter, and executing the target script file according to the target task to generate a target report file.
In another aspect, an embodiment of the present application provides a file generating apparatus, including:
the first generation unit is used for generating a preset template file according to the file module selected by the user and the style of the file module;
the extraction filling unit is used for extracting target file data corresponding to the target file name from a preset database by using a Python script based on the target file name, and filling the extracted target file data into the preset template file;
the call conversion unit is used for calling a script file conversion tool to convert the filled preset template file to obtain a target script file;
and the call generation unit is used for calling Jenkins, creating a target task taking the name of the target file as a parameter, and executing the target script file according to the target task to generate a target report file.
In yet another aspect, an embodiment of the present application further provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements the file generation method as described above when executing the computer program.
In yet another aspect, embodiments of the present application also provide a computer-readable storage medium storing one or more computer programs executable by one or more processors to implement the file generation method as described above.
The embodiment of the application provides a file generation method, a file generation device, computer equipment and a storage medium, wherein the method comprises the following steps: generating a preset template file according to the file module selected by the user and the style of the file module; extracting target file data corresponding to the target file name from a preset database by using a Python script based on the target file name, and filling the extracted target file data into the preset template file; calling a script file conversion tool to convert the filled preset template file to obtain a target script file; and calling Jenkins, creating a target task taking the name of the target file as a parameter, and executing the target script file according to the target task to generate a target report file. The application optimizes the file generation flow, automatically generates the target report file by setting the template file, saves a great deal of manpower and improves the file generation efficiency
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for the description of the embodiments will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is an application scenario schematic diagram of a file generating method according to an embodiment of the present application;
FIG. 2 is a schematic flow chart of a file generation method according to an embodiment of the present application;
FIG. 3 is another schematic flow chart of a file generation method provided by an embodiment of the present application;
FIG. 4 is another schematic flow chart of a file generation method provided by an embodiment of the present application;
FIG. 5 is another schematic flow chart diagram of a file generation method provided by an embodiment of the present application;
FIG. 6 is another schematic flow chart diagram of a file generation method provided by an embodiment of the present application;
FIG. 7 is a schematic block diagram of a file generating apparatus according to an embodiment of the present application;
FIG. 8 is a schematic block diagram showing a first generating unit of a document generating apparatus according to an embodiment of the present application;
FIG. 9 is a schematic block diagram of an extraction filling unit of a file generating apparatus according to an embodiment of the present application;
FIG. 10 is a schematic block diagram of a call conversion unit of a file generation device according to an embodiment of the present application;
FIG. 11 is a schematic block diagram of a call generation unit of a file generation device provided by an embodiment of the present application;
fig. 12 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the application. Based on the embodiments of the present application, one of ordinary skill in the art did not make any inventive effort
All other embodiments obtained under dynamic conditions fall within the scope of protection of the present application.
It should be understood that the terms "comprises" and "comprising," when used in this specification and the appended claims
The inclusion of "a feature, integer, step, operation, element, and/or component described does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the application herein is for the purpose of describing particular implementations only
The examples are not intended to limit the application. As used in the present specification and appended claims
As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
Referring to fig. 1 and fig. 2, fig. 1 is a schematic application scenario diagram of a file generating method according to an embodiment of the present application, and fig. 2 is a schematic flow diagram of a file generating method according to an embodiment of the present application. The file generation method is applied to the client or the server. As an application, as shown in fig. 1, the file generating method is applied to a server 10, where the server 10 is responsible for generating a preset template file according to a user's selection, obtaining a target script file according to the template file, and finally executing the target script file to generate a target report file, and then sending the target report file to a client 20, where the client is a terminal device used by the user, such as a desktop computer, a notebook computer, or a smart phone.
Referring to fig. 2, fig. 2 is a schematic flowchart of a file generating method according to an embodiment of the present application. As shown in FIG. 2, the method includes the following steps S101-S104.
S101, generating a preset template file according to the file module selected by the user and the style of the file module.
In the embodiment of the application, the file module is a component part of the preset template file, and comprises a head part, a bottom part, a main body, a banner and the like of the file; the patterns of the file module can comprise the position, the height and the width of the file module, and various patterns such as the text content, the text fonts and the text colors of the file module. Specifically, the user can obtain the file module and the style of each file module through the file module selected at the front end interface of the server and the style of each file module output at the front end interface, and send the selected file module and the style of each file module to the rear end of the server for processing to generate the preset template file.
In one embodiment, as shown in fig. 3, the step S101 includes steps S201 to S202:
s201, acquiring a file module selected by a user on a preset front end interface and a style corresponding to the file module.
In the embodiment of the application, a user can select a required file module on a preset front-end interface provided by the server, designate a style corresponding to the file module for the selected file module, and send the style to the rear end of the server for processing through the preset front-end interface provided by the server.
S202, extracting the file module selected by the user and the data information of the corresponding style, and generating a preset template file according to the extracted data information.
In the embodiment of the application, after the rear end of the server receives the file module and the style of the file module sent by the front end interface, the data information of the file module and the style is extracted, and a preset template file is generated according to the extracted data information of the file module, so that the generated preset template file comprises the file module and the style corresponding to the file module.
S102, extracting target file data corresponding to the target file name from a preset database by using a Python script based on the target file name, and filling the extracted target file data into the preset template file.
In the embodiment of the present application, the target file data corresponding to the target file name may be read from a preset database, for example, hbase (HadoopDatabase), and the target file data corresponding to the target file name may be extracted from the preset database. The target file data refers to each piece of file data generated by a user of a preset APP in the processes of downloading, editing and the like. For example, each piece of word data generated by the word user during editing, downloading, etc. may be recorded in the Hbase database. Specifically, in order to reduce the pressure of the server, the target file data may be read from a preset database when a preset condition is reached, for example, when a Query Per Second (QPS) is lower than a preset threshold, the target file data may be read from a preset database such as an Hbase database. The preset threshold is a threshold preset in the system, for example, may be 20%, 30%, etc., and the specific threshold value is not limited herein. Filling the target file data into a preset template file after extracting the target file data from a preset database, specifically, filling the target file data into the preset template file by using an inserted sentence of a Python script, wherein the used inserted sentence can be in the following format: INSERT INTO preset the module file name value (inserted destination file data name 1, inserted destination file data name 2,.. Insert destination file data name n).
In one embodiment, as shown in fig. 4, the step S102 includes steps S301 to S303:
s301, detecting whether the target file name contains a file suffix name.
In the embodiment of the application, the file suffix name refers to a suffix name in a file name attribute, and the type of the file suffix name comprises a document file, a compressed file, a graphic file, a sound file, an animation file, a system file, an executable file, a system file and the like. In this embodiment, the detection may be real-time, periodic, or triggered, for example, each time the target file name is received. And extracting the file name according to the suffix name.
S302, if the fact that the target file name contains the file suffix name is detected, whether the target file suffix name matched with the file suffix name exists in the preset database is judged.
In the embodiment of the application, if the file suffix name is detected to be included, judging whether a target file suffix name matched with the file suffix name exists in the preset database according to the file suffix name, specifically, if the target file suffix name matched with the file suffix name exists in the preset database, target file data corresponding to the target file name exists in the preset database, and a Python script is used for extracting the corresponding target file data; and if the target file suffix name matched with the file suffix name does not exist in the preset database, the target file data corresponding to the target file name does not exist in the preset database.
S303, if the target file suffix name matched with the file suffix name exists in the preset database, extracting corresponding target file data from the preset database according to the target file suffix name by using a Python script, and filling the extracted target file data into the preset template file.
In the embodiment of the application, the target file data is filled into the preset template file by using the inserted sentence of the Python script, and the used inserted sentence can be in the following format: INSERT INTO preset the module file name value (inserted destination file data name 1, inserted destination file data name 2,.. Insert destination file data name n).
S103, calling a script file conversion tool to convert the filled preset template file to obtain a target script file.
In the embodiment of the application, a script file conversion tool is called to convert the filled preset template file, and content analysis and content conversion are carried out on the filled preset template file, so that a target script file which can be used for other/appointed test platforms to execute is obtained. In practical application, since the test platforms are developed based on non-framework, script files generated by different framework platforms cannot be shared, so that a script file conversion tool is required to be called to convert a preset template file to obtain a target script file. It can be understood that in the process of calling the script file conversion tool to convert the preset template file to obtain the target script file, instead of calling the script file conversion tool to tamper with the execution content in the preset template file, another target script file is generated according to the file content of the preset template file, and the target script file can be executed on other test platforms.
In one embodiment, as shown in fig. 5, the step S103 includes steps S401 to S404:
s401, extracting template file primitives from the filled preset template file.
In the embodiment of the application, the template file primitive is a statement for controlling the testing process of the application in the process of executing the preset template file by the test file platform and is used for reflecting the control action of the application in the testing process.
In practical application, the template file primitives extracted from the preset template file may include a plurality of strips, and each template file primitive corresponds to at least one control instruction.
S402, generating an ordered control instruction queue according to the template file primitives.
In the embodiment of the application, an ordered control instruction queue is generated according to the template file primitives, corresponding codes and decoders can be searched in a preset code and decode list according to the template file primitives, the ordered control instruction queue is obtained by performing code conversion on the template file primitives, and the ordered control instruction queue is subjected to block encapsulation to obtain the target script statement.
S403, converting the control instruction queue to obtain a target script statement.
Before converting the template file primitives, configuring corresponding codecs for different template file primitives, and establishing a corresponding relation between the template file primitives and the corresponding codecs, namely, a corresponding relation between each test file platform and one template file primitive and the corresponding codec; when the preset template file runs in the current test file platform, encoding and decoding of the template file primitives in the preset template file are determined according to the corresponding relation between the template file primitives corresponding to the current test file platform and the encoding and decoding, so that an ordered control instruction queue obtained by encoding the template file primitives in the preset template file is more in line with the current test file platform, and the preset template file can be tested by using the current test file platform more accurately by running the ordered control instruction queue.
It can be understood that when the script file conversion tool is called to convert the preset template file, the corresponding template file primitive can be obtained by performing static analysis on the filled preset template file, wherein the static analysis on the preset template file refers to scanning operation on the content of the preset template file under the condition that the preset template file is not executed.
S404, configuring the target script statement into a preset script frame according to the time sequence consistent with the control instruction queue to obtain the target script file.
In the embodiment of the application, a script frame is pre-configured according to different test file platforms, and target script sentences are configured into the preset script frame according to the time sequence consistent with the control instruction queue, so that a target script file is obtained.
S104, calling Jenkins, creating a target task taking the name of the target file as a parameter, and executing the target script file according to the target task to generate a target report file.
In the embodiment of the application, a user can create a target task through a Jenkins interface, specifically, after opening a Jenkins web management interface through the Jenkins interface, selecting a Newltem icon, generating a construction task name from the Newltem icon, selecting the target file name as the construction task name, after constructing the task name, the user can select a task template, specifically, the selected template is not limited in the embodiment, the user completes the creation of the task after selecting the task template, and because the user selects the target file name as the construction task name, the user also constructs the target task taking the target file name as a parameter. After the target task is created, the user can load the target script file in the created target task, specifically, the user can load the path address of the target script file through the target task to load the target script file, and finally, the generating instruction is executed to generate the target report file.
In one embodiment, as shown in fig. 6, the step S104 includes steps S501 to S502:
s501, invoking Jenkins and creating a target task taking the target file name as a parameter.
In the embodiment of the application, after the Jenkins interface is passed and the Jenkins web management interface is opened, a Newltem icon is selected, and a building task name is generated by the Newltem icon, the target file name can be selected as the building task name, after the task name is built, the user can select a task template, and the specifically selected template is not limited in the embodiment, the task is created after the user selects the task template, and because the user selects the target file name as the building task name, the user also builds the target task taking the target file name as a parameter.
S502, inserting the target script file into the Jenkins platform, calling a preset configuration compiling tool in the Jenkins platform, and executing the target script file by using a target task to generate a target report file.
In the embodiment of the application, after the target task is created, the user can load the target script file in the created target task, specifically, the user can load the path address of the target script file through the target task to load the target script file, and finally, the user executes the generating instruction and invokes a preset configuration compiling tool in the Jenkins platform and executes the target script file through the target task to generate the target report file.
From the above, the embodiment of the application generates the preset template file according to the file module selected by the user and the style of the file module; extracting target file data corresponding to the target file name from a preset database by using a Python script based on the target file name, and filling the extracted target file data into the preset template file; calling a script file conversion tool to convert the filled preset template file to obtain a target script file; and calling Jenkins, creating a target task taking the name of the target file as a parameter, and executing the target script file according to the target task to generate a target report file. According to the method and the device for generating the target report file, the file generation flow is optimized, the target report file is automatically generated by setting the template file, a large amount of manpower can be saved, and the file generation efficiency can be improved.
Referring to fig. 7, in response to the above-mentioned method for generating a file, an embodiment of the present application further provides a device for generating a file, where the device 100 includes: a first generation unit 101, an extraction filling unit 102, a call conversion unit 103, and a call generation unit 104.
The first generating unit 101 is configured to generate a preset template file according to a file module selected by a user and a style of the file module; an extraction and filling unit 102, configured to extract, based on a target file name, target file data corresponding to the target file name from a preset database using a Python script, and fill the extracted target file data into the preset template file; a call conversion unit 103, configured to call a script file conversion tool to convert the filled preset template file to obtain a target script file; and the call generation unit 104 is used for calling Jenkins and creating a target task taking the name of the target file as a parameter, and executing the target script file according to the target task to generate a target report file.
In one embodiment, referring to fig. 8, the first generating unit 101 includes:
an obtaining unit 101a, configured to obtain a file module selected by a user on a preset front-end interface and a style corresponding to the file module; the first generation subunit 101b is configured to extract data information of a file module and a corresponding style selected by a user, and generate a preset template file according to the extracted data information.
In one embodiment, referring to fig. 9, the extraction filling unit 102 includes:
a detecting unit 102a, configured to detect whether the target file name includes a file suffix name; a judging unit 102b, configured to judge whether a target file suffix name matched with the file suffix name exists in the preset database if it is detected that the target file name includes the file suffix name; and the extraction and filling subunit 102c is configured to extract, if a preset database has a target file suffix name matching the file suffix name, corresponding target file data from the preset database according to the target file suffix name by using a Python script, and fill the extracted target file data into the preset template file.
In one embodiment, referring to fig. 10, the call conversion unit 103 includes:
an extracting unit 103a, configured to extract template file primitives from the filled preset template file; a second generating unit 103b, configured to generate an ordered control instruction queue according to the template file primitive; a conversion unit 103c, configured to convert the control instruction queue to obtain a target script statement; and a configuration unit 103d, configured to configure the target script statement into a preset script frame according to a time sequence consistent with the control instruction queue, so as to obtain the target script file.
In one embodiment, referring to fig. 11, the call generation unit 104 includes:
a call creation unit 104a, configured to call Jenkins and create a target task with the target file name as a parameter; and the call generation subunit 104b is configured to insert the target script file in the Jenkins platform, call a preset configuration compiling tool in the Jenkins platform, and execute the target script file by using a target task to generate a target report file.
From the above, the embodiment of the application generates the preset template file according to the file module selected by the user and the style of the file module; extracting target file data corresponding to the target file name from a preset database by using a Python script based on the target file name, and filling the extracted target file data into the preset template file; calling a script file conversion tool to convert the filled preset template file to obtain a target script file; and calling Jenkins, creating a target task taking the name of the target file as a parameter, and executing the target script file according to the target task to generate a target report file. According to the method and the device for generating the target report file, the file generation flow is optimized, the target report file is automatically generated by setting the template file, a large amount of manpower can be saved, and the file generation efficiency can be improved.
The specific principle and process of the file generating device and the file generating method are the same as those of the method described in the above embodiment, and are not repeated.
The file generating means described above may be implemented in the form of a computer program which is executable on a computer device as shown in fig. 12.
Fig. 12 is a schematic structural diagram of a computer device according to the present application. The device may be a terminal or a server, where the terminal may be an electronic device such as a notebook computer or a desktop computer. The server may be an independent server or a server cluster formed by a plurality of servers. With reference to FIG. 12, the computer device 500 includes a processor 502, a non-volatile storage medium 503, internal memory 504, and a network interface 505, connected by a system bus 501. The non-volatile storage medium 503 of the computer device 500 may store an operating system 5031 and a computer program 5032, wherein the computer program 5032, when executed, may cause the processor 502 to perform a file generation method. The processor 502 of the computer device 500 is used to provide computing and control capabilities, supporting the operation of the entire computer device 500. The internal memory 504 provides an environment for the execution of a computer program 5032 in the non-volatile storage medium 503, which when executed by the processor, causes the processor 502 to perform a file generation method. The network interface 505 of the computer device 500 is for network communication. It will be appreciated by persons skilled in the art that the block diagram of FIG. 12 is merely a partial structure associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements are applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
Wherein the processor 502, when executing the computer program, performs the following operations:
generating a preset template file according to the file module selected by the user and the style of the file module;
extracting target file data corresponding to the target file name from a preset database by using a Python script based on the target file name, and filling the extracted target file data into the preset template file;
calling a script file conversion tool to convert the filled preset template file to obtain a target script file;
and calling Jenkins, creating a target task taking the name of the target file as a parameter, and executing the target script file according to the target task to generate a target report file.
In one embodiment, generating a preset template file according to a file module selected by a user and a style of the file module includes:
acquiring a file module selected by a user on a preset front-end interface and a style corresponding to the file module;
and extracting the file module selected by the user and the data information of the corresponding style, and generating a preset template file according to the extracted data information.
In one embodiment, the extracting, based on the target file name, target file data corresponding to the target file name from a preset database by using a Python script, and filling the extracted target file data into the preset template file includes:
detecting whether the target file name contains a file suffix name or not;
if the target file name is detected to contain a file suffix name, judging whether the target file suffix name matched with the file suffix name exists in the preset database or not;
if the target file suffix name matched with the file suffix name exists in the preset database, extracting corresponding target file data from the preset database by using a Python script according to the target file suffix name, and filling the extracted target file data into the preset template file.
In one embodiment, the transferring the script file transferring tool to transfer the filled preset template file to obtain the target script file includes:
extracting template file primitives from the filled preset template file;
generating an ordered control instruction queue according to the template file primitives;
converting the control instruction queue to obtain a target script statement;
and configuring the target script statement into a preset script frame according to the time sequence consistent with the control instruction queue to obtain the target script file.
In one embodiment, the calling Jenkins and creating a target task with the target file name as a parameter, and executing the target script file according to the target task to generate a target report file includes:
invoking Jenkins and creating a target task taking the target file name as a parameter;
inserting the target script file into the Jenkins platform, calling a preset configuration compiling tool in the Jenkins platform, and executing the target script file by using a target task to generate a target report file.
Those skilled in the art will appreciate that the embodiment of the computer device shown in fig. 12 is not limiting of the specific construction of the computer device, and in other embodiments, the computer device may include more or less components than those shown, or certain components may be combined, or a different arrangement of components. For example, in some embodiments, the computer device includes only memory and a processor, and in such embodiments, the structure and function of the memory and the processor are consistent with the embodiment shown in fig. 12, and will not be described again.
The present application provides a computer readable storage medium storing one or more computer programs executable by one or more processors to implement the steps of:
generating a preset template file according to the file module selected by the user and the style of the file module;
extracting target file data corresponding to the target file name from a preset database by using a Python script based on the target file name, and filling the extracted target file data into the preset template file;
calling a script file conversion tool to convert the filled preset template file to obtain a target script file;
and calling Jenkins, creating a target task taking the name of the target file as a parameter, and executing the target script file according to the target task to generate a target report file.
In one embodiment, generating a preset template file according to a file module selected by a user and a style of the file module includes:
acquiring a file module selected by a user on a preset front-end interface and a style corresponding to the file module;
and extracting the file module selected by the user and the data information of the corresponding style, and generating a preset template file according to the extracted data information.
In one embodiment, the extracting, based on the target file name, target file data corresponding to the target file name from a preset database by using a Python script, and filling the extracted target file data into the preset template file includes:
detecting whether the target file name contains a file suffix name or not;
if the target file name is detected to contain a file suffix name, judging whether the target file suffix name matched with the file suffix name exists in the preset database or not;
if the target file suffix name matched with the file suffix name exists in the preset database, extracting corresponding target file data from the preset database by using a Python script according to the target file suffix name, and filling the extracted target file data into the preset template file.
In one embodiment, the transferring the script file transferring tool to transfer the filled preset template file to obtain the target script file includes:
extracting template file primitives from the filled preset template file;
generating an ordered control instruction queue according to the template file primitives;
converting the control instruction queue to obtain a target script statement;
and configuring the target script statement into a preset script frame according to the time sequence consistent with the control instruction queue to obtain the target script file.
In one embodiment, the calling Jenkins and creating a target task with the target file name as a parameter, and executing the target script file according to the target task to generate a target report file includes:
invoking Jenkins and creating a target task taking the target file name as a parameter;
inserting the target script file into the Jenkins platform, calling a preset configuration compiling tool in the Jenkins platform, and executing the target script file by using a target task to generate a target report file.
The aforementioned storage medium of the present application includes: various media capable of storing program codes, such as magnetic disk, optical disk, read-Only Memory (ROM), etc.
The units in all embodiments of the application may be implemented by a general-purpose integrated circuit, such as a CPU (Central processing unit)
Processing Unit, central Processing Unit), or by an ASIC (Application Specific Integrated Circuit ).
The steps in the file generation method of the embodiment of the application can be sequentially adjusted, combined and deleted according to actual needs.
The units in the file generation device can be combined, divided and deleted according to actual needs.
While the application has been described with reference to certain preferred embodiments, it will be understood by those skilled in the art that various changes and substitutions of equivalents may be made and equivalents will be apparent to those skilled in the art without departing from the scope of the application. Therefore, the protection scope of the application is subject to the protection scope of the claims.

Claims (8)

1. A method of generating a file, the method comprising:
generating a preset template file according to the file module selected by the user and the style of the file module;
extracting target file data corresponding to the target file name from a preset database by using a Python script based on the target file name, and filling the extracted target file data into the preset template file;
detecting whether the target file name contains a file suffix name or not;
if the target file name is detected to contain a file suffix name, judging whether the target file suffix name matched with the file suffix name exists in the preset database or not;
if the target file suffix name matched with the file suffix name exists in the preset database, extracting corresponding target file data from the preset database according to the target file suffix name by using a Python script, and filling the extracted target file data into the preset template file, wherein the target file data is filled into the preset template file by using an insertion statement of the Python script, and the format of the insertion statement is as follows: INSERT INTO presets the target file data name inserted by the template file name value;
calling a script file conversion tool to convert the filled preset template file to obtain a target script file;
and calling Jenkins, creating a target task taking the name of the target file as a parameter, and executing the target script file according to the target task to generate a target report file.
2. The method of claim 1, wherein the generating the preset template file according to the file module selected by the user and the style of the file module comprises:
acquiring a file module selected by a user on a preset front-end interface and a style corresponding to the file module;
and extracting the file module selected by the user and the data information of the corresponding style, and generating a preset template file according to the extracted data information.
3. The method of claim 1, wherein the calling the script file conversion tool to convert the populated preset template file to obtain the target script file comprises:
extracting template file primitives from the filled preset template file;
generating an ordered control instruction queue according to the template file primitives;
converting the control instruction queue to obtain a target script statement;
and configuring the target script statement into a preset script frame according to the time sequence consistent with the control instruction queue to obtain the target script file.
4. The method of claim 1, wherein the invoking Jenkins and creating a target task having the target file name as a parameter, and executing the target script file according to the target task to generate a target report file, comprises:
invoking Jenkins and creating a target task taking the target file name as a parameter;
inserting the target script file into a Jenkins platform, calling a preset configuration compiling tool in the Jenkins platform, and executing the target script file by using a target task to generate a target report file.
5. A document generating apparatus, the apparatus comprising:
the first generation unit is used for generating a preset template file according to the file module selected by the user and the style of the file module;
the extraction filling unit is used for extracting target file data corresponding to the target file name from a preset database by using a Python script based on the target file name, and filling the extracted target file data into the preset template file;
the detection unit is used for detecting whether the target file name contains a file suffix name or not;
the judging unit is used for judging whether the target file suffix name matched with the file suffix name exists in the preset database or not if the target file suffix name is detected to contain the file suffix name;
the extraction and filling subunit is configured to extract, if a preset database has a target file suffix name that matches the file suffix name, corresponding target file data from the preset database according to the target file suffix name by using a Python script, fill the extracted target file data into the preset template file, and fill the target file data into the preset template file by using an insert sentence of the Python script, where the insert sentence format is: INSERT INTO presets the target file data name inserted by the template file name value;
the call conversion unit is used for calling a script file conversion tool to convert the filled preset template file to obtain a target script file;
and the call generation unit is used for calling Jenkins, creating a target task taking the name of the target file as a parameter, and executing the target script file according to the target task to generate a target report file.
6. The apparatus of claim 5, wherein the first generation unit comprises:
the acquisition unit is used for acquiring the file module selected by the user on the preset front-end interface and the style corresponding to the file module;
the first generation subunit is used for extracting the file module selected by the user and the data information of the corresponding style, and generating a preset template file according to the extracted data information.
7. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the file generation method of any of claims 1-4 when the computer program is executed.
8. A computer readable storage medium storing one or more computer programs executable by one or more processors to implement the file generation method of any of claims 1-4.
CN202010294733.6A 2020-04-15 2020-04-15 File generation method, device, computer equipment and storage medium Active CN111488731B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010294733.6A CN111488731B (en) 2020-04-15 2020-04-15 File generation method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010294733.6A CN111488731B (en) 2020-04-15 2020-04-15 File generation method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111488731A CN111488731A (en) 2020-08-04
CN111488731B true CN111488731B (en) 2023-09-29

Family

ID=71810913

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010294733.6A Active CN111488731B (en) 2020-04-15 2020-04-15 File generation method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111488731B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112800741A (en) * 2021-01-29 2021-05-14 远光软件股份有限公司 Task execution method, electronic device and storage medium
CN113779953B (en) * 2021-11-10 2022-04-01 航天宏图信息技术股份有限公司 Automatic document generation method and system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108415826A (en) * 2018-01-12 2018-08-17 深圳壹账通智能科技有限公司 Test method, terminal device and the computer readable storage medium of application
CN110109877A (en) * 2018-01-10 2019-08-09 武汉斗鱼网络科技有限公司 A kind of automatic document classifying method, storage medium, equipment and system
CN110401581A (en) * 2019-07-22 2019-11-01 杭州电子科技大学 Industry control agreement fuzz testing case generation method based on flow retrospect
CN110633081A (en) * 2019-08-23 2019-12-31 北京浪潮数据技术有限公司 Page generation method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110109877A (en) * 2018-01-10 2019-08-09 武汉斗鱼网络科技有限公司 A kind of automatic document classifying method, storage medium, equipment and system
CN108415826A (en) * 2018-01-12 2018-08-17 深圳壹账通智能科技有限公司 Test method, terminal device and the computer readable storage medium of application
CN110401581A (en) * 2019-07-22 2019-11-01 杭州电子科技大学 Industry control agreement fuzz testing case generation method based on flow retrospect
CN110633081A (en) * 2019-08-23 2019-12-31 北京浪潮数据技术有限公司 Page generation method and device

Also Published As

Publication number Publication date
CN111488731A (en) 2020-08-04

Similar Documents

Publication Publication Date Title
CN107665233B (en) Database data processing method and device, computer equipment and storage medium
CN106022483B (en) The method and apparatus converted between machine learning model
CN100405370C (en) Dynamic switching between local and remote speech rendering
CN110457143B (en) Micro-service calling method and device
CN111639287A (en) Page processing method and device, terminal equipment and readable storage medium
CN109101228B (en) Application program execution method and device
CN111488731B (en) File generation method, device, computer equipment and storage medium
CN110399306B (en) Automatic testing method and device for software module
CN113971110A (en) Interface testing method, device, equipment and computer readable storage medium
CN110474836A (en) A kind of email template generation method, calculates equipment and medium at device
CN113419729A (en) Front-end page building method, device, equipment and storage medium based on modularization
CN110855555B (en) Mail sending method, device, equipment and computer readable storage medium
CN111523065B (en) Rich text data processing method and device, electronic equipment and computer storage medium
CN111475237A (en) Menu processing method and device, electronic equipment and storage medium
CN113887442A (en) OCR training data generation method, device, equipment and medium
CN112581568B (en) Dynamic poster generation method, device, server and storage medium
CN108427599A (en) Method, apparatus and storage medium is uniformly processed in asynchronous task
CN110162301B (en) Form rendering method, form rendering device and storage medium
CN111506305A (en) Tool kit generation method and device, computer equipment and readable storage medium
CN110599581A (en) Image model data processing method and device and electronic equipment
US20180373512A1 (en) Method and device for simulating synchronous blocking in asynchronous environment, storage medium, server and terminal
CN113590564B (en) Data storage method, device, electronic equipment and storage medium
CN110618881B (en) Method and system for simulating message queue
CN112785284A (en) Message storage method and device based on structured document
CN115982358B (en) Document splitting method, device, terminal equipment and computer readable 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
GR01 Patent grant
GR01 Patent grant