Digital-to-electricity invoice management method based on AI model and cloud platform

By deploying AI models and synchronization tools on electronic devices and combining with cloud platforms, the upgrade of traditional electronic invoice systems is solved, and the problems of high cost, complex implementation and lack of flexibility in traditional methods are provided, providing a low-cost, easy to implement and well-adapted digital invoice management solution.

CN119722362AActive Publication Date: 2025-03-28WUHAN FEIYU YIKE TECH CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202510234954.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-28
Publication Date
2025-03-28
Estimated Expiration
2045-02-28

AI Technical Summary

Technical Problem

The traditional electronic invoice issuance method requires enterprises to invest a lot of money in business system upgrades, hardware updates and personnel training. It is expensive, especially for small and medium-sized enterprises, and the implementation process is complex and lacks flexibility, making it difficult to meet the rapidly changing business environment and strict tax requirements.

Method used

Using the digital invoice management method based on AI model, we can realize seamless integration of existing business systems by deploying AI models, business platforms, virtual printers and synchronization tools on electronic devices, reduce system upgrade costs, use cloud platforms to perform file analysis and invoice process processing, reduce the burden on local systems, adapt to changes in tax policies, and realize data interaction between internal and external networks through synchronization tools to ensure data security and invoice requirements.

Benefits of technology

It effectively reduces the implementation cost and complexity of traditional electronic invoice issuance methods, improves compatibility and scalability, enhances intelligence, reduces hardware and labor costs, improves work efficiency, is highly adaptable, and can be quickly deployed in enterprises of different sizes and types.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119722362A_ABST
    Figure CN119722362A_ABST
Patent Text Reader

Abstract

The invention discloses a digital and electronic invoice management method based on an AI model and a cloud platform, and relates to the field of cloud data processing, and the method comprises the steps: obtaining an electronic business bill; performing file format conversion on the electronic business bill to obtain a converted electronic business bill, and storing the converted electronic business bill in a corresponding folder; in response to an event trigger signal of the folder, uploading the converted electronic business bill to the cloud platform through the synchronization tool, the cloud platform being used for performing file analysis on the converted electronic business bill to obtain bill information, executing an invoicing process according to the bill information, generating a digital-to-electronic invoice and a callback instruction, and sending the digital-to-electronic invoice and the callback instruction to the synchronization tool, the synchronization tool generates a printing instruction; and sending the printing instruction and the digital-to-electronic invoice to a physical printer, so that the physical printer prints the digital-to-electronic invoice according to the printing instruction. The method can effectively reduce the improvement cost of a traditional business system of an enterprise.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of cloud data processing, and in particular to a digital electricity invoice management method and cloud platform based on an AI model. Background Art

[0002] With the rapid development of my country's economy and the deepening of digital transformation, electronic invoices, as a more efficient and environmentally friendly form of bills, are gradually replacing traditional paper invoices. Digital invoices can not only improve invoicing efficiency and reduce paper usage, but also effectively prevent fake invoices and improve tax management. However, during this transformation process, many companies are faced with the challenge of how to quickly and cost-effectively upgrade existing systems to adapt to new invoice issuance requirements.

[0003] Traditional electronic invoice issuance methods usually rely on the company's existing business system. However, the company's existing business system is usually designed to meet the company's daily operational needs and does not have the function of directly issuing electronic invoices. In order to achieve electronic invoice issuance, companies usually need to take the following measures on existing business systems: 1. System upgrade and transformation: The company needs to entrust the developer of the original system or a third-party software company to upgrade the existing system. This includes adding electronic invoice modules, modifying data structures, adjusting business processes, etc. This process usually requires a lot of development work, involving multiple links such as system analysis, design, coding, and testing. 2. Hardware equipment update: In order to support the issuance and management of electronic invoices, companies need to purchase new servers, storage devices and other hardware to meet the increased data processing and storage needs. 3. Tax control equipment docking: Companies usually need to purchase dedicated tax control equipment (such as tax control disks) and dock them with business systems. Not only does it increase hardware costs, but it also requires specialized technicians to maintain and manage tax control equipment. 4. Network environment transformation: For security reasons, business systems in some special industries (such as finance, medical care, etc.) are usually not allowed to directly access the external network. In order to issue electronic invoices, these companies need to transform their network environment and add security isolation measures, which further increases complexity and costs. 5. Compliance adjustment: As tax policies change, electronic invoice systems need to be continuously updated and adjusted to meet the latest compliance requirements. Companies need to continue to invest resources to maintain and update the system.

[0004] In summary, the traditional method of issuing electronic invoices requires enterprises to invest a large amount of money in a short period of time for business system upgrades, hardware updates, personnel training, etc. For small and medium-sized enterprises, the cost is high and cannot be popularized. In addition, since each enterprise's business system has its own particularity, customized transformation work is difficult to form economies of scale and cannot reduce the transformation costs of individual enterprises. Therefore, although the existing business system transformation method can achieve basic functions, its high cost, complex implementation process and lack of flexibility make it difficult to meet the current rapidly changing business environment and increasingly stringent tax requirements. Summary of the invention

[0005] The embodiments of the present application provide a digital invoice management method and cloud platform based on an AI model, which are used to effectively reduce the cost of transforming traditional business systems and effectively solve the problems of complex implementation process and lack of flexibility of traditional electronic invoice issuance methods.

[0006] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions: In a first aspect, a digital invoice management method based on an AI model is provided, which is applied to an electronic device, wherein the electronic device is deployed with an AI model, a business platform, a virtual printer, and a synchronization tool, and the electronic device is connected to a physical printer, and the method comprises: Responding to the billing signal of the business platform, obtaining the electronic business bill generated by the business platform; Identify the electronic business bill through the AI ​​model to obtain the domain type of the electronic business bill; Converting the electronic business ticket to a file format through the virtual printer to obtain a converted electronic business ticket, and storing the converted electronic business ticket in a corresponding folder, wherein the folder is generated based on the domain type of the electronic business ticket; In response to the event trigger signal of the folder, the converted electronic business bill is uploaded to the cloud platform through the synchronization tool, wherein the synchronization tool is used to monitor the folder, and the cloud platform is used to parse the converted electronic business bill to obtain bill information, execute the billing process according to the bill information, generate a digital invoice and a callback instruction, and send the digital invoice and the callback instruction to the synchronization tool, so that the synchronization tool generates a printing instruction according to the callback instruction, and the printing instruction is used to control the physical printer; The printing instruction and the digital invoice are sent to the physical printer, so that the physical printer prints the digital invoice according to the printing instruction.

[0007] In a possible implementation manner of the first aspect, identifying the electronic business bill by using the AI ​​model to obtain the domain type of the electronic business bill includes: Extracting features of the electronic business bill to obtain text features and metadata features of the electronic business bill; The text features and the metadata features are input into the AI ​​model to obtain the domain type of the electronic business bill, wherein the domain type includes the HIS domain and the ERP domain.

[0008] In another possible implementation manner of the first aspect, the step of generating a folder includes: Obtaining a first timestamp of generation of the electronic business ticket; In the case where the domain type is the HIS domain, obtaining a business code of a business platform for generating the electronic business ticket, and using a first preset naming rule to generate a first name for the folder according to the first timestamp; Generate a first path of the folder based on a preset first basic path, the first timestamp and the business code; Based on the first name and the first path, create a folder, and create a HIS domain main folder and at least one HIS domain subfolder in the folder; Allocating a first permission of the HIS domain main folder and a second permission of at least one of the HIS domain subfolders, and recording a second path of the HIS domain main folder and a second timestamp of creation of the HIS domain main folder; Creating a first json file in the HIS domain main folder and generating a log, wherein the first json file includes the second timestamp and the domain type, and the log includes the second path, the first permission, and the second permission; In the case where the domain type is the ERP domain, obtaining a business class code of a business platform for generating the electronic business ticket, and using a second preset naming rule to generate a second name for the folder according to the first timestamp; Generate a third path of the folder based on a preset second basic path, the first timestamp and the business class code; Based on the second naming and the third path, create a folder, and create an ERP domain main folder and at least one ERP domain subfolder in the folder, wherein the number of the ERP domain subfolders is the same as the number of the HIS domain subfolders; Allocate a third permission of the ERP domain main folder and a fourth permission of at least one of the ERP domain subfolders, and record a fourth path of the ERP domain main folder and a third timestamp of creation of the HIS domain main folder; A second json file is created in the ERP domain main folder, and a log is generated, wherein the second json file includes the third timestamp and the domain type, and the log includes the fourth path, the third permission, and the fourth permission.

[0009] In another possible implementation of the first aspect, uploading the converted electronic business ticket to a cloud platform through the synchronization tool includes: The synchronization tool uses the converted electronic business bill as a file to be synchronized, and identifies the file type and file size of the file to be synchronized; The synchronization tool determines a corresponding compression algorithm according to the file type, and compresses the file to be synchronized using the compression algorithm to obtain a compressed file; The synchronization tool identifies the sensitive fields of the compressed file and encrypts the sensitive fields to obtain an encrypted data packet; The synchronization tool establishes an HTTPS connection with the cloud platform and uploads the encrypted data packet segments to the cloud platform.

[0010] In another possible implementation of the first aspect, the synchronization tool compresses the to-be-synchronized file using the compression algorithm to obtain a compressed file, including: The synchronization tool creates a memory buffer and initializes the compression algorithm; The synchronization tool reads the to-be-synchronized file into the memory in blocks, and compresses each data block of the to-be-synchronized file using the compression algorithm; The synchronization tool writes all the compressed data blocks into a new file to obtain a compressed file.

[0011] In another possible implementation manner of the first aspect, the synchronization tool encrypts the sensitive field to obtain an encrypted data packet, including: For any sensitive field, the synchronization tool obtains the position of the sensitive field in the file to be synchronized and generates a random initialization vector; The synchronization tool adopts a preset encryption algorithm to replace the sensitive field with the random initialization vector to obtain an encrypted sensitive field; The synchronization tool generates encryption metadata according to the random initialization vector and the position of the sensitive field in the file to be synchronized; The synchronization tool inserts the encryption sensitive field into the corresponding position of the to-be-synchronized file to obtain an encrypted file; The synchronization tool packages the encrypted metadata and the encrypted file into a container file to obtain an encrypted data packet.

