CN113326682A - Electronic form generation method and device - Google Patents

Electronic form generation method and device Download PDF

Info

Publication number
CN113326682A
CN113326682A CN202110629592.3A CN202110629592A CN113326682A CN 113326682 A CN113326682 A CN 113326682A CN 202110629592 A CN202110629592 A CN 202110629592A CN 113326682 A CN113326682 A CN 113326682A
Authority
CN
China
Prior art keywords
exported
worksheet
attribute
annotation
file stream
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
CN202110629592.3A
Other languages
Chinese (zh)
Inventor
鄢仁柱
曾岩
李晶
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
WeBank Co Ltd
Original Assignee
WeBank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by WeBank Co Ltd filed Critical WeBank Co Ltd
Priority to CN202110629592.3A priority Critical patent/CN113326682A/en
Publication of CN113326682A publication Critical patent/CN113326682A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/177Editing, e.g. inserting or deleting of tables; using ruled lines
    • G06F40/18Editing, e.g. inserting or deleting of tables; using ruled lines of spreadsheets
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems

Landscapes

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

Abstract

The invention discloses a method and a device for generating an electronic form, wherein the method comprises the following steps: the method comprises the steps that a table generating instruction sent by a front end is obtained by the back end, the table generating instruction comprises objects to be exported, then an export structure body corresponding to the objects to be exported is determined in a database, the attributes of a worksheet to which the objects to be exported belong and the attributes of the tables of the objects to be exported are recorded in the export structure body, a file stream comprising the objects to be exported is generated according to the attributes of the worksheets and the attributes of the tables recorded by the export structure body and is sent to the front end, and therefore the electronic tables comprising the objects to be exported are analyzed by the front end according to the file stream. Therefore, data export is realized by taking the worksheet as a unit, data export of multiple worksheets and multiple tables is realized, the efficiency and flexibility of data export are increased, and the interaction capacity of the front end and the back end is increased.

Description

