CN111241803A - Method and device for generating text file, computer equipment and readable storage medium - Google Patents

Method and device for generating text file, computer equipment and readable storage medium Download PDF

Info

Publication number
CN111241803A
CN111241803A CN202010041169.7A CN202010041169A CN111241803A CN 111241803 A CN111241803 A CN 111241803A CN 202010041169 A CN202010041169 A CN 202010041169A CN 111241803 A CN111241803 A CN 111241803A
Authority
CN
China
Prior art keywords
text
template
expression
target
calculation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010041169.7A
Other languages
Chinese (zh)
Inventor
李金龙
贾小卫
王屹洲
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
OneConnect Smart Technology Co Ltd
OneConnect Financial Technology Co Ltd Shanghai
Original Assignee
OneConnect Financial Technology Co Ltd Shanghai
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 OneConnect Financial Technology Co Ltd Shanghai filed Critical OneConnect Financial Technology Co Ltd Shanghai
Priority to CN202010041169.7A priority Critical patent/CN111241803A/en
Publication of CN111241803A publication Critical patent/CN111241803A/en
Pending legal-status Critical Current

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/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
    • G06Q50/10Services
    • G06Q50/18Legal services
    • G06Q50/188Electronic negotiation

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Tourism & Hospitality (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Health & Medical Sciences (AREA)
  • Technology Law (AREA)
  • Data Mining & Analysis (AREA)
  • Human Computer Interaction (AREA)
  • Health & Medical Sciences (AREA)
  • Economics (AREA)
  • Databases & Information Systems (AREA)
  • Human Resources & Organizations (AREA)
  • Marketing (AREA)
  • Primary Health Care (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a method for generating a text file, which comprises the following steps: acquiring a target text template, and identifying text elements contained in the target text template; the target text template comprises a plurality of text elements needing element values; respectively acquiring element expressions corresponding to the text elements in the target text template from a preset database, and calculating element values of the corresponding text elements according to each element expression; wherein each element expression stored in the database can be edited; adding each calculated element value to the target text template to generate a text file; the invention reduces the labor cost caused by the change of the calculation rule of the text element and improves the reusability and the expansibility of the text template.

Description

Method and device for generating text file, computer equipment and readable storage medium
Technical Field
The invention relates to the technical field of internet, in particular to a method and a device for generating a text file, computer equipment and a readable storage medium.
Background
At present, the mode of generating the electronic contract on the market mostly adopts a mode of replacing template engine variables, in the mode of generating the electronic contract, contract elements are pure variables and are strongly bound with the contract template, and if the calculation logic of the contract elements is required to be modified, a new contract template needs to be redefined; however, in practical applications, a contract element often has different computation logics in different service scenarios; for example, interest rates in some business scenarios are calculated by time limit integration related rules, while interest rates in some business scenarios are calculated by debit limits and historical overdue rates; if the existing template engine variable replacement mode is adopted, corresponding contract templates need to be defined under different service scenes; frequent changes of the contract template can present challenges to the on-line business operation and maintenance costs.
Disclosure of Invention
The invention aims to provide a method, a device, a computer device and a readable storage medium for generating a text file, which reduce the labor cost caused by the change of the calculation rule of a text element and improve the reusability and the expansibility of a text template.
According to an aspect of the present invention, a method for generating a text file is provided, which specifically includes the following steps:
acquiring a target text template, and identifying text elements contained in the target text template; the target text template comprises a plurality of text elements needing element values;
respectively acquiring element expressions corresponding to the text elements in the target text template from a preset database, and calculating element values of the corresponding text elements according to each element expression; wherein each element expression stored in the database can be edited;
adding each calculated element value to the target text template to generate a text file.
Optionally, the calculating the element value of the corresponding text element according to each element expression specifically includes:
generating an element calculation script according to a preset script template aiming at an element expression;
in the process of executing the element calculation script, according to the calculation function identification contained in the element calculation script, calling an element calculation function corresponding to the calculation function identification from a preset function library so as to calculate the element value of the text element through the element calculation function.
Optionally, the obtaining element expressions corresponding to the text elements in the target text template from a preset database respectively includes:
judging whether an element value corresponding to the text element exists in a cache or not aiming at one text element in the target text template; if yes, acquiring the element value from the cache; and if not, acquiring an element expression corresponding to the text element from a preset database.
Optionally, after calculating the element value of the text element, the method further includes:
judging whether the element type of the text element is non-variant or not, if so, storing the text element and the element value into the cache;
wherein the element values of the non-modified text elements do not change over a certain period of time.
Optionally, the method further includes:
and periodically deleting all the element values in the cache according to a set time interval.
Optionally, the method further includes:
receiving an expression modification instruction, and determining a target text element corresponding to the expression modification instruction;
searching a target element expression corresponding to the target text element from the database, and modifying the target element expression according to the expression modification instruction;
and judging whether the element type of the target text element is non-variant or not, and if so, deleting the element value of the target text element from the cache.
According to another aspect of the present invention, there is also provided an apparatus for generating a text file, specifically including the following components:
the acquisition module is used for acquiring a target text template and identifying text elements contained in the target text template; the target text template comprises a plurality of text elements needing element values;
the calculation module is used for respectively acquiring element expressions corresponding to the text elements in the target text template from a preset database and calculating element values of the corresponding text elements according to the element expressions; wherein each element expression stored in the database can be edited;
and the generating module is used for adding each calculated element value into the target text template to generate a text file.
Optionally, the calculation module is specifically configured to:
generating an element calculation script according to a preset script template aiming at an element expression;
in the process of executing the element calculation script, according to the calculation function identification contained in the element calculation script, calling an element calculation function corresponding to the calculation function identification from a preset function library so as to calculate the element value of the text element through the element calculation function.
According to another aspect of the present invention, there is also provided a computer device, specifically including: a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the above method of generating a text file when executing the program.
According to another aspect of the present invention, there is also provided a computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, carries out the steps of the above-mentioned method of generating a text file.
According to the method, the device, the computer equipment and the readable storage medium for generating the text file, only text elements are reserved in the target text template, and element expressions are not set; all the element expressions are stored in the database, and the element expressions in the database can be dynamically modified, so that the strong coupling of the text elements and the element expressions is eliminated, the text template can be suitable for various application scenes, and the element calculation expressions with complex logics can be supported.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is an alternative flowchart of a method for generating a text file according to an embodiment;
fig. 2 is a schematic diagram of an alternative composition structure of the element calculation engine provided in the second embodiment;
fig. 3 is an alternative flow chart of the method for generating a text file according to the second embodiment;
fig. 4 is a schematic diagram of a storage format of an element expression in a database according to the second embodiment;
FIG. 5 is a schematic diagram of an alternative program module of the apparatus for generating a text file according to the third embodiment;
fig. 6 is a schematic diagram of an alternative hardware architecture of the computer device according to the fourth embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. 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.
Example one
An embodiment of the present invention provides a method for generating a text file, as shown in fig. 1, the method specifically includes the following steps:
step S101: acquiring a target text template, and identifying text elements contained in the target text template; and the target text template comprises a plurality of text elements needing element values.
Specifically, the text template is a template for generating a text file, and only text elements are included in the text template, and element expressions for calculating element values of the text elements are not included; in practical application, the text template may be a contract template, a system template, and the like, and the text elements may be: name, date, amount, etc.
Step S102: respectively acquiring element expressions corresponding to the text elements in the target text template from a preset database, and calculating element values of the corresponding text elements according to each element expression; wherein each element expression stored in the database can be edited.
The database stores element expressions of a plurality of text elements, and the element expressions can calculate element values of the corresponding text elements.
Specifically, the obtaining element expressions corresponding to the text elements in the target text template from a preset database includes:
judging whether an element value corresponding to the text element exists in a cache or not aiming at one text element in the target text template; if yes, acquiring the element value from the cache; and if not, acquiring an element expression corresponding to the text element from a preset database.
The element value of the text element with the element type being non-modified is stored in the cache, and the element value of the text element with the element type being non-modified cannot be changed within a certain period of time, so that when the element value of the text element with the element type is calculated, the element value of the text element with the element type is stored in the cache, and the element value of the text element with the element type is directly obtained from the cache at a later stage, so that network time consumption and performance loss caused by repeated calculation and database query are reduced.
In addition, the calculating the element value of the corresponding text element according to each element expression specifically includes:
step A1: generating an element calculation script according to a preset script template aiming at an element expression;
step A2: in the process of executing the element calculation script, according to the calculation function identification contained in the element calculation script, calling an element calculation function corresponding to the calculation function identification from a preset function library so as to calculate the element value of the text element through the element calculation function.
It should be noted that, corresponding script templates may be set for different element expressions in advance, and a calculation function identifier may be included in the script template, and when the element calculation script is executed, the corresponding element calculation function may be called from the function library according to the calculation function identifier. In the present embodiment, a commonly used element calculation function for performing data processing on a result value calculated by an element expression is stored in the function library, for example: case conversion, overdue calculation, four-digit interception after encoding and the like to obtain the element values in the standard format.
Further, after calculating the element value of the text element, the method further includes:
judging whether the element type of the text element is non-variant or not, if so, storing the text element and the element value into the cache; wherein the element values of the non-modified text elements do not change over a certain period of time.
Furthermore, the method further comprises:
and periodically deleting all the element values in the cache according to a set time interval.
Since the element value of the text element whose element type is non-modified is not changed for a certain period of time, and is not permanently changed, in order to avoid obtaining the wrong element value from the cache, all the element values in the cache are periodically cleared in the embodiment; for example, the cache is emptied each day, and the element value of the text element of which each element type is non-variant is recalculated.
Step S103: adding each calculated element value to the target text template to generate a text file.
Specifically, the method further comprises:
step B1: receiving an expression modification instruction, and determining a target text element corresponding to the expression modification instruction;
step B2: searching a target element expression corresponding to the target text element from the database, and modifying the target element expression according to the expression modification instruction;
step B3: and judging whether the element type of the target text element is non-variant or not, and if so, deleting the element value of the target text element from the cache.
In the embodiment of the present market, the element expressions of the text elements can be dynamically modified in the database, so that the text elements are not simple one-to-one replacement operations and are not hard-coded with strong coupling, but can support dynamic calculation expressions of complex logic. In the embodiment, an expandable database is maintained, and the change of the requirement can be adapted in real time.
Example two
The embodiment of the invention provides a method for generating a text file, which is applied to an element calculation engine shown in fig. 2, wherein the element calculation engine comprises: the system comprises a dynamic calculation client, a query engine, a Redis cache, an element calculator and a database; an electronic contract text in PDF format can be generated by applying the method for generating the text file in the element calculation engine; as shown in fig. 3, the method specifically includes the following steps:
step S301: the dynamic calculation client side obtains a target contract template and identifies contract elements key contained in the target contract template; wherein, a plurality of contract elements keys needing to add element value are included in the target contract template.
For example, the following contract elements key are included in the loan contract template: basic information of the lending party and the lending party, contract numbers, money amount, interest, time limit, expiration date, ending date, signature and seal; as another example, the following contract elements key are included in the payment contract template: transaction flow, amount, transaction detail.
Specifically, the dynamic computation client serves as an entry of an element computation engine, is developed by adopting Java technology and is provided for a service user in a client jar mode; in addition, the dynamic computing client executes Groovy code using Java to engage the query engine to send the identified respective contract element keys to the query engine.
Step S302: for one contract element key, the query engine judges whether an element value corresponding to the contract element key exists in the Redis cache or not; if yes, obtaining the element value from the Redis cache; if not, go to step S303.
The Redis cache stores the element value of the contract element key with the element type being non-modified, and the element value of the contract element key with the element type being non-modified does not change within a certain period of time, so that when the element value of the contract element key of the type is calculated, the element value of the contract element key of the type is stored in the Redis cache, so that the element value of the contract element key of the type is directly acquired from the Redis cache at a later stage, and network time consumption and performance loss caused by repeated calculation and database query are reduced.
Step S303: and the query engine acquires an element expression corresponding to the contract element key from the database and generates an element calculation script according to a preset script template based on the element expression.
Each contract element key has a corresponding element expression, and the element value of the corresponding contract element key can be calculated through the element expression; in this embodiment, the element expression of the contract element key is written as a rule statement in advance in a Groovy language and is persisted in the database, that is, the element expression is a Groovy code segment; in addition, the query engine splices the element expressions of the Groovy language into a complete Groovy language element calculation script according to the corresponding preset script template, and transmits the element calculation script to the element calculator.
As shown in fig. 4, each element expression includes three columns, the first column is a contract element key, the second column is an element description, and the third column is a Groovy expression, which is a storage format of the element expression in the database.
Step S304: the query engine loads an element calculator to execute the element calculation script through the element calculator, calculates an element value of the contract element key, and transmits the calculated element value to the dynamic calculation client.
Specifically, step S304 includes:
and in the process of executing the element calculation script, if a calculation function identifier is analyzed in the element calculation script, the element calculator is called from the dynamic calculation client to an element calculation function corresponding to the calculation function identifier so as to calculate an element value of the contract element key through the element calculation function.
It should be noted that the script template may include a computation function identifier, and when the element calculator executes the element computation script, the corresponding element computation function is called from the dynamic computation client according to the computation function identifier. In the present embodiment, a commonly used element calculation function for performing data processing on a result value calculated by an element expression is stored in the dynamic calculation client, for example: case conversion, overdue calculation, four-digit interception after encoding and the like to obtain the value of the element value in the standard format.
In the embodiment, a commonly used element calculation function is added to a dynamic calculation client in a jar packet form; for example, order-tools.jar is added in a dynamic calculation client, and the jar comprises processing functions of order related classes, such as interest rate calculation, due date calculation and the like; the element calculation function in the dynamic calculation client is introduced in a pluggable mode, a jar package of a newly realized element calculation function can be added into the dynamic calculation client, and an existing jar package of the element calculation function can be deleted from the dynamic calculation client.
In practical application, a dynamic computation client is initialized to complete an independent operating environment; after the initialization of the dynamic computation client is completed, initializing a query engine, wherein the query engine is a Groovy running environment, only the running environment of a Groovy language can be operated, and the running environment of the dynamic computation client is imported into the running environment of the query engine in a static import mode, so that an element computation script generated by the query engine can call an element computation function in the dynamic computation client; the query engine also loads the element calculator, which can share the execution environment of the query engine to execute the scripts of the Groovy language.
Further, after step S304, the method further includes:
the query engine acquires the element type of the contract element key from the database; and if the element type is non-variant, storing the element value into the Redis cache.
Further, the method further comprises:
and periodically deleting all the element values in the Redis cache according to a set time interval.
Since the value of the key element of the contract key with the non-modified key element type is not changed for a certain period of time, and is not permanently changed, in order to avoid obtaining the wrong value of the key element from the Redis cache, all the values of the key element in the Redis cache are periodically emptied in the embodiment; for example, the Redis cache is emptied each day and the element value of the contract element key, each element type of which is non-variant, is recalculated.
Step S305: and adding each calculated element value to the target contract template, and generating a text file in a PDF format.
Specifically, the method further comprises:
receiving an expression modification instruction, and determining a target contract element key corresponding to the expression modification instruction;
searching a target element expression corresponding to the target contract element key from the database, and modifying the target element expression according to the expression modification instruction;
and judging whether the element type of the target contract element key is non-variant or not, and if so, deleting the element value of the target contract element key from the Redis cache.
In the embodiment of the present market, the element expression of the contract element key can be dynamically modified in the database, so that the contract element key is not a simple one-to-one replacement operation and is not hard-coded with strong coupling, but can support a dynamic calculation expression with complex logic. In the embodiment, an expandable database is maintained, and the change of the requirement can be adapted in real time.
EXAMPLE III
An embodiment of the present invention provides a device for generating a text file, and as shown in fig. 5, the device specifically includes the following components:
an obtaining module 501, configured to obtain a target text template, and identify a text element included in the target text template; the target text template comprises a plurality of text elements needing element values;
a calculating module 502, configured to obtain element expressions corresponding to each text element in the target text template from a preset database, and calculate an element value of the corresponding text element according to each element expression; wherein each element expression stored in the database can be edited;
a generating module 503, configured to add each calculated element value to the target text template to generate a text file.
Specifically, the calculating module 502 is configured to:
judging whether an element value corresponding to the text element exists in a cache or not aiming at one text element in the target text template; if yes, acquiring the element value from the cache; and if not, acquiring an element expression corresponding to the text element from a preset database.
Furthermore, the calculating module 502 is further configured to:
generating an element calculation script according to a preset script template aiming at an element expression;
in the process of executing the element calculation script, according to the calculation function identification contained in the element calculation script, calling an element calculation function corresponding to the calculation function identification from a preset function library so as to calculate the element value of the text element through the element calculation function.
Further, the generating module 503 is further configured to:
judging whether the element type of the text element is non-variant or not, if so, storing the text element and the element value into the cache;
wherein the element values of the non-modified text elements do not change over a certain period of time.
Still further, the apparatus further comprises:
and the management module is used for periodically deleting all the element values in the cache according to a set time interval.
Furthermore, the apparatus further comprises:
the modification module is used for receiving an expression modification instruction and determining a target text element corresponding to the expression modification instruction; searching a target element expression corresponding to the target text element from the database, and modifying the target element expression according to the expression modification instruction; and judging whether the element type of the target text element is non-variant or not, and if so, deleting the element value of the target text element from the cache.
Example four
The embodiment also provides a computer device, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server or a rack server (including an independent server or a server cluster composed of a plurality of servers) capable of executing programs, and the like. As shown in fig. 6, the computer device 60 of the present embodiment includes at least, but is not limited to: a memory 601, a processor 602 communicatively coupled to each other via a system bus. It should be noted that FIG. 6 only shows the computer device 60 having components 601 and 602, but it should be understood that not all of the shown components are required to be implemented, and that more or fewer components can be implemented instead.
In this embodiment, the memory 601 (i.e., a readable storage medium) includes a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the storage 601 may be an internal storage unit of the computer device 60, such as a hard disk or a memory of the computer device 60. In other embodiments, the memory 601 may also be an external storage device of the computer device 60, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), etc. provided on the computer device 60. Of course, the memory 601 may also include both internal and external storage devices for the computer device 60. In the present embodiment, the memory 601 is generally used for storing an operating system and various types of application software installed in the computer device 60, such as program codes of the apparatus for generating a text file of the second embodiment. In addition, the memory 601 can also be used to temporarily store various types of data that have been output or are to be output.
Processor 602 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 602 is typically used to control the overall operation of the computer device 60.
Specifically, in this embodiment, the processor 602 is configured to execute a program of a method for generating a text file stored in the processor 602, and the program of the method for generating a text file implements the following steps when executed:
acquiring a target text template, and identifying text elements contained in the target text template; the target text template comprises a plurality of text elements needing element values;
respectively acquiring element expressions corresponding to the text elements in the target text template from a preset database, and calculating element values of the corresponding text elements according to each element expression; wherein each element expression stored in the database can be edited;
adding each calculated element value to the target text template to generate a text file.
The specific embodiment process of the above method steps can be referred to in the first embodiment, and the detailed description of this embodiment is not repeated here.
EXAMPLE five
The present embodiments also provide a computer readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, a server, an App application mall, etc., having stored thereon a computer program that when executed by a processor implements the method steps of:
acquiring a target text template, and identifying text elements contained in the target text template; the target text template comprises a plurality of text elements needing element values;
respectively acquiring element expressions corresponding to the text elements in the target text template from a preset database, and calculating element values of the corresponding text elements according to each element expression; wherein each element expression stored in the database can be edited;
adding each calculated element value to the target text template to generate a text file.
The specific embodiment process of the above method steps can be referred to in the first embodiment, and the detailed description of this embodiment is not repeated here.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A method of generating a text file, the method comprising:
acquiring a target text template, and identifying text elements contained in the target text template; the target text template comprises a plurality of text elements needing element values;
respectively acquiring element expressions corresponding to the text elements in the target text template from a preset database, and calculating element values of the corresponding text elements according to each element expression; wherein each element expression stored in the database can be edited;
adding each calculated element value to the target text template to generate a text file.
2. The method of claim 1, wherein the calculating the element value of the corresponding text element according to each element expression specifically comprises:
generating an element calculation script according to a preset script template aiming at an element expression;
in the process of executing the element calculation script, according to the calculation function identification contained in the element calculation script, calling an element calculation function corresponding to the calculation function identification from a preset function library so as to calculate the element value of the text element through the element calculation function.
3. The method for generating a text file according to claim 1, wherein the obtaining element expressions corresponding to the text elements in the target text template from a preset database respectively comprises:
judging whether an element value corresponding to the text element exists in a cache or not aiming at one text element in the target text template; if yes, acquiring the element value from the cache; and if not, acquiring an element expression corresponding to the text element from a preset database.
4. The method of generating a text file according to claim 3, wherein after calculating the element value of the text element, the method further comprises:
judging whether the element type of the text element is non-variant or not, if so, storing the text element and the element value into the cache;
wherein the element values of the non-modified text elements do not change over a certain period of time.
5. The method of generating a text file according to claim 4, wherein the method further comprises:
and periodically deleting all the element values in the cache according to a set time interval.
6. The method of generating a text file according to claim 5, wherein the method further comprises:
receiving an expression modification instruction, and determining a target text element corresponding to the expression modification instruction;
searching a target element expression corresponding to the target text element from the database, and modifying the target element expression according to the expression modification instruction;
and judging whether the element type of the target text element is non-variant or not, and if so, deleting the element value of the target text element from the cache.
7. An apparatus for generating a text file, the apparatus comprising:
the acquisition module is used for acquiring a target text template and identifying text elements contained in the target text template; the target text template comprises a plurality of text elements needing element values;
the calculation module is used for respectively acquiring element expressions corresponding to the text elements in the target text template from a preset database and calculating element values of the corresponding text elements according to the element expressions; wherein each element expression stored in the database can be edited;
and the generating module is used for adding each calculated element value into the target text template to generate a text file.
8. The apparatus for generating a text file according to claim 7, wherein the computing module is specifically configured to:
generating an element calculation script according to a preset script template aiming at an element expression;
in the process of executing the element calculation script, according to the calculation function identification contained in the element calculation script, calling an element calculation function corresponding to the calculation function identification from a preset function library so as to calculate the element value of the text element through the element calculation function.
9. A computer device, the computer device comprising: memory, processor and computer program stored on the memory and executable on the processor, characterized in that the steps of the method according to any of claims 1 to 6 are implemented when the processor executes the program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 6.
CN202010041169.7A 2020-01-15 2020-01-15 Method and device for generating text file, computer equipment and readable storage medium Pending CN111241803A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010041169.7A CN111241803A (en) 2020-01-15 2020-01-15 Method and device for generating text file, computer equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010041169.7A CN111241803A (en) 2020-01-15 2020-01-15 Method and device for generating text file, computer equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN111241803A true CN111241803A (en) 2020-06-05

Family

ID=70872561

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010041169.7A Pending CN111241803A (en) 2020-01-15 2020-01-15 Method and device for generating text file, computer equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN111241803A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112348458A (en) * 2020-10-19 2021-02-09 湖南大唐先一科技有限公司 Process model matching method and system based on business rules
CN112486479A (en) * 2020-11-30 2021-03-12 浙江中控技术股份有限公司 Data acquisition method and device
CN113378515A (en) * 2021-08-16 2021-09-10 宜科(天津)电子有限公司 Text generation system based on production data

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100313119A1 (en) * 2009-06-05 2010-12-09 Microsoft Corporation In-line dynamic text with variable formatting
CN104281447A (en) * 2014-09-01 2015-01-14 国家电网公司 Report form fast generating and issuing system and method
CN106649212A (en) * 2016-09-12 2017-05-10 济南浪潮高新科技投资发展有限公司 Business data processing method and device
CN108520068A (en) * 2018-04-13 2018-09-11 卓易法智(上海)网络科技有限公司 User report generation method, device, storage medium and terminal device
CN109815471A (en) * 2019-01-04 2019-05-28 深圳壹账通智能科技有限公司 Contract text generation method, device, computer equipment and storage medium
CN109933754A (en) * 2019-01-31 2019-06-25 平安科技(深圳)有限公司 Search method, apparatus, computer equipment and the storage medium of change to the contract part

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100313119A1 (en) * 2009-06-05 2010-12-09 Microsoft Corporation In-line dynamic text with variable formatting
CN104281447A (en) * 2014-09-01 2015-01-14 国家电网公司 Report form fast generating and issuing system and method
CN106649212A (en) * 2016-09-12 2017-05-10 济南浪潮高新科技投资发展有限公司 Business data processing method and device
CN108520068A (en) * 2018-04-13 2018-09-11 卓易法智(上海)网络科技有限公司 User report generation method, device, storage medium and terminal device
CN109815471A (en) * 2019-01-04 2019-05-28 深圳壹账通智能科技有限公司 Contract text generation method, device, computer equipment and storage medium
CN109933754A (en) * 2019-01-31 2019-06-25 平安科技(深圳)有限公司 Search method, apparatus, computer equipment and the storage medium of change to the contract part

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112348458A (en) * 2020-10-19 2021-02-09 湖南大唐先一科技有限公司 Process model matching method and system based on business rules
CN112486479A (en) * 2020-11-30 2021-03-12 浙江中控技术股份有限公司 Data acquisition method and device
CN113378515A (en) * 2021-08-16 2021-09-10 宜科(天津)电子有限公司 Text generation system based on production data

Similar Documents

Publication Publication Date Title
CN111241803A (en) Method and device for generating text file, computer equipment and readable storage medium
CN111274045A (en) Multi-platform docking method and device, computer equipment and readable storage medium
CN111414391A (en) Method and system for accessing multiple data sources
CN111858727A (en) Multi-data-source data export system and method based on template configuration
CN113434175A (en) Data processing method, device, storage medium and equipment
CN115712422A (en) Form page generation method and device, computer equipment and storage medium
CN111240772A (en) Data processing method and device based on block chain and storage medium
CN111984674A (en) Method and system for generating structured query language
CN116911572A (en) Page automation assembly method, system, computer equipment and storage medium
CN103838575A (en) Plug-in type page customization implementation method based on EXTJS frame
CN111177099A (en) Data processing method and device of business system, electronic equipment and storage medium
CN116450723A (en) Data extraction method, device, computer equipment and storage medium
CN114625372A (en) Automatic component compiling method and device, computer equipment and storage medium
CN112631719B (en) Data prediction model calling method, device, equipment and storage medium
CN114637672A (en) Automatic data testing method and device, computer equipment and storage medium
CN114816361A (en) Method, device, equipment, medium and program product for generating splicing project
CN110377269B (en) Service approval system collocation method, device and storage medium
CN114169306A (en) Method, device and equipment for generating electronic receipt and readable storage medium
CN111610908B (en) Method for generating frame diagram, computer equipment and readable storage medium
CN111580799A (en) Domain specific language script assembling method and system
CN113448960A (en) Method and device for importing form file
CN113298636B (en) Risk control method, device and system based on simulation resource application
CN110413644B (en) Data caching method, electronic device and computer readable storage medium
KR102449831B1 (en) Electronic device for providing information regarding new text, server for identifying new text and operation method thereof
CN112925523A (en) Object comparison method, device, equipment and computer readable 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