[0012] In another possible implementation of the first aspect, the synchronization tool establishes an HTTPS connection with the cloud platform and uploads the encrypted data packet segments to the cloud platform, including: The synchronization tool calculates a first file checksum of the encrypted data packet and generates upload metadata, wherein the upload metadata includes the first name, the file size, and the first file checksum, or the upload metadata includes the second name, the file size, and the first file checksum; The synchronization tool establishes an HTTPS connection with the cloud platform; The synchronization tool divides the encrypted data packet into a plurality of fixed-size data blocks, uploads the data blocks to the cloud platform one by one, and records the fixed-size data blocks uploaded to the cloud platform; After the synchronization tool uploads all the fixed-size data blocks to the cloud platform, the synchronization tool sends the upload metadata to the cloud platform.

[0013] In a second aspect, the present application provides a digital invoice management method based on an AI model, which is applied to the above-mentioned cloud platform, wherein the cloud platform is connected to an electronic device, and the electronic device is connected to a physical printer, and the method comprises: In response to receiving one of the fixed-size data blocks transmitted by the electronic device, storing the fixed-size data block in a preset buffer until all the fixed-size data blocks are received; Reorganize all the fixed-size data blocks in the buffer to obtain a reorganized file; Calculating a second file checksum of the reorganized file; Receiving and parsing the uploaded metadata to obtain the first file verification code and the location of the sensitive field; comparing the second file checksum with the first file checksum; After the comparison is successful, the encrypted data packet is unpacked to obtain the encrypted metadata and the encrypted file, and the field to be decrypted is located according to the position of the sensitive field; Decrypting the field to be decrypted using a preset decryption algorithm and a preset security key, obtaining the sensitive field corresponding to the field to be decrypted, and obtaining a decrypted compressed file; Decompressing the compressed file using a preset decompression algorithm to obtain an electronic business receipt; Parsing the electronic business bill to obtain bill information, and executing the billing process according to the bill information to generate a digital invoice and a callback instruction; The digital invoice and callback instruction are sent to the electronic device so that the electronic device generates a printing instruction according to the callback instruction, and the printing instruction and the digital invoice are sent to the physical printer, and the physical printer is used to print the digital invoice according to the printing instruction.

[0014] In a possible implementation of the second aspect, the invoicing process includes: Call the preset tax interface, obtain the invoice code and invoice number according to the bill information, and generate an electronic signature; Fill the invoice code, the invoice number and the electronic signature into a preset standard template to generate a digital invoice.

[0015] In a third aspect, the present application provides a cloud platform, which is applied to the digital electricity invoice management method based on the AI ​​model of the first aspect, and the digital electricity invoice management method based on the AI ​​model of the second aspect, including: A communication module, used to communicate with an electronic device; and The data processing module is connected to the communication module and is used to execute the digital electricity invoice management method based on the AI ​​model of the second aspect.

[0016] Through the above technical solutions, firstly, by deploying AI models, business platforms, virtual printers and synchronization tools on electronic devices, seamless integration of existing business systems is achieved, without the need for large-scale upgrades and renovations of the original enterprise systems, greatly reducing the implementation cost and complexity. It effectively avoids the tedious process of entrusting the original system developer or third-party software company to upgrade the system in the traditional method, saving a lot of development work and related costs. Secondly, through the use of virtual printers, the problem of inconsistent output formats of different business systems is effectively solved, and unified processing of electronic business bills is achieved, without the need to develop interfaces separately for each system, greatly improving compatibility and scalability. The introduction of AI models further enhances the degree of intelligence, and can automatically identify the field type of electronic business bills, thereby achieving accurate classification processing and improving the automation level of the entire process. In addition, the technical solution uses the cloud platform for file parsing and invoicing process processing, which not only reduces the burden on the local system, but also can better adapt to changes in tax policies. It only needs to be updated in the cloud without frequent adjustments to the internal system of the enterprise, greatly reducing the cost and difficulty of compliance adjustments. In response to the network security restrictions faced by some special industries, this technical solution realizes the interaction of intranet and extranet data through synchronization tools and folder monitoring mechanisms, which not only ensures data security, but also meets the invoicing needs, and solves the problem of complex network environment transformation required in traditional methods. In terms of hardware investment, this technical solution mainly relies on the company's existing electronic equipment and physical printers, without the need to purchase additional dedicated tax control equipment or a large amount of new hardware, which significantly reduces hardware costs. At the same time, since the entire process is highly automated, the need for personnel training is greatly reduced, labor costs are reduced, and work efficiency is improved. In general, this technical solution effectively overcomes the problems of high cost, complex implementation, and lack of flexibility in traditional electronic invoice methods, and provides enterprises, especially small and medium-sized enterprises, with a low-cost, easy-to-implement and well-adaptable digital invoice management solution.

[0017] Other features and advantages of the embodiments of the present application will be described in detail in the subsequent specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 A schematic diagram of a process for issuing electronic invoices for an enterprise provided in an embodiment of the present application; Figure 2 A first flow chart of a method for managing digital electricity invoices based on an AI model provided in an embodiment of the present application; Figure 3 A second flow chart of a method for managing digital electricity invoices based on an AI model provided in an embodiment of the present application; Figure 4 A schematic diagram of a process of creating a folder provided in an embodiment of the present application; Figure 5 A third flow chart of a method for managing digital electricity invoices based on an AI model provided in an embodiment of the present application; Figure 6 A schematic diagram of the structure of a cloud platform provided in an embodiment of the present application. DETAILED DESCRIPTION

[0019] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the specific implementation methods described herein are only used to illustrate and explain the embodiments of the present application, and are not used to limit the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0020] It should be noted that if the embodiments of the present application involve directional indications (such as up, down, left, right, front, back...), such directional indications are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.

[0021] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present application, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or suggesting their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0022] For easier understanding of the solution, please refer to Figure 1 , Figure 1 A schematic diagram of a process for issuing an electronic invoice for an enterprise provided in an embodiment of the present application is shown, and the process is as follows: 1. The enterprise submits an application to the finance and taxation administration through its business system. The application content includes the required invoice type, quantity and other information; 2. The finance and taxation administration reviews the enterprise's application and approves a certain number of invoicing shares based on the enterprise's tax credit, business scale and other factors, and sends the approved shares electronically to the enterprise's business system; 3. When the enterprise actually needs to issue an invoice, it uses the invoice issuance module in the business system and inputs relevant transaction information, such as product name, quantity, amount, etc. The business system automatically generates an electronic invoice and consumes the previously applied invoicing share; 4. Print the issued invoice. If a paper version is required, the business system will send the electronic invoice to the printer; 5. Make an invoice declaration and report it to the finance and taxation administration. The enterprise regularly (usually monthly) summarizes the invoice information issued and declares the invoice through the business system or special declaration software. The declaration content includes detailed information such as the number of invoices issued, the amount, and the tax amount, and uploads the declaration information to the system of the finance and taxation administration.

[0023] From this process, we can see that the invoice issuance module has achieved seamless connection between business data and invoice issuance by integrating into the enterprise's business system.

[0024] An enterprise's business system is usually deployed on the enterprise's central control host. Therefore, based on this process, the embodiment of the present application proposes a digital electricity invoice management method based on an AI model, which can effectively solve the problem of high cost of integrating traditional invoice issuance modules with business systems.

[0025] Specifically, Figure 2 The following schematically shows a flow chart of a method for managing digital electricity invoices based on an AI model according to an embodiment of the present application. Figure 2 and Figure 3 As shown, an embodiment of the present application provides a digital invoice management method based on an AI model, which is applied to an electronic device. The electronic device is deployed with an AI model, a business platform, a virtual printer and a synchronization tool. The electronic device is connected to a physical printer. The method may include the following steps.

[0026] S110, in response to the billing signal of the business platform, obtaining the electronic business bill generated by the business platform; S120, identifying the electronic business bill through the AI ​​model, and obtaining the field type of the electronic business bill; S130, converting the file format of the electronic business bill through a virtual printer to obtain a converted electronic business bill, and storing the converted electronic business bill in a corresponding folder, wherein the folder is generated based on the field type of the electronic business bill; S140, in response to an event trigger signal of the folder, uploading the converted electronic business bill to the cloud platform through a synchronization tool, wherein the synchronization tool is used to monitor the folder, and the cloud platform is used to parse the converted electronic business bill to obtain bill information, execute the billing process according to the bill information, generate a digital invoice and a callback instruction, and send the digital invoice and the callback instruction to the synchronization tool, so that the synchronization tool generates a printing instruction according to the callback instruction, and the printing instruction is used to control the physical printer; S150: Send the printing instruction and the digital invoice to the physical printer, so that the physical printer prints the digital invoice according to the printing instruction.

[0027] In this embodiment, the electronic device can be a tablet computer, a desktop computer, a laptop computer, a handheld computer, a wearable device, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, or other device with a processor. Of course, the electronic device can also be a server. The embodiment of the present application does not impose any special restrictions on the specific form of the electronic device.

[0028] The electronic device first responds to the invoicing signal sent by the business platform. The invoicing signal is triggered by the user clicking the "Issue Invoice" button on the interface of the business platform, or it can be automatically triggered by the business system according to preset rules.

[0029] When receiving the invoicing signal, the electronic device immediately establishes a data connection with the business platform and obtains the relevant electronic business bills through predefined interfaces or API calls. Electronic business bills can contain transaction amounts, product or service descriptions, buyer and seller information, etc. During the acquisition process, the electronic device will conduct a preliminary verification of the data to ensure the integrity and correctness of the data. If the data is found to be missing or in an incorrect format, it will immediately provide feedback to the business platform and request the correct data to be re-provided.

[0030] In this embodiment, in order to improve processing efficiency, the electronic device can adopt a batch processing method to obtain multiple electronic business bills to be issued at one time. The obtained bill data is temporarily stored in the memory or local storage of the electronic device.

[0031] After obtaining the electronic business bill, the AI ​​model is used to identify and classify the obtained electronic business bill. The AI ​​model is a trained deep learning model, such as a convolutional neural network (CNN) or a recurrent neural network (RNN). The AI ​​model is used to analyze the structure, content, and characteristics of the electronic business bill to determine the type of domain to which it belongs. In this solution, the main identified domain types include HIS (hospital information system) and ERP (enterprise resource planning system). During the identification process, the AI ​​model can consider multiple factors, such as the format of the bill, the fields included, the terms used, etc. For example, if the bill contains a large number of medical-related terms or patient information, the model identifies it as an HIS type; if the bill mainly contains information related to corporate operations, such as inventory, orders, or financial data, it is identified as an ERP type. The use of the AI ​​model greatly improves the accuracy and efficiency of identification, and can quickly process a large number of electronic business bills from different sources, so that electronic devices can adopt corresponding processing strategies according to different types of bills, and improve the intelligence and processing efficiency of the entire process.

