CN108228897B - File generation method and electronic device - Google Patents

File generation method and electronic device Download PDF

Info

Publication number
CN108228897B
CN108228897B CN201810115905.1A CN201810115905A CN108228897B CN 108228897 B CN108228897 B CN 108228897B CN 201810115905 A CN201810115905 A CN 201810115905A CN 108228897 B CN108228897 B CN 108228897B
Authority
CN
China
Prior art keywords
file
title
generated
content
database
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
CN201810115905.1A
Other languages
Chinese (zh)
Other versions
CN108228897A (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.)
Bank of China Ltd
Original Assignee
Bank of China 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 Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN201810115905.1A priority Critical patent/CN108228897B/en
Publication of CN108228897A publication Critical patent/CN108228897A/en
Application granted granted Critical
Publication of CN108228897B publication Critical patent/CN108228897B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/164File meta data generation

Abstract

The file generation method and the electronic equipment provided by the invention can generate files of various file types, have universality, can generate files of corresponding file types by using the file generation method provided by the embodiment of the invention even if the file generation method is not a program developer, and are suitable for a wide range of people.

Description

File generation method and electronic device
Technical Field
The invention relates to the technical field of communication, in particular to a file generation method and electronic equipment.
Background
There are many application scenarios that require generating files of different file types, for example, files of file types such as report, csv, txt, XML, and the like, and the current method for generating files of different file types is to develop a corresponding application program for each file type.
For files of different file types, corresponding application programs need to be repeatedly developed, and the universality of each application program is poor.
Disclosure of Invention
In view of this, the present invention provides a file generating method and an electronic device, so as to solve the problem of poor versatility in the prior art. The specific technical scheme is as follows:
a file generation method is applied to electronic equipment and comprises the following steps:
Establishing communication connection with a database;
acquiring preset configuration information;
wherein the configuration information comprises: the file type of the file to be generated; the configuration information further includes: the first indication information is used for representing a way of acquiring a title in a file to be generated; and second indication information used for representing a way of obtaining the detailed content in the file to be generated; and one or more of third indication information for representing a way of acquiring ending content of the file to be generated;
acquiring the file type of the file to be generated from the database based on the configuration information;
acquiring the title and/or detailed content and/or ending content of the file to be generated from the database based on the configuration information;
and generating a file corresponding to the file type based on the title and/or the detailed content and/or the ending content.
An electronic device, comprising:
the establishing module is used for establishing communication connection with the database;
the first acquisition module acquires preset configuration information;
wherein the configuration information comprises: the file type of the file to be generated; the configuration information further includes: the first indication information is used for representing a way of acquiring a title in a file to be generated; and second indication information used for representing a way of obtaining the detailed content in the file to be generated; and one or more of third indication information for representing a way of acquiring ending content of the file to be generated;
The second obtaining module is used for obtaining the file type of the file to be generated from the database based on the configuration information;
a third obtaining module, configured to obtain, from the database, a title and/or detailed content and/or end content of the file to be generated based on the configuration information;
and the generating module is used for generating a file corresponding to the file type based on the title and/or the detailed content and/or the ending content.
An electronic device, comprising:
a memory for storing a program;
a processor configured to execute the program, the program specifically configured to:
establishing communication connection with a database;
acquiring preset configuration information;
wherein the configuration information comprises: the file type of the file to be generated; the configuration information further includes: the first indication information is used for representing a way of acquiring a title in a file to be generated; and second indication information used for representing a way of obtaining the detailed content in the file to be generated; and one or more of third indication information for representing a way of acquiring ending content of the file to be generated;
acquiring the file type of the file to be generated from the database based on the configuration information;
Acquiring the title and/or detailed content and/or ending content of the file to be generated from the database based on the configuration information;
and generating a file corresponding to the file type based on the title and/or the detailed content and/or the ending content.
The technical scheme has the following beneficial effects:
the file generation method provided by the invention can generate files of various file types, has universality, can generate files of corresponding file types by using the file generation method provided by the embodiment of the invention even if the file generation method is not a program developer, and is suitable for a wide range of people.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
FIG. 1 is a diagram of a file generation system provided by an embodiment of the present invention;
FIG. 2 is a method flowchart of an implementation manner of a file generation method according to an embodiment of the present invention;
FIGS. 3a to 3b are schematic views of a fourth window interface according to an embodiment of the invention;
fig. 4 is a flowchart of an implementation manner of obtaining the title of the file to be generated from the database based on the configuration information according to the embodiment of the present invention;
fig. 5 is a flowchart of an implementation manner for obtaining the detailed content of the file to be generated from the database based on the configuration information according to the embodiment of the present invention;
fig. 6 is a flowchart of an implementation manner for acquiring ending contents of the file to be generated from the database based on the configuration information according to the embodiment of the present invention;
fig. 7 is a flowchart of an implementation manner of generating a file corresponding to the file type based on the title and/or the detailed content and/or the end content according to the embodiment of the present invention;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The file generation method provided by the embodiment of the invention can be applied to electronic equipment, the electronic equipment can be a computer or a server, and the like, wherein the server can be a server, a server cluster formed by a plurality of servers, or a cloud computing service center.
The file generation method provided by the embodiment of the invention can also be a client running in the electronic equipment, namely an application program.
As shown in fig. 1, a file generation system provided in an embodiment of the present invention includes:
the electronic device 11 includes a database, and the electronic device 12 includes a file generation application, where the electronic device 11 and the electronic device 12 may belong to the same electronic device or different electronic devices, and the present invention is not limited in detail herein.
The user needs to set the configuration information in advance before generating the file using the electronic device 12. The user may log in the database in the electronic device in which the electronic device 12 is located, after the user logs in the database, the electronic device may optionally show whether to allow the file generation method to access a window interface of the file generation method, and if the user clicks the permission, a communication connection 13 between the database and the electronic device 12 is established.
In an alternative embodiment, the electronic device 12 may obtain the configuration information from the electronic device 11 through the communication connection 13, and generate a file corresponding to the corresponding file type based on the configuration information.
The following describes a file generation method with reference to the file generation system. As shown in fig. 2, a method flowchart of an implementation manner of the file generation method provided in the embodiment of the present invention is shown, where the method includes:
step S201: and establishing a communication connection with the database.
Step S202: and acquiring preset configuration information.
Wherein the configuration information comprises: the file type of the file to be generated; the configuration information further includes: the first indication information is used for representing a way of acquiring a title in a file to be generated; and second indication information used for representing a way of obtaining the detailed content in the file to be generated; and one or more of third indication information used for representing a way of acquiring the ending content of the file to be generated.
The user needs to set configuration information before generating a file of the corresponding file type based on the electronic device 12.
There are various methods for acquiring the preset configuration information in step S202 in the embodiment of the present invention, and the embodiment of the present invention provides, but is not limited to, the following:
The first method is as follows: and obtaining the configuration information from the database through the communication connection.
The second method comprises the following steps: and if the file type of the file to be generated is the target file type, displaying a fourth window interface, wherein the fourth window interface is used for guiding a user to fill in the configuration information.
In an alternative embodiment, the target file type may be an XML type.
Electronic device 12 may present a fourth window interface for guiding the user in filling out configuration information. Fig. 3a to 3b are schematic views of a fourth window interface according to an embodiment of the present invention.
The user may populate the fourth window interface with configuration information. In fig. 3a to 3b, the XML type is taken as an example, the fourth window interface shown in fig. 3a only includes configuration information for instructing the user to fill in the content including the title and the detail content, and the fourth window interface shown in fig. 3b is the window interface after the user fills in the configuration information including the title and the detail content.
As can be seen from fig. 3b, fig. 3b instructs the user to fill in the first indication information corresponding to 3 titles, but the user only fills in the first indication information corresponding to 2 titles, which are: first indication information 1 and first indication information 2; the file to be generated may show only the 3 titles, or the 2 titles, and the name "MBJGDM" of the title in which the corresponding first indication information is not filled.
In fig. 3b, the user also fills in second indication information corresponding to the detailed content, which is second indication information 1 to second indication information 10.
Step S203: and acquiring the file type of the file to be generated from the database based on the configuration information.
Step S204: and acquiring the title and/or detailed content and/or ending content of the file to be generated from the database based on the configuration information.
Step S205: and generating a file corresponding to the file type based on the title and/or the detailed content and/or the ending content.
In an optional embodiment, the configuration information further comprises: a storage path of the file to be generated stored in the electronic device 12 and a preset name of the file to be generated; step S205 specifically includes: generating a file which corresponds to the file type and has a name of a preset name based on the title and/or the detailed content and/or the ending content; and storing the file to a position corresponding to the storage path.
The file generation method provided by the embodiment of the invention can generate files of various file types, has universality, can generate files of corresponding file types by using the file generation method provided by the embodiment of the invention even if the program development personnel do not use the file generation method, and is suitable for a wide range of people.
The following describes the process of obtaining the title, detail content, and ending content from the database in detail.
If the configuration information is preset in the database, as shown in fig. 4, the method is a flowchart of an implementation manner for acquiring the title of the file to be generated from the database based on the configuration information, where the implementation manner is provided in the embodiment of the present invention, and the method includes:
step S401: and acquiring a first parameter which is pre-stored in the database and used for representing whether the file to be generated comprises a title or not.
In an alternative embodiment, the database may store a report text parameter table, which may be shown in table 1, where table 1 shows a part of the contents of the report text parameter table. The REPORTPARAM textual parameters table may include a first parameter.
TABLE 1REPORTPARAM text parameter Table
Column name Numerical value
First parameter First preset value
Second parameter Second preset value
Third parameter E:\afms\file\filename
The first parameter is used for representing whether the file to be generated comprises a title, and if the numerical value corresponding to the first parameter is a first preset value (for example, 0), the first parameter is used for representing that the file to be generated comprises the title; if the value corresponding to the first parameter is not the first preset value (for example, not 0), it indicates that the first parameter represents that the file to be generated does not include a title.
The second parameter is used for representing whether the file to be generated comprises the ending content, and if the value corresponding to the second parameter is a second preset value (for example, 0), the second parameter represents that the file to be generated comprises the ending content; if the value corresponding to the first parameter is not a second preset value (for example, not 0), it indicates that the second parameter represents that the file to be generated does not include the end content.
The third parameter is used to characterize a storage path of the file to be generated stored in the electronic device 12 and a name of the file to be generated, and taking table 1 as an example, the file name of the file to be generated is "filename".
Step S402: and if the first parameter represents that the file to be generated comprises a title, acquiring the title and the position of the title in the file to be generated based on a file title table pre-stored in the database.
In an alternative embodiment, step S402 includes:
the first step is as follows: and acquiring the first indication information from a file title table pre-stored in the database.
The second step is that: if the first indication information represents that the title is a constant stored at a first preset position in the file title table, obtaining the title from the first preset position in the file title table;
The third step: if the first indication information represents that the title is obtained based on a first preset SQL statement, controlling the database to operate the first preset SQL statement to obtain the title;
the fourth step: if the first indication information indicates that the title contains replaceable variables, replacing the variables contained in the title with parameter values obtained from a first window interface displayed by the electronic equipment to obtain the replaced title, wherein the first window interface carries information used for guiding a user to fill in the parameter values corresponding to the variables contained in the title.
In an alternative embodiment the file header table may be as shown in table 2, table 2 showing a part of the contents of the file header table.
TABLE 2 File title Table
Figure BDA0001570627600000071
Wherein, H001 represents a code of a file title, which is used to locate the title content of the generated text, LINENO represents the number of lines of the title in the file to be generated, and taking table 2 as an example, "account transaction detail condition statistics" is located in the first line of the file to be generated; "Account: @ param $ $ date: the @ param $' is located on the second line of the file to be generated; "Account transaction amount: the first preset SQL statement is positioned on the third row of the file to be generated.
HEADTYPE indicates the type of title, HEADVALUE indicates the way to obtain the corresponding title; still taking table 2 as an example, 0 indicates that the type of the title is a constant, and the corresponding "account transaction detail condition statistics" in HEADVALUE is the title; 2 indicates that the title contains alternative variables, the corresponding HEADVALUE "account: @ param $ $ date: the "@ @ param $" and "@ @ param $" in @ @ param $ "need to be replaced with preset parameter values. Assuming that the preset parameter values are "first account" and "2018 year 1 month 18 day", the HEADVALUE account may be replaced sequentially according to the sequence of "first account" and "2018 year 1 month 18 day": @ param $ $ date: the content in @ param $, "gets" account: date of the first account: year 2018, month 1, day 18 "; 1 indicates that the type of the title is the SQL statement type; accordingly, the database performs "account transaction total: a first preset SQL statement in the first preset SQL statement' is obtained, so that a character string corresponding to the first preset SQL statement is obtained, and the first preset SQL statement is assumed to be a first account sum; then "account transaction total: the first account transaction amount is the title.
Optionally, the number of columns of each title in the file to be generated may also be preset. As shown in table 3.
TABLE 3 File title Table
Figure BDA0001570627600000081
Wherein, LINENO1 represents the number of lines of the title in the file to be generated; LINENO2 indicates the number of columns of titles in the file to be generated.
In summary, the file to be generated may include one or more titles. The "location of the title in the file to be generated" may include: the number of rows and/or columns of each title in the file to be generated.
If the type of the title includes the variable, the user needs to input the parameter value to replace each variable, and the electronic device 12 may display a window interface for guiding the user to fill in the parameter value to replace each variable; if the title contains a plurality of variables, the variables in the title are sequentially replaced based on the order of the obtained parameter values.
If the configuration information is preset in the database, as shown in fig. 5, the method is a flowchart of an implementation manner for acquiring the detailed content of the file to be generated from the database based on the configuration information, where the implementation manner is provided in the embodiment of the present invention, and the method includes:
step S501: and obtaining the second indication information from a detail table pre-stored in the database.
In an alternative embodiment, the list may be as shown in Table 4.
TABLE 4 detailed table
Figure BDA0001570627600000091
Wherein, detaildose is used for identifying the detail table, D001 is the identification of the detail table, and the corresponding detail table can be searched through the identification.
Table 4 may show only a portion of the list; the list includes: the detailed contents of the SQL statement type, for example, the second preset SQL statement, will be described below by taking a specific example, assuming that the second preset SQL statement is "SELECT, which is a detail, ACCNO AS CXZH, TRANTYPE AS jyxx, AMT AS JE, oppac AS JYDFZKH FROM trandteinatilinfo WHERE acc no ═ @ param ═ AND TRANDATE ═ @ param @ $ $ product", WHERE the variable "@ @ param $" and the constant are included in the second preset SQL statement.
In an optional embodiment, the second indication information is detailcalaue in table 4.
Step S502: and acquiring the detail content and the position of the detail content in the file to be generated based on the second indication information.
Step S502 includes:
and if the second indication information representation obtains the detail content based on a second preset SQL statement, controlling the database to operate the second preset SQL statement to obtain the detail content.
If the second preset SQL statement contains replaceable variables, replacing the variables contained in the second preset SQL statement with the parameter values obtained from a second window interface displayed by the electronic equipment to obtain the replaced second preset SQL statement, wherein the second window interface carries information used for guiding a user to fill and replace the parameter values corresponding to the variables contained in the detailed content.
Still taking table 4 AS an example, the second predetermined SQL statement is a detail containing replaceable variables, and assuming that the user fills in jiaxiaoming and step height in the second window interface, the second predetermined SQL statement after replacement is "SELECT this is detail, ACCNO AS CXZH, tranctye AS jyxx, AMT AS JE, oppac AS JYDFZKH FROM trandetai line operator ACCNO ═ jiaxiaoming AND TRANDATE is step height".
The control database runs "SELECT" which is a detail, ACCNO AS CXZH, trantyle AS jyxx, AMT AS JE, oppac AS JYDFZKH FROM TRANDETAILINFO WHERE ACCNO is at step height AND TRANDATE, and the obtained content is used AS the detail content.
As shown in fig. 6, which is a flowchart of an implementation manner of obtaining the ending content of the file to be generated from the database based on the configuration information according to the embodiment of the present invention, the method includes:
step S601: and if the second parameter prestored in the database represents that the file to be generated comprises ending content.
In an alternative embodiment, the second parameter may be stored in the REPORTPARAM text parameter table shown in Table 1.
The second parameter is used for representing whether the file to be generated comprises the ending content, and if the value corresponding to the second parameter is a second preset value (for example, 0), the second parameter represents that the file to be generated comprises the ending content; if the value corresponding to the first parameter is not a second preset value (for example, not 0), it indicates that the second parameter represents that the file to be generated does not include the end content.
Step S602: and acquiring the ending content and the position of the ending content in the file to be generated based on the third indication information.
Step S602 includes:
the first step is as follows: and obtaining the third indication information from a text tail table pre-stored in the database.
In an alternative embodiment, the text trailer table may be as shown in table 5.
Table 5 text trailer table
LINENO TAILTYPE TAILVALUE
1 1 Third Preset SQL statement
2 2 @ param $ $ write
3 0 Conclusion of the year there is a great harvest
The LINENO indicates the number of lines of the ending content of the file to be generated, is a local number of lines of the ending content, and is not the number of lines of the whole content of the file to be generated, taking table 5 as an example, the content corresponding to the "third preset SQL statement" is located in the 1 st line of the ending content of the file to be generated; "@ param $ $ write" line 2 in the end content of the file to be generated; "summarizing the very big harvest this year" is located in line 3 in the end of the file to be generated.
TAILVALUE represents the type of ending content, TAILVALUE represents the way to obtain the corresponding ending content; still taking table 5 as an example, 0 indicates that the type of the ending content is a constant, and the corresponding "summarizing great harvest in this year" in TAILVALUE is the ending content; 2 indicates that the trailing content contains an alternative variable, and the corresponding "@ @ param $" in TAILVALUE "@ @ param $ $ writing" needs to be replaced by a preset parameter value. Assuming that the preset parameter value is "jiaxiangming", the "jiaxiangming" can be used to replace "@ @ param $" in TAILVALUE, and the detail content is "jiaxiangming writing"; 1, the type of the ending content is an SQL statement type; the corresponding TAILVALUE "third preset SQL statement" includes a third preset SQL statement for acquiring the ending content; the database executes the third preset SQL statement, so as to obtain a character string corresponding to the third preset SQL statement, assuming that "the first account deposits the most today"; then "the first account is deposited the most this year" is the ending content.
Optionally, the number of columns of each ending content in the file to be generated may also be preset.
The position of the ending content in the file to be generated comprises: the number of columns and/or rows of ending content in the file to be generated.
In an alternative embodiment, the text end table may further include a fourth parameter for characterizing whether to mark a page number on each page of the file to be generated.
The second step is that: and if the third indication information represents that the ending content is a constant stored at a third preset position in the text tail table, obtaining the ending content from the third preset position in the text tail table.
The third step: and if the third indication information represents that the ending content is obtained based on a third preset SQL statement, controlling the database to operate the third preset SQL statement to obtain the ending content.
The fourth step: and if the second indication information indicates that the ending content contains replaceable variables, replacing the variables contained in the ending content with parameter values obtained from a third window interface displayed by the electronic equipment to obtain the replaced ending content, wherein the third window interface carries information for instructing a user to fill and replace the parameter values corresponding to the variables contained in the ending content.
It is understood that the title, detail, and end content may include variables; the first flag may be set before the parameter value for replacing the variable contained in the header, for example, H, then parameter value 1 and parameter value 2 in parameter value 1 and parameter value 2 are used to replace the variable contained in the header; setting a second flag, e.g., D, before the parameter value used to replace the variable contained in the detail content, then parameter value 3 and parameter value 4 in D parameter value 3 and parameter value 4 are used to replace the variable in the detail content; a third flag, e.g., T, is set before the parameter value for replacing the variable contained in the ending content, then parameter value 5 and parameter value 6 are used to replace the variable contained in the ending content in parameter value 5 and parameter value 6.
If preset configuration information is obtained based on the fourth window interface displayed by the electronic device 12, obtaining the title of the file to be generated from the database based on the configuration information may include:
and obtaining the title of the file to be generated from the database based on the first indication information.
In an alternative embodiment, the first indication information may include "heartbeat" in table 2, for example, the first indication information may be "account transaction detail statistics" and/or "account: @ param $ $ date: @ param $ ", and/or" total amount of account trades: the first preset SQL statement ", then, the process of" obtaining the title of the file to be generated from the database based on the first indication information "may refer to the second step to the fourth step included in step S402.
If preset configuration information is obtained based on the fourth window interface displayed by the electronic device 12, obtaining the detailed content of the file to be generated from the database based on the configuration information may include:
and obtaining the detail content of the file to be generated from the database based on the second indication information.
In an alternative embodiment, the second indication information may characterize that the detail content is obtained based on a second predetermined SQL statement, for example, the second indication information may include "SELECT" in table 4, which is detail, ACCNO AS CXZH, TRANTYPE AS JYLX, AMT AS JE, oppac AS jydfzkhfromtrandilacelinfo WHERE ACCNO ═ @ para @ @ @ @ @ @ @ $ AND TRANDATE @ @ param @ @ @ $ $. Then, the process of "obtaining the details of the file to be generated from the database based on the second indication information" may refer to step S502, which includes the step.
If preset configuration information is obtained based on the fourth window interface displayed by the electronic device 12, obtaining the tail content of the file to be generated from the database based on the configuration information may include:
and acquiring the tail content of the file to be generated from the database based on the third indication information.
In an alternative embodiment, the third indication may comprise a value as shown in TAILVALUE in Table 5, such as a "third preset SQL statement", and/or a "@ @ param $ write", and/or "summarize a big harvest this year". Then, the process of "obtaining the tail content of the file to be generated from the database based on the third indication information" may refer to the second step to the fourth step included in step S602.
After obtaining the title and/or the detailed content and/or the ending content of the file to be generated, the electronic device 12 may store the title, the detailed content and the ending content to the title chain table, the detailed chain table and the ending chain table, respectively, that is, the title chain table stores one or more titles of the file to be generated; the detail linked list stores one or more pieces of detail content of the file to be generated; the ending linked list stores one or more pieces of ending contents of the file to be generated.
As shown in fig. 7, a flowchart of an implementation manner of generating a file corresponding to the file type based on the title and/or the detailed content and/or the end content according to an embodiment of the present invention is provided, where the method includes:
step S701: and if the detail content is stored in the detail list, and a cursor in the detail list is located at the initial position of the detail list, detecting whether the title list contains a title or not, wherein the cursor is used for indicating the position of the detail content to be traversed currently.
Step S702: and if the title linked list comprises the title, obtaining the title from the title linked list, and writing the title into the file to be generated.
In an alternative embodiment, if the configuration information is obtained from the database, step S702 is specifically configured to: and writing the title into the corresponding position of the file to be generated based on the position of the title in the file to be generated.
In an optional embodiment, if the file type of the file to be generated is the target file type, the configuration information of the file to be generated is obtained through the fourth window interface, then step S702 is specifically configured to: writing the title into a corresponding position in a file template associated with the fourth window interface.
The positions of the title, the detailed content and the ending content in the file template are preset.
Step S703: and sequentially traversing each detail content in the detail list, and sequentially writing the detail content into the file to be generated until the cursor does not correspond to any detail content.
In an optional embodiment, if the configuration information is obtained from the database, step S703 is specifically configured to: and writing the detail content into the corresponding position of the file to be generated based on the position of the detail content in the file to be generated.
In an optional embodiment, if the file type of the file to be generated is the target file type, the configuration information of the file to be generated is obtained through the fourth window interface, then step S703 is specifically configured to: writing the detailed content to a corresponding location in a file template associated with the fourth window interface.
The cursor does not correspond to any detail content, and all the detail contents in the detail content description detail list are traversed.
Step S704: and if the ending linked list contains ending content, writing the ending content into the file to be generated so as to obtain the file.
In an alternative embodiment, if the configuration information is obtained from the database, step S704 is specifically configured to: and writing the ending content into the corresponding position of the file to be generated based on the position of the ending content in the file to be generated.
In an optional embodiment, if the file type of the file to be generated is the target file type, the configuration information of the file to be generated is obtained through the fourth window interface, step S704 is specifically configured to: writing the ending content into a corresponding position in a file template associated with the fourth window interface.
As shown in fig. 8, which is a schematic structural diagram of an electronic device according to an embodiment of the present invention, the electronic device includes:
An establishing module 81, configured to establish a communication connection with a database;
a first obtaining module 82, which obtains preset configuration information;
wherein the configuration information comprises: the file type of the file to be generated; the configuration information further includes: the first indication information is used for representing a way of acquiring a title in a file to be generated; and second indication information used for representing a way of obtaining the detailed content in the file to be generated; and one or more of third indication information for representing a way of acquiring ending content of the file to be generated;
a second obtaining module 83, configured to obtain a file type of the file to be generated from the database based on the configuration information;
a third obtaining module 84, configured to obtain, from the database, a title and/or detailed content and/or end content of the file to be generated based on the configuration information;
a generating module 85, configured to generate a file corresponding to the file type based on the title and/or the detailed content and/or the end content.
Optionally, the third obtaining module 84 includes:
the first acquisition unit is used for acquiring a first parameter which is pre-stored in the database and used for representing whether the file to be generated comprises a title or not;
And a second obtaining unit, configured to, if the first parameter indicates that the file to be generated includes a title, obtain, based on a file title table pre-stored in the database, the title and a position of the title in the file to be generated.
Optionally, the second obtaining unit includes:
the first acquisition subunit is used for acquiring the first indication information from a file title table pre-stored in the database;
a second obtaining subunit, configured to obtain the title from a first preset position in the file title table if the first indication information indicates that the title is a constant stored in the first preset position in the file title table;
a third obtaining subunit, configured to, if the first indication information represents that the title is obtained based on a first preset SQL statement, control the database to run the first preset SQL statement to obtain the title;
and if the first indication information indicates that the title includes a replaceable variable, replacing the variable included in the title with a parameter value obtained from a first window interface displayed by the electronic device to obtain the replaced title, wherein the first window interface carries information for guiding a user to fill in the parameter value corresponding to the variable included in the title.
Optionally, the third obtaining module 84 includes:
a third obtaining unit, configured to obtain the second indication information from a detail table pre-stored in the database;
and the fourth acquisition unit is used for acquiring the detail content and the position of the detail content in the file to be generated based on the second indication information.
Optionally, the fourth obtaining unit includes:
and the sixth obtaining subunit is configured to, if the second indication information represents that the detail content is obtained based on a second preset SQL statement, control the database to run the second preset SQL statement to obtain the detail content.
Optionally, the third obtaining module 84 includes:
a fifth obtaining unit, configured to obtain the third indication information from a text tail table pre-stored in the database if a second parameter pre-stored in the database indicates that the file to be generated includes an ending content;
a sixth obtaining unit, configured to obtain, based on the third indication information, the ending content and a position of the ending content in the file to be generated.
Optionally, the sixth obtaining unit includes:
a ninth obtaining subunit, configured to obtain the ending content from a third preset position in the text tail table if the third indication information indicates that the ending content is a constant stored at the third preset position in the text tail table;
A tenth obtaining subunit, configured to, if the third indication information represents that the ending content is obtained based on a third preset SQL statement, control the database to run the third preset SQL statement to obtain the ending content;
and an eleventh obtaining subunit, configured to, if the second indication information indicates that the ending content includes a replaceable variable, replace the variable included in the ending content with a parameter value obtained from a third window interface displayed by the electronic device to obtain a replaced ending content, where the third window interface carries information used for instructing a user to fill in and replace the parameter value corresponding to the variable included in the ending content.
Optionally, the first obtaining module 82 includes:
a seventh obtaining unit, configured to obtain the configuration information from the database through the communication connection;
or the like, or, alternatively,
and the display unit is used for displaying a fourth window interface if the file type of the file to be generated is the target file type, wherein the fourth window interface is used for guiding a user to fill in the configuration information, and the fourth window interface is associated with the file template of the target file type.
And the eighth acquiring unit is configured to acquire the configuration information through the fourth window interface.
Optionally, the generating module 85 includes:
the detection unit is used for detecting whether the title list comprises a title or not if the detail content is stored in the detail list and a cursor in the detail list is located at an initial position of the detail list, wherein the cursor is used for indicating the position of the detail content to be traversed currently;
the first writing unit is used for obtaining the title from the title linked list and writing the title into the file to be generated if the file to be generated comprises the title;
the second writing unit is used for sequentially traversing all the detail contents in the detail list and sequentially writing the detail contents into the file to be generated until the cursor does not correspond to any detail content;
and the third writing unit is used for writing the ending content into the file to be generated if the ending linked list contains the ending content so as to obtain the file.
As shown in fig. 9, which is a schematic view of another structure of an electronic device according to an embodiment of the present invention, the electronic device includes:
a memory 91 for storing a program;
the program may include program code including computer operating instructions.
The memory 91 may comprise a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
A processor 92 configured to execute the program, the program being specifically configured to:
establishing communication connection with a database;
acquiring preset configuration information;
wherein the configuration information comprises: the file type of the file to be generated; the configuration information further includes: the first indication information is used for representing a way of acquiring a title in a file to be generated; and second indication information used for representing a way of obtaining the detailed content in the file to be generated; and one or more of third indication information for representing a way of acquiring ending content of the file to be generated;
acquiring the file type of the file to be generated from the database based on the configuration information;
acquiring the title and/or detailed content and/or ending content of the file to be generated from the database based on the configuration information;
and generating a file corresponding to the file type based on the title and/or the detailed content and/or the ending content.
The processor 92 may be a central processing unit CPU, or an application Specific Integrated circuit ASIC, or one or more Integrated circuits configured to implement embodiments of the present invention.
The payment server may further comprise a communication interface 93 and a communication bus 94, wherein the memory 91, the processor 92 and the communication interface 93 are in communication with each other via the communication bus 94.
An embodiment of the present invention further provides a readable storage medium, where the storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to perform the steps in any of the above file generation method embodiments.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
In the several embodiments provided in the present application, it should be understood that the disclosed method, apparatus, and device may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment. In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A file generation method is applied to electronic equipment and comprises the following steps:
establishing communication connection with a database;
acquiring preset configuration information;
wherein the configuration information comprises: the file type of the file to be generated; the configuration information further includes: the first indication information is used for representing a way of acquiring a title in a file to be generated; and second indication information used for representing a way of obtaining the detailed content in the file to be generated; and one or more of third indication information for representing a way of acquiring ending content of the file to be generated;
Acquiring the file type of the file to be generated from the database based on the configuration information;
acquiring the title and/or detailed content and/or ending content of the file to be generated from the database based on the configuration information;
generating a file corresponding to the file type based on the title and/or the detailed content and/or the ending content;
acquiring the title of the file to be generated from the database based on the configuration information, wherein the acquiring comprises the following steps:
obtaining a first parameter which is pre-stored in the database and used for representing whether the file to be generated comprises a title or not;
if the first parameter represents that the file to be generated comprises a title, acquiring the title and the position of the title in the file to be generated based on a file title table pre-stored in the database;
the acquiring the title from a file title table pre-stored in the database comprises:
acquiring the first indication information from a file title table pre-stored in the database;
if the first indication information represents that the title is a constant stored at a first preset position in the file title table, obtaining the title from the first preset position in the file title table;
If the first indication information represents that the title is obtained based on a first preset SQL statement, controlling the database to operate the first preset SQL statement to obtain the title;
if the first indication information indicates that the title contains replaceable variables, replacing the variables contained in the title with parameter values obtained from a first window interface displayed by the electronic equipment to obtain the replaced title, wherein the first window interface carries information used for guiding a user to fill in the parameter values corresponding to the variables contained in the title.
2. The file generation method according to claim 1, wherein obtaining the detail content of the file to be generated from the database based on the configuration information comprises:
obtaining the second indication information from a detail table pre-stored in the database;
and acquiring the detail content and the position of the detail content in the file to be generated based on the second indication information.
3. The file generation method according to claim 2, wherein acquiring the detail content based on the second instruction information includes:
and if the second indication information representation obtains the detail content based on a second preset SQL statement, controlling the database to operate the second preset SQL statement to obtain the detail content.
4. The file generation method according to claim 1, wherein obtaining the ending content of the file to be generated from the database based on the configuration information comprises:
if the second parameter prestored in the database represents that the file to be generated comprises ending content, acquiring the third indication information from a text tail table prestored in the database;
and acquiring the ending content and the position of the ending content in the file to be generated based on the third indication information.
5. The file generation method according to claim 4, wherein acquiring the ending content based on the third indication information includes:
if the third indication information represents that the ending content is a constant stored at a third preset position in the text tail table, obtaining the ending content from the third preset position in the text tail table;
if the third indication information represents that the ending content is obtained based on a third preset SQL statement, controlling the database to operate the third preset SQL statement to obtain the ending content;
and if the second indication information indicates that the ending content contains replaceable variables, replacing the variables contained in the ending content with parameter values obtained from a third window interface displayed by the electronic equipment to obtain the replaced ending content, wherein the third window interface carries information for instructing a user to fill and replace the parameter values corresponding to the variables contained in the ending content.
6. The file generation method according to claim 1,
the acquiring preset configuration information includes: obtaining the configuration information from the database through the communication connection;
or the like, or, alternatively,
the acquiring preset configuration information includes:
if the file type of the file to be generated is the target file type, displaying a fourth window interface, wherein the fourth window interface is used for guiding a user to fill in the configuration information, and the fourth window interface is associated with a file template of the target file type;
and obtaining the configuration information through the fourth window interface.
7. The file generation method according to claim 1, wherein obtaining the title and/or the detailed content and/or the end content of the file to be generated from the database based on the configuration information comprises:
acquiring the title of the file to be generated from the database, and storing the title into a title linked list;
and/or the presence of a gas in the gas,
acquiring the detail content of the file to be generated from the database, and storing the detail content into a detail list;
and/or the presence of a gas in the gas,
and acquiring the ending content of the file to be generated from the database, and storing the ending content into an ending linked list.
8. The file generation method according to claim 7, wherein generating a file corresponding to the file type based on the title and/or the detailed content and/or the end content comprises:
if the detail content is stored in the detail list, and a cursor in the detail list is located at an initial position of the detail list, detecting whether the title list contains a title or not, wherein the cursor is used for indicating the position of the detail content to be traversed currently;
if the file to be generated comprises the title, obtaining the title from the title linked list, and writing the title into the file to be generated;
sequentially traversing each detail content in the detail chain table, and sequentially writing the detail content into the file to be generated until the cursor does not correspond to any detail content;
and if the ending linked list contains ending content, writing the ending content into the file to be generated so as to obtain the file.
9. An electronic device, comprising:
the establishing module is used for establishing communication connection with the database;
the first acquisition module acquires preset configuration information;
wherein the configuration information comprises: the file type of the file to be generated; the configuration information further includes: the first indication information is used for representing a way of acquiring a title in a file to be generated; and second indication information used for representing a way of obtaining the detailed content in the file to be generated; and one or more of third indication information for representing a way of acquiring ending content of the file to be generated;
The second obtaining module is used for obtaining the file type of the file to be generated from the database based on the configuration information;
a third obtaining module, configured to obtain, from the database, a title and/or detailed content and/or end content of the file to be generated based on the configuration information; acquiring the title of the file to be generated from the database based on the configuration information, wherein the acquiring comprises the following steps: obtaining a first parameter which is pre-stored in the database and used for representing whether the file to be generated comprises a title or not; if the first parameter represents that the file to be generated comprises a title, acquiring the title and the position of the title in the file to be generated based on a file title table pre-stored in the database;
a generating module, configured to generate a file corresponding to the file type based on the title and/or the detailed content and/or the end content;
the third obtaining module obtains the title from a file title table pre-stored in the database, and includes:
acquiring the first indication information from a file title table pre-stored in the database;
if the first indication information represents that the title is a constant stored at a first preset position in the file title table, obtaining the title from the first preset position in the file title table;
If the first indication information represents that the title is obtained based on a first preset SQL statement, controlling the database to operate the first preset SQL statement to obtain the title;
if the first indication information indicates that the title contains replaceable variables, replacing the variables contained in the title with parameter values obtained from a first window interface displayed by the electronic equipment to obtain the replaced title, wherein the first window interface carries information used for guiding a user to fill in the parameter values corresponding to the variables contained in the title.
10. An electronic device, comprising:
a memory for storing a program;
a processor configured to execute the program, the program specifically configured to:
establishing communication connection with a database;
acquiring preset configuration information;
wherein the configuration information comprises: the file type of the file to be generated; the configuration information further includes: the first indication information is used for representing a way of acquiring a title in a file to be generated; and second indication information used for representing a way of obtaining the detailed content in the file to be generated; and one or more of third indication information for representing a way of acquiring ending content of the file to be generated;
Acquiring the file type of the file to be generated from the database based on the configuration information;
acquiring the title and/or detailed content and/or ending content of the file to be generated from the database based on the configuration information; acquiring the title of the file to be generated from the database based on the configuration information, wherein the acquiring comprises the following steps: obtaining a first parameter which is pre-stored in the database and used for representing whether the file to be generated comprises a title or not; if the first parameter represents that the file to be generated comprises a title, acquiring the title and the position of the title in the file to be generated based on a file title table pre-stored in the database;
generating a file corresponding to the file type based on the title and/or the detailed content and/or the ending content;
the acquiring the title from a file title table pre-stored in the database comprises:
acquiring the first indication information from a file title table pre-stored in the database;
if the first indication information represents that the title is a constant stored at a first preset position in the file title table, obtaining the title from the first preset position in the file title table;
If the first indication information represents that the title is obtained based on a first preset SQL statement, controlling the database to operate the first preset SQL statement to obtain the title;
if the first indication information indicates that the title contains replaceable variables, replacing the variables contained in the title with parameter values obtained from a first window interface displayed by the electronic equipment to obtain the replaced title, wherein the first window interface carries information used for guiding a user to fill in the parameter values corresponding to the variables contained in the title.
CN201810115905.1A 2018-02-06 2018-02-06 File generation method and electronic device Active CN108228897B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810115905.1A CN108228897B (en) 2018-02-06 2018-02-06 File generation method and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810115905.1A CN108228897B (en) 2018-02-06 2018-02-06 File generation method and electronic device

