Disclosure of Invention
The invention aims to provide a method and a device for generating a check document based on dynamic data, which do not need a programmer to modify a program when the content or format of the document changes and are simple and convenient to operate.
To achieve these objects and other advantages in accordance with the purpose of the invention, there is provided a verification document generation method based on dynamic data, including:
determining an expression rule of the dynamic content;
establishing a document template, wherein the document template comprises a dynamic content name and a region to be filled corresponding to the dynamic content name;
and traversing the resource file, taking the data matched with the expression rule in the resource file as dynamic content, and filling the dynamic content into the area to be filled to generate a check document.
Preferably, in the method for generating a test document based on dynamic data, the resource file at least includes a test order, test contract information, a test flow plan, a field test result, correction information, a test result, and report information.
Preferably, in the verification document generation method based on dynamic data, the dynamic content has a preset format;
and converting the data matched with the expression rule in the resource file into a preset format and using the preset format as dynamic content.
Preferably, in the method for generating a verification document based on dynamic data, the regions to be filled of the blank document template are filled with placeholders corresponding to dynamic content one to one;
in populating the dynamic content, the placeholders are replaced with the dynamic content.
Preferably, the verification document generation method based on dynamic data further includes:
after the verification document is generated, the verification document is electronically signed.
Preferably, the verification document generation method based on dynamic data further includes:
when the resource file is traversed each time, writing each dynamic content into a first intermediate file respectively, and storing the first intermediate file;
acquiring a storage path of the first intermediate file, and generating a first link in the corresponding region to be filled according to the storage path;
after detecting the modification operation on the resource file each time, acquiring the modification content of each dynamic content, writing the modification content into a second intermediate file, and storing the second intermediate file;
acquiring a storage path of the second intermediate file, and generating a second link in the corresponding region to be filled according to the storage path;
and receiving a click command of the first link or the second link, and filling the corresponding content of the first intermediate file or the second intermediate file into the corresponding area to be filled.
The invention also provides a verification document generation device based on dynamic data, which comprises:
a processor;
a memory storing executable instructions;
wherein the processor is configured to execute the executable instructions to perform the method for verification document generation based on dynamic data.
The invention at least comprises the following beneficial effects:
aiming at the practical situations that the inspection flow of the stadium is fixed, but the inspected data contents are different, the project data items change greatly, the types (texts, numbers, pictures) and the like of all the data items are different, the invention sequentially determines the expression rule of the dynamic content, establishes a document template, traverses the resource file, takes the data matched with the expression rule in the resource file as the dynamic content, and fills the dynamic content into the area to be filled to generate the inspection document. The invention can be operated by non-professional IT personnel with general IT skills when the content or format of a newly added inspection item or an inspection report changes, and has the advantages of simple and convenient operation, short time consumption and low cost.
Additional advantages, objects, and features of the invention will be set forth in part in the description which follows and in part will become apparent to those having ordinary skill in the art upon examination of the following or may be learned from practice of the invention.
Detailed Description
The present invention is further described in detail below with reference to the attached drawings so that those skilled in the art can implement the invention by referring to the description text.
It will be understood that terms such as "having," "including," and "comprising," as used herein, do not preclude the presence or addition of one or more other elements or groups thereof.
In one embodiment, as shown in fig. 1, a method for generating a verification document based on dynamic data includes:
determining an expression rule of the dynamic content;
establishing a document template, wherein the document template comprises a dynamic content name and a region to be filled corresponding to the dynamic content name;
and traversing the resource file, taking the data matched with the expression rule in the resource file as dynamic content, and filling the dynamic content into the area to be filled to generate a check document.
In the above technical solution, the dynamic content refers to content of each data entry in the inspection document, and changes with different resource files. The expression rule can generally represent the expression mode of each data item, for example, the expression mode of the test date is year, month and day, the telephone number, address, company name, test item, test result and the like also have the specific expression mode thereof, and can be determined according to statistics or experience. The document template comprises a dynamic content name meeting the current requirement and a region to be filled for filling the dynamic content, and can be customized by a user according to the requirement of the user. The resource file is a source file of the inspection document and comprises data required by the inspection document, and the data which accords with the expression rule is filled into the region to be filled as dynamic content by traversing the resource file until all the regions to be filled in the document template are filled.
It can be seen that the technical scheme defines the expression rule in advance, then customizes the document template, and generates the inspection document by traversing the resource file and filling the document template. When the content or format of the newly added inspection item or the inspection report changes, a non-professional IT person with general IT skills can edit or modify the document template, so that the operation is simple and convenient, the time consumption is short, and the cost is low.
In another technical solution, in the method for generating a test document based on dynamic data, the resource file at least includes a test order, test contract information, a test flow plan, a field test result, correction information, a test result, and report information. The resource file is used for providing dynamic content for the verification document, and the attribute of the information and the data type of the attribute are defined in advance, wherein the data type of the attribute supports text strings, integers, decimal numbers, dates, time, pictures and documents.
In another technical solution, in the method for generating a test document based on dynamic data, the dynamic content has a preset format;
and converting the data matched with the expression rule in the resource file into a preset format and using the preset format as dynamic content. Here, the dynamic content is converted into a preset format of the area to be filled, such as attributes and data types specified in the above technical solution. And then filling the region to be filled with the inspection file, wherein the technical scheme ensures that the obtained inspection file is more in line with the actual requirement.
In another technical scheme, in the inspection document generation method based on dynamic data, placeholders corresponding to dynamic contents one by one are filled in a to-be-filled area of a blank document template;
in populating the dynamic content, the placeholders are replaced with the dynamic content. Here, the placeholder occupies the to-be-filled area of the blank document template, and corresponds to the corresponding dynamic content one to one, so that a user can design the document template conveniently, find the accurate position of each dynamic content conveniently, and fill the dynamic content in the resource file to the accurate position conveniently. The replacement is performed according to the data type of the resource attribute declared by the placeholder.
In another technical solution, the method for generating a test document based on dynamic data further includes:
after the verification document is generated, the verification document is electronically signed. Here, the electronic signature is used to ensure non-tamper-ability of the electronic verification document.
In another technical solution, the method for generating a test document based on dynamic data further includes:
when the resource file is traversed each time, writing each dynamic content into a first intermediate file respectively, and storing the first intermediate file;
acquiring a storage path of the first intermediate file, and generating a first link in the corresponding region to be filled according to the storage path;
after detecting the modification operation on the resource file each time, acquiring the modification content of each dynamic content, writing the modification content into a second intermediate file, and storing the second intermediate file;
acquiring a storage path of the second intermediate file, and generating a second link in the corresponding region to be filled according to the storage path;
and receiving a click command of the first link or the second link, and filling the corresponding content of the first intermediate file or the second intermediate file into the corresponding area to be filled.
According to the technical scheme, when the resource file is traversed, a first intermediate file is generated and used for storing corresponding dynamic contents, and after the resource file is modified, a second intermediate file is generated and used for storing corresponding modified contents. And displaying the link in the corresponding area to be filled by the first intermediate file and the second intermediate file. And storing the corresponding first intermediate file and the second intermediate file every time of traversing and modifying. And clicking the link by the user, and presenting the required content in the area to be filled. The user experience is further improved through the first intermediate file and the second intermediate file, and the situation that all resource files need to be traversed every time the resource files are added, replaced or modified is avoided.
The invention also provides a verification document generation device based on dynamic data, which comprises:
a processor;
a memory storing executable instructions;
wherein the processor is configured to execute the executable instructions to perform the method for verification document generation based on dynamic data.
The technical scheme is obtained based on the same inventive concept as the method for generating the inspection document based on the dynamic data, and the description of the method part can be referred. The device of the technical scheme is not limited to be realized by a PC, a terminal and a server.
The following is a specific description.
Defining the data type: the data types supported by the system and required to be used are predefined, such as text strings, numbers, dates, time, pictures and document basic types. This data type mainly determines the canonical representation of the next data model, and the format and representation of the data in the final document, such as pictures, may require a special blank space to store and define the size and position of the final program.
Define data model (CDM or PDM): since the inspection process of the stadium is substantially the same, the information collected in the whole process is mainly information of 6 subjects, such as an inspection order, inspection contract information, inspection flow plan, field inspection result, correction information, inspection result, report information, and the like. The information of each object is mainly divided into two parts, one is the preset information related to the process, such as the information of the state of the inspection process, the occurrence time of each step, the operator and the like, and the part is mainly set by the system design; and secondly, the related data items are specifically checked, business personnel can dynamically add or modify the data items according to the needs when the system runs, the names and the data types of the data items are simply set, and finally, the system automatically sets a related interface for data management according to the business personnel and the business personnel enter the related data.
Defining a model document template: the method is characterized in that a document template is generated by a service person according to a method for writing a standard document, and the dynamic content can be marked by a special expression method: the content such as the date of verification is included in the template in parenthesis such as: { date of examination }. The method can be unfixed, and only one or more ways which are convenient for business personnel to understand can be selected according to the requirement.
Template processing/document creation program module: the document generation program module loads the data model of the type of the examination venue and automatically loads the corresponding data from the system; the document generation program module loads a template file, traverses the content of the document, finds all dynamic content areas in the document according to the expression rule of the dynamic content, loads and formats actual data according to the data type and display parameters of the dynamic content defined in the data model, and finally replaces the corresponding placeholder content in the template at the moment.
For data items not found in the data model or data, special processing such as blank processing can be performed. For in-depth applications, expressions can be used in the templates to support certain user-controlled more dynamic control of content, such as common IF conditional decisions/data loops, etc.
Document signing: after the document is generated, the document may be automatically electronically signed according to a pre-configured system. This part is mainly to ensure the non-tamper property of the electronic document (i.e. the electronic signature of the document will automatically fail after the document is modified), so as to provide a better application scenario of the electronic document in the application process of the whole system, and in the future, the signed electronic document can be considered to replace the document with a paper printed official seal.
The number of apparatuses and the scale of the process described herein are intended to simplify the description of the present invention. Applications, modifications and variations of the method and apparatus for generating a verification document based on dynamic data of the present invention will be apparent to those skilled in the art.
While embodiments of the invention have been described above, it is not limited to the applications set forth in the description and the embodiments, which are fully applicable in various fields of endeavor to which the invention pertains, and further modifications may readily be made by those skilled in the art, it being understood that the invention is not limited to the details shown and described herein without departing from the general concept defined by the appended claims and their equivalents.