[0032] A virtual printer is a software-simulated printing device that intercepts the data stream sent to the printer and converts it into files of other formats. In this embodiment, the virtual printer first receives the original electronic business invoices from the business platform, which may exist in a variety of different formats, such as PDF, Word documents, Excel tables, etc. The virtual printer can convert these invoices in different formats into a standardized format, usually PDF or a specific image format, according to preset rules. During the conversion process, the virtual printer retains all key information of the original invoice while ensuring that the converted file has good readability and compatibility. After the conversion is completed, the electronic device will automatically create or select a corresponding folder in the storage space of the electronic device based on the field type (HIS or ERP) previously identified by the AI ​​model. Specifically, Figure 4 As shown in the figure, a folder path can be generated according to the field type of the electronic business bill, and a folder can be created based on the folder path. The created folder can be organized according to date, field type or other rules. Then, the converted electronic business bill is stored in the corresponding folder, which effectively improves the processing ability of bills from different sources and formats, provides a unified data format for subsequent cloud upload and processing, and also facilitates data traceability.

[0033] like Figure 2As shown, the electronic business bills in the folder will be transferred to the synchronization tool for processing. Specifically, the synchronization tool is used to continuously monitor the folder created in step S130. When an event is detected in the folder (such as a new file being stored, an existing file being modified or deleted), the synchronization tool will immediately trigger the upload operation. During the upload process, the synchronization tool will establish a secure connection with the cloud platform, and encrypted transmission protocols such as HTTPS can be used to protect data security. After the file upload is completed, the cloud platform receives the converted electronic business bill and immediately starts the file parsing process. The parsing process can use OCR technology to extract text information from PDF or images, or use a preset parsing algorithm to process structured data. The parsed bill information includes transaction details, amount, date, buyer and seller information, etc.

[0034] Subsequently, the cloud platform executes the invoicing process based on the parsed bill information, combined with preset rules and templates. The invoicing process includes generating digital invoices that meet tax requirements, and creating callback instructions containing processing results and subsequent operation instructions. The generated digital invoices and callback instructions will be sent back to the synchronization tool. After the synchronization tool receives the digital invoice and callback instructions, it will generate printing instructions based on the callback instructions. The printing instructions contain detailed parameters for printing digital invoices, such as paper size, print quality, number of copies, etc. Ultimately, a seamless combination of local data and cloud processing is achieved, which greatly improves the efficiency and accuracy of invoice processing, while using cloud resources to reduce the burden on local systems.

[0035] Finally, the electronic device sends the print instruction and digital invoice data generated in step S140 to the connected physical printer. The transmission process is usually carried out through a standard printing protocol, such as IPP (Internet Printing Protocol) or a specific manufacturer's print driver. When the physical printer receives this data, it sets the printing parameters, such as page layout, print quality, color mode, etc., according to the received print instruction. Then, the printer starts the printing process to convert the digital invoice content into a physical paper document. After printing is completed, the printer sends a print completion status message to the electronic device so that the business platform can update the invoice status. This embodiment ensures that digital invoices can be converted into physical form, meets the needs of scenarios where paper invoices are required, and ensures the quality and compliance of the printed invoices by precisely controlling the printing process. The entire process is highly automated, reduces human intervention, improves efficiency, and reduces error rates.

[0036] In summary, compared with the traditional business system transformation, this embodiment has the following effects: by deploying AI models, virtual printers and synchronization tools, seamless integration with the existing business platform is achieved without the need for major modifications to the original system, effectively solving the problem that the traditional method requires large-scale transformation of the existing system, thereby reducing the cost of system upgrades and transformations; the use of virtual printers replaces dedicated tax control equipment, reducing hardware costs. At the same time, the cloud platform handles complex bill parsing and invoicing processes, reducing the requirements for local hardware performance; uploading data to the cloud platform through synchronization tools solves the problem that some special industries (such as finance and medical care) do not allow the system to directly access the external network due to security considerations; the AI ​​model recognizes bills in different fields (HIS and ERP) and stores them in corresponding folders, realizing the effective integration of different business systems; the cloud platform is responsible for executing the invoicing process and generating digital invoices, which can more easily adapt to changes in tax policies and perform unified updates without the need for self-maintenance by enterprises; the embodiment of the present application can be quickly deployed and is suitable for enterprises of different sizes and types, overcoming the problem that customized transformation in traditional methods is difficult to form economies of scale; since the solution mainly relies on mature AI technology and cloud services, the implementation risk is greatly reduced compared to the comprehensive transformation of existing systems; the automatic recognition of AI models, automatic conversion of virtual printers, automatic processing of cloud platforms and other features greatly improve the efficiency of the entire invoicing process; modular design (AI model, virtual printer, synchronization tool, cloud platform) makes the business system have good scalability and adaptability, and can better cope with changes in the business environment.

[0037] In general, this embodiment effectively solves the problems of high cost, complex implementation, lack of flexibility and other issues in traditional methods through the combination of intelligence, automation and cloud services, and provides a more economical, efficient, easy to implement and well-adaptable solution, which is especially suitable for enterprises that want to quickly and cost-effectively upgrade to a digital invoice system.

[0038] This embodiment firstly realizes the seamless integration of the existing business system by deploying AI models, business platforms, virtual printers and synchronization tools on electronic devices, without the need for large-scale upgrades and renovations of the original enterprise system, greatly reducing the implementation cost and complexity. It effectively avoids the cumbersome process of entrusting the original system developer or third-party software company to upgrade the system in the traditional method, saving a lot of development work and related costs. Secondly, through the use of virtual printers, the problem of inconsistent output formats of different business systems is effectively solved, and the unified processing of electronic business bills is realized. There is no need to develop interfaces separately for each system, which greatly improves compatibility and scalability. The introduction of AI models further enhances the degree of intelligence, and can automatically identify the field type of electronic business bills, thereby realizing accurate classification processing and improving the automation level of the entire process. In addition, the technical solution uses the cloud platform for file parsing and invoicing process processing, which not only reduces the burden on the local system, but also can better adapt to changes in tax policies. It only needs to be updated in the cloud without frequent adjustments to the internal system of the enterprise, greatly reducing the cost and difficulty of compliance adjustments. In response to the network security restrictions faced by some special industries, this technical solution realizes the interaction of intranet and extranet data through synchronization tools and folder monitoring mechanisms, which not only ensures data security, but also meets the invoicing needs, and solves the problem of complex network environment transformation required in traditional methods. In terms of hardware investment, this technical solution mainly relies on the company's existing electronic equipment and physical printers, without the need to purchase additional dedicated tax control equipment or a large amount of new hardware, which significantly reduces hardware costs. At the same time, since the entire process is highly automated, the need for personnel training is greatly reduced, labor costs are reduced, and work efficiency is improved. In general, this technical solution effectively overcomes the problems of high cost, complex implementation, and lack of flexibility in traditional electronic invoice methods, and provides enterprises, especially small and medium-sized enterprises, with a low-cost, easy-to-implement and well-adaptable digital invoice management solution.

[0039] In one implementation of this embodiment, identifying the electronic business bill through the AI ​​model to obtain the field type of the electronic business bill includes the following steps: S210, extracting features from the electronic business bill to obtain text features and metadata features of the electronic business bill; S220. Input text features and metadata features into an AI model to obtain a domain type of the electronic business bill, where the domain type includes an HIS domain and an ERP domain.

[0040] In this embodiment, the feature extraction process is divided into two main aspects: extraction of text features and metadata features.

[0041] First, text feature extraction mainly includes keyword recognition and text structure analysis. For keyword recognition, natural language processing (NLP) technology, such as word frequency statistics (TF-IDF) or word embedding (Word Embedding) and other algorithms, can be used to extract key words from electronic business bills. For example, for the HIS (hospital information) field, key words can be medical-related words such as "patient", "visit", and "prescription"; while for the ERP (enterprise resource planning) field, key words can be business terms such as "order", "supplier", and "invoice". In addition, the position, frequency, and contextual relationship of words in the document can also be identified. For example, if the word "patient" appears frequently in a document and often co-occurs with words such as "diagnosis" and "treatment", then the document belongs to the HIS field.

[0042] Text structure analysis includes identifying the title, paragraph division, table structure, etc. of the document. The basic formatting rule method can be used to identify specific format patterns. For example, documents in the HIS field contain specific structures such as patient information tables and diagnostic reports, while documents in the ERP field contain different structural features such as order details and financial statements.

[0043] Secondly, metadata feature extraction is used to extract non-content information carried by the document itself. This includes the generation time, generation, and related IDs of the document. This information is usually stored in the attributes or header of the document. For example, the creation date and last modification time of the document can be extracted. These timestamps are used to imply the timeliness and importance of the document. Generated information, such as identifiers such as "HIS-v3.2" or "ERP-2022", directly indicate the source of the document and provide clues for domain classification. For example, related IDs, such as patient IDs or order numbers, also imply the domain attributes of the document in their format and structure.

[0044] The extracted features are converted into numerical vectors or other formats suitable for processing by machine learning models. For example, keywords are converted into term frequency vectors, document structures are encoded as binary features, and timestamps are converted into days relative to a base date.

[0045] Afterwards, the extracted features are input into the AI ​​model and the domain type of the electronic business bill is derived.

[0046] Specifically, first, the text features and metadata features extracted in step S210 are preprocessed and standardized, including feature scaling (such as normalizing all numerical features to the range of 0-1), missing value processing (such as filling with the mean or median), feature encoding (such as converting categorical features to one-hot encoding), etc., to ensure that all features are at the same scale, which is conducive to the learning and prediction of the AI ​​model.

[0047] Next, the preprocessed features will be input into the pre-trained AI model. The AI ​​model can be a deep learning model, such as a multi-layer perceptron (MLP), a long short-term memory network (LSTM), etc. The AI ​​model contains multiple hidden layers. Each layer performs a nonlinear transformation on the input features and gradually extracts higher-level abstract features. For example, the first layer can learn simple word combination patterns, while subsequent layers may capture more complex semantic relationships. The last layer is a softmax layer that outputs the probability distribution of each category (HIS and ERP).

[0048] The model training process involves a large number of labeled electronic business bill samples. During the training phase, the model continuously adjusts its internal parameters through the back-propagation algorithm to minimize the gap between the predicted results and the true labels. After training, the model is able to classify new, unseen electronic business bills.

