Extensible markup language (XML) format electricity ticket checking method and device and storage medium
By calling the HTTPS or FTP interface, and using the hutool toolkit and the front-end template engine for data conversion and page rendering, the problems of cumbersome operations, interface limitations and data security risks in the existing technology are solved, and a more efficient, safe and convenient digital ticket checking experience is achieved.
Patent Information
- Application Number
- CN202411978743.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-15
AI Technical Summary
The existing digital ticket viewing tools or software have problems such as cumbersome operation, limitations of display interfaces and data security risks.
By calling the HTTPS interface or the FTP server, the XML formatted ticket is obtained, and the hutool toolkit is used to convert the XML formatted ticket into JSON information, and then the encryption process is performed and returned to the front end. Then, the front-end template engine is used to determine the invoice type based on JSON information and perform page rendering and display.
It simplifies user operation steps, improves the intuitiveness and interactive experience of the user interface, and enhances data security through encryption and decryption technologies, avoiding the risk of locally storing sensitive files.
Smart Images

Figure CN119829187A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of file processing technology, and in particular to a method, device and storage medium for viewing digital invoices in XML format. Background Art
[0002] As the global digitalization process accelerates, digital invoices, as a digital substitute for traditional paper invoices, have become an important tool for modern financial management and tax processing. Digital invoices not only improve the efficiency of invoice issuance, transmission, storage and management, but also significantly reduce the operating costs of enterprises and promote the transparency and intelligence of tax management.
[0003] Currently, viewing digital invoices in XML format usually relies on professional tools or software. Most of these software products are based on the XBRL specification formulated by the Ministry of Finance, which is a set of XML definition standards for 9 types of digital invoices. The software parses the XML file through technical means and extracts relevant information of the invoice, such as invoice code, invoice number, invoice date, buyer and seller information, etc. The extracted relevant information can be displayed to the user in two ways: one is to display it directly in text form on the user interface, and the other is to convert the information into images, PDF, OFD and other formats according to the digital invoice template of the Ministry of Finance for easy printing and saving.
[0004] However, although the existing digital ticket viewing tools or software meet the needs of users to a certain extent, they have the following defects:
[0005] (1) Complicated operation: When using these tools or software, users usually need to download and install specific software before opening the software to load and view digital invoices. This process not only increases the number of user operation steps, but also reduces the user's convenience to a certain extent.
[0006] (2) Display interface limitations: Invoice information displayed directly in text form is simple and direct, but lacks intuitiveness and cannot completely restore the original style of the invoice, which may affect the user's visual experience and judgment of the invoice information. Although converting the invoice information into images or other formats can provide a visual effect closer to the original invoice, there is a risk of failure in the conversion process. For example, the conversion may fail due to file format compatibility issues, and the converted file may not be easy to view on all devices, affecting the user experience.
[0007] (3) Data security risks: Since users need to install specific software to view digital invoices, this may introduce security vulnerabilities to the computer system. In addition, existing tools or software often lack effective data permission control mechanisms and cannot ensure data security and privacy. Summary of the invention
[0008] The embodiment of the present application provides a method, device and storage medium for viewing digital electronic tickets in XML format to solve the problems existing in the related technologies. The technical solution is as follows:
[0009] In a first aspect, an embodiment of the present application provides a method for viewing a digital ticket in XML format, including:
[0010] Call the HTTPS interface or FTP server to obtain the digital ticket in XML format;
[0011] Call the hutool toolkit to convert the digital invoice in XML format into JSON information, encrypt the JSON information and return it to the front end of the specified invoice management system;
[0012] Calling the front end to decrypt the encrypted JSON information to obtain the JSON information, and determining the invoice type of the digital invoice in XML format according to the JSON information;
[0013] The specified front-end template engine is called to render and display the XML digital invoice on the front-end according to the invoice type and the JSON information.
[0014] In one embodiment, calling the HTTPS interface to obtain the digital ticket in XML format includes:
[0015] Constructing a first HTTPS request for requesting the digital ticket in the XML format;
[0016] Sending the first HTTPS request to the designated invoice management system;
[0017] Receive response information returned by the designated invoice management system in response to the first HTTPS request, wherein the response information includes the digital invoice in XML format.
[0018] In one embodiment, calling an FTP server to obtain a digital ticket in XML format includes:
[0019] Connecting to an FTP server storing the digital electronic tickets in the XML format;
[0020] Log in to the FTP server;
[0021] Call the FTP server to download the digital ticket in XML format.
[0022] In one embodiment, calling the hutool toolkit to convert the digital invoice in XML format into JSON information, encrypting the JSON information and returning it to the front end of the specified invoice management system includes:
[0023] Add dependencies related to the hutool tool and JavaCryptography in the front-end project of the specified invoice management system;
[0024] Calling XmlUtil and JSONUtil in the hutool tool to read the digital invoice in the XML format, and converting the read digital invoice in the XML format into the JSON information;
[0025] Calling the hutool tool to encrypt the JSON information based on the RSA algorithm by using the Java KeyPairGenerator class to obtain the encrypted JSON information;
[0026] The hutool tool is called to return the encrypted JSON information to the front end of the specified invoice management system.
[0027] In one embodiment, determining the invoice type of the digital invoice in XML format according to the JSON information includes:
[0028] Parse the JSON information and convert it into a JavaScript object;
[0029] Check the key attributes of the JavaScript object, and determine the invoice type of the digital invoice in XML format based on the key attributes.
[0030] In one embodiment, calling a specified front-end template engine to render and display the XML digital invoice on the front-end according to the invoice type and the JSON information includes:
[0031] Get the rendering template corresponding to the invoice type;
[0032] Calling the specified front-end template engine to generate rendered HTML based on the rendering template and the JSON information, wherein the rendered HTML uses a cascading style sheet to display the digital invoice in XML format;
[0033] The specified front-end template engine is called to insert the rendered HTML into a specified position of the display page of the front end for display.
[0034] In one implementation, the designated front-end template engine is an art-template front-end template engine.
[0035] In a second aspect, the embodiment of the present application further provides a device for viewing digital electronic tickets in XML format, including:
[0036] A receiving unit, used to call an HTTPS interface or an FTP server to obtain a digital ticket in XML format;
[0037] A conversion unit, used for calling the hutool toolkit to convert the digital invoice in XML format into JSON information, encrypting the JSON information and returning it to the front end of the specified invoice management system;
[0038] A determination unit, configured to call the front end to decrypt the encrypted JSON information to obtain the JSON information, and determine the invoice type of the digital invoice in XML format according to the JSON information;
[0039] The rendering unit is used to call a specified front-end template engine to render and display the XML digital invoice on the front end according to the invoice type and the JSON information.
[0040] In one embodiment, when the receiving unit is used to call the HTTPS interface to obtain the digital ticket in XML format, it is specifically used to:
[0041] Constructing a first HTTPS request for requesting the digital ticket in the XML format;
[0042] Sending the first HTTPS request to the designated invoice management system;
[0043] Receive response information returned by the designated invoice management system in response to the first HTTPS request, wherein the response information includes the digital invoice in XML format.
[0044] In one embodiment, when the receiving unit is used to call the FTP server to obtain the digital ticket in XML format, it is specifically used to:
[0045] Connecting to an FTP server storing the digital electronic tickets in the XML format;
[0046] Log in to the FTP server;
[0047] Call the FTP server to download the digital ticket in XML format.
[0048] In one embodiment, the conversion unit is used to call the hutool toolkit to convert the digital invoice in XML format into JSON information, encrypt the JSON information and return it to the front end of the specified invoice management system, specifically for:
[0049] Add dependencies related to the hutool tool and JavaCryptography in the front-end project of the specified invoice management system;
[0050] Calling XmlUtil and JSONUtil in the hutool tool to read the digital invoice in the XML format, and converting the read digital invoice in the XML format into the JSON information;
[0051] Calling the hutool tool to encrypt the JSON information based on the RSA algorithm by using the Java KeyPairGenerator class to obtain the encrypted JSON information;
[0052] The hutool tool is called to return the encrypted JSON information to the front end of the specified invoice management system.
[0053] In one embodiment, when the determining unit is used to determine the invoice type of the digital invoice in XML format according to the JSON information, it is specifically used to:
[0054] Parse the JSON information and convert it into a JavaScript object;
[0055] Check the key attributes of the JavaScript object, and determine the invoice type of the digital invoice in XML format based on the key attributes.
[0056] In one embodiment, when the rendering unit is used to call a specified front-end template engine to render and display the XML digital invoice on the front end according to the invoice type and the JSON information, it is specifically used to:
[0057] Get the rendering template corresponding to the invoice type;
[0058] Calling the specified front-end template engine to generate rendered HTML based on the rendering template and the JSON information, wherein the rendered HTML uses a cascading style sheet to display the digital invoice in XML format;
[0059] The specified front-end template engine is called to insert the rendered HTML into a specified position of the display page of the front end for display.
[0060] In one implementation, the designated front-end template engine is an art-template front-end template engine.
[0061] In a third aspect, an embodiment of the present application further provides a computer device, comprising: a memory and a processor, wherein the memory stores instructions, and the instructions are loaded and executed by the processor to implement a method in any one of the above-mentioned aspects, wherein the memory and the processor communicate with each other through an internal connection path.
[0062] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program runs on a computer, the method in any one of the above-mentioned embodiments is implemented.
[0063] The advantages or beneficial effects of the above technical solution include at least:
[0064] This application uses the HTTPS protocol or FTP protocol for file transfer to ensure the security of data during the transmission process, and processes data by implementing encryption and decryption technology and avoiding local storage of sensitive files, thereby further enhancing data security. At the same time, by utilizing front-end template engine technology, the user interface and interactive experience are optimized, so that digital invoices in XML format can be displayed in real time, improving the convenience of individual users and the speed of digital transformation of enterprises.
[0065] In summary, this application is relatively easy to implement, can be deployed independently, or implemented in existing businesses. It can solve the problems of existing technologies in compatibility, data security and permission control, real-time updates and synchronization, cross-platform and mobile access, thereby reducing the technical difficulty for users to view digital invoices in real time, promoting the widespread application of digital invoices, and significantly improving the user experience.
[0066] The above summary is for illustrative purposes only and is not intended to be limiting in any way. In addition to the illustrative aspects, embodiments and features described above, further aspects, embodiments and features of the present application will be readily apparent by reference to the accompanying drawings and the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] In the accompanying drawings, unless otherwise specified, the same reference numerals throughout the multiple drawings represent the same or similar parts or elements. These drawings are not necessarily drawn to scale. It should be understood that these drawings only depict some embodiments disclosed in the present application and should not be regarded as limiting the scope of the present application.
[0068] Figure 1 An example flow chart of a method for viewing digital electronic tickets in XML format provided in an embodiment of the present application;
[0069] Figure 2 An example diagram of the page rendering display effect of a digital electronic ticket in XML format provided in an embodiment of the present application;
[0070] Figure 3 A structural block diagram of a digital ticket viewing device in XML format provided in an embodiment of the present application;
[0071] Figure 4A structural block diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0072] In the following, only some exemplary embodiments are briefly described. As those skilled in the art will appreciate, the described embodiments may be modified in various ways without departing from the spirit or scope of the present application. Therefore, the drawings and descriptions are considered to be exemplary and non-restrictive in nature.
[0073] Before introducing the embodiments of the present application, some terms in the present application are first explained to facilitate understanding by those skilled in the art.
[0074] Digital invoices, that is, fully digitalized electronic invoices (fully electronic invoices), are a new form of invoice with the same legal effect as paper invoices. They do not exist in paper form, but are completely digital and do not require media support.
[0075] CSS, or Cascading Style Sheets (abbreviated as CSS), is a style sheet language used to describe the presentation of HTML or XML (including XML branch languages such as SVG, MathML or XHTML) documents. CSS describes how elements should be rendered on screens, paper, audio and other media.
[0076] XML, Extensible Markup Language (XML), is a subset of the standard generalized markup language. It can be used to mark data and define data types. It is a source language that allows users to define their own markup languages.
[0077] XBRL, or eXtensible Business Reporting Language, is an application of XML to the exchange of financial reporting information. It is currently widely used in financial reporting and related regulatory reporting fields, such as financial institution prudential supervision reports, listed company annual reports, tax reports, etc.
[0078] art-template is a simple and super fast template engine. It uses scope pre-declaration technology to optimize template rendering speed, thereby achieving operating performance close to the limit of JavaScript, and supports both NodeJS and browsers.
[0079] Hutool is a feature-rich and easy-to-use Java tool library that aims to help developers complete various development tasks quickly and conveniently through the use of many practical tool classes.
[0080] Various technical solutions provided by the embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0081] Figure 1 A flowchart of a method for viewing digital invoices in XML format according to an embodiment of the present application is shown.
[0082] As shown in the figure, the method may include the following steps:
[0083] S110. Call the HTTPS interface or FTP server to obtain the digital invoice in XML format.
[0084] In one embodiment, the implementation process of calling the HTTPS interface to obtain the digital invoice in XML format may include the following steps:
[0085] S111. Construct the first HTTPS request for requesting a digital invoice in XML format.
[0086] In specific implementation, before executing step S111, necessary authentication information such as API key and API document can be obtained from the service provider (i.e., the designated invoice management system service provider). The API document can include the method of using the API. The API key can be changed regularly to reduce security risks.
[0087] In specific implementation, a first HTTPS request may be constructed according to the API document, wherein the first HTTPS request may include but is not limited to: a correct URL, an HTTPS method (such as GET or POST), and a request header necessary for authentication (such as authentication information cet, content type, etc.).
[0088] S112. Send a first HTTPS request to a designated invoice management system.
[0089] During specific implementation, a programming language (such as Python, Java, etc.) may be used to send the first HTTPS request to a designated invoice management system.
[0090] In specific implementation, the designated invoice management system may be a bill management system or an expense reimbursement system, or may be other systems with invoice management functions, which is not limited in the embodiments of the present application.
[0091] S113: Receive response information returned by the designated invoice management system in response to the first HTTPS request.
[0092] In a specific implementation, the response information may include but is not limited to: a digital ticket in XML format.
[0093] As an example, in step S113, the HTTP status code may be checked to confirm whether the first HTTPS request is successful. For example, the HTTP status code may be checked based on the API key to confirm whether the first HTTPS request is successful. If unsuccessful, an error code (such as 404, 500, etc.) may be returned. Thus, error handling may be performed as required by checking the error code.
[0094] In this example, corresponding logging can also be performed, such as recording the sent HTTPS request and detailed information of the specified invoice management system's response to the sent HTTPS request, to facilitate problem troubleshooting and debugging.
[0095] In an embodiment of the present application, by calling the HTTPS interface to obtain the digital invoice in XML format, it can be ensured that HTTPS is used instead of HTTP to obtain the digital invoice in XML format, that is, by adopting the HTTPS protocol to transmit the digital invoice in XML format, the security of the data during the transmission process can be ensured, thereby improving the security of data transmission.
[0096] In another embodiment, the implementation process of calling the FTP server to obtain the digital ticket in XML format may include the following steps:
[0097] S111a, connect to the FTP server storing the digital invoices in XML format.
[0098] In specific implementation, before executing step S111a, necessary authentication information such as FTP account and login password, relevant information of FTP server, etc. can be obtained from the service provider (i.e., the designated invoice management system service provider). The relevant information may include: address, port, etc. of FTP server. The login password of FTP account can be changed regularly to reduce security risks.
[0099] During specific implementation, a programming language (such as Python's ftplib library and Java's ftpclint, etc.) can be used to connect to the FTP server.
[0100] S112a, log in to the FTP server.
[0101] In specific implementation, the FTP server can be logged in by entering the FTP account and login password provided by the service provider on the login page of the FTP server.
[0102] S113a, calling the FTP server to download the digital ticket in XML format.
[0103] In specific implementation, after logging into the FTP server, you can navigate to the file directory and find the directory storing XML format files (including XML format digital electronic tickets). Then, select the required XML format digital electronic tickets in the directory and call the FTP server to download the XML format digital electronic tickets to the local computer.
[0104] In specific implementation, in this implementation mode, corresponding log records may also be performed, such as detailed information on logging into the FTP server, to facilitate problem troubleshooting and debugging.
[0105] In specific implementation, during FTP transmission, SFTP or FTPS can be used to encrypt data to prevent the data from being intercepted during transmission.
[0106] As an example, after completing the download of the digital invoice in XML format, the connection with the FTP server can be disconnected.
[0107] In the embodiment of the present application, by calling the FTP server to obtain the digital invoice in XML format, the data can be prevented from being intercepted during the transmission process, thereby improving the security of data transmission.
[0108] In an embodiment of the present application, by executing step S110, there is no need to first download and install specific software to obtain the digital invoice in XML format, which can simplify the operation steps for users to view the digital invoice in XML format, and help improve the convenience of users to view the digital invoice in XML format.
[0109] S120, calling the hutool toolkit to convert the digital invoice in XML format into JSON information, encrypting the JSON information and returning it to the front end of the specified invoice management system.
[0110] In one implementation, the implementation process of step S120 may include the following steps:
[0111] S121. Add dependencies related to hutool and JavaCryptography in the front-end project of the specified invoice management system.
[0112] As an example, if Maven is used for project dependency management, that is, the front-end project is a Maven project, you can add the following dependencies to the pom.xml of the Maven project:
[0113] <!--Hutool Tools-->
[0114] <dependency>
[0115] <groupid> cn.hutool< / groupid>
[0116] <artifactid> hutool-all< / artifactid>
[0117] <version> 5.7.16< / version> <!--Please check the latest version-->
[0118] < / dependency>
[0119] <!-- RSA encryption may require additional libraries, but the Java standard library is sufficient -->
[0120] In the embodiment of the present application, by executing step S121, it can be ensured that the front-end project of the specified invoice management system includes the dependencies related to hutool and Java Cryptography.
[0121] S122. Call XmlUtil and JSONUtil in the hutool tool to read the digital invoice in XML format, and convert the read digital invoice in XML format into JSON information.
[0122] During specific implementation, the JSON may be a JSON string.
[0123] As an example, step S122 may be implemented by the following code:
[0124]
[0125] S123, calling the hutool tool to encrypt the JSON information by using the Java KeyPairGenerator class and the RSA algorithm to obtain the encrypted JSON information.
[0126] In specific implementation, the RSA algorithm is an asymmetric encryption algorithm.
[0127] In specific implementation, the hutool tool may be called to generate an RSA key pair based on the RSA algorithm by using the Java KeyPairGenerator class, and then Cipher may be used to encrypt the JSON information based on the RSA key pair to obtain the encrypted JSON information.
[0128] As an example, step S123 may be implemented by the following code:
[0129] public static string encrypt(string data,PublicKey publicKey)throwsException{
[0130] Cipher cipher=cipher.getInstance(ALGORITHM);
[0131] cipher.init(cipher.ENCRYPT MODE,publickey);
[0132] byte[]encryptedBytes=cipher.doFinal(data.getBytes());
[0133] return Base64.getEncoder().encodeToString(encryptedBytes);
[0134] }
[0135] In this embodiment, the JSON information is a JSON string.
[0136] S124. Call the hutool tool to return the encrypted JSON information to the front end of the specified invoice management system.
[0137] S130. Call the front end to decrypt the encrypted JSON information to obtain the JSON information, and determine the invoice type of the digital invoice in XML format according to the JSON information.
[0138] In one implementation, the implementation process of step S130 may include the following steps:
[0139] S131. Call the front end of the specified invoice management system to receive the encrypted JSON information.
[0140] In the specific implementation, before step S131, the front-end environment of the designated invoice management system can also be prepared. For example, an encryption library that supports RSA decryption, such as jsencrypt, forge or crypto-js, can be introduced into the front-end project of the designated invoice management system. In this way, it can be ensured that the encrypted JSON information can be decrypted. That is, the front-end has the private key required to decrypt the encrypted JSON information. The private key is usually securely transmitted from the back-end to the front-end, or obtained through a secure key management service.
[0141] In a specific implementation, a second HTTPS for requesting to receive the encrypted JSON information can be constructed, and then a second HTTPS request is sent to the front end, so that after the front end receives the second HTTPS request, it receives the encrypted JSON information returned by the hutool tool. The construction method of the second HTTPS request is the same or similar to the construction method of the first HTTPS request, and the embodiments of the present application will not be repeated here.
[0142] As an example, AJAX, Fetch API or other HTTPS client libraries may be called to send a second HTTPS request to the front end.
[0143] S132, calling the front end to decrypt the encrypted JSON information to obtain the JSON information.
[0144] In the specific implementation, you can use the front-end encryption library to configure the RSA decryptor, and then pass the corresponding private key into the RSA decryption library. After that, you can call the front-end to use the configured RSA decryptor to decrypt the encrypted JSON information to obtain the JSON information (i.e., the JSON information before encryption).
[0145] S133. Parse the JSON information and convert it into a JavaScript object.
[0146] By executing step S133, the JSON information can be further processed.
[0147] S134. Check the key attributes of the JavaScript object, and determine the invoice type of the digital invoice in XML format based on the key attributes.
[0148] In specific implementation, the invoice type of the digital invoice in XML format can be determined based on the correspondence between the key attribute and the preset key attribute and the invoice type.
[0149] The key attribute may be invoiceType, documentNumber, etc.
[0150] In the embodiment of the present application, by executing step S120 and step S130, the invoice file may not be stored, thereby eliminating the potential risks that may be caused by the storage of the invoice file from the source. At the same time, an encryption algorithm (such as the RAS encryption algorithm) may be introduced to encrypt the structured content of the invoice. For example, a pair of public and private keys are first generated, and then the invoice data is converted into a byte sequence and may be divided into small blocks. Each data block is then encrypted with the public key, and finally the encrypted data is stored or transmitted. When decrypting, the private key is used to restore the data. The whole process ensures the security and integrity of the data. This encryption method is like putting on a layer of indestructible armor for the data, which effectively guarantees the security of the data, minimizes the possibility of data leakage, and builds a solid line of defense for the user's information security.
[0151] S140. Call the specified front-end template engine to render and display the digital invoice in XML format on the front-end according to the invoice type and the JSON information.
[0152] In one implementation, the designated front-end template engine may be an art-template front-end template engine.
[0153] In this implementation, the art-template library can be introduced into the front-end project of the designated invoice management system. For example, the art-template library can be installed in the front-end project of the designated invoice management system by introducing the CDN link of art-template through npm or directly in HTML.
[0154] In one implementation, the implementation process of step S140 may include the following steps:
[0155] S141. Obtain a rendering template corresponding to the invoice type.
[0156] In the specific implementation, corresponding rendering templates can be created for different invoice types in advance. For example, a template area can be defined in the HTML file, and rendering templates corresponding to different invoice types can be written using the art-template syntax. In this way, the corresponding rendering template can be directly obtained according to the corresponding invoice type.
[0157] S142. Calling a specified front-end template engine to generate rendered HTML based on the rendering template and JSON information.
[0158] In specific implementation, the rendered HTML can use CCS (Cascading Style Sheets) to display the digital invoice in XML format, that is, use CCS to render the invoice information of the digital invoice in XML format, so as to ensure that the page is beautiful and easy to read.
[0159] In specific implementation, the template function of the art-template library can be used to parse the rendering template, and the JSON information can be passed into the rendering template to generate the rendered HTML.
[0160] S143. Call the specified front-end template engine to insert the rendered HTML into the specified position of the display page of the front end for display.
[0161] That is, by executing step S143, the rendering result can be inserted into the DOM of the display page of the front end to update the DOM of the display page of the front end.
[0162] In the specific implementation, in order to make the rendering results adaptable to different devices, media queries can be used for responsive design to ensure that the front-end display page can be well displayed on different devices.
[0163] In specific implementation, in the above steps S142 and S143, the escape filter of the art-template library can be used to escape the data to ensure that the rendered data is safe and avoid XSS attacks.
[0164] As an example, the page rendering display effect of the digital invoice in XML format can be as follows: Figure 2 shown.
[0165] In an embodiment of the present application, by executing step S140, template adaptation technology can be used to automatically adapt to different types of invoice data. For example, the template can be dynamically adjusted according to all possible elements required for invoice display, such as invoice number, date, amount, payer, payee, etc., to ensure the correct display of invoice information. At the same time, existing browser rendering technology (i.e., modern Web technology), such as HTML5, CSS3 and JavaScript, can be used to directly render invoice information in the browser without relying on specific software or plug-ins.
[0166] In summary, the method for viewing digital invoices in XML format provided in the embodiment of the present application can ensure the security of data during transmission by adopting HTTPS protocol or FTP protocol for file transmission, and processes data by implementing encryption and decryption technology and avoiding local storage of sensitive files, thereby further enhancing data security. At the same time, by utilizing front-end template engine technology, the user interface and interactive experience are optimized, so that digital invoices in XML format can be displayed in real time, thereby improving the convenience of individual users and the speed of digital transformation of enterprises.
[0167] In summary, the method for viewing digital invoices in XML format provided in the embodiment of the present application is relatively easy to implement, can be deployed separately, and can also be implemented in existing businesses. It can solve the problems of existing technologies in compatibility, data security and authority control, real-time update and synchronization, cross-platform and mobile access, etc., thereby reducing the technical difficulty of users viewing digital invoices in real time, promoting the widespread application of digital invoices, and significantly improving the user experience.
[0168] In practical applications, by using the digital invoice viewing method in XML format provided by the embodiment of the present application, in the bill management system or expense reimbursement system, after the user completes the upload operation of the electronic invoice in the invoice management, a preview can be performed. At the same time, accountants and auditors can easily view the detailed information of the electronic voucher, including invoice number, invoice code, invoice date, purchaser information, seller information, commodity or service details, tax rate, tax amount and other key data. Through this function, the efficiency and accuracy of the financial process are effectively improved, and the errors of manual review are reduced. For example, when an employee uploads a digital invoice when submitting a travel expense reimbursement, the accountant can quickly view the invoice information and verify the rationality of the expenses; auditors can also quickly obtain accurate invoice data when conducting financial audits to ensure financial compliance.
[0169] Figure 3 The following is a structural block diagram of a digital ticket viewing device in XML format according to an embodiment of the present application. Figure 3 As shown, the device may include:
[0170] The receiving unit 210 is used to call the HTTPS interface or FTP server to obtain the digital ticket in XML format;
[0171] The conversion unit 220 is used to call the hutool toolkit to convert the digital invoice in XML format into JSON information, encrypt the JSON information and return it to the front end of the specified invoice management system;
[0172] The determination unit 230 is used to call the front end to decrypt the encrypted JSON information, obtain the JSON information, and determine the invoice type of the digital invoice in XML format according to the JSON information;
[0173] The rendering unit 240 is used to call the specified front-end template engine to render and display the XML digital invoice on the front end according to the invoice type and JSON information.
[0174] In one implementation, when the receiving unit 210 is used to call the HTTPS interface to obtain the digital ticket in XML format, it is specifically used to:
[0175] Constructing a first HTTPS request for requesting a digital invoice in XML format;
[0176] Sending a first HTTPS request to a specified invoice management system;
[0177] Receive response information returned by the designated invoice management system in response to the first HTTPS request, the response information including the digital invoice in XML format.
[0178] In one implementation, when the receiving unit 210 is used to call the FTP server to obtain the digital ticket in XML format, it is specifically used to:
[0179] Connect to the FTP server that stores the digital invoices in XML format;
[0180] Log in to the FTP server;
[0181] Call the FTP server to download the digital invoice in XML format.
[0182] In one embodiment, when the conversion unit 220 is used to call the hutool toolkit to convert the digital invoice in XML format into JSON information, encrypt the JSON information and return it to the front end of the specified invoice management system, it is specifically used to:
[0183] Add dependencies related to hutool and Java Cryptography in the front-end project of the specified invoice management system;
[0184] Call XmlUtil and JSONUtil in the hutool tool to read the digital invoice in XML format, and convert the read digital invoice in XML format into JSON information;
[0185] Call the hutool tool to encrypt the JSON information based on the RSA algorithm using the Java KeyPairGenerator class to obtain the encrypted JSON information;
[0186] Call the hutool tool to return the encrypted JSON information to the front end of the specified invoice management system.
[0187] In one implementation, when the determination unit 230 is used to determine the invoice type of the digital invoice in XML format according to the JSON information, it is specifically used to:
[0188] Parse JSON information and convert it into JavaScript objects;
[0189] Check the key properties of the JavaScript object and determine the invoice type of the digital invoice in XML format based on the key properties.
[0190] In one embodiment, when the rendering unit 240 is used to call a specified front-end template engine to render and display the XML digital invoice on the front end according to the invoice type and JSON information, it is specifically used to:
[0191] Get the rendering template corresponding to the invoice type;
[0192] Call the specified front-end template engine to generate rendered HTML based on the rendering template and JSON information. The rendered HTML uses cascading style sheets to display the digital invoice in XML format.
[0193] Call the specified front-end template engine to insert the rendered HTML into the specified position of the front-end display page for display.
[0194] In one implementation, the designated front-end template engine is the art-template front-end template engine.
[0195] The functions of each unit in the XML format electronic ticket viewing device of the embodiment of the present application can be found in the corresponding description in the above method, and will not be repeated here.
[0196] Figure 4 FIG. 2 shows a block diagram of a computer device according to an embodiment of the present application. Figure 4As shown, the computer device includes: a memory 310 and a processor 320. The memory 310 stores instructions, and the instructions are loaded and executed by the processor 320 to implement the method for viewing digital electronic tickets in XML format in the above embodiment. The number of the memory 310 and the processor 320 can be one or more.
[0197] The computer device also includes:
[0198] The communication interface 330 is used to communicate with external devices and perform data exchange transmission.
[0199] If the memory 310, the processor 320 and the communication interface 330 are implemented independently, the memory 310, the processor 320 and the communication interface 330 can be connected to each other through a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0200] Optionally, in a specific implementation, if the memory 310, the processor 320 and the communication interface 330 are integrated on a chip, the memory 310, the processor 320 and the communication interface 330 can communicate with each other through an internal interface.
[0201] An embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program runs on a computer, the method provided in the embodiment of the present application is implemented.
[0202] An embodiment of the present application also provides a chip, which includes a processor for calling and executing instructions stored in a memory, so that a communication device equipped with the chip executes the method provided by the embodiment of the present application.
[0203] An embodiment of the present application also provides a chip, including: an input interface, an output interface, a processor and a memory, wherein the input interface, the output interface, the processor and the memory are connected via an internal connection path, and the processor is used to execute the code in the memory. When the code is executed, the processor is used to execute the method provided in the embodiment of the application.
[0204] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. It is worth noting that the processor may be a processor supporting the Advanced RISC Machines (ARM) architecture.
[0205] Further, optionally, the above-mentioned memory may include a read-only memory and a random access memory, and may also include a non-volatile random access memory. The memory may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may include a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may include a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available. For example, static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct rambus RAM (DR RAM).
[0206] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
[0207] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification and the features of different embodiments or examples, unless they are contradictory.
[0208] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0209] Any process or method description in the flow chart or otherwise described herein can be understood to represent a module, fragment or portion of a code including one or more executable instructions for implementing the steps of a specific logical function or process. And the scope of the preferred embodiment of the present application includes other implementations, in which the functions may not be performed in the order shown or discussed, including in a substantially simultaneous manner or in a reverse order according to the functions involved.
[0210] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, which can be embodied in any computer-readable medium for use by an instruction execution system, apparatus or device (such as a computer-based system, a system including a processor or other system that can fetch instructions from an instruction execution system, apparatus or device and execute instructions), or used in combination with these instruction execution systems, apparatuses or devices.
[0211] It should be understood that the various parts of the present application can be implemented with hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented with software or firmware stored in a memory and executed by a suitable instruction execution system. All or part of the steps of the above embodiment method can be completed by instructing the relevant hardware through a program, which can be stored in a computer-readable storage medium, and when the program is executed, it includes one of the steps of the method embodiment or a combination thereof.
[0212] In addition, each functional unit in each embodiment of the present application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into one module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of a software functional module. If the above-mentioned integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. The storage medium can be a read-only memory, a disk or an optical disk, etc.
[0213] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for viewing digital invoices in XML format, characterized in that: include: Call the HTTPS interface or FTP server to obtain the digital ticket in XML format; Call the hutool toolkit to convert the digital invoice in XML format into JSON information, encrypt the JSON information and return it to the front end of the specified invoice management system; Calling the front end to decrypt the encrypted JSON information to obtain the JSON information, and determining the invoice type of the digital invoice in XML format according to the JSON information; The specified front-end template engine is called to render and display the XML digital invoice on the front-end according to the invoice type and the JSON information.
2. The method according to claim 1, characterized in that: Calling the HTTPS interface to obtain the digital invoice in XML format includes: Constructing a first HTTPS request for requesting the digital ticket in the XML format; Sending the first HTTPS request to the designated invoice management system; Receive response information returned by the designated invoice management system in response to the first HTTPS request, wherein the response information includes the digital invoice in XML format.
3. The method according to claim 1, characterized in that Calling the FTP server to obtain the digital invoice in XML format includes: Connecting to an FTP server storing the digital electronic tickets in the XML format; Log in to the FTP server; Call the FTP server to download the digital ticket in XML format.
4. The method according to claim 1, characterized in that Calling the hutool toolkit to convert the digital invoice in XML format into JSON information, encrypting the JSON information and returning it to the front end of the specified invoice management system includes: Add dependencies related to the hutool tool and JavaCryptography in the front-end project of the specified invoice management system; Calling XmlUtil and JSONUtil in the hutool tool to read the digital invoice in the XML format, and converting the read digital invoice in the XML format into the JSON information; Calling the hutool tool to encrypt the JSON information based on the RSA algorithm by using the Java KeyPairGenerator class to obtain the encrypted JSON information; The hutool tool is called to return the encrypted JSON information to the front end of the specified invoice management system.
5. The method according to claim 1, characterized in that Determining the invoice type of the digital invoice in XML format according to the JSON information includes: Parse the JSON information and convert it into a JavaScript object; Check the key attributes of the JavaScript object, and determine the invoice type of the digital invoice in XML format based on the key attributes.
6. The method according to any one of claims 1 to 5, characterized in that Calling a specified front-end template engine to render and display the XML digital invoice on the front-end according to the invoice type and the JSON information includes: Get the rendering template corresponding to the invoice type; Calling the specified front-end template engine to generate rendered HTML based on the rendering template and the JSON information, wherein the rendered HTML uses a cascading style sheet to display the digital invoice in XML format; The specified front-end template engine is called to insert the rendered HTML into a specified position of the display page of the front end for display.
7. The method according to claim 6, characterized in that The specified front-end template engine is the art-template front-end template engine.
8. A device for viewing digital tickets in XML format, characterized in that: include: A receiving unit, used to call an HTTPS interface or an FTP server to obtain a digital ticket in XML format; A conversion unit, used for calling the hutool toolkit to convert the digital invoice in XML format into JSON information, encrypting the JSON information and returning it to the front end of the specified invoice management system; A determination unit, configured to call the front end to decrypt the encrypted JSON information to obtain the JSON information, and determine the invoice type of the digital invoice in XML format according to the JSON information; The rendering unit is used to call a specified front-end template engine to render and display the XML digital invoice on the front end according to the invoice type and the JSON information.
9. A computer device, characterized in that: include: A memory and a processor, wherein the memory stores instructions, and the instructions are loaded and executed by the processor to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed on a computer, the method according to any one of claims 1 to 7 is implemented.