Disclosure of Invention
The embodiment of the application provides a digital-to-electric invoice sharing cloud printing method and a cloud server, which are used for effectively improving printing efficiency.
In order to achieve the above purpose, the embodiment of the present application adopts the following technical scheme:
in a first aspect, a digital-to-electric invoice sharing cloud printing method is provided, and is applied to a cloud server, and the method comprises the following steps:
Responding to receiving an uploading signal of a user uploading a digital invoice file through a user terminal, and acquiring the digital invoice file;
Verifying the digital invoice file, acquiring the current geographic position of the user terminal after the digital invoice file is successfully verified, and determining a target printing service provider terminal based on printing parameters input by a user and the current geographic position;
Generating a print job according to the print parameters and the digital invoice file;
The print task is sent to the target print service provider terminal, and the target print service provider terminal is used for executing the print task, generating an invoice copy and returning the invoice copy to the cloud server;
Encrypting the invoice copy in response to receiving the invoice copy, and generating an invoice sharing link based on the encrypted invoice copy;
and sending the invoice sharing link to the user terminal, wherein the user terminal is used for receiving the invoice sharing link and decrypting the encrypted invoice copy in the invoice sharing link to obtain the invoice copy, so that a user clicks the invoice sharing link through the user terminal to download the invoice copy.
In a possible implementation manner of the first aspect, after the sending the print job to the print service provider terminal, the method includes:
Receiving a printing state returned by the printing service provider terminal in real time, wherein the printing state comprises printing success, printing failure or printing in progress;
and packaging the printing state into a state notification message, and sending the state notification message to the user terminal.
In another possible implementation manner of the first aspect, the verifying the digital invoice file includes:
Analyzing the digital invoice file, and extracting file header information and content data;
verifying whether the header information meets the preset tax file format standard, and
Verifying whether the content data accords with a preset tax content rule;
and under the condition that the file header information and the content data pass verification, confirming that the verification of the digital invoice file is successful.
In another possible implementation manner of the first aspect, the printing parameters include a number of printing copies, a printing quality and a printing service type, and the determining the target printing service provider terminal based on the printing parameters input by the user and the current geographic location includes:
analyzing the current geographic position to obtain geographic coordinates of the user;
obtaining geographic coordinates and service capacity of each printing service provider terminal from a preset printing service provider terminal list;
for each of the print service provider terminals, calculating euclidean distance between the user geographical coordinates and the geographical coordinates of the print service provider terminal as a distance factor for the print service provider terminal;
According to the printing service type, a corresponding basic weight value is obtained from a preset service type weight table;
According to the printing quality, a corresponding quality weight value is obtained from a preset printing quality weight table;
adding the basic weight value and the sum of the basic weight value as the service capability weight;
For each of the print service provider terminals, taking a weighted sum of the inverse of the distance factor and the service capability weight as a matching degree score of the print service provider terminal;
And taking the printing service provider terminal with the highest matching degree score as a target printing service provider terminal.
In another possible implementation manner of the first aspect, the generating a print job according to the print parameter and the digital invoice file includes:
acquiring a unique code of the target printing service provider terminal;
Generating a print job description file according to the print parameters, wherein the print job description file comprises a file identifier, the number of prints, the print quality and the unique code of the target print service provider terminal;
the digital invoice file is associated with the print task description file, and a print task package is generated;
and carrying out digital signature on the print job package to obtain the print job.
In another possible implementation manner of the first aspect, the encrypting the invoice copy includes:
encrypting the invoice copy by adopting a symmetrical encryption algorithm to generate an encrypted invoice copy;
Encrypting a key of the symmetric encryption algorithm by using an asymmetric encryption algorithm to generate an encryption key;
encapsulating the encrypted invoice copy and the encryption key into a data packet;
Compressing the data packet to generate a compressed data packet;
base64 encoding is carried out on the compressed data packet, and the encrypted invoice copy is generated;
before said encrypting said invoice copy, further comprising:
calculating a hash value of the invoice copy, and packaging the hash value into blockchain transaction data;
Broadcasting the blockchain transaction data to nodes in a blockchain network, wherein the nodes in the blockchain network are used for writing the blockchain transaction data into a blockchain through a consensus mechanism.
In another possible implementation manner of the first aspect, the generating an invoice sharing link based on the encrypted invoice copy includes:
generating a unique file access identifier based on the encrypted invoice copy;
acquiring a user identity and a user authority level through the user terminal;
generating an access token according to the user identity and the user authority level;
acquiring the validity period of the access token from a preset authority validity period table according to the user authority level;
Acquiring the access times of the user from a preset user access frequency table according to the user identity;
binding the validity period and the access times with the access token, wherein the access token after binding is used for limiting the access times of a user in the validity period;
combining the file access identifier and the access token after binding to generate a shared link parameter;
carrying out hash processing on the shared link parameters to generate a shared link identifier;
and combining the sharing link identifier with a preset domain name to generate an invoice sharing link, wherein the invoice sharing link comprises the validity period and the access times.
In another possible implementation manner of the first aspect, the generating an access token according to the user identity and the user authority level includes:
Generating a user unique identifier according to the user identity;
generating a permission identifier according to the user permission level;
And combining the unique user identifier and the authority identifier to generate an access token.
In another possible implementation manner of the first aspect, the receiving, by the user terminal, the invoice sharing link, and decrypting an encrypted invoice copy in the invoice sharing link, to obtain the invoice copy, includes:
The user terminal analyzes the invoice sharing link and extracts the file access identifier and the access token;
The user terminal sends a decryption request to the cloud server, and the cloud server is used for acquiring the access token through the decryption request, verifying the validity of the access token and returning the encrypted invoice copy after the verification is passed;
And the user terminal decrypts the encryption key by using an asymmetric encryption algorithm, and decrypts the encrypted invoice copy by using the decrypted key to obtain the invoice copy.
In a second aspect, the present application provides a cloud server, including:
communication means for establishing a communication connection with the user terminal and the printing service provider terminal;
a processor configured to:
Responding to receiving an uploading signal of a user uploading a digital invoice file through a user terminal, and acquiring the digital invoice file;
Verifying the digital invoice file, acquiring the current geographic position of the user terminal after the digital invoice file is successfully verified, and determining a target printing service provider terminal based on printing parameters input by a user and the current geographic position;
Generating a print job according to the print parameters and the digital invoice file;
The print task is sent to the target print service provider terminal, and the target print service provider terminal is used for executing the print task, generating an invoice copy and returning the invoice copy to the cloud server;
Encrypting the invoice copy in response to receiving the invoice copy, and generating an invoice sharing link based on the encrypted invoice copy;
and sending the invoice sharing link to the user terminal, wherein the user terminal is used for receiving the invoice sharing link and decrypting the encrypted invoice copy in the invoice sharing link to obtain the invoice copy, so that a user clicks the invoice sharing link through the user terminal to download the invoice copy.
Through the technical scheme, the user can directly upload the digital electricity invoice file to the cloud server through the terminal equipment without depending on local printing equipment, so that the operation flow is greatly simplified. After the cloud server receives the uploading signal, the validity of the file can be automatically verified, and the validity and the safety of the printing content are ensured. And secondly, the current geographic position of the user terminal can be obtained, and the most suitable printing service provider can be automatically matched by combining the printing parameters input by the user, so that the problem that the traditional local printing equipment cannot meet the cross-region and cross-platform printing requirements is solved, and the distribution efficiency of the printing tasks is greatly improved. The cloud server generates a standardized print task according to the print parameters and the invoice file and sends the standardized print task to the target print service provider terminal, so that automation and standardization of a print flow are realized, and human operation errors are effectively reduced. After executing the print task and generating the invoice copy, the print service provider terminal returns the invoice copy to the cloud server, and the cloud server immediately encrypts the invoice copy and generates a safe invoice sharing link. The encryption mechanism ensures the security and privacy of invoice information and prevents sensitive information from being revealed. Finally, the user can conveniently download and check the invoice copy through the received shared link without relying on the local printing equipment again. The cloud printing and sharing mechanism not only improves the printing efficiency, but also provides a more flexible and more convenient invoice acquisition mode for users. Overall, the scheme realizes comprehensive optimization of the electronic invoice printing process through the cloud computing technology and the intelligent matching algorithm, and effectively solves the problems of low efficiency, geographical limitation and safety in the traditional method. The printing system can process a large number of printing requests simultaneously, meets high concurrency requirements in an enterprise environment, and remarkably improves the working efficiency of financial staff. In addition, due to the cross-region and cross-platform characteristics of the scheme, a user can easily finish the printing task of the electronic invoice at any place by using any equipment, and the user experience is greatly improved. By introducing an encryption mechanism and a safe sharing link, the scheme also enhances the data security in the electronic invoice processing process and effectively protects the sensitive information of enterprises and individuals. In summary, by introducing the cloud server and the shared printing mechanism, the scheme effectively solves the problems of the existing electronic invoice printing technology, remarkably improves the printing efficiency and meets the large-scale and high-concurrency printing requirements.
Additional features and advantages of embodiments of the application will be set forth in the detailed description which follows.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it should be understood that the detailed description described herein is merely for illustrating and explaining the embodiments of the present application, and is not intended to limit the embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
It should be noted that, if directional indications (such as up, down, left, right, front, and rear are referred to in the embodiments of the present application), the directional indications are merely used to explain the relative positional relationship, movement conditions, and the like between the components in a specific posture (as shown in the drawings), and if the specific posture is changed, the directional indications are correspondingly changed.
In addition, if there is a description of "first", "second", etc. in the embodiments of the present application, the description of "first", "second", etc. is for descriptive purposes only and is not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In addition, the technical solutions of the embodiments may be combined with each other, but it is necessary to base that the technical solutions can be realized by those skilled in the art, and when the technical solutions are contradictory or cannot be realized, the combination of the technical solutions should be considered to be absent and not within the scope of protection claimed in the present application.
Fig. 1 schematically shows a flow diagram of a digital-to-electrical invoice sharing cloud printing method according to an embodiment of the application. As shown in fig. 1, an embodiment of the present application provides a digital invoice sharing cloud printing method, which is applied to a cloud server, and the method may include the following steps.
S110, responding to receiving an uploading signal of a user uploading the digital invoice file through a user terminal, and acquiring the digital invoice file;
S120, verifying the digital invoice file, acquiring the current geographic position of the user terminal after verification is successful, and determining a target printing service provider terminal based on the printing parameters input by the user and the current geographic position;
s130, generating a print job according to the print parameters and the digital invoice file;
s140, sending the print task to a target print service provider terminal, wherein the target print service provider terminal is used for executing the print task, generating an invoice copy, and returning the invoice copy to the cloud server;
S150, in response to receiving the invoice copy, encrypting the invoice copy, and generating an invoice sharing link based on the encrypted invoice copy;
And S160, sending the invoice sharing link to a user terminal, wherein the user terminal is used for receiving the invoice sharing link, decrypting the encrypted invoice copy in the invoice sharing link, and obtaining the invoice copy, so that a user clicks the invoice sharing link through the user terminal to download the invoice copy.
In this embodiment, the user terminal may be a device with a processor, such as a tablet computer, desktop, laptop, handheld computer, wearable device, notebook computer, ultra-mobilepersonalcomputer, UMPC, or netbook. Of course, the user terminal may also be a server. The embodiment of the application does not limit the specific form of the user terminal.
When a user uploads a digital invoice file through terminal equipment (such as a mobile phone, a computer and the like), the cloud server receives an uploading signal. This signal is typically transmitted over a network and contains the file data uploaded by the user. The cloud server firstly analyzes the signal and extracts the digital invoice file. The digital invoice file is usually stored in a specific format (such as PDF, XML, etc.), and contains detailed information of the invoice, such as an invoice number, an invoicing date, an amount of money, commodity information, etc. In order to ensure the integrity and the safety of the file, the cloud server can perform preliminary verification on the file, and check whether the size and the format of the file meet the requirements and whether the file has signs of damage or tampering. If the file passes the preliminary verification, the cloud server stores the file in a temporary storage area and waits for subsequent processing. The implementation effect of the step is to ensure that the digital invoice file can be safely and accurately received and stored, and lay a foundation for the subsequent processing steps.
After the digital invoice file is acquired, the cloud server can verify the digital invoice file in detail. The verification process includes analyzing the header information and the content data, and checking whether the header information meets a preset tax file format standard, and whether the content data meets a preset tax content rule. For example, the header information may include the version number, coding scheme, etc. of the invoice, and the content data includes specific information of the invoice, such as the issuer, the receiver, the commodity details, etc. If the file header and the content data pass the verification, the cloud server can confirm that the verification of the digital invoice file is successful. Next, the cloud server may obtain the current geographic location of the user terminal. This is typically accomplished through GPS, wi-Fi or IP address location techniques. After the geographical position is obtained, the cloud server determines the most suitable target printing service provider terminal from a preset printing service provider terminal list according to printing parameters (such as printing number, printing quality, printing service type and the like) and the current geographical position, which are input by a user. The implementation effect of the step is that the legitimacy and the safety of the digital invoice file are ensured, the most suitable printing service provider is provided for the user through an intelligent matching algorithm, and the distribution efficiency of the printing task is improved.
After determining the target printing service provider terminal, the cloud server generates a standardized printing task according to the printing parameters and the digital invoice file input by the user. The print parameters include the number of prints, print quality, print service type, etc., which are parsed and a print job description file is generated. The print job description file typically contains information such as a file identification, the number of prints, print quality, unique code of the target print service provider terminal, and the like. The cloud server associates the digital invoice file with the print job description file to generate a print job package. To ensure the security and integrity of the print job, the cloud server digitally signs the print job package. The digital signature is generated by an encryption algorithm, so that the print job can be prevented from being tampered in the transmission process. After generating the print job, the cloud server stores the print job in a job queue, waiting for sending to the target print service provider terminal. The implementation effect of the step is that automation and standardization of the printing task are realized, human operation errors are reduced, and safety and integrity of the printing task are ensured.
After the print job is generated, the cloud server sends it to the target print service provider terminal. The sending process is typically performed through a network, and the cloud server may use a secure communication protocol (such as HTTPS) to ensure the security of data transmission. After receiving the print job, the target print service provider terminal first verifies the validity of the digital signature to ensure that the print job has not been tampered with. After the verification is passed, the print service provider performs the print job according to the parameters in the print job description file. During printing, the printing service provider monitors the printing state in real time and returns state information (such as printing success, printing failure or printing in progress) to the cloud server. After the print job is completed, the print service provider generates a copy of the invoice and returns it to the cloud server. The invoice copy is typically stored in the form of an electronic file containing the same information as the original digital invoice file. The implementation effect of the step is that the automatic execution and state monitoring of the printing task are realized, the efficient completion of the printing task is ensured, and a foundation is provided for the follow-up invoice sharing.
When the cloud server receives the invoice copy returned by the printing service provider terminal, encryption processing is firstly carried out on the invoice copy. The encryption process typically encrypts the invoice copy using a symmetric encryption algorithm (e.g., AES) to generate an encrypted invoice copy. To ensure security of the encryption key, the cloud server encrypts the key of the symmetric encryption algorithm using an asymmetric encryption algorithm (e.g., RSA) to generate the encryption key. The encrypted invoice copy and the encryption key are packaged into a data packet, compressed and Base64 coded to generate a final encrypted invoice copy. Then, the cloud server generates a unique file access identifier based on the encrypted invoice copy, and obtains the user identity and the user authority level through the user terminal. According to the user identity and the user authority level, the cloud server generates an access token and binds the access token with the file access identifier to generate an invoice sharing link. Invoice sharing links typically contain expiration and access times restrictions to ensure security and controllability of the links. The implementation effect of the step is to ensure the safety and privacy of invoice copies, prevent sensitive information from being revealed, and provide a convenient invoice sharing mode for users.
After the invoice sharing link is generated, the cloud server sends the invoice sharing link to the user terminal. After receiving the invoice sharing link, the user terminal firstly analyzes the link and extracts the file access identification and the access token. The user terminal sends a decryption request to the cloud server, and the cloud server verifies the validity of the access token after receiving the request. After verification passes, the cloud server returns an encrypted invoice copy. And the user terminal decrypts the encryption key by using an asymmetric encryption algorithm, and decrypts the encrypted invoice copy by using the decrypted key to obtain an original invoice copy. The user may download and view a copy of the invoice by clicking on the invoice sharing link. The implementation effect of the step is that safe downloading and viewing of the invoice copy are realized, the invoice copy can be ensured to be conveniently acquired and used by a user, and the user experience is improved.
Through the steps, the cloud printing and sharing of the digital invoice are realized, the problems of low efficiency, geographical limitation and safety of the traditional local printing equipment are solved, and the printing efficiency and the user experience are remarkably improved.
According to the embodiment, the user can directly upload the digital invoice file to the cloud server through the terminal equipment, and does not need to rely on local printing equipment, so that the operation flow is greatly simplified. After the cloud server receives the uploading signal, the validity of the file can be automatically verified, and the validity and the safety of the printing content are ensured. And secondly, the current geographic position of the user terminal can be obtained, and the most suitable printing service provider can be automatically matched by combining the printing parameters input by the user, so that the problem that the traditional local printing equipment cannot meet the cross-region and cross-platform printing requirements is solved, and the distribution efficiency of the printing tasks is greatly improved. The cloud server generates a standardized print task according to the print parameters and the invoice file and sends the standardized print task to the target print service provider terminal, so that automation and standardization of a print flow are realized, and human operation errors are effectively reduced. After executing the print task and generating the invoice copy, the print service provider terminal returns the invoice copy to the cloud server, and the cloud server immediately encrypts the invoice copy and generates a safe invoice sharing link. The encryption mechanism ensures the security and privacy of invoice information and prevents sensitive information from being revealed. Finally, the user can conveniently download and check the invoice copy through the received shared link without relying on the local printing equipment again. The cloud printing and sharing mechanism not only improves the printing efficiency, but also provides a more flexible and more convenient invoice acquisition mode for users. Overall, the scheme realizes comprehensive optimization of the electronic invoice printing process through the cloud computing technology and the intelligent matching algorithm, and effectively solves the problems of low efficiency, geographical limitation and safety in the traditional method. The printing system can process a large number of printing requests simultaneously, meets high concurrency requirements in an enterprise environment, and remarkably improves the working efficiency of financial staff. In addition, due to the cross-region and cross-platform characteristics of the scheme, a user can easily finish the printing task of the electronic invoice at any place by using any equipment, and the user experience is greatly improved. By introducing an encryption mechanism and a safe sharing link, the scheme also enhances the data security in the electronic invoice processing process and effectively protects the sensitive information of enterprises and individuals. In summary, by introducing the cloud server and the shared printing mechanism, the scheme effectively solves a plurality of problems existing in the existing electronic invoice printing technology, remarkably improves the printing efficiency, and meets the large-scale and high-concurrency printing requirements.
In one implementation of this embodiment, after sending the print job to the print service provider terminal, the method includes the steps of:
S210, receiving a printing state returned by the printing service provider terminal in real time, wherein the printing state comprises printing success, printing failure or printing in progress;
S220, packaging the printing state into a state notification message, and sending the state notification message to the user terminal.
After the print job is sent to the print service provider terminal, the cloud server receives the print status information returned by the print service provider terminal in real time. The print status information is generated by the print service provider terminal during execution of the print job and reflects the current progress of the print job. The print status generally includes three types, print success, print failure, or print in progress. The successful printing indicates that the printing task is successfully completed, the invoice copy is generated and returned to the cloud server, the failure printing indicates that the printing task encounters a problem in the execution process and cannot be completed, and the printing indicates that the printing task is executing but not completed. In order to ensure the real-time performance and accuracy of the printing status information, the printing service provider terminal may transmit the printing status information to the cloud server in real time through a preset communication interface (such as an API). After receiving the print status information, the cloud server first analyzes the print status information to extract key status data, such as task ID, status type, timestamp, etc. The cloud server then verifies the status data to ensure its integrity and authenticity. For example, the cloud server may check if the timestamp is within a reasonable range, if the job ID matches a sent print job, etc. If the state data passes the verification, the cloud server will store it in a state log for subsequent query and analysis. The implementation effect of the step is that the real-time monitoring and recording of the status of the printing task are realized, the traceability and transparency of the printing task are ensured, and timely feedback information is provided for the user.
After receiving the print status information and completing the verification, the cloud server encapsulates it as a status notification message. The status notification message is a structured data format that typically contains fields for task ID, status type, timestamp, status description, etc. For example, a print successful status notification message may contain a task ID of "12345", a status type of "print successful", a timestamp of "2023-10-01 12:00:00", and a status description of "invoice copy has been generated and returned to the cloud server". In the packaging process, the cloud server fills the printing state information into corresponding fields according to a preset message template and generates a unique message ID. To ensure the security and integrity of the status notification message, the cloud server digitally signs it. The digital signature is generated by an encryption algorithm, so that the message can be prevented from being tampered in the transmission process. After the status notification message is generated, the cloud server sends the status notification message to the user terminal through a preset communication channel (such as a short message, an email, a push notification and the like). After receiving the status notification message, the user terminal first verifies the validity of the digital signature to ensure that the message has not been tampered with. After the verification is passed, the user terminal analyzes the message content, extracts the key state information and displays the key state information on the user interface. For example, the user can view the current status of the print job on the cell phone APP, knowing whether the print job is successful, failed or in progress. The implementation effect of the step is that the real-time notification and feedback of the status of the printing task are realized, the user is ensured to know the progress situation of the printing task in time, and the user experience and satisfaction are improved.
The embodiment realizes the real-time monitoring, recording and notification of the status of the print job, and ensures the traceability and transparency of the print job. The printing state information is received in real time and fed back to the user in time through the state notification message, so that the execution efficiency of the printing task is improved, and the control feeling and the trust degree of the user on the printing process are enhanced. The real-time monitoring and recording of the printing state can rapidly locate and solve the problem of the printing task, and the time and resource waste caused by printing failure are reduced. The encapsulation and the sending of the state notification message ensure that a user can know the progress condition of the printing task at any time and any place without frequent inquiry or waiting, and greatly improve the user experience. In addition, through digital signature and message verification, the security and the integrity of the state notification message are ensured, and the information is prevented from being tampered or falsified. In the technical scheme, through a real-time state monitoring and notification mechanism, the management efficiency and the user satisfaction of the printing task are remarkably improved, and powerful support is provided for cloud printing and sharing of electronic invoices.
In one implementation manner of the embodiment, the verification of the digital invoice file includes the following steps:
S310, analyzing the digital invoice file, and extracting file header information and content data;
s320, verifying whether the header information meets the preset tax file format standard, and
S330, verifying whether the content data accords with a preset tax content rule;
And S340, under the condition that the file header information and the content data pass the verification, the success of the verification of the digital invoice file is confirmed.
After the digital invoice file uploaded by the user is received, the digital invoice file needs to be analyzed firstly to extract key information. The digital invoice file is typically stored in a specific format, such as PDF, XML, or other structured data format. The parsing process firstly reads binary data of the file and decomposes the binary data into two parts, namely file header information and content data according to the specification of the file format. The header information is usually located in the beginning of the file and contains metadata of the file, such as file version number, coding mode, creation time, file size, etc. Such information is critical to verifying the legitimacy and integrity of the file. The content data is the main part of the file and contains specific invoice information, such as invoice number, date of invoicing, amount, commodity details, invoicer and ticket receiver information. In the parsing process, a special parsing tool or library (such as a PDF parsing library or an XML parser) is used to read the file content row by row, and the required fields are extracted according to predefined rules. For example, in a PDF format invoice file, the corresponding data may be located and extracted by identifying a particular text label (e.g., "invoice number:"). After the parsing is completed, the header information and the content data are stored in different data structures, respectively, for use in subsequent verification steps. The implementation effect of the step is to ensure that the key information of the digital invoice file can be accurately extracted, and basic data support is provided for the subsequent verification step.
After the header information is extracted, it needs to be verified to ensure that it meets the preset tax file format standard. Tax file format standards are typically established by tax authorities, specifying the basic structure and metadata requirements of digital invoice files. The verification process first checks whether the key fields in the header information are complete, such as the file version number, coding mode, creation time, etc. Then, it is verified whether the values of the fields meet the preset standard one by one. For example, the file version number may need to be consistent with the latest version supported by the current tax department, the coding scheme may need to be UTF-8, and the creation time may need to be within a reasonable range (e.g., not exceeding the current date). In addition, other metadata in the file header information, such as whether the file size is in line with expectations, whether the file type is consistent with the uploaded file, etc., are checked. If any field in the file header information does not meet the preset standard, the verification process is immediately terminated, and a verification failure result is returned. If all the fields pass the verification, the header information will be marked as valid and the next step of content data verification will be entered. The implementation effect of the step is to ensure that the basic structure and metadata of the digital invoice file meet the requirements of tax departments, and prevent illegal or non-compliant files from entering the subsequent processing flow.
After the file header information passes the verification, whether the content data accords with the preset tax content rule needs to be further verified. Tax content rules are typically formulated by tax authorities, specifying the format and range of values for specific data in a digital invoice file. The verification process first checks whether the key fields in the content data are complete, such as invoice number, date of invoicing, amount of money, commodity details, invoicer and acquirer information, etc. Then, it is verified whether the values of the fields meet the preset rules one by one. For example, the invoice number may need to be in compliance with a particular encoding rule (e.g., length, character set, etc.), the date of the invoice needs to be within a reasonable range (e.g., not exceeding the current date), the amount needs to be positive and in compliance with a currency format, and the commodity details need to contain information such as commodity name, quantity, unit price, and total price. In addition, other information in the content data such as whether tax registration numbers of the drawer and the ticket receiver are in compliance with the regulations, whether the invoice amount is in agreement with the total price in the commodity details, and the like are checked. If any one field in the content data does not accord with the preset rule, the verification process is immediately terminated, and a verification failure result is returned. If all the fields pass the verification, the content data will be marked as valid and the next comprehensive verification is entered. The implementation effect of the step is to ensure that the specific data of the digital invoice file meets the requirements of tax departments, and prevent illegal or non-compliant data from entering the subsequent processing flow.
After the file header information and the content data pass the verification, the file header information and the content data need to be comprehensively verified to confirm the integral validity of the digital invoice file. The comprehensive verification process first checks the consistency between the header information and the content data, for example, whether the version number of the file in the header information is consistent with the invoice version in the content data, whether the creation time in the header information is consistent with the billing date in the content data, and the like. Then, consistency between the individual fields in the content data, such as whether the invoice amount coincides with the total price in the commodity details, whether the tax registration numbers of the drawer and the ticket taker are in compliance, etc., is checked. If there is an inconsistency between the header information and the content data or between the various fields in the content data, the verification process will terminate immediately and a result of verification failure will be returned. If all the checks pass, the digital invoice file will be marked as successful in verification and enter the subsequent process flow. The implementation effect of the step is to ensure the integral validity and consistency of the digital invoice file and prevent illegal or non-compliant files from entering the subsequent processing flow.
The embodiment realizes the comprehensive verification of the log-electricity invoice file and ensures the validity and compliance of the file. The analysis process accurately extracts the file header information and the content data, and provides basic data support for the subsequent verification step. The verification of the file header information ensures that the basic structure and metadata of the file meet the requirements of tax departments, and prevents illegal or illegal files from entering the subsequent processing flow. The verification of the content data ensures that the specific data of the file meets the requirements of tax departments, and prevents illegal or non-compliant data from entering the subsequent processing flow. The comprehensive verification process ensures consistency between the file header information and the content data, and prevents inconsistent files from entering a subsequent processing flow. In the whole, the technical scheme obviously improves the safety and reliability of the digital invoice file through a multi-level verification mechanism, and provides a solid foundation for the follow-up printing and sharing process.
In one implementation of the present embodiment, the print parameters include a print number of copies, a print quality, and a print service type, and the determining the target print service provider terminal based on the print parameters input by the user and the current geographic location includes the following steps:
s410, analyzing the current geographic position to obtain geographic coordinates of the user;
s420, obtaining the geographic coordinates and service capacity of each printing service provider terminal from a preset printing service provider terminal list;
S430, for each printing service provider terminal, calculating Euclidean distance between the geographic coordinates of the user and the geographic coordinates of the printing service provider terminal as a distance factor of the printing service provider terminal;
S440, acquiring a corresponding basic weight value from a preset service type weight table according to the printing service type;
s450, acquiring a corresponding quality weight value from a preset printing quality weight table according to the printing quality;
s460, adding the basic weight value and the sum of the basic weight values to be used as a service capability weight;
S470, taking the weighted sum of the inverse of the distance factor and the service capability weight as a matching degree score of the printing service provider terminal for each printing service provider terminal;
And S480, taking the printing service provider terminal with the highest matching degree score as a target printing service provider terminal.
Before determining the target print service provider terminal, the geographical location information of the user needs to be acquired first. The geographic location of the user is usually obtained through a positioning function of a terminal device (such as a mobile phone, a computer and the like), and may be derived from technologies such as GPS, wi-Fi positioning or IP address positioning. The obtained geographic position information is usually expressed in terms of longitude and latitude, for example, 39.9042 degrees north latitude, 116.4074 degrees east longitude represents the central position of Beijing city. In order to ensure the accuracy and availability of the geographic location information, the cloud server analyzes and verifies the acquired geographic location data. The parsing process first converts the raw geographic location data into a standard theodolite format, such as a decimal format. The cloud server then checks whether the latitude and longitude values are within a reasonable range (e.g., latitude is between-90 and 90 degrees, longitude is between-180 and 180 degrees), and whether there is a significant positioning error (e.g., latitude and longitude value is 0, which may indicate a positioning failure). If the geographic position data passes the verification, the cloud server stores the geographic position data as user geographic coordinates for subsequent matching calculation. The implementation effect of the step is to ensure the accuracy and availability of the geographic position of the user and provide basic data support for the subsequent matching of the printing service provider terminals.
After the geographical coordinates of the user are obtained, the cloud server obtains the geographical coordinates and the service capability of each printing service provider terminal from a preset printing service provider terminal list. The print service provider terminal list is typically a structured data table containing basic information of each terminal, such as terminal ID, geographical coordinates (latitude and longitude), service capabilities (e.g., supported print service type, print quality, maximum number of print copies, etc.). The geographic coordinates are used to calculate the distance between the user and the print service provider terminal and the service capability is used to evaluate whether the terminal is able to meet the user's print requirements. The acquisition process first looks up the print service provider terminal list and extracts the record for each terminal. Then, the cloud server analyzes the record of each terminal and extracts the geographic coordinates and the service capability information. For example, a record of a print service provider terminal may contain information such as a terminal ID of "PRT001", geographic coordinates of 39.9042 degrees North latitude, 116.4074 degrees east longitude, service capabilities of supporting color printing, a maximum number of prints of 100 copies, supporting high resolution printing, etc. The implementation effect of the step is to ensure that the basic information of the printing service provider terminal can be accurately extracted, and basic data support is provided for subsequent distance calculation and service capability evaluation.
After the geographical coordinates of the user and the geographical coordinates of each printing service provider terminal are obtained, the cloud server calculates the euclidean distance between the user and each terminal as a distance factor. Euclidean distance is a commonly used distance measurement method for calculating the straight line distance between two points. The calculation formula is that the distance =Where (x 1, y 1) represents the user geographic coordinates and (x 2, y 2) represents the geographic coordinates of the print service provider terminal. For example, the user geographic coordinates are 39.9042 degrees north latitude, 116.4074 degrees east longitude, the print service provider terminal geographic coordinates are 39.9092 degrees north latitude, 116.3974 degrees east longitude, then distance ===Approximately 0.0112 degrees. Since the actual distance corresponding to degrees of longitude and latitude varies from geographic location to geographic location, it is often necessary to convert the degrees to actual distances (e.g., kilometers). For example, in Beijing, 1 degree latitude is approximately equal to 111 km, 1 degree longitude is approximately equal to 85 km, and thus 0.0112 degrees is approximately equal to 1.25 km. After the calculation is completed, the cloud server stores the distance factor as an attribute of each print service provider terminal for subsequent matching calculation use. The implementation effect of the step is to ensure that the distance between the user and the printing service provider terminal can be accurately calculated, and basic data support is provided for subsequent matching degree evaluation.
After calculating the distance factor, the cloud server acquires a corresponding basic weight value from a preset service type weight table according to the printing service type input by the user. The service type weight table is typically a structured data table containing weight values for different print service types. For example, the weight value of the normal print service is 1, the weight value of the quick print service is 2, and the weight value of the high-quality print service is 3. The acquisition process first refers to the service type weight table and extracts the record corresponding to the print service type input by the user. Then, the cloud server analyzes the record and extracts a basic weight value. For example, if the print service type selected by the user is a high quality print service, the base weight value is 3. The implementation effect of the step is to ensure that the priorities of different printing service types can be accurately reflected, and basic data support is provided for subsequent matching degree evaluation.
After the basic weight value is obtained, the cloud server obtains a corresponding quality weight value from a preset printing quality weight table according to the printing quality input by the user. The print quality weight table is typically a structured data table containing weight values for different print qualities. For example, the weight value of the normal print quality is 1, the weight value of the high-resolution print quality is 2, and the weight value of the ultra-high-resolution print quality is 3. The acquisition process first queries the print quality weight table to extract records corresponding to the print quality entered by the user. Then, the cloud server analyzes the record and extracts a quality weight value. For example, if the print quality selected by the user is a high resolution print quality, the quality weight value is 2. The implementation effect of the step is to ensure that the priority of different printing quality can be accurately reflected, and basic data support is provided for subsequent matching degree evaluation.
After the basic weight value and the quality weight value are obtained, the cloud server adds the basic weight value and the quality weight value to obtain the service capability weight. For example, if the base weight value is 3 and the quality weight value is 2, the service capability weight is 5. The service capability weight is used to evaluate the service capability of the print service provider terminal, the higher the weight value, the stronger the service capability of the terminal. The implementation effect of the step is to ensure that the service capability of the printing service provider terminal can be accurately evaluated, and basic data support is provided for subsequent matching degree evaluation.
After calculating the service capability weights, the cloud server may take, for each print service provider terminal, a weighted sum of the inverse of the distance factor and the service capability weights as a matching degree score. The calculation formula of the matching degree score is that the matching degree score= (1/distance factor) x distance weight + service capability weight x capability weight, wherein the distance weight and the capability weight are preset weight coefficients for adjusting the proportion of the distance factor and the service capability weight in the matching degree score. For example, if the distance weight is 0.6, the capability weight is 0.4, the distance factor is 1.25 km, and the service capability weight is 5, the matching degree score= (1/1.25) ×0.6+5×0.4=0.8×0.6+2=0.48+2=2.48. After the calculation is completed, the cloud server stores the matching degree score as one attribute of each printing service provider terminal so as to select the subsequent target terminal for use. The implementation effect of the step is to ensure that the matching degree of the printing service provider terminal can be accurately evaluated, and basic data support is provided for subsequent target terminal selection.
After calculating the matching score of each print service provider terminal, the cloud server may select a terminal with the highest matching score as the target print service provider terminal. The selection process first traverses the matching degree scores of all terminals to find the maximum value among them. Then, the cloud server marks the terminal corresponding to the maximum value as a target terminal. For example, if the matching degree score of terminal a is 2.48, the matching degree score of terminal B is 2.30, and the matching degree score of terminal C is 2.10, terminal a is selected as the target terminal. The implementation effect of this step is to ensure that the most appropriate print service provider terminal can be accurately selected, providing basic data support for subsequent print job execution.
The embodiment realizes intelligent matching of the printing service provider terminal based on the geographic position of the user and the printing parameters. Analyzing the geographical position of the user and the geographical coordinates of the terminal of the printing service provider ensures the accuracy of distance calculation, acquiring and calculating the service capability weight, ensuring the accurate assessment of the service capability of the terminal, calculating the matching degree score and selecting the target terminal, and ensuring that the most suitable terminal can be accurately selected. Overall, the technical scheme remarkably improves the efficiency and accuracy of print task allocation through a multi-level matching mechanism, and provides a better and more convenient print service experience for users.
In one implementation manner of the embodiment, the generating a print job according to the print parameters and the digital invoice file includes the following steps:
s510, acquiring a unique code of a target printing service provider terminal;
S520, generating a print job description file according to the print parameters, wherein the print job description file comprises a file identifier, the number of prints, print quality and a unique code of a target print service provider terminal;
S530, associating the digital invoice file with the print job description file to generate a print job package;
s540, carrying out digital signature on the printing task package to obtain the printing task.
After determining the target print service provider terminal, it is first necessary to acquire the unique code of the terminal. The unique code is an identifier of the print service provider terminal, typically consisting of numbers and letters, for uniquely identifying one terminal. The acquisition process first looks up the print service provider terminal list to find the record corresponding to the target terminal. Then, the cloud server analyzes the record and extracts a unique code. For example, the record of the target terminal may contain information such that the terminal ID is "PRT001", the geographical coordinates are 39.9042 degrees North latitude, 116.4074 degrees east longitude, the service capability is to support color printing, the maximum number of printing copies is 100 copies, high resolution printing is supported, and the like, and the unique code is "PRT001-2023". The generation of the unique code is typically based on the ID and the time stamp of the terminal to ensure its uniqueness and traceability. After the unique code is acquired, the cloud server stores the unique code as one attribute of the print job so as to generate and use a subsequent print job description file. The implementation effect of the step is to ensure that the unique identification of the target printing service provider terminal can be accurately acquired, and basic data support is provided for the subsequent generation of the printing task description file.
After the unique code of the target printing service provider terminal is acquired, the cloud server generates a printing task description file according to the printing parameters input by the user. The print job description file is a structured data file containing basic information of the print job, such as file identification, number of prints, print quality, and unique code of the target print service provider terminal. The file identification is a unique identifier of a print job, typically consisting of numbers and letters, for uniquely identifying one print job. The number of prints is the number of prints designated by the user, for example, 1 copy, 2 copies, and the like. The print quality is a print resolution specified by the user, such as normal quality, high quality, and the like. The generation process first creates an empty print job description file and then fills the unique code of the file identification, the number of prints, the print quality and the target print service provider terminal into the corresponding fields. For example, a print job description file may contain information that the file identifier is "TASK001-2023", the number of print copies is 2 copies, the print quality is high quality, and the unique code of the target print service provider terminal is "PRT001-2023". After the generation is completed, the cloud server stores the print job description file as one attribute of the print job so as to generate and use a subsequent print job package. The implementation effect of the step is to ensure that the basic information of the print task can be accurately recorded, and basic data support is provided for the generation of the subsequent print task package.
After the print job description file is generated, the cloud server associates the digital invoice file with the print job description file to generate a print job package. The print job package is a structured data package containing all necessary information of the print job, such as a digital invoice file, a print job description file, and the like. The association process first creates an empty print job package and then adds the digital invoice file and print job description file to the corresponding fields. For example, a print job package may contain information that the digital invoice file is a PDF file and the print job description file is a JSON file. After the generation is completed, the cloud server stores the print job package as an attribute of the print job for subsequent digital signature use. The implementation effect of this step is to ensure that all necessary information of the print job can be accurately correlated, providing basic data support for subsequent digital signatures.
After the print job package is generated, the cloud server digitally signs it to ensure the integrity and security of the print job. Digital signatures are an encryption technique used to verify the origin and integrity of data. The signing process first hashes the print job packet using a hash algorithm (e.g., SHA-256) to generate a hash value. The cloud server then encrypts the hash value using the private key, generating a digital signature. For example, if the hash value of the print job packet is "a1b2c3d4e5f6g7h8i9j0", the private key is "PRIVATEKEY123", the digital SIGNATURE is "signalure 123". After the generation is completed, the cloud server adds the digital signature to the print job package to form a final print job. The implementation effect of this step is to ensure the integrity and security of the print job, and prevent the print job from being tampered or counterfeited during the transmission process.
The method and the device realize the generation and signature of the print job and ensure the integrity and the safety of the print job. The method comprises the steps of obtaining a unique code of a target printing service provider terminal, ensuring that a unique identifier of the terminal can be accurately obtained, generating a printing task description file, ensuring that basic information of a printing task can be accurately recorded, associating a digital invoice file with the printing task description file, ensuring that all necessary information of the printing task can be accurately associated, digitally signing a printing task package, and ensuring the integrity and the safety of the printing task. Overall, the technical scheme remarkably improves the safety and reliability of the printing task through a multi-level generation and signature mechanism, and provides a better and safer printing service experience for users.
In one implementation of this embodiment, encrypting the invoice copy includes the steps of:
S610, encrypting the invoice copy by adopting a symmetric encryption algorithm to generate an encrypted invoice copy;
S620, encrypting a key of the symmetric encryption algorithm by using the asymmetric encryption algorithm to generate an encryption key;
s630, packaging the encrypted invoice copy and the encryption key into a data packet;
s640, compressing the data packet to generate a compressed data packet;
s650, performing Base64 coding on the compressed data packet to generate an encrypted invoice copy;
Before encrypting the invoice copy, further comprising:
s1, calculating a hash value of an invoice copy, and packaging the hash value into blockchain transaction data;
S2, broadcasting the blockchain transaction data to nodes in a blockchain network, wherein the nodes in the blockchain network are used for writing the blockchain transaction data into the blockchain through a consensus mechanism.
Fig. 2 shows a schematic flow chart of an encryption invoice copy provided in an embodiment of the application, and as shown in fig. 2, a symmetric encryption algorithm is first selected before the invoice copy is encrypted. The symmetric encryption algorithm is an encryption technique that uses the same key for encryption and decryption, and common symmetric encryption algorithms include AES (advanced encryption standard), DES (data encryption standard), and the like. Taking the AES algorithm as an example, the encryption process first generates a random symmetric key, such as a 128 bit or 256 bit key. The invoice copy is then encrypted using the key. In the encryption process, the data of the invoice copy is divided into blocks (such as 128 bits) with fixed sizes, and each block is subjected to multiple rounds of replacement, permutation and confusion operations, so that an encrypted data block is finally generated. For example, if the invoice copy is a PDF file, the encryption process may divide its binary data into 128-bit blocks, and then AES encrypt each block to generate an encrypted data block. After encryption is completed, all encrypted data blocks are combined into one encrypted invoice copy. The implementation effect of the step is to ensure the security of the data of the invoice copy in the transmission and storage processes and prevent unauthorized access and tampering.
After the encrypted invoice copy is generated, the key of the symmetric encryption algorithm needs to be encrypted by using an asymmetric encryption algorithm to ensure the security of the key. The asymmetric encryption algorithm is an encryption technology that uses public and private keys for encryption and decryption, and common asymmetric encryption algorithms include RSA, ECC (elliptic curve encryption), and the like. Taking the RSA algorithm as an example, the encryption process first generates a pair of public and private keys, the public key being used for encryption and the private key being used for decryption. The symmetric key is then encrypted using the public key. In the encryption process, the data of the symmetric key is divided into blocks (for example 1024 bits or 2048 bits) with fixed size, and each block is subjected to modular exponentiation operation and padding operation, so as to finally generate an encrypted data block. For example, if the symmetric key is a 128-bit AES key, the encryption process would divide it into 1024-bit blocks, and then RSA encrypt each block to produce an encrypted block of data. After encryption is completed, all encrypted data blocks are combined into one encryption key. The implementation effect of this step is to ensure the security of the symmetric key and prevent the key from being revealed or tampered during transmission and storage.
After the encrypted invoice copy and encryption key are generated, they need to be packaged into one data packet for transmission and storage. The encapsulation process first creates an empty data packet and then adds the copy of the encrypted invoice and the encryption key to the corresponding fields. For example, a data packet may contain information such that the copy of the encrypted invoice is a binary file and the encryption key is a Base64 encoded string. After encapsulation, the package is stored as a structured data file, such as a JSON file or XML file. The implementation effect of this step is to ensure that the encrypted invoice copy and the encryption key can be accurately associated and stored, providing basic data support for subsequent compression and encoding.
After the data packet is packaged, the data packet needs to be compressed, so that the size of the data packet is reduced, and the transmission efficiency is improved. The compression process first selects a compression algorithm, such as ZIP, GZIP, DEFLATE, or the like. The data packet is then compressed using the algorithm. In the compression process, the data of the data packet is divided into a plurality of blocks, and each block is subjected to dictionary coding, huffman coding and other operations to finally generate a compressed data block. For example, if the data packet is a JSON file, the compression process will divide its binary data into a plurality of blocks, and then GZIP compress each block to produce compressed data blocks. After compression is completed, all the compressed data blocks are combined into one compressed data packet. The implementation effect of the step is to ensure that the size of the data packet can be effectively reduced, and the efficiency of data transmission and storage is improved.
After the compressed data packet is generated, it needs to be Base64 encoded for transmission in a text format transmission medium (e.g., email, HTTP request, etc.). Base64 coding is a coding technique that converts binary data into text format, and common Base64 coding standards include RFC 4648, etc. The encoding process first breaks the binary data of the compressed data packet into a plurality of 6-bit blocks, and then converts each block into a corresponding Base64 character. For example, if the compressed data packet is a GZIP file, the encoding process will divide its binary data into a plurality of 6-bit blocks, and then Base64 encode each block to generate a Base64 encoded string. After encoding is completed, the Base64 encoded string is stored as an encrypted invoice copy. The implementation effect of the step is to ensure that the compressed data packet can be accurately converted into a text format, and the compatibility and the safety of data transmission are improved.
Before encrypting the invoice copy, it is necessary to calculate its hash value and package the hash value as blockchain transaction data to ensure the integrity and tamper resistance of the invoice copy. The hash value is a fixed-length string used to uniquely identify the content of the data, and common hash algorithms include SHA-256, MD5, etc. Taking the SHA-256 algorithm as an example, the calculation process first divides binary data of the invoice copy into a plurality of blocks, and then performs hash calculation on each block, thereby finally generating a 256-bit hash value. For example, if the invoice copy is a PDF file, the computing process may divide its binary data into a plurality of blocks, and then perform a SHA-256 hash on each block to generate a 256-bit hash value. After the calculation is completed, the hash value is encapsulated into blockchain transaction data, such as a JSON file or XML file. The implementation effect of the step is to ensure that the integrity of the invoice copy can be accurately verified, and prevent the data from being tampered in the transmission and storage processes.
After the blockchain transaction data is generated, it needs to be broadcast to nodes in the blockchain network to ensure that the transaction data can be written to the blockchain. A blockchain network is a distributed network that is made up of multiple nodes, each of which maintains a complete copy of the blockchain. The broadcast process will first send blockchain transaction data to one or more nodes in the network, which will then forward the transaction data to other nodes. For example, if the blockchain network is a bitcoin network, the broadcast process may send its transaction data to a plurality of nodes in the network, which may then forward the transaction data to other nodes. After the broadcast is completed, nodes in the blockchain network write transaction data into the blockchain through a consensus mechanism (such as workload certification, rights certification, and the like). The implementation effect of this step is to ensure that the blockchain transaction data can be accurately written into the blockchain, and prevent the data from being tampered or falsified in the transmission and storage processes.
The method and the system realize encryption and blockchain storage of the invoice copy, and ensure the safety, the integrity and the non-tamper property of the invoice copy. The method comprises the steps of encrypting invoice copies by adopting a symmetric encryption algorithm, ensuring the safety of data in the transmission and storage processes, encrypting symmetric keys by using an asymmetric encryption algorithm, ensuring the safety of the keys, packaging the encrypted invoice copies and the encrypted keys into data packets, ensuring the accurate association and storage of the data, compressing the data packets, improving the efficiency of data transmission and storage, performing Base64 encoding on the compressed data packets, improving the compatibility and safety of data transmission, calculating hash values of the invoice copies and packaging the hash values into blockchain transaction data, ensuring the integrity and the non-tamper modification of the data, and broadcasting the blockchain transaction data to nodes in a blockchain network, thereby ensuring that the data can be accurately written into a blockchain. Overall, the technical scheme remarkably improves the safety and reliability of invoice copies through a multi-level encryption and blockchain storage mechanism, and provides higher-quality and safer invoice management service experience for users.
In one implementation of this embodiment, generating an invoice sharing link based on the encrypted invoice copy includes the steps of:
S710, generating a unique file access identifier based on the encrypted invoice copy;
s720, acquiring a user identity and a user authority level through a user terminal;
S730, generating an access token according to the user identity and the user authority level;
s740, acquiring the validity period of the access token from a preset authority validity period table according to the user authority level;
s750, acquiring the access times of the user from a preset user access frequency table according to the user identity;
s760, binding the validity period and the access times with the access token, wherein the bound access token is used for limiting the access times of the user in the validity period;
s770, combining the file access identifier and the access token after binding to generate a shared link parameter;
S780, carrying out hash processing on the shared link parameters to generate a shared link identifier;
s790, combining the shared link identification with a preset domain name to generate an invoice shared link, wherein the invoice shared link comprises an expiration date and access times.
Fig. 3 shows a flow chart of generating an invoice sharing link based on an encrypted invoice copy, and as shown in fig. 3, before generating the invoice sharing link, a unique file access identifier needs to be generated based on the encrypted invoice copy. The file access identifier is a string of characters, typically consisting of numbers and letters, that uniquely identifies the copy of the encrypted invoice. The generation process first uses a hash algorithm (e.g., SHA-256) to hash the binary data of the encrypted invoice copy to generate a hash value of a fixed length. For example, if the encrypted invoice copy is a Base64 encoded string, the hash calculation will convert it to binary data and then generate a 256 bit hash value. The hash value is then converted into a shorter and easier to handle string, for example by Base62 encoding into a string of numbers and letters. For example, a 256-bit hash value may be converted to a 10-bit Base62 string, such as "A1B2C3D4E5". After the generation is completed, the file access identifier is stored as an attribute of the invoice shared link for subsequent shared link parameter generation use. The implementation effect of this step is to ensure that the encrypted invoice copy can be uniquely identified, providing basic data support for subsequent shared link generation.
After the file access identifier is generated, the user identity and the user authority level need to be acquired through the user terminal. The user identity is a unique identifier of the user, typically consisting of numbers and letters, such as a user ID or a user name. The user permission level is an access permission level of the user, and is generally represented by a number or a character string, for example, "normal user", "advanced user", or the like. The acquisition process firstly extracts the user identity and the user authority level through the login information or the session information of the user terminal. For example, if a user logs in through a mobile phone APP, the login information includes a user ID and a permission level. Then, the cloud server can verify the user identity and the user authority level, and the validity and the effectiveness of the user identity and the user authority level are ensured. For example, the user ID needs to be present in the user database and the permission level needs to be in a preset permission level list. The implementation effect of this step is to ensure that the user identity and user permission level can be accurately acquired, providing basic data support for subsequent access token generation.
After the user identity and user permission level are obtained, an access token needs to be generated based on this information. An access token is a string of characters, typically consisting of numbers and letters, used to verify the identity and rights of a user. The generation process first combines the user identity and the user permission level into a structured data object, such as a JSON object. The data object is then hashed using a hash algorithm (e.g., SHA-256) to generate a hash value of a fixed length. For example, if the USER identity is "USER001" and the USER permission level is "advanced USER", the hash calculation may generate a 256-bit hash value. The hash value is then converted into a shorter and easier to handle string, for example by Base62 encoding into a string of numbers and letters. For example, a 256-bit hash value may be converted to a 10-bit Base62 string, such as "E5F6G7H8I9". After the generation is completed, the access token is stored as an attribute of the invoice sharing link for subsequent sharing link parameter generation use. The implementation effect of this step is to ensure that the user identity and user permission level can be accurately verified, providing basic data support for subsequent shared link generation.
After the access token is generated, the validity period of the access token needs to be obtained from a preset authority validity period table according to the authority level of the user. The authority validity period table is a structured data table and comprises validity periods corresponding to different authority levels. For example, the validity period of the general user is 1 day, the validity period of the advanced user is 7 days, and the validity period of the administrator is 30 days. The acquisition process first queries the rights validity table to find the record corresponding to the user rights level. Then, the cloud server analyzes the record and extracts the validity period. For example, if the user authority level is "advanced user", the validity period is 7 days. After the validity period is obtained, the cloud server stores the validity period as one attribute of the access token so as to generate and use subsequent sharing link parameters. The implementation effect of this step is to ensure that the validity period of the access token can be accurately set, providing basic data support for subsequent shared link generation.
After the validity period of the access token is acquired, the access times of the user are required to be acquired from a preset user access times table according to the user identity. The user access frequency table is a structured data table and comprises access frequency corresponding to different user identities. For example, the number of accesses by the USER "USER001" is 5 times, and the number of accesses by the USER "USER002" is 10 times. The acquisition process first queries the user access number table to find the record corresponding to the user identity. Then, the cloud server analyzes the record and extracts the access times. For example, if the USER identity is "USER001", the number of accesses is 5. After the access times are acquired, the cloud server stores the access times as one attribute of the access token so as to generate and use subsequent sharing link parameters. The implementation effect of the step is to ensure that the access times of the user can be accurately set, and basic data support is provided for subsequent shared link generation.
After the validity period and the access times are acquired, the validity period and the access times need to be bound with the access token to ensure that the access token limits the access times of the user in the validity period. The binding process first creates a structured data object containing the access token, expiration date, and number of accesses. For example, a data object may contain information that the access token is "E5F6G7H8I9", the validity period is 7 days, and the number of accesses is 5. The cloud server would then store the data object as one attribute of the access token for subsequent shared link parameter generation use. The implementation effect of the step is to ensure that the validity period and the access times of the access token can be accurately bound, and basic data support is provided for subsequent shared link generation.
After the binding validity period and the access times, the file access identifier and the bound access token are required to be combined to generate the shared link parameter. The shared link parameter is a structured data object that contains a file access identifier and an access token. The generation process first creates an empty data object and then adds the file access identifier and access token to the corresponding fields. For example, one shared link parameter may contain information that the file access identifier is "A1B2C3D4E5" and the access token is "E5F6G7H8I9". After the generation is completed, the shared link parameter is stored as an attribute of the invoice shared link for subsequent shared link identification generation use. The implementation effect of this step is to ensure that the file access identifier and the access token can be accurately combined, providing basic data support for subsequent shared link identifier generation.
After the shared link parameter is generated, hash processing is needed to be carried out on the shared link parameter, and a shared link identifier is generated. The shared link identifier is a string of characters, typically consisting of numbers and letters, that uniquely identify the shared link. The hash process first uses a hash algorithm (e.g., SHA-256) to hash binary data sharing the link parameters to generate a hash value of a fixed length. For example, if the shared link parameter is a JSON object, the hash computation will convert it to binary data and then generate a 256-bit hash value. The hash value is then converted into a shorter and easier to handle string, for example by Base62 encoding into a string of numbers and letters. For example, a 256-bit hash value may be converted to a 10-bit Base62 string, such as "J0K1L2M3N4". After the generation is completed, the shared link identifier is stored as an attribute of the invoice shared link for subsequent shared link generation use. The implementation effect of this step is to ensure that the shared link parameters can be uniquely identified, providing basic data support for subsequent shared link generation.
After the shared link identifier is generated, the shared link identifier needs to be combined with a preset domain name to generate an invoice shared link. The invoice sharing link is a URL and comprises a sharing link identifier, a validity period and the number of times of access. The generation process first obtains a preset domain name, e.g. "https:// example. Com". The shared link identification, validity period, and number of accesses are then added to the path or query parameters of the URL. For example, an invoice sharing link may be "https:// sample.com/share/J0K 1L2M3N4 share=7 & access=5", where "J0K1L2M3N4" is a sharing link identification, "share=7" indicates a validity period of 7 days and "access=5" indicates a number of accesses of 5 times. After the generation is completed, the invoice sharing link is sent to the user terminal, and the user can access the encrypted invoice copy by clicking the link. The implementation effect of the step is to ensure that the invoice sharing link can be accurately generated and accessed, and a convenient invoice sharing mode is provided for users.
The method and the system realize generation and management of invoice sharing links, and ensure safety and controllability of invoice copies. The method comprises the steps of generating a unique file access identifier based on an encrypted invoice copy, ensuring that the invoice copy can be uniquely identified, acquiring a user identity and a user authority level through a user terminal, ensuring that the user identity and the authority can be accurately verified, generating an access token according to the user identity and the authority level, ensuring that the access authority is accurately set, acquiring a validity period and access times according to the user authority level and the identity, ensuring validity and controllability of the access token, binding the validity period and the access times with the access token, ensuring that the access times of the user are limited in the validity period of the access token, combining the file access identifier and the bound access token to generate a sharing link parameter, ensuring that the sharing link is accurately generated, carrying out hash processing on the sharing link parameter to generate a sharing link identifier, ensuring uniqueness and safety of the sharing link, combining the sharing link identifier with a preset domain name to generate an invoice sharing link, and ensuring that the user can conveniently access the encrypted invoice copy. Overall, the technical scheme obviously improves the safety and convenience of invoice sharing through a multi-level generation and management mechanism, and provides higher-quality and safer invoice management service experience for users.
In one implementation manner of the embodiment, the access token is generated according to the identity of the user and the user authority level, and the method comprises the following steps:
s810, generating a user unique identifier according to the user identity;
s820, generating a permission identifier according to the user permission level;
s830, combining the unique user identifier and the authority identifier to generate an access token.
Before generating the access token, a user unique identification is first generated based on the user identity. The user unique identification is a string of characters, typically consisting of numbers and letters, that uniquely identify the user. The generation process first extracts key fields, such as user ID, user name, registration time, etc., from the user identity information. These fields are then hashed using a hash algorithm (e.g., SHA-256) to generate a hash value of a fixed length. For example, if the USER ID is "USER001", the USER name is "JohnDoe", the registration time is "2023-01-01", the hash calculation will combine these fields into a string and then generate a 256-bit hash value. The hash value is then converted into a shorter and easier to handle string, for example by Base62 encoding into a string of numbers and letters. For example, a 256-bit hash value may be converted to a 10-bit Base62 string, such as "U1V2W3X4Y5". After the generation is completed, the user unique identification is stored as an attribute of the access token for subsequent rights identification generation use. The implementation effect of this step is to ensure that the user identity can be uniquely identified, providing basic data support for subsequent access token generation.
After generating the user unique identifier, a permission identifier needs to be generated according to the user permission level. Rights identification is a string of characters, typically consisting of numbers and letters, used to identify the user's rights level. The generation process first extracts key fields, such as rights level names, rights level codes, etc., from the user rights level information. These fields are then hashed using a hash algorithm (e.g., SHA-256) to generate a hash value of a fixed length. For example, if the rights level alias is called "advanced user" and the rights level code is "2", the hash computation would combine these fields into a string and then generate a 256-bit hash value. The hash value is then converted into a shorter and easier to handle string, for example by Base62 encoding into a string of numbers and letters. For example, a 256-bit hash value may be converted to a 10-bit Base62 string, such as "P1Q2R3S4T5". After the generation is completed, the rights identification is stored as an attribute of the access token for subsequent access token generation use. The implementation effect of this step is to ensure that the user permission level can be accurately identified, providing basic data support for subsequent access token generation.
After the user unique identification and the rights identification are generated, they need to be combined to generate the access token. An access token is a string of characters, typically consisting of numbers and letters, used to verify the identity and rights of a user. The generation process first creates a structured data object containing the user unique identification and the rights identification. For example, a data object may contain information uniquely identified by the user as "U1V2W3X4Y5" and the rights as "P1Q2R3S4T5". The data object is then hashed using a hash algorithm (e.g., SHA-256) to generate a hash value of a fixed length. For example, a hash calculation may generate a 256-bit hash value. The hash value is then converted into a shorter and easier to handle string, for example by Base62 encoding into a string of numbers and letters. For example, a 256-bit hash value may be converted to a 10-bit Base62 string, such as "A1B2C3D4E5". After the generation is completed, the access token is stored as an attribute of the invoice sharing link for subsequent sharing link parameter generation use. The implementation effect of this step is to ensure that the user identity and permission level can be accurately verified, providing basic data support for subsequent shared link generation.
The method and the device realize the generation and management of the access token and ensure the accurate verification of the user identity and the authority level. The method comprises the steps of generating a user unique identifier according to a user identity, ensuring that the user identity can be uniquely identified, generating a right identifier according to a user right level, ensuring that the user right level can be accurately identified, combining the user unique identifier and the right identifier to generate an access token, and ensuring that the user identity and the right level can be accurately verified. In the technical scheme, through a multi-level generation and management mechanism, the security and reliability of the access token are obviously improved, and better and safer invoice management service experience is provided for users.
In one implementation manner of the embodiment, the user terminal receives the invoice sharing link, decrypts the encrypted invoice copy in the invoice sharing link, and obtains the invoice copy, and includes the following steps:
S910, the user terminal analyzes the invoice sharing link, and extracts a file access identifier and an access token;
S920, the user terminal sends a decryption request to the cloud server, and the cloud server is used for acquiring an access token through the decryption request, verifying the validity of the access token and returning an encrypted invoice copy after the verification is passed;
And S930, the user terminal decrypts the encryption key by using the asymmetric encryption algorithm, and decrypts the encrypted invoice copy by using the decrypted key to obtain the invoice copy.
When the user terminal receives the invoice sharing link, the link needs to be parsed first to extract key information. The invoice sharing link is typically a URL, containing the file access identification and access token. The parsing process first breaks down the URL into parts such as protocols (e.g., "https"), domain names (e.g., "example. Com"), paths (e.g., "share/J0K 1L2M3N 4"), and query parameters (e.g., "share=7 & access=5"). Then, the file access identification and access token are extracted from the path and the query parameters. For example, if the invoice sharing link is "https:// sample.com/share/J0K 1L2M3N4 share=7 & access=5", then the file access identifier is "J0K1L2M3N4" and the access token is "E5F6G7H8I9". After the extraction is completed, the file access identifier and the access token are stored as an attribute of the user terminal for subsequent decryption requests. The implementation effect of the step is to ensure that key information in the invoice sharing link can be accurately extracted, and basic data support is provided for subsequent decryption requests.
After the file access identifier and the access token are extracted, the user terminal sends a decryption request to the cloud server. The decryption request is a structured data object containing a file access identifier and an access token. The sending process first creates an HTTP request and sends the decryption request as a request body to the API interface of the cloud server. For example, a decryption request may contain information that the file access identifier is "J0K1L2M3N4" and the access token is "E5F6G7H8I9". After receiving the decryption request, the cloud server firstly analyzes the request body and extracts the file access identifier and the access token. The cloud server will then verify the validity of the access token. The authentication process first checks whether the access token is within a validity period, for example by comparing the current time with the generation time of the access token. The cloud server may then check whether the number of accesses to the access token exceeds a limit, for example by querying a user access number table. If the access token passes the verification, the cloud server obtains an encrypted invoice copy from the storage and returns the invoice copy to the user terminal. For example, the encrypted copy of the invoice may be a Base64 encoded string. The implementation effect of the step is to ensure that the encrypted invoice copy can be accurately acquired, and basic data support is provided for subsequent decryption operation.
After receiving the encrypted invoice copy, the user terminal needs to decrypt it to obtain the original invoice copy. The decryption process first decrypts the encryption key using an asymmetric encryption algorithm (e.g., RSA). The encryption key is a symmetric key encrypted using an asymmetric encryption algorithm, typically consisting of numbers and letters. The decryption process first decrypts the encryption key using the private key to generate the original symmetric key. For example, if the encryption key is a Base64 encoded string, the decryption process converts it to binary data and then decrypts it using the private key to generate a 128-bit or 256-bit symmetric key. The user terminal then decrypts the encrypted copy of the invoice using the decrypted symmetric key. In the decryption process, the data of the encrypted invoice copy is divided into blocks (such as 128 bits) with fixed sizes, and each block is subjected to multiple rounds of replacement, permutation and confusion operations, so that a decrypted data block is finally generated. For example, if the encrypted invoice copy is a Base64 encoded string, the decryption process converts it to binary data and then AES decrypts each block to produce decrypted data blocks. After decryption is completed, all decrypted data blocks are combined into one original invoice copy. For example, the original invoice copy may be a PDF file. The implementation effect of the step is to ensure that the encrypted invoice copy can be accurately decrypted, and an original invoice copy is provided for a user.
The method and the device realize analysis and decryption of the invoice sharing link, and ensure safety and controllability of invoice copies. The user terminal analyzes the invoice sharing link, extracts the file access identifier and the access token, ensures that key information can be accurately acquired, sends a decryption request to the cloud server, verifies the validity of the access token and returns an encrypted invoice copy, ensures that the encrypted invoice copy can be accurately acquired, decrypts the encryption key by using an asymmetric encryption algorithm, decrypts the encrypted invoice copy by using the decrypted key, and ensures that the encrypted invoice copy can be accurately decrypted. Overall, the technical scheme remarkably improves the safety and convenience of invoice sharing through a multi-level analysis and decryption mechanism, and provides higher-quality and safer invoice management service experience for users.
Fig. 4 shows a block diagram of a cloud server according to an embodiment of the present application, where, as shown in fig. 4, the embodiment of the present application further provides a cloud server, including:
Communication means 10 for establishing a communication connection with the user terminal and the printing service provider terminal;
a processor 20 configured to:
Responding to receiving an uploading signal of a user uploading the digital invoice file through a user terminal, and acquiring the digital invoice file;
Verifying the digital invoice file, acquiring the current geographic position of the user terminal after the digital invoice file is successfully verified, and determining a target printing service provider terminal based on the printing parameters input by the user and the current geographic position;
generating a print task according to the print parameters and the digital invoice file;
the method comprises the steps that a print job is sent to a target print service provider terminal, the target print service provider terminal is used for executing the print job, generating an invoice copy, and returning the invoice copy to a cloud server;
In response to receiving the invoice copy, encrypting the invoice copy, and generating an invoice sharing link based on the encrypted invoice copy;
And sending the invoice sharing link to a user terminal, wherein the user terminal is used for receiving the invoice sharing link and decrypting the encrypted invoice copy in the invoice sharing link to obtain the invoice copy, so that a user clicks the invoice sharing link through the user terminal to download the invoice copy.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, etc., such as Read Only Memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer 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 disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises an element.
The foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and variations of the present application will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. which come within the spirit and principles of the application are to be included in the scope of the claims of the present application.