[0049] In actual applications, when a new electronic business bill needs to be classified, its text features and metadata features will be input into the trained AI model. The AI ​​model will calculate the probability that the bill belongs to the HIS field and the ERP field. For example, the AI ​​model outputs: the probability of the HIS field is 0.85, and the probability of the ERP field is 0.15. The category with the highest probability is selected as the final classification result. In this example, the electronic business bill will be classified as the HIS field.

[0050] This implementation can accurately identify the domain type of electronic business bills, whether HIS or ERP, through in-depth feature extraction and advanced AI models. This automated classification not only greatly improves processing efficiency and reduces manual intervention, but also provides a reliable foundation for subsequent business processes.

[0051] In one implementation of this embodiment, the step of generating a folder includes: S301, obtaining a first timestamp of the generation of the electronic business bill; When the domain type is the HIS domain, a business code of a business platform for generating electronic business tickets is obtained, and a first preset naming rule is adopted to generate a first name of the folder according to the first timestamp; S302, generating a first path of a folder based on a preset first basic path, a first timestamp and a business code; S303: Create a folder based on the first name and the first path, and create a HIS domain main folder and at least one HIS domain subfolder in the folder; S304, allocating a first permission of the HIS domain main folder and a second permission of at least one HIS domain subfolder, and recording a second path of the HIS domain main folder and a second timestamp of the creation of the HIS domain main folder; S305, creating a first json file in the HIS domain main folder and generating a log, the first json file including the second timestamp and the domain type, and the log including the second path, the first permission and the second permission; S306: When the domain type is the ERP domain, obtain the business class code of the business platform for generating the electronic business bill, and use the second preset naming rule to generate a second name for the folder according to the first timestamp; S307, generating a third path of the folder based on the preset second basic path, the first timestamp and the business class code; S308, creating a folder based on the second naming and the third path, and creating an ERP domain main folder and at least one ERP domain subfolder in the folder, wherein the number of the ERP domain subfolders is the same as the number of the HIS domain subfolders; S309, allocating a third permission of the ERP domain main folder and a fourth permission of at least one ERP domain subfolder, and recording a fourth path of the ERP domain main folder and a third timestamp of creation of the HIS domain main folder; S310. Create a second json file in the ERP domain main folder and generate a log. The second json file includes a third timestamp and a domain type. The log includes a fourth path, a third permission, and a fourth permission.

[0052] First, obtain the first timestamp of the electronic business bill generation. The timestamp of this embodiment is a number accurate to milliseconds, representing the exact time when the bill was generated, for example, "20240419153045123", which represents 15:30:45:123 milliseconds on April 19, 2024. The acquisition of the timestamp can be achieved by calling the system time function. The timestamp is not only used for folder naming, but also can be used as part of the unique identifier of the bill to ensure that each bill has a unique time stamp.

[0053] Next, when the domain type is confirmed to be the HIS domain, the business code of the business platform that generates the electronic business ticket is obtained. The business code is a predefined string used to identify different medical business types, such as "OPD" for outpatient departments, "IPD" for inpatient departments, etc. The business code can be obtained by querying the database or reading the configuration file.

[0054] Then, a first preset naming rule is used to generate a first name of the folder according to the first timestamp. This naming rule may adopt the following format: "HIS_[business code]_[timestamp]". The folder name can clearly indicate that the folder belongs to the HIS field; folders of different business types can be identified by business codes; the use of timestamps ensures the uniqueness of each folder name, and no conflict will occur even if multiple folders are created in the same second.

[0055] For example, if the timestamp is 20240419153045123 and the business code is OPD, the generated folder name is: "HIS_OPD_20240419153045123".

[0056] A first path of the folder is generated based on a preset first basic path, a first timestamp and a business code to determine the exact location of the newly created folder in the file system.

[0057] First, the preset first basic path is a directory pre-defined in the system, which is stored in the configuration file or hard-coded in the program. For example, the basic path can be: " / data / HIS_documents / ". Next, a time-related directory structure is created using the first timestamp. The timestamp can be converted into the form of year, month, and day. For example, if the date corresponding to the timestamp is May 1, 2023, the following path structure can be generated: " / data / HIS_documents / 2023 / 05 / 01 / ". Then, the business code is added to the path. If the business code is "OPD", the complete path becomes: " / data / HIS_documents / 2023 / 05 / 01 / OPD / ". Finally, the folder name generated in step S301 is added to the end of the path to form the final first path.

[0058] Based on the first name and the first path generated in steps S301 and S302, a folder is created, and a HIS domain main folder and at least one HIS domain subfolder are created in the folder to physically create a directory structure in the file system.

[0059] First, check if the first path already exists. If not, recursively create the entire directory structure. This can be done using directory creation functions provided by the programming language, such as the Files.createDirectories() method in Java. These functions can automatically create all non-existent parent directories in the path.

[0060] After creating the main directory, create a HIS domain main folder in it. This main folder can be named "HIS_Main" or other names to store the main documents and metadata related to the HIS field. Next, create at least one HIS domain subfolder. Subfolders correspond to different document types. For example, the subfolder Patient_Records is used to store patient records; the subfolder converted is used to store converted electronic business invoices; the subfolder Billing is used to store billing information, etc. It can be set according to actual conditions, and this application does not limit this.

[0061] Assign the first permission of the HIS domain main folder and the second permission of at least one HIS domain subfolder, and record the second path of the HIS domain main folder and the second timestamp of the creation of the HIS domain main folder. First, assign the first permission to the HIS domain main folder. This permission setting uses an access control list (ACL) or similar mechanism for operations. For example, the following permissions can be set: Owner (usually an administrator or HIS user): read, write, execute; Group (can be a medical staff group): read, execute; Others: no permissions. This permission setting ensures that only authorized personnel can access and modify the contents in the HIS main folder.

[0062] Next, assign secondary permissions to each HIS domain subfolder. Secondary permissions can be set based on the specific purpose of the subfolder. For example, set strict permissions on the Patient_Records folder to only allow specific medical personnel to access it; and only allow members of the finance department to access the Billing folder.

[0063] Then, the second path of the HIS domain main folder will be recorded. The second path is different from the first path generated in step S302, and it specifically refers to the location of the main folder. For example, if the first path is: " / data / HIS_documents / 2023 / 05 / 01 / OPD / HIS_OPD_20240419153045123 / "; Then the second path can be: " / data / HIS_documents / 2023 / 05 / 01 / OPD / HIS_OPD_20240419153045123 / HIS_Main / ".

[0064] Recording the second path can facilitate subsequent quick location and access to the HIS main folder without traversing the entire directory structure.

[0065] Finally, the second timestamp of the creation of the HIS domain master folder is recorded, which accurately records the time when the master folder was actually created.

[0066] Create the first json file in the main folder of the HIS domain and generate a log. Specifically, create a JSON format file in the main folder of the HIS domain, which can be named "metadata.json". The JSON file contains two key information: the second timestamp and the domain type. For example, the file content may be {"timestamp": "20240419153046789","domain": "HIS"}. At the same time, generate a log file to record more detailed information, including the second path, the first permission (main folder permission) and the second permission (subfolder permission). The log file can be named "XX.txt".

[0067] When the domain type is ERP (Enterprise Resource Planning) domain, it is necessary to obtain the business class code of the business platform that generates the electronic business invoice. The business class code is a more detailed business identifier, for example, "SALES_ORDER" represents a sales order, and "PURCHASE_ORDER" represents a purchase order. Then, use the second preset naming rule to generate the second name of the folder according to the first timestamp. This naming rule is different from that in the HIS domain and can be in the format of "ERP_business class code_timestamp". Therefore, if the first timestamp is "20240419153045123" and the business class code is "SALES_ORDER", then the second name can be "ERP_SALES_ORDER_20240419153045123".

[0068] The third path of the folder is generated based on the preset second basic path, the first timestamp and the business class code. The second basic path is the storage root directory preset for the ERP field, which is similar to the first basic path in the HIS field and can be " / data / ERP / ". The second basic path is combined with the second name generated previously to obtain the complete third path. For example, if the second basic path is " / data / ERP / " and the second name is "ERP_SALES_ORDER_20240419153045123", then the generated third path is " / data / ERP / ERP_SALES_ORDER_20240419153045123 / ".

[0069] Based on the generated second naming and third path, create a folder structure in the ERP domain. First create a main folder, and then create an ERP domain main folder and at least one ERP domain subfolder in it. The ERP domain main folder can be named "ERP_MAIN", and the number of subfolders needs to be consistent with the subfolders in the HIS domain to ensure the correspondence between the data structures of the two systems. For example, you can create subfolders such as "CUSTOMER_INFO", "ORDER_DETAILS", and "FINANCIAL_RECORDS". The number is consistent with the subfolders in the HIS domain, which is convenient for comparison and integration with the data of the HIS system when receiving electronic invoice data from both domains at the same time.

[0070] Assign permissions to the ERP domain main folder and subfolders. Similar to the permission settings in the HIS domain, you can set the following permissions: Owner (usually an administrator or ERP user): Read, Write, Execute; Group (can be an enterprise staff group): Read, Execute; Others: No permissions. This permission setting ensures that only authorized personnel can access and modify the contents of the ERP main folder.

[0071] Next, assign secondary permissions to each ERP domain subfolder. Secondary permissions can be set based on the specific purpose of the subfolder. For example, the PURCHASE_ORDER folder is set with strict permissions, allowing only specific purchasing personnel to access it; the SALES_ORDER folder is only accessible to members of the sales department. This permission setting ensures the security of ERP data and prevents unauthorized access or modification.

[0072] At the same time, record the fourth path of the ERP domain main folder, which is the absolute path of the ERP main folder, such as " / data / ERP / ERP_SALES_ORDER_20240419153045123 / ERP_MAIN / ". It is also necessary to record the third timestamp of the ERP main folder creation, which reflects the actual creation time of the ERP folder.

[0073] A second JSON file is created in the ERP domain main folder. The JSON file contains two key pieces of information: the third timestamp and the domain type. For example, the file content may be {"timestamp": "20240419153047456", "domain":"ERP"}. At the same time, a new log file is generated to record detailed information related to ERP, including the fourth path, the third permissions (ERP main folder permissions), and the fourth permissions (ERP subfolder permissions). The log file can be named "XX.txt".