Publications (2)

Publication Number Publication Date
CN108228897A CN108228897A (en) 2018-06-29
CN108228897B true CN108228897B (en) 2021-10-08

Family

ID=62670759

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810115905.1A Active CN108228897B (en) 2018-02-06 2018-02-06 File generation method and electronic device

Country Status (1)

Country Link
CN (1) CN108228897B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106598919A (en) * 2015-10-14 2017-04-26 中兴通讯股份有限公司 Document generation method and device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120079408A1 (en) * 2010-09-24 2012-03-29 Visibility, Biz. Inc. Systems and methods for generating a swimlane timeline for task data visualization
CN104123394B (en) * 2014-08-13 2018-05-15 中国银行股份有限公司 Processing method for the report file of database

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106598919A (en) * 2015-10-14 2017-04-26 中兴通讯股份有限公司 Document generation method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Tutorial: Generate complex documents from Enterprise Architect with a two-step semi-automated approach;Geert Bellekens;《https://bellekens.com/2015/11/12/tutorial-generate-complex-documents-from-enterprise-architect-with-a-two-step-semi-automated-approach/》;20151112;第2-6、10页 *

Also Published As

Publication number Publication date
CN108228897A (en) 2018-06-29

Similar Documents

Publication Publication Date Title
CN108628741A (en) Webpage test method, device, electronic equipment and medium
CN109074383B (en) Document search with visualization within the context of a document
US20170116227A1 (en) System and method for extracting a star schema from tabular data for use in a multidimensional database environment
CN109359026A (en) Log reporting method, device, electronic equipment and computer readable storage medium
CN108280051A (en) Detection method, device and the equipment of error character in a kind of text data
CN110795524A (en) Main data mapping processing method and device, computer equipment and storage medium
CN110806866A (en) Generation method and device of front-end management system
CN111522741A (en) Interface test code generation method and device, electronic equipment and readable storage medium
CN115391439A (en) Document data export method, device, electronic equipment and storage medium
CN108228897B (en) File generation method and electronic device
CN109542890B (en) Data modification method, device, computer equipment and storage medium
CN108153663B (en) Page data processing method and device
US20200258093A1 (en) Compliance standards mapping
CN114741077A (en) Page effect preview method, device, equipment and medium based on field granularity
Mendes et al. Toward characterizing HTML defects on the Web
CN113822014B (en) Code material storage method and device, electronic equipment and storage medium
CN112380117A (en) Production method and device of software test basic case and electronic equipment
WO2016028973A1 (en) Plug-in manager and deployment system
CN107168684B (en) Method and device for generating content editing form
US11314765B2 (en) Multistage data sniffer for data extraction
Domingues et al. A web-based system to monitor the quality of meta-data in web portals
CN115599269B (en) Method and device for generating experiment report and electronic equipment
CN116166617B (en) Catalog generation method and device for combined open format document OFD
US20240054174A1 (en) Methods and systems for obtaining and storing web pages
JP2008217170A (en) Information processor and program

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