CN114970496A - OFD-based electronic invoice file conversion method, system and related device - Google Patents

OFD-based electronic invoice file conversion method, system and related device Download PDF

Info

Publication number
CN114970496A
CN114970496A CN202210591058.2A CN202210591058A CN114970496A CN 114970496 A CN114970496 A CN 114970496A CN 202210591058 A CN202210591058 A CN 202210591058A CN 114970496 A CN114970496 A CN 114970496A
Authority
CN
China
Prior art keywords
file
electronic invoice
signature
ofd
directory
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
CN202210591058.2A
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.)
Kingdee Software China Co Ltd
Original Assignee
Kingdee Software China 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 Kingdee Software China Co Ltd filed Critical Kingdee Software China Co Ltd
Priority to CN202210591058.2A priority Critical patent/CN114970496A/en
Publication of CN114970496A publication Critical patent/CN114970496A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/151Transformation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • Artificial Intelligence (AREA)
  • Computer Security & Cryptography (AREA)
  • Bioethics (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • Storage Device Security (AREA)

Abstract

The embodiment of the application provides a conversion method and a related device based on an OFD electronic invoice file, which are used for converting the OFD electronic invoice file into an electronic invoice file with a target format so as to be displayed on target electronic equipment conveniently. The method in the embodiment of the application comprises the following steps: obtaining an OFD electronic invoice file; analyzing the OFD electronic invoice file to extract a structure directory file, a signature result file and a signature file of the OFD electronic invoice file; checking the structural directory file and the signature file according to the signature result file; and if the label is checked to pass, converting the OFD electronic invoice file into an electronic invoice file in a target format for display.

Description

OFD-based electronic invoice file conversion method, system and related device
Technical Field
The application relates to the technical field of electronic invoices, in particular to a method and a system for converting an electronic invoice file based on OFD (office format display) and a related device.
Background
The OFD (Open Fixed-layout Document) is a format Document national standard established by a format writing group established by the institute of electronic technology standardization of china, which is the department of industry and informatization, and belongs to an independent format of china for conveniently storing, reading and editing electronic documents.
With the announcement of matters such as the integrated service platform of the value-added tax invoice by the State tax administration (the announcement of the State tax administration No. 1 in 2020), it is gradually known by the public that the format of the value-added tax electronic general invoice format file is in the OFD format.
The OFD is widely used in fields of administrative office official documents, electronic invoices and the like at present, but at present, OFD files only support previewing on a windows operating system, but cannot be normally displayed on other electronic equipment, and inconvenience is brought to enterprises and users.
Disclosure of Invention
The embodiment of the application provides a conversion method, a system and a related device based on an OFD electronic invoice file, which are used for converting the OFD electronic invoice file into an electronic invoice file in a target format so as to be displayed on target electronic equipment except a windows operating system.
The embodiment of the present application provides a method for converting an electronic invoice file based on OFD in a first aspect, which is characterized by including:
obtaining an OFD electronic invoice file;
analyzing the OFD electronic invoice file to extract a structure directory file, a signature result file and a signature file of the OFD electronic invoice file;
checking the structural directory file and the signature file according to the signature result file;
and if the label is checked to pass, converting the OFD electronic invoice file into an electronic invoice file in a target format for display.
Optionally, the checking the signature of the structure directory file according to the signature result file includes:
acquiring a file signature and a signature algorithm in the signature result file, wherein the file signature comprises a hash value of each structure directory file abstract;
calculating the hash value of each structure directory file abstract according to the signature algorithm;
and if the hash value of each structural directory file abstract obtained by calculation is the same as the hash value of each structural directory file abstract in the file signature, determining that the structural directory file signature passes the verification.
Optionally, the verifying the signature file according to the signature result file includes:
acquiring a signature algorithm in the signature result file;
performing hash calculation on the hash values of the plurality of structured directory file digests again according to the signature algorithm to obtain the hash values of all the structured directory file digests;
acquiring a hash abstract in the signature file;
and if the hash values of all the structural directory file digests are the same as the hash digests in the signature file, determining that the signature of the signature file passes the verification.
Optionally, the verifying the signature file according to the signature result file further includes:
acquiring signature certificate information and signature dates in the signature file, wherein the signature certificate information comprises a certificate validity period and signature fingerprints;
if the hash value of the all structure directory file digests is the same as the hash digest in the signature file, determining that the signature file passes the verification, comprising:
and if the signature date is within the validity period of the certificate, the signature fingerprint is consistent with the signature fingerprint stored in advance, and the hash values of all the structure directory file digests are the same as the hash digests in the signature file, determining that the signature file passes the signature verification.
Optionally, the structure directory file includes a template file, a data file, a resource file and/or an invoice attachment file of the OFD electronic invoice file; the electronic invoice file with the target format comprises at least one of an electronic invoice PDF file, an electronic invoice picture file and an electronic invoice SVG file;
if the electronic invoice file in the target format is an electronic invoice SVG file, the OFD electronic invoice file is converted into the electronic invoice file in the target format for display, and the method comprises the following steps:
drawing a format template of the electronic invoice SVG file according to a template file of the OFD electronic invoice file;
extracting the position coordinates of the invoice data and the invoice data from the data file;
extracting picture files and position coordinates of the picture files from the resource files;
and filling the invoice data and the picture file into a format template of the electronic invoice SVG file according to the position coordinates of the invoice data and the position coordinates of the picture file to obtain and display the electronic invoice SVG file.
Optionally, if the electronic invoice file in the target format is an electronic invoice PDF file or an electronic invoice picture file;
the step of converting the OFD electronic invoice file into an electronic invoice file in a target format for display includes:
and converting the electronic invoice SVG file into an electronic invoice PDF file or an electronic invoice picture file by using a file conversion tool.
Optionally, after obtaining the OFD electronic invoice file, the method further includes:
acquiring functional parameters and extended data of the OFD electronic invoice file, wherein the functional parameters are used for indicating the extracted content of the OFD electronic invoice file and a first target format to be converted, and the extended data are used for indicating a definition parameter of the format-converted electronic invoice file;
the analyzing the OFD electronic invoice file to extract a structure directory file, a signature result file and a signature file of the OFD electronic invoice file comprises the following steps:
analyzing the OFD electronic invoice file according to the functional parameters to extract a structure directory file, a signature result file and a signature file of the OFD electronic invoice file;
the step of converting the OFD electronic invoice file into an electronic invoice file in a target format for display includes:
and converting the OFD electronic invoice file into an electronic invoice file in the first target format, and displaying the electronic invoice file meeting the definition parameter.
Optionally, after obtaining the OFD electronic invoice file and before parsing the OFD electronic invoice file, the method further includes:
judging whether the OFD electronic invoice file conforms to the format standard of the OFD electronic invoice file or not according to the format standard of the OFD electronic invoice file;
and if so, triggering the step of analyzing the OFD electronic invoice file.
A second aspect of the embodiments of the present application provides a conversion system based on an OFD electronic invoice file, including:
the acquisition unit is used for acquiring an OFD electronic invoice file;
the analysis unit is used for analyzing the OFD electronic invoice file to extract a structure directory file, a signature result file and a signature file of the OFD electronic invoice file;
the signature verification unit is used for verifying and signing the structure directory file and the signature file according to the signature result file;
and the conversion unit is used for converting the OFD electronic invoice file into an electronic invoice file in a target format for display when the structural directory file and the signature file pass signature verification.
Optionally, the signature verification unit is specifically configured to:
acquiring a file signature and a signature algorithm in the signature result file, wherein the file signature comprises a hash value of each structure directory file abstract;
calculating the hash value of each abstract of the structure directory file according to the signature algorithm;
and if the hash value of each structural directory file abstract obtained by calculation is the same as the hash value of each structural directory file abstract in the file signature, determining that the structural directory file signature passes.
Optionally, the signature verification unit is specifically configured to:
acquiring a signature algorithm in the signature result file;
performing hash calculation on the hash values of the plurality of structured directory file digests again according to the signature algorithm to obtain the hash values of all the structured directory file digests;
acquiring a hash abstract in the signature file;
and if the hash values of all the structural directory file digests are the same as the hash digests in the signature file, determining that the signature of the signature file passes the verification.
Optionally, the signature verification unit is further configured to:
acquiring signature certificate information and signature date in the signature file, wherein the signature certificate information comprises a certificate validity period and a signature fingerprint;
and if the signature date is within the validity period of the certificate, the signature fingerprint is consistent with the signature fingerprint stored in advance, and the hash values of all the structure directory file digests are the same as the hash digests in the signature file, determining that the signature file passes the signature verification.
Optionally, the structure directory file includes a template file, a data file, a resource file and/or an invoice attachment file of the OFD electronic invoice file; the electronic invoice file with the target format comprises at least one of an electronic invoice PDF file, an electronic invoice picture file and an electronic invoice SVG file;
the conversion unit is specifically configured to:
drawing a format template of the electronic invoice SVG file according to a template file of the OFD electronic invoice file;
extracting the position coordinates of the invoice data and the invoice data from the data file;
extracting picture files and position coordinates of the picture files from the resource files;
and filling the invoice data and the picture file into a format template of the electronic invoice SVG file according to the position coordinates of the invoice data and the position coordinates of the picture file to obtain and display the electronic invoice SVG file.
Optionally, if the electronic invoice file in the target format is an electronic invoice PDF file or an electronic invoice picture file;
the conversion unit is further configured to:
and converting the electronic invoice SVG file into an electronic invoice PDF file or an electronic invoice picture file by using a file conversion tool.
Optionally, the obtaining unit is further configured to:
after an OFD electronic invoice file is acquired, acquiring functional parameters and extension data of the OFD electronic invoice file, wherein the functional parameters are used for indicating the extracted content and a first target format to be converted aiming at the OFD electronic invoice file, and the extension data are used for indicating a definition parameter of the format-converted electronic invoice file;
the analysis unit is specifically configured to:
analyzing the OFD electronic invoice file according to the functional parameters to extract a structure directory file, a signature result file and a signature file of the OFD electronic invoice file;
the conversion unit is specifically configured to:
and converting the OFD electronic invoice file into an electronic invoice file in the first target format, and displaying the electronic invoice file meeting the definition parameter.
Optionally, the system further includes:
and the judging unit is used for judging whether the OFD electronic invoice file meets the format standard of the OFD electronic invoice file according to the pre-stored format standard of the OFD electronic invoice file after the OFD electronic invoice file is acquired and before the OFD electronic invoice file is analyzed, and triggering the step of analyzing the OFD electronic invoice file when the OFD electronic invoice file meets the format standard of the OFD electronic invoice file.
A third aspect of the embodiments of the present application provides a computer apparatus, including a processor, where the processor is configured to, when executing a computer program stored on a memory, implement the method for converting an OFD-based electronic invoice file provided in the first aspect of the embodiments of the present application.
A fourth aspect of the embodiments of the present application provides a computer-readable storage medium, on which a computer program is stored, where the computer program is used, when being executed by a processor, to implement the method for converting an OFD-based electronic invoice file provided in the first aspect of the embodiments of the present application.
A fifth aspect of the present embodiment provides a computer program product, where a computer program is stored, and when the computer program is executed by a computer device, the computer program is configured to implement the method for converting an OFD-based electronic invoice file provided in the first aspect of the present embodiment.
According to the technical scheme, the embodiment of the application has the following advantages:
in the embodiment of the application, an OFD electronic invoice file is obtained; analyzing the OFD electronic invoice file to extract a structure directory file, a signature result file and a signature file of the OFD electronic invoice file; checking the structural directory file and the signature file according to the signature result file; and if the label is checked to pass, converting the OFD electronic invoice file into an electronic invoice file in a target format for display. That is, in the embodiment of the present application, when the OFD electronic invoice file is not tampered, the OFD electronic invoice file is converted into an electronic invoice file in a target format that can be displayed on other electronic devices, so that the OFD electronic invoice file can also be normally displayed on other electronic devices.
Drawings
FIG. 1 is a schematic diagram of an architecture of an OFD electronic invoice file-based conversion system according to an embodiment of the present application;
fig. 2 is a schematic diagram of an embodiment of a method for converting an OFD-based electronic invoice file according to an embodiment of the present application;
FIG. 3 is a detailed step of step 203 in the embodiment of FIG. 2 of the present application;
FIG. 4 is a detailed step of step 204 in the embodiment of FIG. 2 of the present application;
fig. 5 is a schematic diagram of another embodiment of a conversion method based on an OFD electronic invoice file in the embodiment of the present application;
FIG. 6 is the format standard of OFD electronic invoice in the embodiment of the present application;
fig. 7 is a schematic diagram of an embodiment of a conversion system based on an OFD electronic invoice file in the embodiment of the present application.
Detailed Description
The embodiment of the application provides a conversion method, a system and a related device based on an OFD electronic invoice file, which are used for converting the OFD electronic invoice file into an electronic invoice file in a target format so as to be displayed on target electronic equipment except a windows operating system.
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all 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 application.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims of the present application and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Based on the problem that the OFD electronic invoice file in the prior art cannot be normally displayed on electronic equipment except a Windows system, the application provides a conversion method based on the OFD electronic invoice file, which is used for converting the OFD electronic invoice file into an electronic invoice file in a target format so as to be conveniently displayed on target electronic equipment.
The embodiment of the application provides a method for converting an electronic invoice file based on OFD, and the method has the following general principle:
when receiving an OFD electronic invoice file, analyzing the OFD electronic invoice to extract a structure directory file, a signature result file and a signature file of which the OFD electronic invoice is a file, checking the structure directory file and the signature file according to the signature result file, and if the signature passes through the verification, converting the OFD electronic invoice file into an electronic invoice file in a target format for display.
In order to implement the above method for converting an OFD-based electronic invoice file, an embodiment of the present application provides a conversion system based on an OFD electronic invoice file, please refer to fig. 1, and fig. 1 is a schematic structural diagram of the conversion system based on the OFD electronic invoice file according to the embodiment of the present application. The OFD electronic invoice file-based conversion system can comprise at least one terminal device 101 and a server 102; different types of applications, such as folders or various applications capable of receiving files, such as wps, office, and the like, may be installed on the terminal device 101, and the terminal device may be a smart phone, a tablet computer, a notebook computer, a desktop computer, an intelligent wearable device, and the like. The server 102 is used to store application data and file data generated by different types of application programs of the terminal apparatus 101. The server 102 may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, a cloud server providing basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a Network service, cloud communication, a middleware service, a domain name service, a security service, a Content Delivery Network (CDN), a big data and artificial intelligence platform, and the like.
The OFD electronic invoice file conversion method can be executed by the terminal device 101 and/or the server 102, when the OFD electronic invoice file conversion method is executed by the terminal device and the server in an interactive manner, the terminal device can acquire the OFD electronic invoice file from the server, then the terminal device extracts the OFD electronic invoice from the OFD electronic invoice file as a structure directory file, a signature result file and a signature file of the file, and verifies the structure directory file and the signature file according to the signature result file, and if the signature passes, the OFD electronic invoice file is converted into the electronic invoice file in the target format for display.
Referring to fig. 2, fig. 2 is a schematic view illustrating an embodiment of a conversion method based on an OFD electronic invoice file in the embodiment of the present application, where the conversion method may be executed by an intelligent device, and the intelligent device may be the terminal device 101 and/or the server 102.
201. Obtaining an OFD electronic invoice file;
specifically, before the OFD electronic invoice file is converted, the intelligent device in the embodiment of the application needs to acquire the OFD electronic invoice file, where the OFD electronic invoice file may be an electronic invoice file stored in the intelligent device in advance, or an electronic invoice file temporarily acquired by the intelligent device from a terminal device or a server, where the acquisition may be active downloading by the intelligent device or passive receiving by the intelligent device, and a specific process of acquiring the OFD electronic invoice file is not limited herein.
202. Analyzing the OFD electronic invoice file to extract a structure directory file, a signature result file and a signature file of the OFD electronic invoice file;
after the intelligent device acquires the OFD electronic invoice file, the OFD electronic invoice file is automatically analyzed to extract a structure directory file, a signature result file and a signature file of the OFD electronic invoice file.
Specifically, the parsing at least includes a decompression process of the OFD electronic invoice file, so as to obtain a structure directory file, a signature result file, and a signature file of the electronic invoice file from the decompressed electronic invoice file, where the structure directory file of the electronic invoice file includes a template file, a data file, a resource file, and/or an invoice attachment file of the OFD electronic invoice, and the like.
Further, the template file of the OFD electronic invoice includes an external contour line template of the electronic invoice, a basic information template of the electronic invoice (such as a invoicing party, an invoicing date, etc.), the data file of the electronic invoice mainly includes the invoicing information in the electronic invoice and the position coordinates of the invoicing information, such as the invoicing party is 1xxx1, the position coordinates are (x1, y1), the invoicing party is 2xxx, the position coordinates are (x2, y2), and the resource file of the electronic invoice mainly includes a two-dimensional code picture and a signature picture in the electronic invoice, and the position coordinates of the picture.
The invoice attachment file comprises: template files, data files and resource files of the electronic invoice files and mapping relations among all the parts are combined to form a complete electronic invoice file.
Furthermore, the signature result file is tamper-resistant information (such as hash digests of the respective structure directory files, hash digests in the signature files, and the like) of the structure directory file and the signature file recorded for preventing tampering of the structure directory file and the signature file of the OFD electronic invoice file.
The signature file records certificate information for signing the electronic invoice, invoice signing date and the like so as to be used for carrying out anti-counterfeiting on the electronic invoice.
203. Checking the structural directory file and the signature file according to the signature result file;
since the anti-tampering information for preventing tampering of the structure directory file and the signature file of the electronic invoice is recorded in the signature result file, in the embodiment of the application, the signature of the structure directory file and the signature file can be verified through the signature result file, and step 204 is executed after the signature passes.
Specifically, the process of how to perform signature verification on the structure directory file and the signature file according to the signature result file will be described in the following embodiments, and details are not described here.
204. And if the label is checked to pass, converting the OFD electronic invoice file into an electronic invoice file in a target format for display.
In step 203, if the structure directory file and the signature file in the electronic invoice file pass the signature verification, the OFD electronic invoice file is converted into the electronic invoice file in the target format for display, so that convenience in displaying the OFD electronic invoice file on other electronic equipment is improved.
Specifically, the target format in the present application includes at least one of PDF, picture or SVG format, which is not specifically limited herein, and the process of how to convert the OFD electronic invoice file into the electronic invoice file in the target format will also be described in the following embodiments, which is not described herein again.
In the embodiment of the application, an OFD electronic invoice file is obtained; analyzing the OFD electronic invoice file to extract a structure directory file, a signature result file and a signature file of the OFD electronic invoice file; checking the structural directory file and the signature file according to the signature result file; and if the label is checked to pass, converting the OFD electronic invoice file into an electronic invoice file in a target format for display. That is, in the embodiment of the present application, when the OFD electronic invoice file is not tampered, the OFD electronic invoice file is converted into an electronic invoice file in a target format that can be displayed on other electronic devices, so that the OFD electronic invoice file can also be normally displayed on other electronic devices.
Based on the embodiment shown in fig. 2, step 203 in the embodiment of fig. 2 is described in detail below, please refer to fig. 3, and fig. 3 is a detailed step of step 203:
301. acquiring a file signature and a signature algorithm in the signature result file, wherein the file signature comprises a hash value of each structure directory file abstract;
specifically, the signature result file stores a file signature and a signature algorithm in advance, the file signature includes a hash value of each digest of the structured directory file, and the signature algorithm is a specific algorithm for calculating each digest of the structured directory file, such as SM3, MD5, MD2, or SHA-1, and the specific signature algorithm is not limited herein.
302. Calculating the hash value of each abstract of the structure directory file according to the signature algorithm;
after the signature algorithm for calculating the digest of each structured directory file is obtained in step 301, the hash operation is sequentially performed on the digest of each structured directory file according to the signature algorithm to obtain a hash value of the digest of each structured directory file, so as to perform step 303.
303. Judging whether the hash value of each structural directory file abstract obtained by calculation is the same as the hash value of each structural directory file abstract in the file signature; if yes, go to step 304, if no, go to step 305;
after calculating the hash value of each structured directory file digest according to the signature algorithm in step 302, sequentially determining whether the hash value of each structured directory file digest is the same as the hash value of the corresponding structured directory file digest recorded in the file signature, if so, executing step 304, and if not, executing step 305.
304. Determining that the structural directory file passes the verification;
and if the hash value of each structure directory file abstract obtained by calculation is the same as the hash value of each structure directory file abstract in the file signature, determining that the structure directory file passes the signature verification, namely that the structure directory file is not tampered.
305. And determining that the structural directory file does not pass the verification.
If the hash value of the digest of any one structural target file obtained through calculation is different from the hash value of the digest of the corresponding structural directory file in the file signature, the structural directory file is determined not to pass the signature verification, that is, the structural directory file of the OFD electronic invoice file is tampered, and a user can be prompted that the structural directory file is tampered.
306. Performing hash calculation on the hash values of the plurality of structured directory file digests again according to the signature algorithm to obtain the hash values of all the structured directory file digests;
after the signature algorithm is obtained in step 301, further performing hash calculation on the hash values of the plurality of structured directory file digests according to the signature algorithm again to obtain hash values of all the structured directory file digests.
Specifically, if there are 3 structure directory files, where the hash value of the first structure target file digest is SDxxFD1, the hash value of the second structure directory file digest is FFDxxA1, and the hash value of the third structure directory file digest is DDFFDA, the step is to further perform a hash operation on SDxxFD1, FFDxxA1, and DDFFDA again according to a signature algorithm to obtain the hash values of all structure directory file digests.
307. Acquiring a hash abstract in the signature file;
specifically, in the signature file in the embodiment of the present application, a hash digest value is also stored, and the hash digest value is a hash value of a digest of all structure target files, and in order to verify the signature of the signature file, the hash digest in the signature file may be further obtained, and the hash digest in the signature file is compared with the hash digest values of all structure target files calculated in step 306, so as to verify the signature of the signature file.
308. Acquiring signature certificate information and signature date in the signature file, wherein the signature certificate information comprises a certificate validity period and a signature fingerprint;
further, in order to ensure the authenticity of the signature file, the embodiment of the application may further obtain signature certificate information and a signature date in the signature file, where the signature certificate information includes a certificate validity period and a signature fingerprint, and perform signature verification on the signature date according to the signature certificate information, and perform signature verification on the signature fingerprint in the signature certificate according to a pre-stored signature fingerprint, so as to ensure the validity of the signature certificate.
309. Judging whether the signature date is within the validity period of the certificate, whether the signature fingerprint is consistent with the signature fingerprint stored in advance, and whether the hash value of the digest of the directory file with the whole structure is the same as the hash digest in the signature file;
after the validity period of the signature certificate, the signature fingerprint and the hash values of all the structural directory file digests are obtained, the embodiment of the application judges whether the signature date in the signature file is in the validity period of the certificate, whether the signature fingerprint of the signature certificate is the same as the pre-stored certificate fingerprint, whether the hash values of all the structural directory file digests are the same as the hash digests in the signature file, if yes, step 310 is executed, and if not, step 311 is executed.
310. And determining that the signature file passes the signature verification.
And if the signature date is within the validity period of the certificate, the signature fingerprint of the signature certificate is the same as the pre-stored certificate fingerprint, and the hash values of all the structure directory file digests are the same as the hash digests in the signature file, determining that the signature file passes the signature verification.
311. And determining that the signature of the signature file fails to pass the verification.
If the signature date is not within the validity period of the certificate, or the signature fingerprint of the signature certificate is different from the pre-stored certificate fingerprint, or the hash value of the digest of all the structure directory files is different from the hash digest in the signature file, determining that the signature of the signature file does not pass through, and further prompting that the signature file may be false.
In the embodiment of the application, the signature verification process of the structure directory file and the signature file according to the signature result file is described in detail, so that on one hand, the safety of the structure directory file and the signature file in the OFD electronic invoice file is improved, and on the other hand, the reliability of the signature verification process is also improved.
Based on the embodiments described in fig. 2 to 3, the following describes step 204 in the embodiment of fig. 2 in detail, wherein the electronic invoice file in the target format may be a PDF version electronic invoice file, a picture invoice file, or an electronic invoice file in an SVG format, and the format conversion process is described in detail below by taking the SVG format as an example, please refer to fig. 4, and fig. 4 is a detailed step of step 204:
401. drawing a format template of the electronic invoice SVG file according to a template file of the OFD electronic invoice file;
specifically, the structure directory file of the OFD electronic invoice file includes a template file, a data file, a resource file and/or an invoice attachment file of the OFD electronic invoice file.
The OFD electronic invoice template file includes an external contour line template of the electronic invoice and a basic information template of the electronic invoice (such as a invoicing party, an invoicing date, and the like), the electronic invoice data file mainly includes invoicing information in the electronic invoice and position coordinates of the invoicing information, for example, the invoicing party is 1xxx1, the position coordinates are (x1, y1), the invoicing party is 2xxx, the position coordinates are (x2, y2), and the electronic invoice resource file mainly includes a two-dimensional code picture and a signature picture in the electronic invoice and the position coordinates of the picture.
In order to convert the electronic invoice in the OFD format into the electronic invoice in the SVG format, the embodiment of the application draws a format template of the SVG file of the electronic invoice according to the template of the OFD electronic invoice file, for example, draws a contour line in the SVG format, and correspondingly fills basic information (such as a invoicing party, a ticket collecting party, and a billing date) in the template of the OFD electronic invoice file into the format template of the SVG file.
402. Extracting the position coordinates of the invoice data and the invoice data from the data file;
further, in the embodiment of the present application, the position coordinates of the invoice data of the data set of the invoice are extracted from the data file, for example, the specific content corresponding to the invoicing party: 1xxx1, and the position coordinates (x1, y1) of the particular content of the invoker, the particular content corresponding to the invoker: 2xxx, and the location coordinates (x2, y2) of the particular content of the ticket collector, to facilitate populating the particular content corresponding to each project into an electronic invoice file in SVG format.
403. Extracting picture files and position coordinates of the picture files from the resource files;
because the ticket content of the electronic invoice comprises a part of pictures, such as two-dimensional code pictures, signature pictures and the like, besides corresponding characters, the picture file and the position coordinates of the picture file are further extracted from the resource file, so that the corresponding picture is filled into the electronic invoice file in the SVG format according to the position coordinates of the picture.
404. And filling the invoice data and the picture file into a format template of the electronic invoice SVG file according to the position coordinates of the invoice data and the position coordinates of the picture file to obtain and display the electronic invoice SVG file.
After acquiring the invoice data of the electronic invoice and the position coordinates of the invoice data, and the position coordinates of the picture file and the picture file respectively in steps 402 and 403, correspondingly filling the invoice data and the picture file into a format template of the electronic invoice SVG file according to the position coordinates of the invoice data and the position coordinates of the picture file to obtain and display the electronic invoice SVG file.
The method and the device for converting the format of the electronic invoice file have the advantages that the process of converting the electronic invoice file of the OFD format into the electronic invoice file of the SVG format is described in detail, and the reliability of the format conversion process in the embodiment of the application is improved.
Further, after the electronic invoice file in the SVG format is obtained based on fig. 4, if the target format is the electronic invoice file in the PDF format or the picture format, the embodiment of the application may further use a file conversion tool (such as Adobe Illustrator tool, SVGToImage) to convert the electronic invoice SVG file into the electronic invoice PDF file or the electronic invoice picture file, respectively.
Based on the above embodiment, the following further describes the OFD electronic invoice file-based conversion method in the present application in detail, referring to fig. 5, where another embodiment of the OFD electronic invoice file-based conversion method in the embodiment of the present application includes:
501. acquiring function parameters and extension data of the OFD electronic invoice file and the OFD electronic invoice file, wherein the function parameters are used for indicating the extracted content of the OFD electronic invoice file and a first target format to be converted, and the extension data are used for indicating a definition parameter of the electronic invoice file after the format is converted;
specifically, in the embodiment of the application, after the OFD electronic invoice is obtained, a functional parameter and extension data of the OFD electronic invoice file are further obtained, where the functional parameter is used to indicate the content extracted for the OFD electronic invoice file and the first target format to be converted, and the extension data is used to indicate the definition of the electronic invoice file after the format is converted.
Generally, the extracted content of the electronic invoice comprises signature data of an OFD electronic invoice file and electronic invoice data, the signature data of the electronic invoice is consistent with the description of the signature file and the signature result file in the embodiment of fig. 1, and is used for verifying the signature of the signature file, and the electronic invoice data is consistent with the description of the structure directory file in the embodiment of fig. 1, so as to obtain a template file and invoice data of the OFD electronic invoice, and be used for converting the OFD electronic invoice file into an electronic invoice file in a target format according to the template file and invoice data of the OFD electronic invoice.
Besides, the functional parameters further include a first target format to be converted, which is used to indicate to which format the OFD electronic invoice file is converted into, and the first target format generally includes at least one of a PDF format, a picture format, and a SVG format. The extended data is used for indicating the definition of the electronic invoice file after format conversion, generally, the electronic invoice file after format conversion has a default definition value, and after the definition of the electronic invoice file after format conversion is clearly specified by the extended data, the electronic invoice file after format conversion is required to meet the definition parameter.
502. Judging whether the OFD electronic invoice file meets the format standard of the OFD electronic invoice file or not according to the format standard of the OFD electronic invoice file, if so, executing a step 503, and if not, ending the process;
further, in order to avoid acquiring an electronic invoice file in a non-OFD format, in the embodiment of the present application, it may also be determined whether the acquired OFD electronic invoice file meets the format standard of the OFD electronic invoice file according to the format standard of the OFD electronic invoice file, if yes, step 503 is executed, and if not, the process of the present application is ended.
Specifically, for ease of understanding, fig. 6 shows a hierarchical organization structure of the OFD electronic invoice, wherein please refer to table 1 for a description of each structure name.
TABLE 1OFD electronic invoice file hierarchy organization structure
Figure BDA0003667407370000151
Figure BDA0003667407370000161
503. Analyzing the OFD electronic invoice file according to the functional parameters to extract a structure directory file, a signature result file and a signature file of the OFD electronic invoice file;
the description of this step is similar to that of step 202 in the embodiment of fig. 2, and is not repeated here.
504. Checking the structural directory file and the signature file according to the signature result file;
the description of this step is similar to that of step 203 in the embodiment of fig. 2 and that of the embodiment of fig. 3, and is not repeated here.
505. And judging whether the verification of the structure target file and the signature file passes, if so, executing the step 506, and if not, ending the process.
After the result of the signature verification on the structure directory file and the signature file is obtained, whether the signature verification on the structure directory file and the signature file passes or not is further judged, if yes, the step 506 is executed, and if not, the flow is ended.
506. And converting the OFD electronic invoice file into an electronic invoice file in the first target format, and displaying the electronic invoice file meeting the definition parameter.
If the structure directory file and the signature file of the OFD electronic invoice file are verified to pass, which indicates that the electronic invoice file is not tampered, the OFD electronic invoice file is converted into an electronic invoice file in a first target format, and the electronic invoice file meeting the definition parameters in step 501 is displayed.
In the embodiment of the application, the conversion process can be directly quitted when the acquired electronic invoice file is a non-OFD electronic invoice file, and the OFD electronic invoice file can be converted into the electronic invoice file in the first target format meeting the preset definition parameters, so that the personalized requirements of users are met.
The above has described in detail the OFD electronic invoice file-based conversion method in the embodiment of the present application, and the following describes a conversion system based on the OFD electronic invoice file in the embodiment of the present application, please refer to fig. 7, where an embodiment of the OFD electronic invoice file-based conversion system in the embodiment of the present application includes:
an obtaining unit 701, configured to obtain an OFD electronic invoice file;
an analyzing unit 702, configured to analyze the OFD electronic invoice file to extract a structure directory file, a signature result file, and a signature file of the OFD electronic invoice file;
the signature verification unit 703 is configured to verify the signature of the structure directory file and the signature file according to the signature result file;
a conversion unit 704, configured to convert the OFD electronic invoice file into an electronic invoice file in a target format for display when the structure directory file and the signature file pass signature verification.
Optionally, the signature verification unit 703 is specifically configured to:
acquiring a file signature and a signature algorithm in the signature result file, wherein the file signature comprises a hash value of each structure directory file abstract;
calculating the hash value of each abstract of the structure directory file according to the signature algorithm;
and if the hash value of each structural directory file abstract obtained by calculation is the same as the hash value of each structural directory file abstract in the file signature, determining that the structural directory file signature passes.
Optionally, the signature verification unit 703 is specifically configured to:
acquiring a signature algorithm in the signature result file;
performing hash calculation on the hash values of the plurality of structured directory file digests again according to the signature algorithm to obtain the hash values of all the structured directory file digests;
acquiring a hash abstract in the signature file;
and if the hash values of all the structural directory file digests are the same as the hash digests in the signature file, determining that the signature of the signature file passes the verification.
Optionally, the signature verification unit 703 is further configured to:
acquiring signature certificate information and signature date in the signature file, wherein the signature certificate information comprises a certificate validity period and a signature fingerprint;
and if the signature date is within the validity period of the certificate, the signature fingerprint is consistent with the signature fingerprint stored in advance, and the hash values of all the structure directory file digests are the same as the hash digests in the signature file, determining that the signature file passes the signature verification.
Optionally, the structure directory file includes a template file, a data file, a resource file and/or an invoice attachment file of the OFD electronic invoice file; the electronic invoice file with the target format comprises at least one of an electronic invoice PDF file, an electronic invoice picture file and an electronic invoice SVG file;
the conversion unit 704 is specifically configured to:
drawing a format template of the electronic invoice SVG file according to a template file of the OFD electronic invoice file;
extracting the position coordinates of the invoice data and the invoice data from the data file;
extracting picture files and position coordinates of the picture files from the resource files;
and filling the invoice data and the picture file into a format template of the electronic invoice SVG file according to the position coordinates of the invoice data and the position coordinates of the picture file to obtain and display the electronic invoice SVG file.
Optionally, if the electronic invoice file in the target format is an electronic invoice PDF file or an electronic invoice picture file;
the conversion unit 704 is further configured to:
and converting the electronic invoice SVG file into an electronic invoice PDF file or an electronic invoice picture file by using a file conversion tool.
Optionally, the obtaining unit 701 is further configured to:
after an OFD electronic invoice file is acquired, acquiring functional parameters and extension data of the OFD electronic invoice file, wherein the functional parameters are used for indicating the extracted content and a first target format to be converted aiming at the OFD electronic invoice file, and the extension data are used for indicating a definition parameter of the format-converted electronic invoice file;
the parsing unit 702 is specifically configured to:
analyzing the OFD electronic invoice file according to the functional parameters to extract a structure directory file, a signature result file and a signature file of the OFD electronic invoice file;
the conversion unit 704 is specifically configured to:
and converting the OFD electronic invoice file into an electronic invoice file in the first target format, and displaying the electronic invoice file meeting the definition parameters.
Optionally, the system further includes:
the determining unit 705 is configured to determine, after acquiring the OFD electronic invoice file and before parsing the OFD electronic invoice file, whether the OFD electronic invoice file meets the format standard of the OFD electronic invoice file according to a format standard of a prestored OFD electronic invoice file, and trigger a step of parsing the OFD electronic invoice file when the OFD electronic invoice file meets the format standard of the OFD electronic invoice file.
Specifically, the functions of the units in the embodiment of the present application are similar to those described in the embodiment of fig. 2 to 5, and are not described again here.
In the embodiment of the application, the OFD electronic invoice file is acquired through the acquisition unit 701; analyzing the OFD electronic invoice file through an analyzing unit 702 to extract a structure directory file, a signature result file and a signature file of the OFD electronic invoice file; the signature verification unit 703 is used for verifying the signature of the structure directory file and the signature file according to the signature result file; if the label is verified, the OFD electronic invoice file is converted into an electronic invoice file in a target format by the conversion unit 704 for display. That is, in the embodiment of the present application, when the OFD electronic invoice file is not tampered, the OFD electronic invoice file is converted into an electronic invoice file in a target format that can be displayed on other electronic devices, so that the OFD electronic invoice file can also be normally displayed on other electronic devices.
The embodiment of the present application further provides a computer program product, on which a computer program is stored, and when the computer program is executed by a computer device, the computer program is used to implement the OFD-based electronic invoice file conversion method described in the embodiments of fig. 2 to fig. 5 of the present application.
The OFD electronic invoice file-based conversion system in the embodiment of the present application is described above from the perspective of a modular functional entity, and the computer apparatus in the embodiment of the present application is described below from the perspective of hardware processing:
the computer device is used for realizing the function of a conversion system based on an OFD electronic invoice file, and one embodiment of the computer device in the embodiment of the application comprises the following steps:
a processor and a memory;
the memory is used for storing the computer program, and the processor is used for realizing the following steps when executing the computer program stored in the memory:
obtaining an OFD electronic invoice file;
analyzing the OFD electronic invoice file to extract a structure directory file, a signature result file and a signature file of the OFD electronic invoice file;
checking the structural directory file and the signature file according to the signature result file;
and if the label is checked to pass, converting the OFD electronic invoice file into an electronic invoice file in a target format for display.
In some embodiments of the present application, the processor may be further configured to:
acquiring a file signature and a signature algorithm in the signature result file, wherein the file signature comprises a hash value of each structure directory file abstract;
calculating the hash value of each abstract of the structure directory file according to the signature algorithm;
and if the hash value of each structural directory file abstract obtained by calculation is the same as the hash value of each structural directory file abstract in the file signature, determining that the structural directory file signature passes the verification.
In some embodiments of the present application, the processor may be further configured to:
acquiring a signature algorithm in the signature result file;
performing hash calculation on the hash values of the plurality of structured directory file digests again according to the signature algorithm to obtain the hash values of all the structured directory file digests;
acquiring a hash abstract in the signature file;
and if the hash values of all the structural directory file digests are the same as the hash digests in the signature file, determining that the signature of the signature file passes the verification.
In some embodiments of the present application, the processor may be further configured to:
acquiring signature certificate information and signature date in the signature file, wherein the signature certificate information comprises a certificate validity period and a signature fingerprint;
if the hash value of the all structure directory file digests is the same as the hash digest in the signature file, determining that the signature file passes the verification, comprising:
and if the signature date is within the validity period of the certificate, the signature fingerprint is consistent with the signature fingerprint stored in advance, and the hash values of all the structure directory file digests are the same as the hash digests in the signature file, determining that the signature file passes the signature verification.
In some embodiments of the present application, the structure directory file comprises a template file, a data file, a resource file, and/or an invoice attachment file of the OFD electronic invoice file; the electronic invoice file with the target format comprises at least one of an electronic invoice PDF file, an electronic invoice picture file and an electronic invoice SVG file, and the processor can be further used for realizing the following steps:
drawing a format template of the electronic invoice SVG file according to a template file of the OFD electronic invoice file;
extracting the position coordinates of the invoice data and the invoice data from the data file;
extracting picture files and position coordinates of the picture files from the resource files;
and filling the invoice data and the picture file into a format template of the electronic invoice SVG file according to the position coordinates of the invoice data and the position coordinates of the picture file to obtain and display the electronic invoice SVG file.
In some embodiments of the application, if the electronic invoice file in the target format is an electronic invoice PDF file or an electronic invoice picture file, the processor may be further configured to implement the following steps:
and converting the electronic invoice SVG file into an electronic invoice PDF file or an electronic invoice picture file by using a file conversion tool.
In some embodiments of the present application, after obtaining the OFD electronic invoice file, the processor may be further configured to:
acquiring functional parameters and extended data of the OFD electronic invoice file, wherein the functional parameters are used for indicating the extracted content of the OFD electronic invoice file and a first target format to be converted, and the extended data are used for indicating a definition parameter of the format-converted electronic invoice file;
in some embodiments of the present application, the processor may be further configured to:
analyzing the OFD electronic invoice file according to the functional parameters to extract a structure directory file, a signature result file and a signature file of the OFD electronic invoice file;
in some embodiments of the present application, the processor may be further configured to:
and converting the OFD electronic invoice file into an electronic invoice file in the first target format, and displaying the electronic invoice file meeting the definition parameter.
In some embodiments of the present application, after obtaining the OFD electronic invoice file, and before parsing the OFD electronic invoice file, the processor may be further configured to implement the following steps:
judging whether the OFD electronic invoice file meets the format standard of the OFD electronic invoice file or not according to the format standard of the OFD electronic invoice file;
and if so, triggering the step of analyzing the OFD electronic invoice file.
It is to be understood that, when the processor in the computer apparatus described above executes the computer program, the functions of each unit in the corresponding apparatus embodiments may also be implemented, and are not described herein again. Illustratively, the computer program may be partitioned into one or more modules/units that are stored in the memory and executed by the processor to accomplish the present application. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used for describing the execution process of the computer program in the OFD electronic invoice file-based conversion system. For example, the computer program may be divided into units in the above-described OFD electronic invoice file-based conversion system, and each unit may implement specific functions as described above in the description of the corresponding OFD electronic invoice file-based conversion system.
The computer device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing equipment. The computer device may include, but is not limited to, a processor, a memory. It will be appreciated by those skilled in the art that the processor, memory are merely examples of a computer apparatus and do not constitute a limitation of the computer apparatus, and may include more or fewer components, or combine certain components, or different components, for example, the computer apparatus may also include input output devices, network access devices, buses, and the like.
The Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. The general purpose processor may be a microprocessor or the processor may be any conventional processor or the like which is the control center for the computer device and which connects the various parts of the overall computer device using various interfaces and lines.
The memory may be used to store the computer programs and/or modules, and the processor may implement various functions of the computer device by running or executing the computer programs and/or modules stored in the memory and invoking data stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program 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 the use of the terminal, and the like. In addition, the memory may include high speed random access memory, and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other volatile solid state storage device.
The present application further provides a computer-readable storage medium for implementing the functions of the OFD electronic invoice file-based conversion system, on which a computer program is stored, and when the computer program is executed by a processor, the processor, when the computer program stored in the computer-readable storage medium is executed by the processor, may be configured to perform the following steps:
obtaining an OFD electronic invoice file;
analyzing the OFD electronic invoice file to extract a structure directory file, a signature result file and a signature file of the OFD electronic invoice file;
checking the structural directory file and the signature file according to the signature result file;
and if the label is checked to pass, converting the OFD electronic invoice file into an electronic invoice file in a target format for display.
In some embodiments of the application, the computer program stored by the computer-readable storage medium, when executed by the processor, may further be configured to implement the steps of:
acquiring a file signature and a signature algorithm in the signature result file, wherein the file signature comprises a hash value of each structure directory file abstract;
calculating the hash value of each structure directory file abstract according to the signature algorithm;
and if the hash value of each structural directory file abstract obtained by calculation is the same as the hash value of each structural directory file abstract in the file signature, determining that the structural directory file signature passes the verification.
In some embodiments of the application, the computer program stored by the computer-readable storage medium, when executed by the processor, may further be configured to implement the steps of:
acquiring a signature algorithm in the signature result file;
performing hash calculation on the hash values of the plurality of structured directory file digests again according to the signature algorithm to obtain the hash values of all the structured directory file digests;
acquiring a hash abstract in the signature file;
and if the hash values of all the structural directory file digests are the same as the hash digests in the signature file, determining that the signature of the signature file passes the verification.
In some embodiments of the application, the computer program stored by the computer-readable storage medium, when executed by the processor, may further be configured to implement the steps of:
acquiring signature certificate information and signature dates in the signature file, wherein the signature certificate information comprises a certificate validity period and signature fingerprints;
if the hash value of the all structure directory file digests is the same as the hash digest in the signature file, determining that the signature file passes the verification, comprising:
and if the signature date is within the validity period of the certificate, the signature fingerprint is consistent with the signature fingerprint stored in advance, and the hash values of all the structure directory file digests are the same as the hash digests in the signature file, determining that the signature file passes the signature verification.
In some embodiments of the present application, the structure directory file comprises a template file, a data file, a resource file, and/or an invoice attachment file of the OFD electronic invoice file; the electronic invoice file with the target format comprises at least one of an electronic invoice PDF file, an electronic invoice picture file and an electronic invoice SVG file, and when a computer program stored in a computer-readable storage medium is executed by a processor, the processor can be further used for realizing the following steps:
drawing a format template of the electronic invoice SVG file according to a template file of the OFD electronic invoice file;
extracting the position coordinates of the invoice data and the invoice data from the data file;
extracting picture files and position coordinates of the picture files from the resource files;
and filling the invoice data and the picture file into a format template of the electronic invoice SVG file according to the position coordinates of the invoice data and the position coordinates of the picture file to obtain and display the electronic invoice SVG file.
In some embodiments of the present application, if the electronic invoice file in the target format is an electronic invoice PDF file or an electronic invoice picture file, and when a computer program stored in a computer-readable storage medium is executed by a processor, the processor may further be configured to implement the following steps:
and converting the electronic invoice SVG file into an electronic invoice PDF file or an electronic invoice picture file by using a file conversion tool.
In some embodiments of the present application, after obtaining the OFD electronic invoice file, the processor, when being executed by the computer program stored in the computer readable storage medium, may further be configured to implement the following steps:
acquiring functional parameters and extended data of the OFD electronic invoice file, wherein the functional parameters are used for indicating the extracted content of the OFD electronic invoice file and a first target format to be converted, and the extended data are used for indicating a definition parameter of the format-converted electronic invoice file;
in some embodiments of the application, the computer program stored by the computer-readable storage medium, when executed by the processor, may further be configured to implement the steps of:
analyzing the OFD electronic invoice file according to the functional parameters to extract a structure directory file, a signature result file and a signature file of the OFD electronic invoice file;
in some embodiments of the application, the computer program stored by the computer-readable storage medium, when executed by the processor, may further be configured to implement the steps of:
and converting the OFD electronic invoice file into an electronic invoice file in the first target format, and displaying the electronic invoice file meeting the definition parameter.
In some embodiments of the present application, after obtaining the OFD electronic invoice file and before parsing the OFD electronic invoice file, the processor, when the computer program stored in the computer-readable storage medium is executed by the processor, may be further configured to implement the following steps:
judging whether the OFD electronic invoice file meets the format standard of the OFD electronic invoice file or not according to the format standard of the OFD electronic invoice file;
and if so, triggering the step of analyzing the OFD electronic invoice file.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a portable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, an optical disk, or other various media capable of storing program codes.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit may be implemented in the form of hardware, or may also be implemented in the form of a software functional unit.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (11)

1. A method for converting an OFD-based electronic invoice file is characterized by comprising the following steps:
obtaining an OFD electronic invoice file;
analyzing the OFD electronic invoice file to extract a structure directory file, a signature result file and a signature file of the OFD electronic invoice file;
checking the structural directory file and the signature file according to the signature result file;
and if the label is checked to pass, converting the OFD electronic invoice file into an electronic invoice file in a target format for display.
2. The method of claim 1, wherein signing the structured directory file according to the signature result file comprises:
acquiring a file signature and a signature algorithm in the signature result file, wherein the file signature comprises a hash value of each structure directory file abstract;
calculating the hash value of each abstract of the structure directory file according to the signature algorithm;
and if the hash value of each structural directory file abstract obtained by calculation is the same as the hash value of each structural directory file abstract in the file signature, determining that the structural directory file signature passes the verification.
3. The method of claim 1, wherein signing the signature file according to a signature result file comprises:
acquiring a signature algorithm in the signature result file;
performing hash calculation on the hash values of the plurality of structured directory file digests again according to the signature algorithm to obtain the hash values of all the structured directory file digests;
acquiring a hash abstract in the signature file;
and if the hash values of all the structural directory file digests are the same as the hash digests in the signature file, determining that the signature of the signature file passes the verification.
4. The method of claim 3, wherein signing the signature file based on the signature result file further comprises:
acquiring signature certificate information and signature dates in the signature file, wherein the signature certificate information comprises a certificate validity period and signature fingerprints;
if the hash value of the all structure directory file digests is the same as the hash digest in the signature file, determining that the signature file passes the verification, comprising:
and if the signature date is within the validity period of the certificate, the signature fingerprint is consistent with the signature fingerprint stored in advance, and the hash values of all the structure directory file digests are the same as the hash digests in the signature file, determining that the signature file passes the signature verification.
5. The method according to claim 1, wherein the structure directory file comprises a template file, a data file, a resource file and/or an invoice attachment file of the OFD electronic invoice file; the electronic invoice file with the target format comprises at least one of an electronic invoice PDF file, an electronic invoice picture file and an electronic invoice SVG file;
if the electronic invoice file in the target format is an electronic invoice SVG file, the OFD electronic invoice file is converted into the electronic invoice file in the target format for display, and the method comprises the following steps:
drawing a format template of the electronic invoice SVG file according to a template file of the OFD electronic invoice file;
extracting the position coordinates of the invoice data and the invoice data from the data file;
extracting picture files and position coordinates of the picture files from the resource files;
and filling the invoice data and the picture file into a format template of the electronic invoice SVG file according to the position coordinates of the invoice data and the position coordinates of the picture file to obtain and display the electronic invoice SVG file.
6. The method according to claim 5, wherein if the electronic invoice file in the target format is an electronic invoice PDF file or an electronic invoice picture file;
the step of converting the OFD electronic invoice file into an electronic invoice file in a target format for display includes:
and converting the electronic invoice SVG file into an electronic invoice PDF file or an electronic invoice picture file by using a file conversion tool.
7. The method of claim 1, wherein after obtaining the OFD electronic invoice file, the method further comprises:
acquiring functional parameters and extended data of the OFD electronic invoice file, wherein the functional parameters are used for indicating the extracted content of the OFD electronic invoice file and a first target format to be converted, and the extended data are used for indicating a definition parameter of the format-converted electronic invoice file;
the analyzing the OFD electronic invoice file to extract a structure directory file, a signature result file and a signature file of the OFD electronic invoice file comprises the following steps:
analyzing the OFD electronic invoice file according to the functional parameters to extract a structure directory file, a signature result file and a signature file of the OFD electronic invoice file;
the step of converting the OFD electronic invoice file into an electronic invoice file in a target format for display includes:
and converting the OFD electronic invoice file into an electronic invoice file in the first target format, and displaying the electronic invoice file meeting the definition parameter.
8. The method according to any of claims 1 to 7, wherein after obtaining the OFD electronic invoice file, and before parsing the OFD electronic invoice file, the method further comprises:
judging whether the OFD electronic invoice file meets the format standard of the OFD electronic invoice file or not according to the format standard of the OFD electronic invoice file;
and if so, triggering the step of analyzing the OFD electronic invoice file.
9. A conversion system based on OFD electronic invoice file is characterized by comprising:
the acquisition unit is used for acquiring an OFD electronic invoice file;
the analysis unit is used for analyzing the OFD electronic invoice file to extract a structure directory file, a signature result file and a signature file of the OFD electronic invoice file;
the signature verification unit is used for verifying the signature of the structure directory file and the signature file according to the signature result file;
and the conversion unit is used for converting the OFD electronic invoice file into an electronic invoice file in a target format for display when the structural directory file and the signature file pass signature verification.
10. A computer arrangement comprising a processor, characterized in that the processor, when executing a computer program stored on a memory, is adapted to implement the OFD-based electronic invoice file conversion method according to any one of claims 1 to 8.
11. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, is configured to implement the OFD-based electronic invoice file conversion method according to any one of claims 1 to 8.
CN202210591058.2A 2022-05-27 2022-05-27 OFD-based electronic invoice file conversion method, system and related device Pending CN114970496A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210591058.2A CN114970496A (en) 2022-05-27 2022-05-27 OFD-based electronic invoice file conversion method, system and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210591058.2A CN114970496A (en) 2022-05-27 2022-05-27 OFD-based electronic invoice file conversion method, system and related device

Publications (1)

Publication Number Publication Date
CN114970496A true CN114970496A (en) 2022-08-30

Family

ID=82957989

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210591058.2A Pending CN114970496A (en) 2022-05-27 2022-05-27 OFD-based electronic invoice file conversion method, system and related device

Country Status (1)

Country Link
CN (1) CN114970496A (en)

Similar Documents

Publication Publication Date Title
CN106598930B (en) electronic license processing method based on layout file
US10140511B2 (en) Building classification and extraction models based on electronic forms
CN107888557B (en) Method and system for generating protocol file
CN110597511B (en) Page automatic generation method, system, terminal equipment and storage medium
US9715625B2 (en) Hierarchical information extraction using document segmentation and optical character recognition correction
US10339373B1 (en) Optical character recognition utilizing hashed templates
CN110737630B (en) Method and device for processing electronic archive file, computer equipment and storage medium
CN111814441A (en) Report generation method and device, electronic equipment and storage medium
CN110532808A (en) A kind of electronic signature method based on electronic document image object
CN110266469A (en) A kind of remote online electronic signature method based on WEB script data stream operation
CN113489704A (en) Sensitive data identification method and device based on flow, electronic equipment and medium
CN111142863A (en) Page generation method and device
CN116360769A (en) Code generation method, device, equipment and storage medium
CN109214362B (en) Document processing method and related equipment
CN112235409B (en) File uploading method and device, electronic equipment and computer readable storage medium
CN113986822A (en) Method and system for converting format of value-added tax electronic invoice
CN113177193A (en) Watermark adding method, watermark verifying method and terminal equipment
CN113660156A (en) Processing method and device for transmission file, electronic equipment and storage medium
CN112100685A (en) Encryption and tamper-proof processing method for checking and detecting electronic report
CN114970496A (en) OFD-based electronic invoice file conversion method, system and related device
CN112464180A (en) Page screenshot outgoing control method and system, electronic device and storage medium
CN114422586B (en) Event notification method, event notification device, computer equipment and storage medium
CN115511645A (en) Method, device and equipment for detecting claim settlement picture and storage medium
CN113807901A (en) Electronic invoice detection method, terminal equipment and storage medium
CN108052842A (en) Storage, verification method and the device of signed data

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