[0074] The folder generation and management solution of this implementation method provides a unified, orderly and secure framework for data storage in two different areas of HIS and ERP. By using timestamps and business codes / class codes to generate unique folder names, the uniqueness and traceability of data storage are ensured. The hierarchical folder structure (main folders and subfolders) allows different types of data to be clearly classified and stored, which is convenient for subsequent data processing and analysis. The allocation of permissions ensures the security of data and prevents unauthorized access. The creation of JSON files and logs provides important metadata for the system, which is helpful for system maintenance, troubleshooting and data analysis. In particular, by maintaining the consistency of the number of subfolders in the HIS and ERP systems, the foundation is laid for data integration and comparative analysis of the two systems.

[0075] In one implementation of this embodiment, uploading the converted electronic business bill to the cloud platform through a synchronization tool includes the following steps: S410, the synchronization tool uses the converted electronic business receipt as a file to be synchronized, and identifies the file type and file size of the file to be synchronized; S420, the synchronization tool determines a corresponding compression algorithm according to the file type, and compresses the file to be synchronized using the compression algorithm to obtain a compressed file; S430, the synchronization tool identifies the sensitive fields of the compressed file, and encrypts the sensitive fields to obtain an encrypted data packet; S440, the synchronization tool establishes an HTTPS connection with the cloud platform, and uploads the encrypted data packet to the cloud platform in segments.

[0076] The synchronization tool first uses the converted electronic business invoice as the file to be synchronized, and identifies the file type and file size of the synchronized file. Identifying the file type is achieved by analyzing the file extension and content. The file extension can provide preliminary type information, such as .pdf for PDF files and .xlsx for Excel files. In order to more accurately determine the file type, this embodiment also needs to check the magic number of the file. The magic number is a string of specific bytes at the beginning of the file that is used to identify the file type. For example, the magic number of a PDF file is "%PDF-". This can be implemented using Python's magic library.

[0077] The file size can be obtained through the file system API. The file size value is returned in bytes. For example, a 1MB PDF file returns 1048576 bytes.

[0078] For example, suppose the electronic business receipt to be synchronized is a PDF file with a size of 5MB. The synchronization tool will first read the first few bytes of the file and confirm that its magic number is "%PDF-", thus determining that it is a PDF file. Then, the file size is obtained through the file system API, and the result is 5242880 bytes. This information will be recorded for subsequent processing steps.

[0079] Based on the file type identified in step S410, the synchronization tool will select an appropriate compression algorithm. The selection process is usually based on preset rules or configuration files. Different types of files are suitable for different compression algorithms because their data structures and redundancy characteristics are different. For example, for text files (such as .txt, .xml, .json), you can select the GZIP general compression algorithm; for image files, if lossless compression is required, you can select the PNG compression algorithm; if lossy compression is allowed, you can select JPEG compression. For already compressed file formats (such as .pdf, .docx), you can select a lightweight compression algorithm or skip the compression step directly, because these files are usually already optimized, and re-compression may not be obvious or even increase the file size.

[0080] The degree of compression is affected by the compression level, which usually ranges from 1 (fastest compression) to 9 (best compression). Choosing the right compression level is a trade-off between file size reduction and compression time. For a 5MB PDF file, if you choose a medium compression level (such as 5), you may reduce the file size to about 3-4MB, and the compression time may be between a few hundred milliseconds and a few seconds.

[0081] The compression process is implemented using a specialized compression library, such as zlib. After compression, the synchronization tool generates a new compressed file, usually with an extension that indicates the compression algorithm, such as .pdf.gz. By compressing the files to be synchronized, the size of the files to be transmitted is significantly reduced, thereby reducing the time and bandwidth required for network transmission. For files containing a large amount of repeated content or structured data, data transmission efficiency is optimized.

[0082] After compression is complete, the synchronization tool identifies sensitive fields in the compressed file and encrypts them. Sensitive fields can include personal identity information (such as name, ID number, phone number), financial information (such as bank account number, credit card information), medical information, etc. The definition of sensitive fields is usually stored in the configuration file or hard-coded in the program. Identifying sensitive fields can be achieved using regular expressions. For the HIS field, sensitive fields can be patient personal information, diagnosis results, etc.; for the ERP field, sensitive fields can be financial data, contract amounts, etc.

[0083] Assuming that during the parsing process, the synchronization tool identifies an ID card number and a bank card number, these sensitive information needs to be encrypted. The encryption algorithm can be symmetric encryption (such as AES) and asymmetric encryption (such as RSA). This embodiment uses a symmetric encryption algorithm. Taking AES-256 encryption as an example, the process is as follows: 1. Generate a random 256-bit key. 2. Use this key to encrypt sensitive information. For example, "310****34" is encrypted to "7Xt2p9Q3Rf7yLm1nO8Bv4W==". 3. Replace the original sensitive information with the encrypted text. 4. Transmit the encryption key and share it with the recipient (cloud platform) through a secure key exchange protocol (such as Diffie-Hellman).

[0084] The encrypted data packet usually contains two parts: the encrypted file and the encrypted metadata. This embodiment significantly improves the security of the data. Even if the data is intercepted during transmission, the attacker cannot read the sensitive information without the correct decryption key. At the same time, by encrypting only the sensitive fields instead of the entire file, the processing efficiency is balanced while ensuring security, avoiding unnecessary computing overhead.

[0085] The synchronization tool establishes a secure connection with the cloud platform and uploads the encrypted data packets in pieces. First, the synchronization tool establishes an HTTPS connection with the cloud platform. HTTPS is the abbreviation of HTTP over SSL / TLS, which provides encryption and authentication for data transmission through the SSL / TLS protocol. The process of establishing an HTTPS connection is as follows: 1. The client (synchronization tool) sends a "Hello Client" message to the server (cloud platform), which contains information such as the TLS version and encryption algorithm supported by the client. 2. The server responds to the "Hello Server" message, selects the TLS version and encryption algorithm to be used, and sends its digital certificate. 3. The client verifies the server's certificate to ensure that it is indeed communicating with the expected cloud platform. 4. The client generates a pre-master key, encrypts it with the server's public key, and sends it to the server. 5. Both parties use the pre-master key to generate a session key, and all subsequent communications are encrypted using this session key.

[0086] After establishing a secure connection, the synchronization tool starts uploading the encrypted data package. Considering that the data package may be large (even after compression), a multi-slice upload strategy is usually adopted. The multi-slice upload process is as follows: 1. Divide the encrypted data package into blocks of fixed size, such as 5MB per block. 2. Calculate the checksum (such as MD5 or SHA256) for each shard for subsequent integrity verification. 3. Initialize the upload task and obtain the upload ID. 4. Upload each shard in turn. Each upload contains the shard sequence number, shard data and checksum. 5. After all shards are uploaded, a request to complete the upload is sent, which contains information about all shards. 6. The cloud platform verifies the integrity of all shards. If the verification passes, the shards are assembled into a complete file.

[0087] After the upload is complete, the synchronization tool will send a request to complete the upload, informing the server (cloud platform) that all shards have been uploaded and the file can be assembled.

[0088] This implementation method selects the appropriate compression algorithm to significantly reduce the file size and improve transmission efficiency. The identification and encryption of sensitive information ensures the security of data during transmission and storage, and effectively protects user privacy. Finally, by establishing a secure HTTPS connection and implementing a multi-slice upload strategy, not only the security of data transmission is guaranteed, but also the reliability and efficiency of large file transmission are improved.

[0089] In one implementation of this embodiment, the synchronization tool uses a compression algorithm to compress the file to be synchronized to obtain a compressed file, including the following steps: S510, the synchronization tool creates a memory buffer and initializes a compression algorithm; S520, the synchronization tool reads the to-be-synchronized file into the memory in blocks, and compresses the data block of each to-be-synchronized file using a compression algorithm; S530: The synchronization tool writes all compressed data blocks into a new file to obtain a compressed file.

[0090] A memory buffer is a pre-allocated continuous memory space used to temporarily store data. The size of the buffer can be determined based on the size of the data block you expect to process. For example, if you plan to process 1MB of data blocks each time, you can allocate a larger buffer, such as 1.5MB, to have extra space to cope with data expansion or other temporary needs. Memory buffers can be created using the memory allocation functions provided by the programming language.

[0091] Initializing the compression algorithm involves setting compression parameters and preparing the compression state. Taking the DEFLATE algorithm as an example, the initialization process includes: 1. Selecting the compression level (usually from 1 to 9, 1 is the fastest but has the lowest compression rate, 9 is the slowest but has the highest compression rate); 2. Setting the window size (determines the range for searching for duplicate data, usually 32KB); 3. Initializing the Huffman tree (for dynamic Huffman encoding); 4. Allocating and initializing internal data structures (such as hash tables, used to quickly find duplicate strings).

[0092] The file to be synchronized is read into memory in chunks and each chunk is compressed. Chunked reading is used to process large files that may exceed the available memory size, and it also helps with parallel processing and improves overall efficiency.

[0093] First, you need to determine the appropriate block size. The choice of block size requires weighing several factors: memory usage, I / O efficiency, and compression efficiency. Usually, the block size is selected between 64KB and several MB. For example, 1MB can be selected as the block size. This size will not take up too much memory, and can make full use of the read performance of modern hard disks.

[0094] The reading process uses buffered I / O to improve efficiency. Assuming there is a 10MB file that needs to be compressed, using a 1MB block size, the reading process may be as follows: 1. Open the file; 2. Loop 10 times, each time reading 1MB of data into the memory buffer; 3. Compress each 1MB data block; 4. Process the final data block that may be less than 1MB.

[0095] After the to-be-synchronized file is read into the memory in blocks, a compression algorithm is used to compress the data block of each to-be-synchronized file. In this embodiment, the compression of each data block is independent.

[0096] All compressed data blocks are written into a new file. In this embodiment, the data compressed in the previous steps can be integrated into a complete compressed file. Specifically, first, a new file is created to store the compressed data. The file creation API provided by the operating system is usually used for file creation. The writing process adopts a buffered write strategy to improve efficiency. Instead of writing to the disk immediately after compressing a data block each time, multiple compressed data blocks can be accumulated in the memory first, and then written to the disk at one time to reduce the number of disk I / O operations and improve overall performance. For example, a 4MB write buffer can be set, and a write operation is performed only when the accumulated compressed data reaches or approaches 4MB.

[0097] During the writing process, necessary metadata needs to be added, including file size, compressed size, checksum, etc. Metadata is usually written at the beginning or end of the file. For example, a fixed-size header area (such as 512 bytes) can be reserved at the beginning of the file to store these metadata.

