CN110457657B - Method and device for formatting sum field - Google Patents

Method and device for formatting sum field Download PDF

Info

Publication number
CN110457657B
CN110457657B CN201910752788.4A CN201910752788A CN110457657B CN 110457657 B CN110457657 B CN 110457657B CN 201910752788 A CN201910752788 A CN 201910752788A CN 110457657 B CN110457657 B CN 110457657B
Authority
CN
China
Prior art keywords
formatting
amount
type
template
text template
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
CN201910752788.4A
Other languages
Chinese (zh)
Other versions
CN110457657A (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 CN201910752788.4A priority Critical patent/CN110457657B/en
Publication of CN110457657A publication Critical patent/CN110457657A/en
Application granted granted Critical
Publication of CN110457657B publication Critical patent/CN110457657B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/02Banking, e.g. interest calculation or account maintenance

Landscapes

  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Engineering & Computer Science (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Document Processing Apparatus (AREA)
  • Machine Translation (AREA)

Abstract

The invention discloses a method and a device for formatting an amount field, wherein the method comprises the following steps: determining a target text template from the pre-configured text templates; acquiring an amount formatting tag of a target text template; and formatting the monetary field by using a Freemarker template engine according to the monetary formatting type. According to the invention, the amount formatting tag is added in the configured text template, the amount formatting tag comprises an amount formatting type corresponding to the amount field, after the amount formatting tag of the target text template is obtained, the amount field corresponding to the amount formatting type is formatted by using the Freemarker template engine according to the amount formatting type in the amount formatting tag of the target text template, so that a fetch logic is separated from the amount field formatting, the adjustment of the amount formatting type of the text template is dynamically adapted, and the flexibility of the amount field formatting adjustment can be improved.

Description

Method and device for formatting sum field
Technical Field
The invention relates to the technical field of financial document processing, in particular to a method and a device for formatting an amount field.
Background
This section is intended to provide a background or context to the embodiments of the invention that are recited in the claims. The description herein is not admitted to be prior art by inclusion in this section.
Currently, most financial documents in text formats such as report, bill, and receipt, data from the same data source (e.g., amount field) needs to be displayed in different text formats, such as report distribution system format, TXT format, CSV format, XML format, etc. The formats displayed by the same amount field in each format file are sometimes inconsistent, and the amount field in some documents needs to be displayed in a lower case number form, while the amount field in other documents needs to be displayed in a Chinese upper case format, even in English version documents needs to be displayed in an English upper case format.
According to the technical scheme, according to the finally required displayed amount field format, the content of the amount field is formatted in SQL access logic (for obtaining the amount corresponding to the amount field), namely the amount field formatting is completed in the access logic. In view of the fact that the amount field formatting is completed in the fetch logic, if the amount field format is required to be adjusted according to business requirements, the amount field format needs to be redeveloped to meet the requirements, so that adjustment of the amount field formatting has great limitations and constraints, development workload and development cost are greatly increased, and adjustment of the amount field formatting is not flexible enough.
Therefore, the conventional amount field formatting has a problem that adjustment of the amount field formatting is not flexible enough due to completion of the amount field formatting in the fetch logic.
Disclosure of Invention
The embodiment of the invention provides a method for formatting an amount field, which is used for improving the flexibility of formatting adjustment of the amount field, and comprises the following steps:
determining a target text template from the pre-configured text templates; the pre-configured text templates comprise an amount formatting tag; the amount formatting label at least comprises an amount field and an amount formatting type corresponding to the amount field; the target text template comprises a first text template and a second text template;
acquiring an amount formatting tag of a target text template;
according to the amount formatting type in the amount formatting tag of the target text template, formatting an amount field corresponding to the amount formatting type by using a Freemarker template engine;
the target text template comprises a first text template and a second text template, and the method for obtaining the amount formatting tag of the target text template comprises the following steps:
acquiring an amount formatting tag of a first text template and an amount formatting tag of a second text template;
Correspondingly, according to the amount formatting type in the amount formatting tag of the target text template, formatting an amount field corresponding to the amount formatting type by using a Freemarker template engine, including:
according to the amount formatting type in the amount formatting tag of the first text template, formatting an amount field corresponding to the amount formatting type in the first text template by using a Freemarker template engine;
according to the amount formatting type in the amount formatting tag of the second text template, formatting an amount field corresponding to the amount formatting type in the second text template by using a Freemarker template engine;
the amount field corresponding to the amount formatting type in the first text template and the amount field corresponding to the amount formatting type in the second text template are the same amount field.
The embodiment of the invention also provides a device for formatting the money field, which is used for improving the flexibility of formatting adjustment of the money field, and comprises the following steps:
the text template determining module is used for determining a target text template from pre-configured text templates; the pre-configured text templates comprise an amount formatting tag; the amount formatting label at least comprises an amount field and an amount formatting type corresponding to the amount field; the target text template comprises a first text template and a second text template;
The formatted label acquisition module is used for acquiring the amount formatted label of the target text template;
the formatting module is used for formatting an amount field corresponding to the amount formatting type by using a Freemarker template engine according to the amount formatting type in the target text template amount formatting tag;
the formatted label acquisition module comprises an acquisition unit, and the formatting module comprises a first formatting unit and a second formatting unit;
the acquiring unit is used for acquiring the amount formatting tag of the first text template and the amount formatting tag of the second text template;
correspondingly, the formatting module comprises:
the first formatting unit is used for formatting an amount field corresponding to the amount formatting type in the first text template by using a Freemarker template engine according to the amount formatting type in the amount formatting tag of the first text template;
the second formatting unit is used for formatting an amount field corresponding to the amount formatting type in the second text template by using a Freemarker template engine according to the amount formatting type in the amount formatting tag of the second text template;
the amount field corresponding to the amount formatting type in the first text template and the amount field corresponding to the amount formatting type in the second text template are the same amount field.
The embodiment of the invention also provides computer equipment, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor realizes the method for formatting the monetary field when executing the computer program.
The embodiment of the invention also provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program for executing the method for formatting the sum field.
According to the embodiment of the invention, the amount formatting tag is added in the configured text template, the amount formatting tag comprises an amount formatting type corresponding to the amount field, after the amount formatting tag of the target text template is obtained, the amount field corresponding to the amount formatting type is formatted by using the Freemarker template engine according to the amount formatting type in the amount formatting tag of the target text template, so that a fetch logic is separated from the amount field formatting, the adjustment of the amount formatting type of the text template is dynamically adapted on the premise of not changing the fetch logic, the flexibility of the amount field formatting adjustment can be greatly improved, and meanwhile, the development workload and the development cost can be greatly reduced.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art. In the drawings:
FIG. 1 is a flowchart of a method for formatting an amount field according to an embodiment of the present invention;
FIG. 2 is a flowchart of another implementation of a method for formatting an amount field according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating an implementation of step 103 in a method for formatting an amount field according to an embodiment of the present invention;
FIG. 4 is a flowchart of another implementation of the method for formatting an amount field according to an embodiment of the present invention;
FIG. 5 is a functional block diagram of an apparatus for formatting an amount field according to an embodiment of the present invention;
FIG. 6 is a functional block diagram of a format module 503 in an apparatus for formatting an amount field according to an embodiment of the present invention;
FIG. 7 is a functional block diagram of an apparatus for formatting an amount field according to an embodiment of the present invention;
Fig. 8 is a functional block diagram of an apparatus for formatting an amount field according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the embodiments of the present invention will be described in further detail with reference to the accompanying drawings. The exemplary embodiments of the present invention and their descriptions herein are for the purpose of explaining the present invention, but are not to be construed as limiting the invention.
Fig. 1 shows a flow of implementation of the method for formatting an amount field according to the embodiment of the present invention, and for convenience of description, only the portions related to the embodiment of the present invention are shown, which are described in detail below:
as shown in fig. 1, a method for formatting an amount field includes:
step 101, determining a target text template from pre-configured text templates; the pre-configured text templates comprise an amount formatting tag; the amount formatting label at least comprises an amount field and an amount formatting type corresponding to the amount field;
102, acquiring an amount formatting tag of a target text template;
and 103, formatting an amount field corresponding to the amount formatting type by using a Freemarker template engine according to the amount formatting type in the target text template amount formatting tag.
The Freemarker template engine is a generic tool for generating output text (HTML web pages, emails, configuration files, source code, etc.) based on templates and data to be changed. The output text includes presentation text (pages) of different format types for presenting the data to be presented.
For a banking industry system, according to a pre-configured text template, the Freemarker template engine is utilized to generate display texts with different format types, wherein the display texts with different format types comprise forms such as report forms or bills with different formats. It will be appreciated by those skilled in the art that the presentation text may also include forms other than those described above, such as, for example, a receipt, etc., to which embodiments of the present invention are not limited in particular.
The applicant finds that the process of formatting the amount field in the prior art is completed in the fetch logic, which results in great limitation on adjustment of the formatting of the amount field, and inflexibility of adjustment. In view of this, the applicant separates the process of formatting the money field from the fetch logic (obtaining the money corresponding to the money field), and adds the function of the money formatting tag in the text template, where the money formatting tag includes the money formatting type corresponding to the money field, so as to dynamically adapt to the adjustment of the money formatting type of the text template without changing the fetch logic, and greatly improve the flexibility of the formatting adjustment of the money field.
Specifically, the text template and the amount formatting tags in the text template are configured in advance before amount formatting is performed, so that the text template and the amount formatting tags can be used later. For a description of this portion, reference should be made specifically to the description of the related embodiments portion, and detailed description thereof will not be provided here. Note that the amount formatting tag in the text template supports formatting of money that is popular internationally. Here, the amount formatting means that the amount is displayed in a standardized and normalized form, etc.
After the text templates and the amount formatting labels thereof are configured, and the amount field is formatted, firstly, determining a required target text template from the pre-configured text templates. Specifically, the target text template may be selected from the pre-configured text templates, for example, by receiving a text template selection instruction, or may be selected from the pre-configured text templates by a preset logic rule, for example, according to a time sequence, or according to a priority ranking of the text templates, or the like. The amount formatting label of each text template comprises an amount field and an amount formatting type corresponding to the amount field.
And acquiring the amount formatting tag of the target text template after determining the target text template in view of the amount formatting type corresponding to the amount field which is preconfigured in the amount formatting tag of the text template, so as to determine the amount formatting type corresponding to the amount field in the amount formatting tag of the target text template.
After the amount formatting type corresponding to the amount field is obtained from the amount formatting tag of the target text template, the amount field is formatted according to the amount formatting type corresponding to the amount field in the amount formatting tag by using a Freemarker template engine, so that the display text meeting the requirements is obtained. The display text displays at least the amount corresponding to the amount field after the amount field is formatted.
In the embodiment of the invention, the amount formatting tag is added in the configured text template, the amount formatting tag comprises an amount formatting type corresponding to the amount field, after the amount formatting tag of the target text template is obtained, the amount field corresponding to the amount formatting type is formatted by using the Freemarker template engine according to the amount formatting type in the amount formatting tag of the target text template, so that a fetch logic is separated from the amount field formatting, the adjustment of the amount formatting type of the text template is dynamically adapted on the premise of not changing the fetch logic, the flexibility of the amount field formatting adjustment can be greatly improved, and meanwhile, the development workload and the development cost can be greatly reduced.
Fig. 2 shows another implementation flow of the method for formatting an amount field according to the embodiment of the present invention, and for convenience of description, only the portion relevant to the embodiment of the present invention is shown, which is described in detail below:
in an embodiment of the present invention, as shown in fig. 2, the method for formatting the monetary field based on the steps of the method further includes:
step 201, configuring a text template and an amount formatting tag according to the received configuration instruction.
When using a text template, the text template and its amount formatting tags need to be configured. When configuring the amount formatting tag of the text template, the amount formatting tag at least comprises the following parameters: an amount field and an amount formatting type corresponding to the amount field. In the embodiment of the invention, the configured text templates can be summarized to form a text template library, and the text templates in the text template library are continuously modified, added or deleted in the subsequent business development process so as to continuously update the file text template library.
When the text template and the amount formatting label thereof are configured as required, for example, the text template and the amount formatting label thereof can be configured according to the requirement of business development, or according to the frequent use degree of the text template, or according to the requirement of individuation and customization of clients, and the like, and the flexibility of the amount field formatting adjustment can be improved.
For a banking industry system, when configuring a text template and an amount formatting label thereof, a configuration or management personnel needs to have certain management and configuration authority so as to ensure the security of text template data. Meanwhile, in order to further improve the safety and flexibility of the configuration text template, the configuration authority of the configuration personnel can be divided into high, medium and low configuration authorities, for example. Likewise, a certain authority can be set and divided for the modification action of the text template, so that the safety of the text template data is ensured.
In the embodiment of the invention, the text template and the amount formatting label thereof are configured according to the received configuration instruction, so that the text template and the amount formatting label thereof can be flexibly configured as required, and the flexibility of the amount field formatting adjustment is further improved.
In an embodiment of the present invention, on the basis of the above method steps, the method for formatting an amount field further includes:
and modifying the text template and the amount formatting tag according to the received configuration modification instruction.
In practice, the applicant finds that the text template needs to be updated and adjusted in time according to the requirements of business development or the use frequency of the text template and the requirements of individuation and customization of clients. For example, it may be necessary to expand the text template and add a new text template; it may also be desirable to adjust (e.g., add, delete, or modify, etc.) the content or parameters of the amount formatting tags in existing text templates, or it may be desirable to delete some out-of-date text templates, etc. Thus, in an embodiment of the present invention, the configuration modification instruction includes at least: a text template adding instruction, a text template deleting instruction and a text template content adjusting instruction. Text template content adjustment instructions such as additional inserts or alternative modifications.
Therefore, in order to further improve the flexibility of the amount field formatting adjustment, the amount field formatting has strong expandability, enriches the amount field formatting function, and can modify the configured text template by receiving the configuration modification instruction, namely, modify the text template and the amount formatting label thereof according to the received configuration modification instruction.
In the embodiment of the invention, the text template and the amount formatting label thereof are modified according to the received configuration modification instruction, so that the flexibility of amount field formatting modification can be improved, and the amount field formatting has strong expandability.
Fig. 3 shows another implementation flow of the method for formatting an amount field according to the embodiment of the present invention, and for convenience of description, only the portion relevant to the embodiment of the present invention is shown, which is described in detail below:
in an embodiment of the present invention, the money amount formatted tag further includes a money amount currency parameter corresponding to the money amount field. As shown in fig. 3, step 103, according to the amount formatting type in the target text template amount formatting tag, using a freemaker template engine to format an amount field corresponding to the amount formatting type, includes:
Step 301, according to the amount formatting type and the amount currency parameter in the target text template amount formatting tag, formatting an amount field corresponding to the amount formatting type and the amount currency parameter by using a Freemarker template engine.
In order to enrich the comprehensiveness of the display text display content, the amount formatting tag may further include an amount currency parameter corresponding to the amount field. The money type parameter reflects a money type corresponding to the money field, such as rmb, dollar, korean, japanese, new, and lub.
At this time, when the Freemarker template engine is used for formatting the money fields, the money field formatting operation is required to be performed on the money fields corresponding to the two by referring to the money formatting type and the money currency parameter in the money formatting tag. In the display text obtained after the Freemarker template engine is used for carrying out the formatting of the money fields, at least the display money, the currency and the money formatting type are needed, so that the comprehensiveness of the display text content generated after the Freemarker template engine is formatted can be enriched and improved.
According to the method and the device for displaying the text content, according to the amount formatting type and the amount currency parameters in the target text template amount formatting tag, the Freemarker template engine is utilized to format the amount fields corresponding to the amount formatting type and the amount currency parameters, and therefore the comprehensiveness of the displayed text content generated after the Freemarker template engine is formatted can be improved.
In one embodiment of the present invention, the amount formatting type corresponding to the amount field includes a write-down digital formatting type. Step 301, according to the amount formatting type and the amount currency parameter in the target text template amount formatting tag, using a freemaker template engine to format an amount field corresponding to the amount formatting type and the amount currency parameter, including:
the steps are as follows: and according to the format type of the lower-case digital and the monetary currency parameter in the monetary format label of the target text template, performing lower-case digital formatting on the monetary fields corresponding to the format type of the lower-case digital and the monetary currency parameter by using a Freemarker template engine.
Whereas the amount is generally represented by a uniform Arabic number when formatted (it will be understood by those skilled in the art that other types of numbers besides the Arabic numbers described above may be used, and for ease of description and discussion, the default amount is represented by a uniform Arabic number when formatted), at this time, there is no need to distinguish between different types of languages.
Therefore, in order to improve the efficiency of formatting the money field, the same unified text template can be adopted for the money field formatting type which is a lowercase digital format type, so that when the lowercase digital format is carried out, the text template is directly used for formatting by using a Freemarker template engine to generate a display text, and the efficiency of formatting the money field can be greatly improved.
In the embodiment of the invention, according to the format type and the currency parameter of the small-writing digital in the currency format label of the target text template, the Freemarker template engine is utilized to format the small-writing digital in the currency field corresponding to the format type and the currency parameter of the small-writing digital, and in view of the fact that the format type of the small-writing digital is represented by a uniform Arabic number, a uniform text template can be adopted, so that the formatting efficiency of the currency field can be improved.
In an embodiment of the present invention, the amount format type corresponding to the amount field includes a capital format type, and the amount format tag further includes a language type corresponding to the amount field. Step 301, according to the amount formatting type and the amount currency parameter in the target text template amount formatting tag, using a freemaker template engine to format an amount field corresponding to the amount formatting type and the amount currency parameter, including:
and formatting the capitalization type, the language type corresponding to the amount field and the amount field corresponding to the amount currency parameter by using a Freemarker template engine according to the capitalization type, the language type corresponding to the amount field and the amount currency parameter in the target text template amount formatting tag.
In practice, the applicant has found that when capitalizing the amount field using the freemaker template engine, the content presented for different language types of presentation text is different, e.g., the chinese capitalization is different from the english capitalization. Therefore, in the embodiment of the invention, the applicant further expands the money format label, namely adds the language type corresponding to the money field into the money format label, and formats the corresponding money field based on the capitalization format type in the money format label, the language type corresponding to the money field, the money type parameter and the like when the Freemarker template engine is used for formatting the money field, so that the richness and the diversity of the money field formatting function are improved.
According to the method and the device for formatting the money fields, according to the capitalization type, the language type corresponding to the money fields and the money type parameters in the money formatting label of the target text template, the Freemarker template engine is utilized to format the money fields corresponding to the capitalization type, the language type corresponding to the money fields and the money type parameters, the formatting of the money fields of different language types can be enriched, and the richness and the diversity of the money field formatting function are improved.
In an embodiment of the present invention, the method for formatting the money field further includes, based on the steps of the method, the steps of:
and configuring the language type corresponding to the amount field in the text template amount formatting tag according to the received configuration instruction.
The language type corresponding to the configured amount field is similar to that of the configured text template amount formatted label, and this part can be specifically referred to the description of the related embodiment part of the configured text template amount formatted label, which is not described in detail herein.
In an embodiment of the present invention, the method for formatting the money field further includes, based on the steps of the method, the steps of:
and modifying the language type corresponding to the amount field in the text template amount formatting tag according to the received configuration modification instruction.
The language type corresponding to the modified amount field is similar to that of the modified text template amount formatting tag, and this section may be specifically referred to the description of the related embodiment section of the modified text template amount formatting tag, which is not described in detail herein.
In an embodiment of the present invention, an amount format type corresponding to an amount field in the target text template amount format tag includes a first format type and a second format type corresponding to the same amount field, and the first format type and the second format type are different. Step 103, according to the amount formatting type in the target text template amount formatting tag, formatting an amount field corresponding to the amount formatting type by using a Freemarker template engine, including:
And according to the first formatting type and the second formatting type in the target text template amount formatting tag, formatting the same amount field corresponding to the first formatting type and the second formatting type by using a Freemarker template engine.
The applicant has further found through further research and practice that, in the display text which is finally generated by formatting by using the freemaker template engine, different format types of the same amount field need to be displayed simultaneously, for example, small-writing digital formatting and Chinese capitalization formatting of the same amount data are displayed in the same display text.
Therefore, in order to solve the above-mentioned problem, the applicant creatively configures two different types of amount formatting types in the same text template amount formatting tag, and the two different types of amount formatting types correspond to the same amount field. Therefore, when the Freemarker template engine is utilized to format the monetary field to generate a presentation text, the monetary field can be respectively formatted according to the first formatting type and the second formatting type of different types in the text template, so that different monetary formatting results of the same monetary field are simultaneously displayed in the same presentation text, the monetary field formatting function is enriched, and the application range of monetary field formatting is expanded.
In addition, for two different types of amount formatting types in the same text template amount formatting tag, the amount formatting types can be preconfigured, and can be modified and adjusted by receiving a modification instruction after configuration, so that the flexibility of text template configuration is further improved.
According to the method and the device for formatting the same amount field in the text template, according to the first formatting type and the second formatting type in the target text template amount formatting tag, the Freemarker template engine is utilized to format the same amount field corresponding to the first formatting type and the second formatting type respectively, different formatting types of the same amount field can be displayed in one display text generated after the Freemarker template engine is formatted, the function of formatting the amount field is enriched, and the application range of formatting the amount field is expanded.
Fig. 4 shows a further implementation flow of the method for formatting an amount field according to the embodiment of the present invention, and for convenience of description, only the portion relevant to the embodiment of the present invention is shown, which is described in detail below:
in one embodiment of the present invention, the target text template includes a first text template and a second text template. As shown in fig. 4, step 102, obtaining an amount formatted label of a target text template includes:
Step 401, acquiring an amount formatting tag of a first text template and an amount formatting tag of a second text template;
correspondingly, step 103, according to the amount formatting type in the target text template amount formatting tag, uses the Freemarker template engine to format an amount field corresponding to the amount formatting type, including:
step 402, according to the amount formatting type in the amount formatting tag of the first text template, formatting an amount field corresponding to the amount formatting type in the first text template by using a Freemarker template engine;
step 403, according to the amount formatting type in the amount formatting tag of the second text template, formatting an amount field corresponding to the amount formatting type in the second text template by using a Freemarker template engine;
the amount field corresponding to the amount formatting type in the first text template and the amount field corresponding to the amount formatting type in the second text template are the same amount field.
The applicant has further studied and practiced that when the freemaker template engine is sometimes used for formatting the amount field, the amount field may need to be displayed in the same or different formatting types in display texts with different formats, for example, small-written word formatting and Chinese uppercase formatting of the same amount data in display texts with different formats, or small-written word formatting of the same amount data in display texts with different formats, and the like.
Therefore, in order to solve the above-mentioned problems, the applicant creatively configures two types of amount formatting of the same type or different types in different text template amount formatting tags, and the two types of amount formatting correspond to the same amount field. In this way, when the Freemarker template engine is utilized to perform the formatting of the money fields to generate the display texts with different formats, the money formatting types in the money formatting labels of the different text templates can be respectively formatted for the money fields corresponding to the money formatting types in the different text templates so as to generate the display texts with different formats, thereby realizing the same or different money formatting results of the same money field respectively displayed in the display texts with different formats, further enriching the function of formatting the money fields, and further expanding the application range of the formatting of the money fields.
In the embodiment of the invention, an amount formatting tag of a first text template and an amount formatting tag of a second text template are obtained, an amount field corresponding to the amount formatting type in the first text template is formatted by using a Freemarker template engine according to the amount formatting type in the first text template, and an amount field corresponding to the amount formatting type in the second text template is formatted by using a Freemarker template engine according to the amount formatting type in the second text template. Aiming at the same amount field, the embodiment of the invention can display the formatting types of the same amount field (same or different) in the display texts with different formats generated after the Freemarker template engine formats, further enriches the function of formatting the amount field and further expands the application range of formatting the amount field.
The embodiment of the invention also provides a device for formatting the money field, which is described in the following embodiment. Since the principle of solving the problem by these devices is similar to that of formatting the amount field, the implementation of these devices can refer to the implementation of the method, and the repetition is not repeated.
Fig. 5 shows functional modules of an apparatus for formatting an amount field according to an embodiment of the present invention, and for convenience of explanation, only parts related to the embodiment of the present invention are shown in detail as follows:
referring to fig. 5, each module included in the device for formatting an amount field is configured to execute each step in the corresponding embodiment of fig. 1, and detailed descriptions of fig. 1 and the corresponding embodiment of fig. 1 are omitted herein. In the embodiment of the present invention, the device for formatting the amount field includes a text template determining module 501, a format label obtaining module 502, and a formatting module 503.
A text template determination module 501 for determining a target text template from pre-configured text templates; the pre-configured text templates comprise an amount formatting tag; the amount formatting tag at least comprises an amount field and an amount formatting type corresponding to the amount field.
A formatted label acquisition module 502, configured to acquire an amount formatted label of the target text template;
and the formatting module 503 is configured to format an amount field corresponding to the amount formatting type by using the freepack template engine according to the amount formatting type in the target text template amount formatting tag.
In the embodiment of the invention, an amount formatting tag is added in the configured text template, the amount formatting tag comprises an amount formatting type corresponding to an amount field, after the amount formatting tag of the target text template is acquired by the formatting tag acquisition module 502, the formatting module 503 formats the amount field corresponding to the amount formatting type by using a Freemarker template engine according to the amount formatting type in the amount formatting tag of the target text template, so that a fetch logic is separated from the amount field formatting, and the adjustment of the amount formatting type of the text template is dynamically adapted on the premise that the fetch logic is not changed, so that the flexibility of the amount field formatting adjustment can be greatly improved, and the development workload and development cost can be greatly reduced.
Fig. 6 shows another functional module of the apparatus for formatting an amount field according to an embodiment of the present invention, and for convenience of explanation, only a portion related to the embodiment of the present invention is shown in detail as follows:
In an embodiment of the present invention, referring to fig. 6, each module included in the apparatus for formatting an amount field is used to perform each step in the corresponding embodiment of fig. 2, and detailed descriptions in fig. 2 and the corresponding embodiment of fig. 2 are omitted herein. In the embodiment of the present invention, on the basis of the above functional modules, the device for formatting the monetary field further includes a configuration module 601.
The configuration module 601 is configured to configure the text template and the amount formatted tag thereof according to the received configuration instruction.
In the embodiment of the invention, the configuration module 601 configures the text template and the amount formatting tag thereof according to the received configuration instruction, and can flexibly configure the text template and the amount formatting tag thereof according to the requirement, thereby further improving the flexibility of the amount field formatting adjustment.
In an embodiment of the present invention, the device for formatting the monetary field further includes a configuration modification module based on the above functional module.
And the configuration modification module is used for modifying the text template and the amount formatting tag thereof according to the received configuration modification instruction.
In the embodiment of the invention, the configuration modification module modifies the text template and the amount formatting label thereof according to the received configuration modification instruction, so that the flexibility of amount field formatting modification can be improved, and the amount field formatting has strong expandability.
Fig. 7 shows a schematic structural diagram of a formatting module 503 in an apparatus for formatting an amount field according to an embodiment of the present invention, and for convenience of explanation, only a portion related to the embodiment of the present invention is shown, which is described in detail below:
in an embodiment of the present invention, the money amount formatted tag further includes a money amount currency parameter corresponding to the money amount field. Referring to fig. 7, the formatting module 503 includes various units for performing various steps in the corresponding embodiment of fig. 3, and detailed descriptions of fig. 3 and the corresponding embodiment of fig. 3 are omitted herein. In an embodiment of the present invention, the formatting module 503 includes a formatting unit 701.
And a formatting unit 701, configured to format an amount field corresponding to the amount formatting type and the amount currency parameter by using a freename template engine according to the amount formatting type and the amount currency parameter in the target text template amount formatting tag.
In the embodiment of the present invention, the formatting unit 701 formats the monetary fields corresponding to the monetary formatting type and monetary parameters by using the freename template engine according to the monetary formatting type and monetary parameters in the monetary formatting tag of the target text template, so as to improve the comprehensiveness of the display text content generated after the freename template engine formats.
In one embodiment of the present invention, the amount formatting type corresponding to the amount field includes a write-down digital formatting type. The formatting module 503 includes a write-down digital formatting unit.
And the lower-case digital formatting unit is used for performing lower-case digital formatting on the amount fields corresponding to the lower-case digital formatting type and the amount currency parameters by using the Freemarker template engine according to the lower-case digital formatting type and the amount currency parameters in the target text template amount formatting tag.
In the embodiment of the invention, the small-writing digital formatting unit performs small-writing digital formatting on the amount field corresponding to the small-writing digital formatting type and the amount currency parameter by using the Freemarker template engine according to the small-writing digital formatting type and the amount currency parameter in the target text template amount formatting tag, and the small-writing digital formatting type adopts unified Arabic numerals to express and can adopt unified text templates, so that the efficiency of formatting the amount field can be improved.
In an embodiment of the present invention, the amount format type corresponding to the amount field includes a capital format type, and the amount format tag further includes a language type corresponding to the amount field. The formatting module 503 includes a capitalization formatting unit.
And the capitalization formatting unit is used for formatting the capitalization type, the language type corresponding to the amount field and the amount field corresponding to the amount currency parameter by using the Freemarker template engine according to the capitalization type, the language type corresponding to the amount field and the amount currency parameter in the target text template amount formatting tag.
In the embodiment of the invention, the capitalization formatting unit formats the capitalization formatting type, the language type corresponding to the amount field and the amount field corresponding to the amount field by using the Freemarker template engine according to the capitalization formatting type, the language type corresponding to the amount field and the amount field parameters in the target text template amount formatting tag, so that the formatting of the amount field of different language types can be enriched, and the richness and the diversity of the amount field formatting are improved.
In an embodiment of the present invention, an amount format type corresponding to an amount field in the target text template amount format tag includes a first format type and a second format type corresponding to the same amount field, and the first format type and the second format type are different. The formatting module 503 includes separate formatting units.
And the formatting unit is used for formatting the same amount field corresponding to the first formatting type and the second formatting type by using the Freemarker template engine according to the first formatting type and the second formatting type in the target text template amount formatting tag.
In the embodiment of the invention, the formatting unit respectively formats the same amount field corresponding to the first formatting type and the second formatting type by using the Freemarker template engine according to the first formatting type and the second formatting type in the target text template amount formatting tag, so that different formatting types of the same amount field can be simultaneously displayed in one display text generated after the Freemarker template engine is formatted, the function of formatting the amount field is enriched, and the application range of formatting the amount field is enlarged.
Fig. 8 shows still another functional module of the apparatus for formatting an amount field according to an embodiment of the present invention, and for convenience of explanation, only a portion related to the embodiment of the present invention is shown in detail as follows:
in one embodiment of the present invention, the target text template includes a first text template and a second text template. Referring to fig. 8, each module included in the apparatus for formatting an amount field is configured to execute each step in the corresponding embodiment of fig. 4, and specifically please refer to fig. 4 and the related description in the corresponding embodiment of fig. 4, which are not repeated herein. In the embodiment of the present invention, the obtaining module 502 includes an obtaining unit 801, and the formatting module 503 includes a first formatting unit 802 and a second formatting unit 803.
An obtaining unit 801, configured to obtain an amount formatting tag of the first text template and an amount formatting tag of the second text template.
Accordingly, the formatting module 503 includes:
the first formatting unit 802 is configured to format an amount field corresponding to the amount formatting type in the first text template by using a freepack template engine according to the amount formatting type in the amount formatting tag of the first text template.
And a second formatting unit 803, configured to format an amount field corresponding to the amount format type in the second text template by using the freepack template engine according to the amount format type in the second text template amount format tag.
The amount field corresponding to the amount formatting type in the first text template and the amount field corresponding to the amount formatting type in the second text template are the same amount field.
In the embodiment of the invention, the obtaining unit 801 obtains the amount formatting tag of the first text template and the amount formatting tag of the second text template, the first formatting unit 802 formats the amount field corresponding to the amount formatting type in the first text template by using the Freemarker template engine according to the amount formatting type in the first text template, and the second formatting unit 803 formats the amount field corresponding to the amount formatting type in the second text template by using the Freemarker template engine according to the amount formatting type in the second text template.
The following briefly illustrates the parameters and configuration of the amount formatting tags in the text template to more clearly illustrate the basic principles and functions of the present invention:
the amount formatted label may be represented by, for example, curfmt, and its parameters are as follows:
amt: the amount field corresponds to the amount field name in the record set;
cur: an amount currency parameter corresponding to the amount field;
type: an amount formatting type corresponding to the amount field; for example FG denotes a lower case digitization format type, CN denotes a chinese upper case format type, EN denotes an english upper case format type;
the language type corresponding to the amount field is only used in the capitalization format type, and the parameters and configuration are similar to those described above, and will not be described in detail here.
(1) Examples of the amount formatted label in the text template are as follows:
<@curfmt amt="detail.AMOUNT"cur="detail.CURCDE"type="FG"/>;
the meaning of the money format label is that the detail record is concentrated to the money corresponding to the CURCDE money type parameter and the money corresponding to the AMOUNT money field, and the lower case digital format type is adopted to display in the generated display text.
If a field in the report sets the above example, the record set has a detail value of 45678.89 and a detail value of USD, the value of the field in the presentation text is: USD45,678.89.
If a field in the report sets the above example, the record set detail value is 45678.89, the detail value is CAD, and the field shows the following values: CAD45,678.89.
(2)<@curfmt amt="detail.AMOUNT"cur="detail.CURCDE"type="CN"/>
The meaning of the money format label is that the money corresponding to the money format label by CURCDE and the money corresponding to the AMOUNT money field are displayed in the generated display text by adopting a Chinese capitalization format type.
If a field in the report sets the above example, the record set has a detail value of 45678.89 and a detail value of USD, the value of the field in the presentation text is: dollar wang Wu Qianliu Bai-Qi-up eight-element Jiuzhu.
If a field in the report sets the above example, the record set detail value is 45678.89, the detail value is CAD, and the value displayed in the display text is: baqi is picked up by baqi wang Wu Qianliu herb-ten, and baqi is picked up by baqi.
(3)<@curfmt amt="detail.AMOUNT"cur="detail.CURCDE"type="EN"/>
The meaning of the money format label is that the detail record is concentrated to use the money corresponding to the CURCDE money type parameter and the money corresponding to the AMOUNT money field, and the English capital format type is adopted to display in the generated display text.
If a field in the report sets the above example, the record set has a detail value of 45678.89 and a detail value of USD, the value of the field in the presentation text is: SAY US DOLLARS FORTY-FIVE THOUSAND, SIX HUNDRED SEVENTY-EIGHT AND CENTS EIGHTY-NINE ONLY.
If a field in the report sets the above example, the record set detail value is 45678.89, the detail value is CAD, and the value displayed in the display text is: SAY CANADIAN DOLLARS FORTY-FIVE THOUSAND, SIX HUNDRED SEVENTY-EIGHT AND CENTS EIGHTY-NINE ONLY.
The embodiment of the invention also provides computer equipment, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor realizes the method for formatting the monetary field when executing the computer program.
The embodiment of the invention also provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program for executing the method for formatting the sum field.
In summary, in the embodiment of the present invention, an amount formatting tag is added to a configured text template, where the amount formatting tag includes an amount formatting type corresponding to an amount field, after the amount formatting tag of a target text template is obtained, according to the amount formatting type in the amount formatting tag of the target text template, a freemaker template engine is used to format an amount field corresponding to the amount formatting type, so that a fetch logic is separated from an amount field formatting, and on the premise that the fetch logic is not changed, the adjustment of the amount formatting type of the text template is dynamically adapted, so that the flexibility of the amount field formatting adjustment can be greatly improved, and meanwhile, development workload and development cost can be greatly reduced.
It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The foregoing description of the embodiments has been provided for the purpose of illustrating the general principles of the invention, and is not meant to limit the scope of the invention, but to limit the invention to the particular embodiments, and any modifications, equivalents, improvements, etc. that fall within the spirit and principles of the invention are intended to be included within the scope of the invention.

Claims (9)

1. A method of formatting an amount field, comprising:
determining a target text template from the pre-configured text templates; the pre-configured text templates comprise an amount formatting tag; the amount formatting label at least comprises an amount field and an amount formatting type corresponding to the amount field; the target text template comprises a first text template and a second text template;
acquiring an amount formatting tag of a target text template;
according to the amount formatting type in the amount formatting tag of the target text template, formatting an amount field corresponding to the amount formatting type by using a Freemarker template engine;
acquiring an amount formatting tag of a target text template, including:
acquiring an amount formatting tag of a first text template and an amount formatting tag of a second text template;
correspondingly, according to the amount formatting type in the amount formatting tag of the target text template, formatting an amount field corresponding to the amount formatting type by using a Freemarker template engine, including:
according to the amount formatting type in the amount formatting tag of the first text template, formatting an amount field corresponding to the amount formatting type in the first text template by using a Freemarker template engine;
According to the amount formatting type in the amount formatting tag of the second text template, formatting an amount field corresponding to the amount formatting type in the second text template by using a Freemarker template engine;
the amount field corresponding to the amount formatting type in the first text template and the amount field corresponding to the amount formatting type in the second text template are the same amount field.
2. The method as recited in claim 1, further comprising:
and configuring the text template and the amount formatting tag according to the received configuration instruction.
3. The method of claim 1, wherein the money formatting tag further includes a money currency parameter corresponding to a money field, and formatting the money field corresponding to the money formatting type using a freemaker template engine according to the money formatting type in the target text template money formatting tag comprises:
and formatting the money fields corresponding to the money formatting type and the money currency parameters by using a Freemarker template engine according to the money formatting type and the money currency parameters in the money formatting tag of the target text template.
4. The method of claim 3, wherein the amount formatting type corresponding to the amount field includes a lower case digital formatting type, and formatting the amount field corresponding to the amount formatting type and the amount currency parameter with the freemaker template engine according to the amount formatting type and the amount currency parameter in the target text template amount formatting tag includes:
And according to the format type of the lower-case digital and the monetary currency parameter in the monetary format label of the target text template, performing lower-case digital formatting on the monetary fields corresponding to the format type of the lower-case digital and the monetary currency parameter by using a Freemarker template engine.
5. The method of claim 3, wherein the amount formatting type corresponding to the amount field includes a capital formatting type and the amount formatting tag further includes a language type corresponding to the amount field; according to the amount formatting type and the amount currency parameter in the target text template amount formatting tag, formatting an amount field corresponding to the amount formatting type and the amount currency parameter by using a Freemarker template engine, including:
and formatting the capitalization type, the language type corresponding to the amount field and the amount field corresponding to the amount currency parameter by using a Freemarker template engine according to the capitalization type, the language type corresponding to the amount field and the amount currency parameter in the target text template amount formatting tag.
6. The method of claim 1, wherein the amount formatting type corresponding to the amount field in the target text template amount formatting tag includes a first formatting type and a second formatting type corresponding to the same amount field, and the first formatting type and the second formatting type are different, and formatting the amount field corresponding to the amount formatting type by using a freemaker template engine according to the amount formatting type in the target text template amount formatting tag includes:
And according to the first formatting type and the second formatting type in the target text template amount formatting tag, formatting the same amount field corresponding to the first formatting type and the second formatting type by using a Freemarker template engine.
7. An apparatus for formatting an amount field, comprising:
the text template determining module is used for determining a target text template from pre-configured text templates; the pre-configured text templates comprise an amount formatting tag; the amount formatting label at least comprises an amount field and an amount formatting type corresponding to the amount field; the target text template comprises a first text template and a second text template;
the formatted label acquisition module is used for acquiring the amount formatted label of the target text template;
the formatting module is used for formatting an amount field corresponding to the amount formatting type by using a Freemarker template engine according to the amount formatting type in the target text template amount formatting tag;
the formatted label acquisition module comprises an acquisition unit, and the formatting module comprises a first formatting unit and a second formatting unit;
the acquiring unit is used for acquiring the amount formatting tag of the first text template and the amount formatting tag of the second text template;
Correspondingly, the formatting module comprises:
the first formatting unit is used for formatting an amount field corresponding to the amount formatting type in the first text template by using a Freemarker template engine according to the amount formatting type in the amount formatting tag of the first text template;
the second formatting unit is used for formatting an amount field corresponding to the amount formatting type in the second text template by using a Freemarker template engine according to the amount formatting type in the amount formatting tag of the second text template;
the amount field corresponding to the amount formatting type in the first text template and the amount field corresponding to the amount formatting type in the second text template are the same amount field.
8. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method of any of claims 1 to 6 when executing the computer program.
9. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program for executing the method of any one of claims 1 to 6.
CN201910752788.4A 2019-08-15 2019-08-15 Method and device for formatting sum field Active CN110457657B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910752788.4A CN110457657B (en) 2019-08-15 2019-08-15 Method and device for formatting sum field

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910752788.4A CN110457657B (en) 2019-08-15 2019-08-15 Method and device for formatting sum field

Publications (2)

Publication Number Publication Date
CN110457657A CN110457657A (en) 2019-11-15
CN110457657B true CN110457657B (en) 2023-08-22

Family

ID=68486725

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910752788.4A Active CN110457657B (en) 2019-08-15 2019-08-15 Method and device for formatting sum field

Country Status (1)

Country Link
CN (1) CN110457657B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102982624A (en) * 2012-11-19 2013-03-20 深圳市新国都技术股份有限公司 Printing method for point-of-sale (POS) machine trading center based on threshold limit value (TLV) format data
CN105930312A (en) * 2015-09-29 2016-09-07 ***股份有限公司 Method and apparatus for editing printed receipt based on POS terminal
CN105938470A (en) * 2015-03-02 2016-09-14 佳能株式会社 Information processing system, server apparatus, control method
CN106502969A (en) * 2016-10-21 2017-03-15 天津海量信息技术股份有限公司 The method for normalizing of the case-involving amount of money of judicial case

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8805706B2 (en) * 2011-04-29 2014-08-12 Hartford Fire Insurance Company Systems and methods for managing insurance account documents

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102982624A (en) * 2012-11-19 2013-03-20 深圳市新国都技术股份有限公司 Printing method for point-of-sale (POS) machine trading center based on threshold limit value (TLV) format data
CN105938470A (en) * 2015-03-02 2016-09-14 佳能株式会社 Information processing system, server apparatus, control method
CN105930312A (en) * 2015-09-29 2016-09-07 ***股份有限公司 Method and apparatus for editing printed receipt based on POS terminal
CN106502969A (en) * 2016-10-21 2017-03-15 天津海量信息技术股份有限公司 The method for normalizing of the case-involving amount of money of judicial case

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
吕妙玲.凭证中金额的格式化处理.华南金融电脑.2003,(第06期),全文. *

Also Published As

Publication number Publication date
CN110457657A (en) 2019-11-15

Similar Documents

Publication Publication Date Title
US7783971B2 (en) Graphic object themes
US8601361B2 (en) Automatically populating and/or generating tables using data extracted from files
CN103955345B (en) A kind of data-printing method and system
US10585975B2 (en) Finding duplicate passages of text in a collection of text
US11341324B2 (en) Automatic template generation with inbuilt template logic interface
US9218325B2 (en) Quick font match
CN110968996A (en) Document making method, device, equipment and storage medium
CN114090671A (en) Data import method and device, electronic equipment and storage medium
CN111563741A (en) Transaction certificate generation method, device and system
US7941749B2 (en) Composition of electronic document layout
CN111783432A (en) Generation method and device of credit certificate examination key point list
US7865826B2 (en) System and method for creating and presenting mathematical documents
CN110457657B (en) Method and device for formatting sum field
CN112507660A (en) Method and system for determining homology and displaying difference of compound document
CN115841095A (en) Document establishing method, system, medium and equipment
CN110457658B (en) Text file configuration method and device
CN113033177B (en) Method and device for analyzing electronic medical record data
JP2008052356A (en) Source code automatic generation device
CN114115831A (en) Data processing method, device, equipment and storage medium
US20200201937A1 (en) System and method for generating updatable structured content
CN112308570A (en) Method and device for generating business rule output value
JP2005011382A (en) Preparation method of patent specification
CN111222066A (en) Pull-down component system and method for event processing and searching
CN111221787A (en) File processing method and device
US20140281941A1 (en) Classifier Designer - A Graphical System for Designing Classifiers Using Visual Representations of Example Content

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