Electronic form generation method and device
Technical Field
The invention relates to the field of financial technology (Fintech), in particular to a method and a device for generating an electronic form.
Background
With the development of computer technology, more and more technologies (such as block chains, cloud computing or big data) are applied in the financial field, the traditional financial industry is gradually changing to the financial technology, and big data technology is no exception, but higher requirements are also put forward on big data technology due to the security and real-time requirements of the financial and payment industries.
In the prior art, exporting data in a database is generally implemented based on AutoPoi, for example, exporting data tables in the database as files in different formats, such as Excel format files (xlsx, xls), word format files (doc, docx), and the like.
It is well known that a plurality of worksheets (sheets) can be included in any Excel file, and each worksheet can include a plurality of tables, for example, a table (contents of student math achievements) and b table (contents of student Chinese achievements) are included in the worksheet 1.
However, data export in a database based on AutoPoi at present can only be carried out for one table, that is, only one table can be obtained during data export, and multiple worksheets and multiple tables cannot be exported, so that data export efficiency is low, and flexibility is poor.
Therefore, a method for data export is needed, which realizes data export by multiple working tables and multiple tables, and increases the efficiency and flexibility of data export.
Disclosure of Invention
The embodiment of the invention provides a method and a device for generating an electronic form, which are used for realizing.
In a first aspect, an embodiment of the present invention provides a method for generating a spreadsheet, including:
the back end acquires a table generation instruction sent by the front end; the table generation instruction comprises objects to be exported;
the back end determines a exporting structural body corresponding to each object to be exported in a database; the export structure records the worksheet attribute of the worksheet to which the object to be exported belongs and the form attribute of the object to be exported;
and the back end generates a file stream comprising each object to be exported according to the worksheet attribute and the table attribute recorded by the export structure body, and sends the file stream to the front end so that the front end can analyze the electronic table comprising each object to be exported according to the file stream.
In the technical scheme, the worksheet attributes of the worksheets to which the objects to be exported belong and the form attributes of the objects to be exported are recorded in the export structure, data export in a form unit can be achieved according to the form attributes, data export in a worksheet unit can be achieved according to the worksheet attributes, data export in multiple worksheets is achieved, and efficiency and flexibility of data export are improved.
In the prior art, when a file is finally generated, the file is generated by the back end and then sent to the front end, so that the front end and the back end have no interaction.
Optionally, the determining, by the back end, the export structure corresponding to each object to be exported in the database includes:
for any object to be exported, the back end determines the table attribute of the object to be exported according to the table attribute annotation of the object to be exported; determining a worksheet to which the object to be exported belongs according to the worksheet annotation of the object to be exported;
aiming at objects to be exported belonging to the same worksheet, sorting the sheet attributes of the objects to be exported by the back end according to the position annotation in the sheet of the objects to be exported to obtain the worksheet attributes;
and the back end sorts the attributes of the worksheets according to the inter-sheet sorting annotation of the worksheet to which the object to be exported belongs, so as to obtain the export structure corresponding to the object to be exported.
In the technical scheme, the attributes of the worksheet and the attributes of the forms are dynamically determined based on different set annotations, so that the electronic forms of the objects to be exported are automatically determined according to the attributes of the worksheet and the attributes of the forms when the data are exported, and the efficiency and the automation performance of data export are improved.
Optionally, obtaining a derivation structure corresponding to an object to be derived in the database further includes:
generating the export structure body by the object to be exported according to a preset encapsulation data structure; and the preset encapsulation data structure is obtained by transforming and encapsulating the bottom layer of the AutoPoi according to the object to be exported.
In the technical scheme, the export structure body can be obtained based on the preset encapsulation data structure, the method can be realized without depending on annotation, and the data export of multiple working tables and multiple tables can be realized according to the obtained export structure body, so that the flexibility of determining the export structure body is increased.
Optionally, the determining, by the back end, the export structure corresponding to each object to be exported in the database further includes:
the back end generates the export structure body for each object to be exported according to a preset encapsulation data structure; and the preset encapsulation data structure is obtained by transforming and encapsulating the bottom layer of the AutoPoi according to the objects to be exported.
According to the technical scheme, for any object to be exported, a table file stream is obtained according to the AutoPoi, then the table file streams in the same worksheet are sequenced according to the table attributes to obtain the worksheet file stream, and then the file stream is generated according to the worksheet attributes, so that the data export of multiple worksheets and multiple tables is realized.
Optionally, the generating, by the back end, a file stream including each object to be exported according to the worksheet attribute and the form attribute recorded by the export structure includes:
generating a table file stream corresponding to the table attribute of the object to be exported according to the mode of AutoPoi and aiming at the object to be exported belonging to the same worksheet, wherein the back end is based on the table attribute of the object to be exported, and the worksheet file stream is obtained;
and the back end generates the file stream of the object to be exported according to the sequence of the attributes of the worksheets in the export structure.
Optionally, generating a table file stream corresponding to the table attribute of the object to be exported to obtain a worksheet file stream, where the generating includes:
for any cell in the object to be exported, the back end determines the position, the format and the value of the cell in a table according to the cell attribute value annotation;
the back end generates a table file stream corresponding to the table attribute of the object to be exported according to the position, the format and the value of each cell in the table;
and the back end sorts the table file stream according to the position annotation in the table of the object to be exported to obtain a worksheet file stream.
In the technical scheme, a plurality of table file streams in the same worksheet are obtained according to the cell attribute value annotation, and the worksheet file streams are obtained by sequencing the plurality of table file streams, so that data export of multiple tables is realized.
Optionally, the cell attribute values of the object to be exported further include a data dictionary annotation; the data dictionary annotation is used for matching the cell attribute value with a preset key; the cell attribute values including data dictionary annotations are stored in a remote dictionary service;
the back end determines the position, the format and the value of the cell in the table according to the annotation of the cell attribute value, and further comprises:
and the back end matches the cell to be exported in the remote dictionary service according to a preset key.
According to the technical scheme, the cells to be exported are matched in the remote dictionary service, cell data do not need to be acquired in the database, export efficiency is improved, and the exported data can be selected according to the preset key matched cells, so that flexibility of data export is improved.
In a second aspect, an embodiment of the present invention provides an apparatus for generating a spreadsheet, including:
the acquisition module is used for acquiring a table generation instruction sent by the front end; the table generation instruction comprises objects to be exported;
the processing module is used for determining export structural bodies corresponding to the objects to be exported in a database; the export structure records the worksheet attribute of the worksheet to which the object to be exported belongs and the form attribute of the object to be exported;
and generating a file stream comprising each object to be exported according to the worksheet attribute and the table attribute recorded by the export structure, and sending the file stream to the front end so that the front end can analyze the electronic table comprising each object to be exported according to the file stream.
Optionally, the processing module is specifically configured to:
for any object to be exported, determining the table attribute of the object to be exported according to the table attribute annotation of the object to be exported; determining a worksheet to which the object to be exported belongs according to the worksheet annotation of the object to be exported;
aiming at objects to be exported belonging to the same worksheet, sorting the sheet attributes of the objects to be exported according to the position annotation in the sheet of the objects to be exported to obtain the worksheet attributes;
and sequencing the attributes of the worksheets according to the inter-sheet sequencing annotation of the worksheet to which the object to be exported belongs to obtain the export structure corresponding to the object to be exported.
Optionally, the processing module is further configured to:
generating the export structure body by the objects to be exported according to a preset encapsulation data structure; and the preset encapsulation data structure is obtained by transforming and encapsulating the bottom layer of the AutoPoi according to the object to be exported.
Optionally, the processing module is specifically configured to:
generating a table file stream corresponding to the table attribute of the object to be exported based on the table attribute of the object to be exported and belonging to the same worksheet according to an AutoPoi mode, and obtaining the worksheet file stream;
and generating the file stream of the object to be exported according to the sequence of the attributes of the worksheets in the export structure.
Optionally, the worksheet file stream includes a worksheet name, and the worksheet name is determined according to a worksheet identifier annotation of the object to be exported which is located most forward in the worksheet.
Optionally, the processing module is specifically configured to:
for any cell in the object to be exported, determining the position, the format and the value of the cell in a table according to the cell attribute value annotation;
generating a table file stream corresponding to the table attribute of the object to be exported according to the position, the format and the value of each cell in the table;
and sequencing the table file stream according to the position annotation in the table of the object to be exported to obtain a worksheet file stream.
Optionally, the cell attribute values of the object to be exported further include a data dictionary annotation; the data dictionary annotation is used for matching the cell attribute value with a preset key; the cell attribute values including data dictionary annotations are stored in a remote dictionary service;
the processing module is further configured to:
and according to the annotation of the attribute values of the cells, before determining the positions, formats and values of the cells in the table, matching the cells to be exported in the remote dictionary service according to preset keys.
In a third aspect, an embodiment of the present invention further provides a computer device, including:
a memory for storing program instructions;
and the processor is used for calling the program instructions stored in the memory and executing the spreadsheet generation method according to the obtained program.
In a fourth aspect, the embodiment of the present invention further provides a computer-readable storage medium, where computer-executable instructions are stored, and the computer-executable instructions are configured to cause a computer to execute the above-mentioned spreadsheet generation method.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic diagram of a data format of an Excel file according to an embodiment of the present invention;
FIG. 2 is a system architecture diagram according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a method for generating a spreadsheet according to an embodiment of the present invention;
fig. 4 is a schematic diagram of a method for verifying an object to be exported according to an embodiment of the present invention;
FIG. 5 is an annotation schematic diagram of an object to be exported according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a derivation structure according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an apparatus for generating a spreadsheet according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the present invention will be described in further detail with reference to the accompanying drawings, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the prior art, a database has a plurality of data tables, and the data tables have important business data, such as tax management, for example, the tax management database includes a plurality of types of tax, such as value-added tax, enterprise income tax, tax stamp, and other various types of tax.
For each type of tax data, the tax data is acquired by each system in the industry, for example, the general ledger data, the fee control data, the data set by people and the like of company A are acquired by an acquisition module, and after the tax data is acquired, the data is exported to be an Excel file so as to facilitate the work of checking calculation, leadership audit and the like.
The data format of the Excel file is shown in fig. 1, and fig. 1 exemplarily shows a data format schematic diagram of the Excel file, which includes a plurality of worksheets (Sheet1, Sheet2, etc.), and each worksheet may include a plurality of data sheets (table 1, table 2, etc.).
However, in the current technical solution, only one table can be exported, that is, only one table can be obtained when data is exported, which is equivalent to that one table is an Excel file, data cannot be exported to a plurality of tables simultaneously, and a multi-work table and a multi-table electronic table cannot be generated, which results in low data export efficiency and poor flexibility.
For example, the database includes an value-added tax data table and an enterprise income tax data table, and two Excel files are respectively obtained through the AutoPoi, including the value-added tax data table Excel file and the enterprise income tax data table Excel file, so that it can be seen that, when exporting data, the prior art cannot export a plurality of form data into one Excel file, and cannot export different form data into different worksheets in one Excel file.
In the prior art, when a file is finally generated, the file is generated by a back end and then sent to a front end, so that the front end and the back end have no interaction, the front end displays that the file is successfully exported after sending a table generation instruction, and the file is actually exported by the back end in a failure manner, so that the file received by the front end is a messy code file.
Therefore, a method for data export is needed, which realizes data export by multiple worksheets and multiple worksheets, and increases efficiency and flexibility of data export, and interaction capability between the front end and the back end.
Fig. 2 illustrates a system architecture to which an embodiment of the present invention is applicable, which includes a server 200, and the server 200 may include a processor 210, a communication interface 220, and a memory 230.
The communication interface 220 is configured to obtain an object to be exported in the database and an export structure corresponding to the object to be exported.
The processor 210 is a control center of the server 200, connects various parts of the entire server 200 using various interfaces and routes, performs various functions of the server 200 and processes data by operating or executing software programs and/or modules stored in the memory 230 and calling data stored in the memory 230. Alternatively, processor 210 may include one or more processing units.
The memory 230 may be used to store software programs and modules, and the processor 210 executes various functional applications and data processing by operating the software programs and modules stored in the memory 230. The memory 230 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created according to a business process, and the like. Further, memory 230 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
It should be noted that the structure shown in fig. 2 is only an example, and the embodiment of the present invention is not limited thereto.
Based on the above description, fig. 3 is a schematic flow chart illustrating a method for generating a spreadsheet according to an embodiment of the present invention, where the flow chart is executable by a spreadsheet generating apparatus.
As shown in fig. 3, the process specifically includes:
in step 310, the back-end obtains a table generation instruction sent by the front-end.
In the embodiment of the present invention, the table generation instruction is initiated by a front end, where the table generation instruction includes each object to be exported, that is, the table generation instruction includes a plurality of table data to be exported from a database.
And 320, determining the export structure body corresponding to each object to be exported in the database by the back end.
In the embodiment of the present invention, a worksheet attribute of a worksheet to which the object to be exported belongs and a form attribute of the object to be exported are recorded in the export structure.
And 330, generating a file stream comprising each object to be exported by the back end according to the worksheet attributes and the table attributes recorded by the export structure, and sending the file stream to the front end.
In the embodiment of the invention, after receiving the file stream, the front end analyzes the electronic form comprising each object to be exported according to the file stream. The back end sends the generated file stream to the front end, the front end generates the file, the back end can also respond to the step in the process of exporting the front end file (the step of exporting'), and the front end receives the file stream sent by the back end after the last export success or the export failure, so that the interaction capacity of the front end and the back end is increased.
In step 320, before the back end determines the export structure corresponding to each object to be exported in the database, the back end may also verify the object to be exported and determine whether to export the object to be exported out of the file stream.
In an implementation manner, the determination is performed according to a preset value for the object to be exported, for example, it is determined whether the preset allowable export value is included in the object to be exported, if included, the object to be exported is allowed to be exported as a file stream, otherwise, the preset allowable export value is not allowed.
In another implementable manner, the object to be exported is verified according to the worksheet attribute or table attribute of the object to be exported, for example, it is determined whether the object to be exported includes the worksheet attribute or table attribute, if so, the object to be exported is allowed to be exported as a file stream, otherwise, the object to be exported is not allowed.
In the embodiment of the present invention, an object to be exported is verified according to a worksheet attribute and a form attribute, that is, the object to be exported is verified according to an export structure, as shown in fig. 4, fig. 4 exemplarily shows a schematic diagram of a method for verifying the object to be exported, specifically, after the object to be exported is obtained, it is determined whether the object to be exported includes the export structure, and the export structure records the worksheet attribute and the form attribute of the object to be exported, if yes, the object to be exported is marked as the export object, and the object to be exported is allowed to be exported as a file stream, otherwise, the export is not allowed.
Further, in an implementable manner, the export structure of the object to be exported is obtained from the annotation of the object to be exported.
Specifically, for any object to be exported, the back end determines the form attribute of the object to be exported according to the form attribute annotation of the object to be exported, and then determines the worksheet to which the object to be exported belongs according to the worksheet annotation of the object to be exported.
And for the objects to be exported belonging to the same worksheet, the back end sorts the sheet attributes of the objects to be exported according to the in-sheet position annotation of the objects to be exported to obtain the worksheet attributes, and then sorts the worksheet attributes according to the inter-sheet sorting annotation of the worksheets to which the objects to be exported belong to obtain the export structure corresponding to the objects to be exported.
In the embodiment of the invention, the annotation of the worksheet aiming at the object to be exported comprises the worksheet annotation and the inter-sheet sequencing annotation. The annotation of the table aiming at the object to be exported comprises an in-table position annotation, a worksheet identification annotation and a table identification annotation.
Fig. 5 exemplarily shows an annotation schematic diagram of an object to be exported, as shown in fig. 5, where a worksheet annotation is used to mark a worksheet to which the object to be exported belongs, an inter-sheet ordering annotation is used to mark an ordering between worksheets, an intra-sheet position annotation is used to mark an ordering of the object to be exported in the worksheet, a worksheet identification annotation is used to mark a name of the object to be exported acting on the worksheet, and a table identification annotation is used to mark a title of the object to be exported.
For example, the objects to be exported are grouped according to the work sheet annotation, that is, the objects to be exported are determined to belong to the work sheet, the work sheets are sorted according to the sorting annotation among the tables, the grouped objects to be exported are sorted according to the position annotation in the tables, the names of the work sheets are determined according to the work sheet identification annotation, and the titles of the objects to be exported are determined according to the table identification annotation.
In order to better describe the above technical solutions, the following will be illustrated in specific examples.
Example one
The annotations for the three objects to be exported are as follows:
1. @ MultiExcel (group ═ tms1, "orderSheetNum ═ 1, orderGroupNum ═ 1, title ═ passenger transportation income tax," sheetName ═ manual entry ");
Public class PaxtransTnputtax{};
2. @ MultiExcel (group ═ tms1, orderSheetNum ═ 1, orderGroupNum ═ 2, title ═ withal withheld and charged tax, sheetName ═ manual entry ");
Public class WithHoldInputTax{};
3. @ MultiExcel (group ═ tms2, "orderSheetNum ═ 2, orderGroupNum ═ 1, title ═ authentication platform income tax," sheetName ═ authentication platform download ");
Public class TmsCertifiedInputTax{};
wherein, the 'group' is the work sheet annotation, the 'orderSheetNum' is the sequencing annotation among the tables, the 'orderGroupNum' is the position annotation in the table, the 'sheet Name' is the work sheet identification annotation, and the 'title' is the table identification annotation.
The object to be exported includes: "PaxtransTnputtax", "WithHoldlInputTax" and "TmsCertiferdInputTax" are both "tms 1" because the worksheets of "PaxtransTnputtax" and "WithHoldlInputTax" are annotated the same, and then "PaxtransTnputtax" and "WithHoldlInputTax" belong to the same worksheet, the worksheet "tms 1" is ranked 1 according to the value of "orderSheetNum", the object to be derived "PaxtransTnputtax" is ranked 1 in the worksheet "tms 1" according to the value of "orderGroupNum", the object to be derived "WithHoldlInputTax" is ranked 2 in the worksheet "s 1", and the passenger withholding progress tax title "and" traveler deduction progress tax "are respectively determined according to" tie ".
For the object to be derived "tmscertifieldnnputtax", the worksheet annotation is "tms 2", and then in the worksheet "tms 2" to which "tmscertifieldnnputtax" belongs, the worksheet "tms 2" is determined to be ranked 2 according to the value of "orderSheetNum", and the object to be derived "tmscertifieldnnputtax" is determined to be ranked 1 in the worksheet "tms 2" according to the value of "orderGroupNum", and is determined to be titled "certification platform entry tax" according to "title".
Fig. 6 exemplarily shows a structural diagram of an export structure, as shown in fig. 6, the export structure is List < map < String, Object > >, where listA may correspond to a worksheet "tms 1", listB may correspond to a worksheet "tms 2", textranstnputtax "is mapA, WithHoldInputTax" is mapB, and tmscertifieldputtax "may correspond to mapC.
In another implementable manner, the export structure of the object to be exported is preset according to the object to be exported.
Specifically, the object to be exported generates an export structure according to a preset encapsulation data structure, wherein the preset encapsulation data structure is obtained by modifying and encapsulating the bottom layer of the AutoPoi according to the object to be exported.
In connection with the above example one, the preconditions are now known: the objects to be exported are "PaxtransTnputtax", "WithHoldinputtax" and "TmsCertifeidInputtax", and the tasks required to export data are as follows: "PaxtransTnputtax", "WithHoldInputTax" is assigned to the same worksheet "tms 1" with a worksheet rank of 1, and "tmscertifielditputtax" is assigned to another worksheet "tms 2" with a worksheet rank of 2, and its respective title and worksheet identification are preset.
And (3) performing bottom layer transformation on the AutoPoi by a programmer to realize the task of data export, then encapsulating the transformed AutoPoi, and exporting data from the object to be exported according to the encapsulated AutoPoi, so that the required task can be realized.
In step 330, the generating of the file stream includes generating a tabular file stream, obtaining a worksheet file stream according to the export structure, and finally obtaining a file stream of each object to be exported according to each worksheet file stream.
Specifically, for objects to be exported belonging to the same worksheet, the back end generates a table file stream corresponding to the table attribute of the objects to be exported according to the form attribute of the objects to be exported in an automatic Poi manner, and thus the worksheet file stream is obtained; and generating the file stream of the object to be exported according to the sequence of the attributes of the worksheets in the export structure.
In the embodiment of the present invention, for the export structure of each Object to be exported, how many worksheets and specific tables in the worksheets are needed may be determined, that is, with reference to the first example and fig. 6, it is equivalent to circulate "List < map < String, Object > >" in the export structure List < map < String, Object > > "of each Object to be exported, so as to determine how many worksheets are needed. The table in the work table is determined by recycling the 'map < String, Object >' in the export structure List < List < map < String, Object > > > of each Object to be exported.
And aiming at the cells in any table, determining the format, the position and the value in the cell by using the attribute value annotation in an automatic Poi mode in the cell, obtaining a table file stream aiming at the table, and then obtaining a worksheet file stream according to the table file stream.
Further, for any cell in the object to be exported, the back end determines the position, format and value of the cell in the table according to the annotation of the cell attribute value, then the end generates a table file stream corresponding to the table attribute of the object to be exported according to the position, format and value of each cell in the table, and then the table file stream is sorted according to the annotation of the position in the table of the object to be exported to obtain a worksheet file stream.
Taking the first example as an example, circularly deriving the structure List < map < String, Object > >, and determining the Object to be derived includes: "PaxtransTnputtax", "WithHoldInputTax", and "tmscertifieldminputtax", which are two worksheets "tms 1" and "tms 2" in total, for worksheet "tms 1", objects to be derived "PaxtransTnputtax" and "WithHoldInputTax", i.e. tables to be derived "PaxtransTnputtax" and "WithHoldInputTax", are included, taking "PaxtransTnputtax" as an example, where ten cells are included, and the annotations of cell attribute values include name, width, height, type (derived type), and the like, as the following specific annotation code examples:
@ExcelTarget("courseEntity");
public class details java. io. serializable {/. primary key/. private String id;
v. course name/;
@ Excel (name ═ course name, "orderNum ═ 1," needMerge ═ true);
private String name;
v. teacher primary key/;
the column name may indicate a position of the cell in the table, and the column width and the column height may indicate a format of the cell in the table, and the "course name" may indicate a value of the cell in the table, so that a table file stream for "PaxtransTnputtax" may be obtained, and then the corresponding table file streams may be sorted according to an in-table position annotation ("orderGroupNum") of each table ("PaxtransTnputtax" and "WithHoldInputTax"), so that a worksheet file stream for the worksheet "tms 1" may be obtained.
Finally, after each worksheet ("tms 1" and "tms 2") obtains its own table file stream, the worksheet file streams are sorted according to the sort notes among the tables, and thus the file streams are obtained.
The name of the worksheet file stream in the obtained file stream is determined according to the worksheet identification annotation of the object to be exported, and in an implementable mode, the worksheet identification annotation of the object to be exported which is positioned most back in the worksheet is determined as the name of the worksheet.
In an embodiment of the present invention, the worksheet name is determined from the worksheet identification annotation of the most forward located object to be exported in the worksheet.
Taking the example one above as an example, two objects to be exported ("PaxtransTnputtax" and "WithHoldInputTax") are included in worksheet "tms 1", and since "PaxtransTnputtax" is located most forward in worksheet "tms 1", the value of the worksheet identification annotation of "PaxtransTnputtax" is determined as the name of worksheet "tms 1", and the name of worksheet "tms 1" is "manual entry".
Illustratively, based on annotation by AutoPoi, in the embodiment of the present invention, the cell attribute value of the object to be exported further includes a preset custom annotation, so as to increase flexibility of data export.
The cell attribute values of the object to be exported also comprise data dictionary annotations; the data dictionary annotation is used for matching the cell attribute value with a preset key; cell attribute values including data dictionary annotations are stored in a remote dictionary service;
and the back end matches the cell to be exported in the remote dictionary service according to a preset key before determining the position, the format and the value of the cell in the table according to the annotation of the cell attribute value.
Taking the above example as an example, each cell data in the "PaxtransTnputtax" table may be divided into data of monday to sunday, and may also be divided into data of gender (male and female), where monday to sunday and gender (male and female) are preset keys, and when the file stream is determined, if the preset key is selected as "male", the obtained data in the table file stream only includes data of which the cell attribute value in the PaxtransTnputtax "table is annotated as" male ". The data dictionary is characterized by one-to-one associated data, and can be realized by a separator multi-selection key in order to increase the flexibility of data derivation.
For example, when the table file stream is determined, if the preset key is selected as the key of "monday" or "tuesday", the table file stream only includes data annotated as "monday" or "tuesday" by the cell attribute value in the PaxtransTnputtax "table. Accordingly, when the preset keys are the keys of "tuesday", "wednesday" and "friday", only the data annotated as "tuesday", "wednesday" and "friday" by the cell attribute values in the PaxtransTnputtax "table are included in the table file stream, and thus, the examples are not given here.
Illustratively, the cell attribute values further include a permission note, wherein the permission note is used for the database to determine whether the export requester has the export permission.
Taking the above example as an example, regarding the authority annotation, it is assumed that "PaxtransTnputtax" is data of a certain data owner, "WithHoldInputTax" is data of a certain data owner, and "tmscertifidinputtax" is data of a certain data owner, and the authority annotation includes one-to-one correspondence between requesters and data owners, that is, when a requester requesting three data to be exported is a certain data, only a table file stream of "PaxtransTnputtax" can be obtained.
Based on the same technical concept, fig. 7 exemplarily shows a schematic structural diagram of a spreadsheet generation apparatus provided by an embodiment of the present invention, and a flow that the apparatus can execute.
As shown in fig. 7, the apparatus specifically includes:
an obtaining module 710, configured to obtain a table generation instruction sent by a front end; the table generation instruction comprises objects to be exported;
a processing module 720, configured to determine, in a database, an export structure corresponding to each object to be exported; the export structure records the worksheet attribute of the worksheet to which the object to be exported belongs and the form attribute of the object to be exported;
and generating a file stream comprising each object to be exported according to the worksheet attribute and the table attribute recorded by the export structure, and sending the file stream to the front end so that the front end can analyze the electronic table comprising each object to be exported according to the file stream.
Optionally, the processing module 720 is specifically configured to:
for any object to be exported, determining the table attribute of the object to be exported according to the table attribute annotation of the object to be exported; determining a worksheet to which the object to be exported belongs according to the worksheet annotation of the object to be exported;
aiming at objects to be exported belonging to the same worksheet, sorting the sheet attributes of the objects to be exported according to the position annotation in the sheet of the objects to be exported to obtain the worksheet attributes;
and sequencing the attributes of the worksheets according to the inter-sheet sequencing annotation of the worksheet to which the object to be exported belongs to obtain the export structure corresponding to the object to be exported.
Optionally, the processing module 720 is further configured to:
generating the export structure body by the objects to be exported according to a preset encapsulation data structure; and the preset encapsulation data structure is obtained by transforming and encapsulating the bottom layer of the AutoPoi according to the object to be exported.
Optionally, the processing module 720 is specifically configured to:
generating a table file stream corresponding to the table attribute of the object to be exported based on the table attribute of the object to be exported and belonging to the same worksheet according to an AutoPoi mode, and obtaining the worksheet file stream;
and generating the file stream of the object to be exported according to the sequence of the attributes of the worksheets in the export structure.
Optionally, the worksheet file stream includes a worksheet name, and the worksheet name is determined according to a worksheet identifier annotation of the object to be exported which is located most forward in the worksheet.
Optionally, the processing module 720 is specifically configured to:
for any cell in the object to be exported, determining the position, the format and the value of the cell in a table according to the cell attribute value annotation;
generating a table file stream corresponding to the table attribute of the object to be exported according to the position, the format and the value of each cell in the table;
and sequencing the table file stream according to the position annotation in the table of the object to be exported to obtain a worksheet file stream.
Optionally, the cell attribute values of the object to be exported further include a data dictionary annotation; the data dictionary annotation is used for matching the cell attribute value with a preset key; the cell attribute values including data dictionary annotations are stored in a remote dictionary service;
the processing module 720 is further configured to:
and according to the annotation of the attribute values of the cells, before determining the positions, formats and values of the cells in the table, matching the cells to be exported in the remote dictionary service according to preset keys.
Based on the same technical concept, an embodiment of the present invention further provides a computer device, including:
a memory for storing program instructions;
and the processor is used for calling the program instructions stored in the memory and executing the spreadsheet generation method according to the obtained program.
Based on the same technical concept, the embodiment of the invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used for causing a computer to execute the above-mentioned spreadsheet generation method.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application 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 application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams 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.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

Claims (10)

1. A method for generating a spreadsheet, comprising:
the back end acquires a table generation instruction sent by the front end; the table generation instruction comprises objects to be exported;
the back end determines a exporting structural body corresponding to each object to be exported in a database; the export structure records the worksheet attribute of the worksheet to which the object to be exported belongs and the form attribute of the object to be exported;
and the back end generates a file stream comprising each object to be exported according to the worksheet attribute and the table attribute recorded by the export structure body, and sends the file stream to the front end so that the front end can analyze the electronic table comprising each object to be exported according to the file stream.
2. The method of claim 1, wherein the determining, by the back end, the export structure corresponding to each object to be exported in the database comprises:
for any object to be exported, the back end determines the table attribute of the object to be exported according to the table attribute annotation of the object to be exported; determining a worksheet to which the object to be exported belongs according to the worksheet annotation of the object to be exported;
aiming at objects to be exported belonging to the same worksheet, sorting the sheet attributes of the objects to be exported by the back end according to the position annotation in the sheet of the objects to be exported to obtain the worksheet attributes;
and the back end sorts the attributes of the worksheets according to the inter-sheet sorting annotation of the worksheet to which the object to be exported belongs, so as to obtain the export structure corresponding to the object to be exported.
3. The method of claim 1, wherein the back-end determines a export structure corresponding to each object to be exported in a database, further comprising:
the back end generates the export structure body for each object to be exported according to a preset encapsulation data structure; and the preset encapsulation data structure is obtained by transforming and encapsulating the bottom layer of the AutoPoi according to the objects to be exported.
4. The method of claim 1, wherein the back-end generating a file stream including the objects to be exported according to the worksheet attributes and table attributes recorded by the export structure, comprises:
generating a table file stream corresponding to the table attribute of the object to be exported according to the mode of AutoPoi and aiming at the object to be exported belonging to the same worksheet, wherein the back end is based on the table attribute of the object to be exported, and the worksheet file stream is obtained;
and the back end generates the file stream of the object to be exported according to the sequence of the attributes of the worksheets in the export structure.
5. The method of claim 4 wherein the worksheet filestream includes a worksheet name determined from a worksheet identification annotation of a most forward located object to be exported in the worksheet.
6. The method of claim 4, wherein generating a tabular file stream corresponding to the tabular attribute of the object to be exported to obtain a worksheet file stream comprises:
for any cell in the object to be exported, the back end determines the position, the format and the value of the cell in a table according to the cell attribute value annotation;
the back end generates a table file stream corresponding to the table attribute of the object to be exported according to the position, the format and the value of each cell in the table;
and the back end sorts the table file stream according to the position annotation in the table of the object to be exported to obtain a worksheet file stream.
7. The method of claim 6, wherein the cell property values of the object to be derived further comprise a data dictionary annotation; the data dictionary annotation is used for matching the cell attribute value with a preset key; the cell attribute values including data dictionary annotations are stored in a remote dictionary service;
the back end determines the position, the format and the value of the cell in the table according to the annotation of the cell attribute value, and further comprises:
and the back end matches the cell to be exported in the remote dictionary service according to a preset key.
8. An apparatus for generating a spreadsheet, comprising:
the acquisition module is used for acquiring a export structure body corresponding to an object to be exported in the database; the export structure records the worksheet attribute of the worksheet to which the object to be exported belongs and the form attribute of the object to be exported;
and the processing module is used for generating a file stream of the object to be exported according to the worksheet attribute and the table attribute recorded by the export structure, and the file stream is used for being analyzed into the electronic table of the object to be exported.
9. A computer device, comprising:
a memory for storing program instructions;
a processor for calling program instructions stored in said memory to perform the method of any of claims 1 to 7 in accordance with the obtained program.
10. A computer-readable storage medium having stored thereon computer-executable instructions for causing a computer to perform the method of any one of claims 1 to 7.
CN202110629592.3A 2021-06-07 2021-06-07 Electronic form generation method and device Pending CN113326682A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110629592.3A CN113326682A (en) 2021-06-07 2021-06-07 Electronic form generation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110629592.3A CN113326682A (en) 2021-06-07 2021-06-07 Electronic form generation method and device

Publications (1)

Publication Number Publication Date
CN113326682A true CN113326682A (en) 2021-08-31

Family

ID=77419953

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110629592.3A Pending CN113326682A (en) 2021-06-07 2021-06-07 Electronic form generation method and device

Country Status (1)

Country Link
CN (1) CN113326682A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114356252A (en) * 2021-12-27 2022-04-15 金蝶软件(中国)有限公司 Dynamic field printing method, system and related device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114356252A (en) * 2021-12-27 2022-04-15 金蝶软件(中国)有限公司 Dynamic field printing method, system and related device

Similar Documents

Publication Publication Date Title
CN104361018B (en) Electronic archives information reorganization method and device
CN107145480B (en) Method for compiling XBRL report based on Word
US20210049711A1 (en) Method of automatically transmitting data information and device of automatically transmitting data information
CN111192004A (en) Method for displaying current to-do task and subsequent to-do workflow
CN103678609A (en) Large data inquiring method based on distribution relation-object mapping processing
CN109739828B (en) Data processing method and device and computer readable storage medium
KR102656323B1 (en) Method and apparatus for managing document based on blockchain network
CN103473076A (en) Issuing method and issuing system for code version
CN106528794A (en) Electronic document filing method based on archive management system
CN115391439B (en) Document data export method, device, electronic equipment and storage medium
CN111612379A (en) Audit scheme automatic generation method and device
CN107943968B (en) Structured processing method for construction data table data
CN114416638A (en) Automatic electronic file filing method and system
CN113326682A (en) Electronic form generation method and device
CN115881106A (en) Intelligent form filling method, equipment and medium based on multi-scene semantic analysis
CN101408882A (en) Method and system for searching authorisation document
CN114625804A (en) Big data-based user behavior data processing method and system and cloud platform
WO2023226461A1 (en) Multi-domain data fusion method and device, and storage medium
CN116415911A (en) Method and system based on Internet of Rights (IoR) contract
CN110083823A (en) Dictionary sheet method for building up and device, computer installation and storage medium
CN110659348A (en) Group enterprise universe risk fusion analysis method and system based on knowledge reasoning
CN113822549B (en) Order processing method and device
CN110457332B (en) Information processing method and related equipment
CN113705180A (en) Document editing and reviewing method and device, electronic equipment and storage medium
CN113139022A (en) Enterprise logistics data on-demand fusion method based on mixing rule

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