[0098] This implementation provides the necessary resources and environment for the compression process by creating a memory buffer and initializing the compression algorithm. The block reading and compression strategy enables the solution to handle files of various sizes and facilitates parallel processing. The final writing step ensures the correct storage of compressed data and the integrity of metadata. It not only significantly reduces file size and improves data transmission and storage efficiency, but also has good scalability and is suitable for various file compression scenarios.

[0099] In one implementation of this embodiment, the synchronization tool encrypts the sensitive fields to obtain an encrypted data packet, including the following steps: S610: For any sensitive field, the synchronization tool obtains the position of the sensitive field in the file to be synchronized and generates a random initialization vector; S620, the synchronization tool uses a preset encryption algorithm to replace the sensitive field with a random initialization vector to obtain an encrypted sensitive field; S630, the synchronization tool generates encryption metadata according to the random initialization vector and the position of the sensitive field in the file to be synchronized; S640, the synchronization tool inserts the encrypted sensitive field into the corresponding position of the to-be-synchronized file to obtain an encrypted file; S650: The synchronization tool packages the encrypted metadata and the encrypted file into a container file to obtain an encrypted data packet.

[0100] This embodiment first accurately locates the position of sensitive fields in the file. If the file to be synchronized is a structured data file (such as JSON or XML), a corresponding parser can be used to locate specific fields. If it is an unstructured text file, regular expressions or other pattern matching techniques are used to locate sensitive fields. The position of the sensitive field includes the starting position (offset) and length of the field.

[0101] The random initialization vector (IV) is a fixed-length sequence of random bytes, whose length depends on the encryption algorithm used. For example, for the AES encryption algorithm, the random initialization vector is usually 16 bytes (128 bits) long.

[0102] A preset encryption algorithm is used to replace the sensitive field with a random initialization vector to obtain an encrypted sensitive field. The preset encryption algorithm may be an AES encryption algorithm.

[0103] The encryption process first requires an encryption key. The encryption key is pre-set, and the length of the key depends on the selected encryption algorithm. For example, AES can use 128-bit, 192-bit, or 256-bit keys.

[0104] Taking AES-CBC mode as an example, the encryption process can be described as follows: 1. Fill the sensitive field data to an integer multiple of the block size (AES uses a 16-byte block size); 2. Use IV as the input of the first block; 3. Encrypt each data block: a. Perform an XOR operation on the current plaintext block and the previous ciphertext block (or IV); b. Process the XOR result through the AES encryption function; c. The output ciphertext block is used as the input of the next block; 4. Connect all encrypted blocks to form the final ciphertext. Among them, the XOR (exclusive OR) operation is a binary operation, and its rule is: when the two compared bits are different, the result is 1; if they are the same, it is 0.

[0105] For example, assuming the sensitive field is "secret123" (9 bytes), it needs to be padded to 16 bytes. The padded data may be: 73 65 63 72 65 74 31 32 33 07 07 07 07 07 07 07 (the last 7 bytes are all 0x07, indicating 7 bytes are padded).

[0106] Using the previously generated 16-byte IV and a hypothetical 256-bit key, the encryption process is as follows: 1. XOR the IV with the padded data; 2. Process the XOR result using the AES encryption function; 3. Output 16 bytes of ciphertext.

[0107] The resulting ciphertext might be (in hexadecimal): F8 3D A1 4F 9C 21 15 7B 89 5E 330A C2 D4 8F 1B. The 16-byte ciphertext is used to replace the original 9-byte sensitive field.

[0108] This embodiment can convert sensitive fields into an encrypted form that cannot be directly read. By using random IV and encryption algorithm, even if the same sensitive field is encrypted multiple times, different ciphertexts will be generated, greatly enhancing the security of the data. The encrypted data cannot be interpreted without authorization, effectively protecting sensitive information. At the same time, since encryption is performed on specific fields rather than the entire file, this method maintains the overall structure of the file, facilitating subsequent processing and decryption operations.

[0109] Generates encryption metadata based on the random initialization vector and the location of sensitive fields in the file to be synchronized to ensure subsequent correct decryption. The encryption metadata contains key information required for decryption, but does not contain the actual sensitive data itself.

[0110] Encryption metadata can include random initialization vector (IV), location information of sensitive fields in the original file (starting offset and length), encryption algorithm and mode used (such as AES-CBC), length of encrypted data, checksum, etc. Insert the encrypted sensitive field into the corresponding position of the file to be synchronized to obtain the encrypted file. Only the sensitive part that needs to be encrypted can be replaced while keeping the overall structure of the file unchanged.

[0111] Use the previously obtained location information to replace the sensitive fields in the original file with the encrypted data. This can be achieved using slice operations or byte array replacement methods.

[0112] For example, suppose the original sensitive field starts at 100 bytes and is 20 bytes long, while the encrypted data is 32 bytes long. The replacement process can be: keep the first 100 bytes of the file unchanged, then insert 32 bytes of encrypted data, and finally add all the remaining content starting from 120 bytes (i.e. 100+20) in the original file. That is, the replacement of sensitive data is completed while maintaining the integrity of the rest of the file.

[0113] Packing the encryption metadata and the encrypted files into a container file ensures that the encrypted data can be properly transmitted and decrypted. First, select a container file format. Container file formats include ZIP, TAR, or a custom binary format. Taking the ZIP format as an example, the packaging process can be divided into the following steps: 1) Create a new ZIP file; 2) Add the encrypted files to the ZIP file; 3) Add the encryption metadata to the ZIP file as a separate file.

[0114] This implementation first lays the foundation for subsequent encryption by accurately locating sensitive fields and generating random initialization vectors. Then, the encryption algorithm is used to convert sensitive data into ciphertext to ensure the confidentiality of the data. The generated encrypted metadata contains the key information required for decryption, which facilitates subsequent decryption operations. The encrypted data is accurately inserted into the original file, maintaining the integrity of the file structure so that the non-sensitive parts can still be used normally. Finally, by packaging the encrypted file and metadata, a self-contained security data package is created. Not only does it protect sensitive information, but it also maintains the availability and management convenience of the data.

[0115] In one implementation of this embodiment, the synchronization tool establishes an HTTPS connection with the cloud platform and uploads the encrypted data packet to the cloud platform in segments, including the following steps: S710, the synchronization tool calculates a first file checksum of the encrypted data packet, and generates upload metadata, wherein the upload metadata includes a first name, a file size, and a first file checksum, or the upload metadata includes a second name, a file size, and a first file checksum; S720, the synchronization tool establishes an HTTPS connection with the cloud platform; S730, the synchronization tool divides the encrypted data packet into multiple fixed-size data blocks, uploads the data blocks to the cloud platform one by one, and records the fixed-size data blocks uploaded to the cloud platform; S740: After the synchronization tool uploads all fixed-size data blocks to the cloud platform, the synchronization tool sends the upload metadata to the cloud platform.

[0116] First, a checksum algorithm is used to check and calculate the entire encrypted data packet. The checksum algorithm can be SHA-256. The algorithm can generate a 64-bit hexadecimal string that represents the unique fingerprint of the file. Next, the upload metadata is generated. The upload metadata includes the first name or the second name, the file size, and the first file checksum. The upload metadata is in JSON or XML format.

[0117] To establish an HTTPS connection with the cloud platform, please refer to S440, which will not be repeated in this application.

[0118] The upload process of splitting the encrypted data packet into multiple fixed-size data blocks and uploading them one by one can be: a. Establish an HTTPS connection with the cloud platform. b. Upload in pieces: split the 520KB file into two 260KB blocks. Upload the first block, and the server confirms the integrity. Upload the second block, and the server confirms it again. c. Send the upload metadata to the cloud platform.

[0119] The upload process uses a loop to read and upload data blocks one by one. The upload of each block can be regarded as an independent HTTP POST request. In addition to the data block itself, the request should also contain metadata such as the block sequence number and file identifier. This information enables the server to correctly assemble and manage the received data blocks.

[0120] During the upload process, the synchronization tool needs to record the uploaded blocks. This can be achieved by maintaining a data structure (such as an array or bitmap) and marking the corresponding position of each successfully uploaded block. If the upload process is interrupted, the next time it is restarted, it can directly start from the unuploaded blocks to avoid repeatedly uploading the successful parts.

[0121] After all fixed-size data blocks are uploaded, the upload metadata is sent to the cloud platform to provide the overall information of the file, so that the cloud platform can verify all received data blocks and correctly assemble them into a complete file.

[0122] First, the synchronization tool needs to confirm that all data blocks have been successfully uploaded. This can be achieved by checking the previously maintained data block upload status record. For example, if a Boolean array is used to record the upload status of each block, you should ensure that all elements in the array are true. If there are blocks that have not been successfully uploaded, you should complete the upload of these blocks before proceeding to the next step. After confirming that all blocks have been uploaded, the synchronization tool encapsulates the previously generated upload metadata (including file name, file size, and file checksum) into an HTTP request and sends it to the cloud platform. This request usually uses the POST or PUT method, and the data format can be JSON or XML.

[0123] In this request, in addition to the metadata generated previously, you can also include additional information, such as the total number of chunks and the upload ID (a unique identifier assigned by the server when you start uploading). This helps the server-side perform file verification and assembly.

[0124] When the cloud platform receives this request, it performs a series of validation operations. First, it checks whether all the data blocks claimed have been received. Then, it combines all the data blocks into a complete file, calculates the checksum of the file, and compares it with the checksum provided in the upload metadata. If the checksum matches, it means that the file has been successfully uploaded in its entirety; if it does not match, some or all of the data blocks may need to be re-uploaded.

[0125] The synchronization tool waits for and correctly processes the server's response. The status that the server may return includes: upload success, verification failure and need to be re-uploaded, some blocks are lost and need to be retransmitted, etc. Based on different responses, the synchronization tool needs to take corresponding actions, such as reporting the upload success to the user, re-uploading the specified data block, etc.

[0126] This implementation first calculates the file checksum and generates upload metadata, laying the foundation for subsequent file integrity verification. Establishing an HTTPS connection ensures the security of data transmission and prevents information from being eavesdropped or tampered with. The block upload strategy greatly improves the reliability and efficiency of large file transmission, supports breakpoint resumption, and effectively copes with network instability. Finally, the upload metadata is sent as the final confirmation to ensure the integrity and consistency of the entire file.

[0127] Figure 5 A second flow chart of a method for managing digital electricity invoices based on an AI model provided in an embodiment of the present application is shown. Figure 5 As shown, the embodiment of the present application also provides a digital invoice management method based on an AI model, which is applied to a cloud platform, the cloud platform is connected to an electronic device, and the electronic device is connected to a physical printer. The method includes the following steps: S801, in response to receiving a fixed-size data block transmitted by an electronic device, storing the fixed-size data block in a preset buffer until all fixed-size data blocks are received; S802, reorganize all fixed-size data blocks in the buffer to obtain a reorganized file; S803, calculating a second file checksum of the reorganized file; S804, receiving and parsing the uploaded metadata to obtain the first file verification code and the location of the sensitive field; S805, comparing the second file checksum with the first file checksum; S806. After the comparison is successful, the encrypted data packet is unpacked to obtain the encrypted metadata and the encrypted file, and the field to be decrypted is located according to the position of the sensitive field; S807, using a preset decryption algorithm and a preset security key to decrypt the field to be decrypted, obtain a sensitive field corresponding to the field to be decrypted, and obtain a decrypted compressed file; S808, decompressing the compressed file using a preset decompression algorithm to obtain an electronic business receipt; S809, parsing the electronic business bill to obtain bill information, and executing the billing process according to the bill information to generate a digital invoice and a callback instruction; S810, sending the digital electronic invoice and the callback instruction to the electronic device, so that the electronic device generates a printing instruction according to the callback instruction, and sends the printing instruction and the digital electronic invoice to a physical printer, which is used to print the digital electronic invoice according to the printing instruction.

[0128] In response to receiving fixed-size data blocks transmitted by an electronic device, the cloud platform will immediately store these data blocks in a pre-set buffer. This process will continue until all fixed-size data blocks are received. The buffer is usually a temporarily allocated memory space for temporarily storing these data blocks. In a specific implementation, the cloud platform will maintain a data reception status, record the number of data blocks received and the total number of data blocks to be received. Each time a data block is received, it is written to the corresponding position of the buffer and the reception status is updated. For example, assuming that the size of each data block is 1MB and the total size of the file is 10MB, it will be divided into 10 data blocks for transmission. The cloud platform will allocate a 10MB buffer and write each 1MB data block to the corresponding position in the buffer (0-1MB, 1-2MB, ..., 9-10MB) when receiving it.

[0129] Reassemble all fixed-size data blocks in the buffer to obtain a complete reassembled file. Specifically, the data blocks scattered and stored in different positions of the buffer can be connected in the correct order to form a complete file. In specific implementation, this task can be completed using file pointers or memory operations. Assuming that there are 10 data blocks of 1MB in size stored in the buffer, the reassembly process will start from the first data block and write the contents of each data block to a new file or memory space in turn. This process requires precise control of the start and end positions of each data block to ensure that no data is lost or duplicated. For example, the first data block will be written to the 0-1MB position of the new file, the second data block will be written to the 1-2MB position, and so on. If memory operations are used, data can be moved and spliced ​​directly in memory and then written to the file system at one time. Finally, the scattered data blocks are converted into a complete and usable file, ready for subsequent file integrity verification and decryption operations. Through an efficient reassembly process, disk I / O operations can be minimized and the speed of file processing can be increased.

[0130] The second file checksum of the reassembled file is calculated using a checksum algorithm to ensure file integrity. In specific implementation, the contents of the reassembled file can be read block by block, and each block of content is input into the selected checksum algorithm to ultimately obtain a checksum of a fixed length. For example, when using the MD5 algorithm, a 128-bit (16-byte) checksum is ultimately obtained regardless of the file size. Ultimately, a reliable file fingerprint is generated for subsequent comparison with the first file checksum in the uploaded metadata, thereby verifying that the file remains intact and has not been tampered with or damaged during the transmission and reassembly process. In this way, possible errors that may occur during file transmission can be effectively detected, improving the reliability of the entire system and data security.

[0131] Receive and parse the uploaded metadata to obtain the first file verification code and the location of the sensitive field. Specifically, the cloud platform receives the uploaded metadata from the electronic device through a network interface. After receiving the uploaded metadata, the platform uses a corresponding parser (such as a JSON parser) to extract the first file verification code and the location of the sensitive field.

[0132] Comparing the second file checksum with the first file checksum can be achieved through a string comparison operation. The second file checksum is obtained by calculating the reorganized file in step S803, while the first file checksum is parsed from the uploaded metadata in step S804. In specific implementation, the string comparison function provided by the programming language can be used. If the two checksums are not exactly the same, even if there is only one character difference, it will be considered a comparison failure. If the comparison is successful, it means that the file has not been tampered with or damaged during the transmission process, and subsequent processing can be performed. If the comparison fails, it indicates that an error may have occurred in the file during the transmission process, and it needs to be retransmitted or other error handling measures need to be taken. Through this strict verification mechanism, the reliability and security of the system processing data can be greatly improved, and subsequent processing errors caused by file damage or tampering can be prevented.

[0133] After the checksum comparison is successful, the encrypted data packet is unpacked to obtain the encrypted metadata and the encrypted file, and the field to be decrypted is located according to the position of the sensitive field. First, the encrypted data packet needs to be parsed to separate the encrypted metadata and the encrypted file content. Then, based on the sensitive field location information previously obtained from the uploaded metadata, the data segment to be decrypted is accurately located in the encrypted file. In the specific implementation, it is assumed that the structure of the encrypted data packet is: [encrypted metadata length (4 bytes)][encrypted metadata][encrypted file content]. First, the first 4 bytes are read to determine the length of the encrypted metadata, and then the encrypted metadata of the corresponding length is read, and the remaining part is the encrypted file content. For the location of sensitive fields, it is assumed that there are two sensitive fields, located at 100-200 bytes and 300-400 bytes respectively. The system will mark these two areas in the encrypted file content as fields to be decrypted, thereby decomposing the complex encrypted data packet into components that can be processed separately and accurately identifying the data segments that need to be decrypted.

[0134] The preset decryption algorithm and the preset security key are used to decrypt the field to be decrypted, and the sensitive field corresponding to the field to be decrypted is obtained, thereby obtaining the decrypted compressed file. First, the preset decryption algorithm (which is the reverse process of the encryption step from step S610 to step S650) and the corresponding security key are loaded. Then, the previously located fields to be decrypted are decrypted one by one. In the specific implementation, it is assumed that the AES-256 algorithm and a pre-agreed 256-bit key are used. For each field to be decrypted, the corresponding encrypted data is read and the AES decryption algorithm and key are applied for decryption. For the field to be decrypted of 100-200 bytes, 100 bytes of data are read, decrypted using the AES-256 algorithm and key, and then the decrypted data is written back to the original position. This process is repeated for all marked fields to be decrypted. After the decryption is completed, the sensitive information in the file is restored to the plaintext state. This embodiment can safely restore the sensitive information in the file while keeping the other parts of the file unchanged. By decrypting only the necessary parts, the security of the sensitive information is guaranteed and the processing efficiency is improved.

[0135] Use a preset decompression algorithm to decompress the compressed file to obtain an electronic business bill. The decompression algorithm corresponds to the compression algorithm of S520. First, identify the format of the compressed file, and then select the corresponding decompression algorithm. The decompression process usually includes reading the header information of the compressed file, parsing the compressed data structure, and gradually decompressing each compressed block. In specific implementation, it is assumed that a compressed file in ZIP format is used. First, read the central directory of the ZIP file to obtain the file list and the compression information of each file. Then, decompress each compressed file item. This process is repeated for all items in the ZIP file until all files are decompressed. After the decompression is completed, one or more decompressed files are obtained, which are complete electronic business bills.

[0136] The electronic business bill is parsed to obtain the bill information, and the billing process is executed according to the bill information to generate a digital invoice and a callback instruction. First, the corresponding parser is selected according to the format of the electronic business bill (such as PDF, XML, etc.). The parsing process extracts key information from the bill, such as the invoice header, amount, tax rate, commodity details, etc. Then, according to the extracted information, the billing process is executed according to the predetermined billing rules. The parsed bill information is then transmitted to the billing system. The billing system fills the bill information into the corresponding fields according to the preset rules and templates to generate an electronic invoice that complies with tax regulations. At the same time, a callback instruction is generated for subsequent control of the printing process. For example, for a 100 yuan catering consumption bill, the date may be parsed as April 1, 2024, the commodity is "beef noodles", the quantity is 2 copies, and the unit price is 50 yuan. The billing system then generates an electronic invoice containing this information and creates a callback instruction containing printing parameters (such as paper size and number of copies).

[0137] The generated digital electronic invoice (referred to as "digital electronic invoice") and callback instructions are sent to the electronic device through a network transmission protocol (such as HTTPS). After receiving these data, the electronic device can first verify the integrity and authenticity of the data to ensure that it has not been tampered with. Then, the electronic device parses the callback instruction and generates a specific printing instruction based on the parameters in the instruction. This printing instruction contains detailed instructions on how to format and layout the content of the digital electronic invoice. For example, the instruction can specify the use of A4 paper, set a 1 cm page margin, use a 12-point Songti font, etc. After generating the printing instruction, the electronic device packages the printing instruction and the digital electronic invoice data, and sends it to the physical printer through a local network or Bluetooth connection.

[0138] Finally, after the physical printer receives the print instruction and the digital invoice data, it will first parse the print instruction to understand how to process the received data. The printer's control system will set the printing parameters according to the instruction, such as selecting the appropriate paper size, adjusting the print head position, setting the print resolution, etc. The printer will then convert the content of the digital invoice into a printable image or text format and print it on paper according to the specified layout. After printing is completed, the printer can send a confirmation message of printing completion to the electronic device so that the user knows that the invoice has been successfully printed.

[0139] This embodiment realizes the full process automation from electronic business bills to physical printed invoices, effectively improves the efficiency of invoicing and printing, reduces human errors, and ensures the accuracy and consistency of invoice information. Through digital processing and transmission, data security is enhanced and the risk of information leakage is reduced. It not only simplifies the financial management process of enterprises, but also improves the user experience, making it more convenient to issue and obtain invoices.

[0140] In one implementation of this embodiment, the invoicing process includes the following steps: S901. Call the preset tax interface, obtain the invoice code and invoice number according to the bill information, and generate an electronic signature; S902. Fill the invoice code, invoice number and electronic signature into the preset standard template to generate a digital invoice.

[0141] In the first step of the invoicing process, the pre-set tax interface is called to obtain the invoice code and invoice number and generate an electronic signature. This process first involves a secure connection with the tax system. The connection uses the encrypted HTTPS protocol to ensure the security of data transmission. After the connection is established, the parsed invoice information is packaged into a request in a specific format and then sent to the tax interface. The request contains all the key information required for invoicing, such as information about the seller and buyer, a detailed description of the goods or services, the transaction amount, etc. After receiving the request, the tax system will perform a series of verifications and processing. It will check the legitimacy of the request, verify the company's tax qualifications, and assign a unique invoice code and invoice number based on the current invoice number segment.

[0142] After obtaining the invoice code and number, a predefined algorithm is used to generate an electronic signature to ensure the authenticity and integrity of the invoice. Specifically, the company's private key can be used to encrypt the key information of the invoice (including the newly obtained invoice code and number) to generate a unique encrypted string, which is the electronic signature.

[0143] Fill the acquired invoice code, invoice number and generated electronic signature into the preset standard template to generate a complete digital electronic invoice (digital electronic invoice). Since different types of transactions may require different invoice templates, such as VAT general invoice, VAT special invoice, etc., the template can be automatically selected based on the previously parsed bill information. These templates are usually pre-designed and meet the format and content requirements specified by the State Administration of Taxation.

[0144] After selecting the template, fill in the information in order. First, fill in the basic information such as the invoice code and invoice number in the designated location. Then, fill in the detailed information of the seller and the buyer, including name, taxpayer identification number, address, phone number, bank and account number. Next, fill in the product or service information in the corresponding column, including name, specification model, unit, quantity, unit price and amount. If there are multiple product items, the total amount will be automatically calculated and filled in the total amount column.

[0145] Finally, add the previously generated electronic signature to the designated location of the invoice. This signature is usually presented in the form of a QR code to facilitate subsequent verification. At the same time, a normal QR code containing the key information of the invoice is also generated to facilitate quick verification of the invoice information.

[0146] This implementation method obtains the invoice code and number in an automated manner, generates an electronic signature, and fills the information into the standard template, which greatly reduces human errors and improves the efficiency of invoicing. At the same time, the use of electronic signatures ensures the authenticity and non-tamperability of the invoice, and enhances the legal effect and credibility of the invoice.

[0147] like Figure 6 As shown, the embodiment of the present application also provides a cloud platform, which is applied to the above-mentioned digital electricity invoice management method based on the AI ​​model, including: A communication module 10, used for communicating with electronic devices; and The data processing module 20 is connected to the communication module and is used to execute the above-mentioned S801 to S810, and S901 to S902 of the digital electricity invoice management method based on the AI ​​model.

[0148] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0149] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram and the combination of the processes and / or blocks in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0150] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0151] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0152] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0153] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0154] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0155] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0156] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. A digital electricity invoice management method based on AI model, characterized in that: Applied to an electronic device, the electronic device is deployed with an AI model, a business platform, a virtual printer and a synchronization tool, and the electronic device is connected to a physical printer, and the method includes: Responding to the billing signal of the business platform, obtaining the electronic business bill generated by the business platform; Identify the electronic business bill through the AI ​​model to obtain the domain type of the electronic business bill; Converting the electronic business ticket to a file format through the virtual printer to obtain a converted electronic business ticket, and storing the converted electronic business ticket in a corresponding folder, wherein the folder is generated based on the domain type of the electronic business ticket; In response to the event trigger signal of the folder, the converted electronic business bill is uploaded to the cloud platform through the synchronization tool, wherein the synchronization tool is used to monitor the folder, and the cloud platform is used to parse the converted electronic business bill to obtain bill information, execute the billing process according to the bill information, generate a digital invoice and a callback instruction, and send the digital invoice and the callback instruction to the synchronization tool, so that the synchronization tool generates a printing instruction according to the callback instruction, and the printing instruction is used to control the physical printer; The printing instruction and the digital invoice are sent to the physical printer, so that the physical printer prints the digital invoice according to the printing instruction.

2. The method according to claim 1, characterized in that The step of identifying the electronic business bill by using the AI ​​model to obtain the domain type of the electronic business bill includes: Extracting features of the electronic business bill to obtain text features and metadata features of the electronic business bill; The text features and the metadata features are input into the AI ​​model to obtain the domain type of the electronic business bill, wherein the domain type includes the HIS domain and the ERP domain.

3. The method according to claim 2, characterized in that The steps of generating the folder include: Obtaining a first timestamp of generation of the electronic business ticket; In the case where the domain type is the HIS domain, obtaining a business code of a business platform for generating the electronic business ticket, and using a first preset naming rule to generate a first name for the folder according to the first timestamp; Generate a first path of the folder based on a preset first basic path, the first timestamp and the business code; Based on the first name and the first path, create a folder, and create a HIS domain main folder and at least one HIS domain subfolder in the folder; Allocating a first permission of the HIS domain main folder and a second permission of at least one of the HIS domain subfolders, and recording a second path of the HIS domain main folder and a second timestamp of creation of the HIS domain main folder; Creating a first json file in the HIS domain main folder and generating a log, wherein the first json file includes the second timestamp and the domain type, and the log includes the second path, the first permission, and the second permission; In the case where the domain type is the ERP domain, obtaining a business class code of a business platform for generating the electronic business ticket, and using a second preset naming rule to generate a second name for the folder according to the first timestamp; Generate a third path of the folder based on a preset second basic path, the first timestamp and the business class code; Based on the second naming and the third path, create a folder, and create an ERP domain main folder and at least one ERP domain subfolder in the folder, wherein the number of the ERP domain subfolders is the same as the number of the HIS domain subfolders; Allocate a third permission of the ERP domain main folder and a fourth permission of at least one of the ERP domain subfolders, and record a fourth path of the ERP domain main folder and a third timestamp of creation of the HIS domain main folder; A second json file is created in the ERP domain main folder, and a log is generated, wherein the second json file includes the third timestamp and the domain type, and the log includes the fourth path, the third permission, and the fourth permission.

4. The method according to claim 3, characterized in that The step of uploading the converted electronic business bill to the cloud platform through the synchronization tool includes: The synchronization tool uses the converted electronic business bill as a file to be synchronized, and identifies the file type and file size of the file to be synchronized; The synchronization tool determines a corresponding compression algorithm according to the file type, and compresses the file to be synchronized using the compression algorithm to obtain a compressed file; The synchronization tool identifies the sensitive fields of the compressed file and encrypts the sensitive fields to obtain an encrypted data packet; The synchronization tool establishes an HTTPS connection with the cloud platform and uploads the encrypted data packet segments to the cloud platform.

5. The method according to claim 4, characterized in that The synchronization tool compresses the to-be-synchronized file using the compression algorithm to obtain a compressed file, including: The synchronization tool creates a memory buffer and initializes the compression algorithm; The synchronization tool reads the to-be-synchronized file into the memory in blocks, and compresses each data block of the to-be-synchronized file using the compression algorithm; The synchronization tool writes all the compressed data blocks into a new file to obtain a compressed file.

6. The method according to claim 4, characterized in that The synchronization tool encrypts the sensitive field to obtain an encrypted data packet, including: For any sensitive field, the synchronization tool obtains the position of the sensitive field in the file to be synchronized and generates a random initialization vector; The synchronization tool adopts a preset encryption algorithm to replace the sensitive field with the random initialization vector to obtain an encrypted sensitive field; The synchronization tool generates encryption metadata according to the random initialization vector and the position of the sensitive field in the file to be synchronized; The synchronization tool inserts the encryption sensitive field into the corresponding position of the to-be-synchronized file to obtain an encrypted file; The synchronization tool packages the encrypted metadata and the encrypted file into a container file to obtain an encrypted data packet.

7. The method according to claim 6, characterized in that The synchronization tool establishes an HTTPS connection with the cloud platform and uploads the encrypted data packet to the cloud platform in segments, including: The synchronization tool calculates a first file checksum of the encrypted data packet and generates upload metadata, wherein the upload metadata includes the first name, the file size, and the first file checksum, or the upload metadata includes the second name, the file size, and the first file checksum; The synchronization tool establishes an HTTPS connection with the cloud platform; The synchronization tool divides the encrypted data packet into a plurality of fixed-size data blocks, uploads the data blocks to the cloud platform one by one, and records the fixed-size data blocks uploaded to the cloud platform; After the synchronization tool uploads all the fixed-size data blocks to the cloud platform, the synchronization tool sends the upload metadata to the cloud platform.

8. A digital electricity invoice management method based on AI model, characterized in that: The cloud platform according to any one of claims 1 to 7 is connected to an electronic device, and the electronic device is connected to a physical printer, wherein the method comprises: In response to receiving one of the fixed-size data blocks transmitted by the electronic device, storing the fixed-size data block in a preset buffer until all the fixed-size data blocks are received; Reorganize all the fixed-size data blocks in the buffer to obtain a reorganized file; Calculating a second file checksum of the reorganized file; Receiving and parsing the uploaded metadata to obtain the first file verification code and the location of the sensitive field; comparing the second file checksum with the first file checksum; After the comparison is successful, the encrypted data packet is unpacked to obtain the encrypted metadata and the encrypted file, and the field to be decrypted is located according to the position of the sensitive field; Decrypting the field to be decrypted using a preset decryption algorithm and a preset security key to obtain the sensitive field corresponding to the field to be decrypted, and obtain a decrypted compressed file; Decompressing the compressed file using a preset decompression algorithm to obtain an electronic business receipt; Parsing the electronic business bill to obtain bill information, and executing the billing process according to the bill information to generate a digital invoice and a callback instruction; The digital invoice and callback instruction are sent to the electronic device so that the electronic device generates a printing instruction according to the callback instruction, and the printing instruction and the digital invoice are sent to the physical printer, and the physical printer is used to print the digital invoice according to the printing instruction.

9. The method according to claim 8, characterized in that The invoicing process includes: Call the preset tax interface, obtain the invoice code and invoice number according to the bill information, and generate an electronic signature; Fill the invoice code, the invoice number and the electronic signature into a preset standard template to generate a digital invoice.

10. A cloud platform, characterized in that: The digital electricity invoice management method based on the AI ​​model applied to any one of claims 1 to 7, and the digital electricity invoice management method based on the AI ​​model applied to any one of claims 8 to 9, comprising: A communication module, used to communicate with an electronic device; and A data processing module, connected to the communication module, is used to execute the digital electricity invoice management method based on the AI ​​model according to any one of claims 8 to 9.

Citation Information

Patent Citations

  • Method and system for issuing electronic invoice based on electronic commerce cloud platform

    CN105631721A

  • Enterprise product data archiving system and method

    CN106294810A

  • Data encryption and decryption method, device and system

    CN112016113A

  • Electronic invoice storage management method and device

    CN114240464A

  • Electronic invoice printer and printing method

    CN114267134A