CN116109243A - SQL algorithm-based charging method, device, equipment and storage medium - Google Patents

SQL algorithm-based charging method, device, equipment and storage medium Download PDF

Info

Publication number
CN116109243A
CN116109243A CN202310161282.2A CN202310161282A CN116109243A CN 116109243 A CN116109243 A CN 116109243A CN 202310161282 A CN202310161282 A CN 202310161282A CN 116109243 A CN116109243 A CN 116109243A
Authority
CN
China
Prior art keywords
order data
charging result
data
screened
verification
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310161282.2A
Other languages
Chinese (zh)
Inventor
孙越峰
杨周龙
李�杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Dongpu Software Co Ltd
Original Assignee
Dongpu Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Dongpu Software Co Ltd filed Critical Dongpu Software Co Ltd
Priority to CN202310161282.2A priority Critical patent/CN116109243A/en
Publication of CN116109243A publication Critical patent/CN116109243A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/08Logistics, e.g. warehousing, loading or distribution; Inventory or stock management
    • G06Q10/087Inventory or stock management, e.g. order filling, procurement or balancing against orders
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/248Presentation of query results
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/02Marketing; Price estimation or determination; Fundraising
    • G06Q30/0201Market modelling; Market analysis; Collecting market data
    • G06Q30/0206Price or cost determination based on market factors

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Development Economics (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Strategic Management (AREA)
  • Economics (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Computational Linguistics (AREA)
  • General Business, Economics & Management (AREA)
  • Marketing (AREA)
  • Tourism & Hospitality (AREA)
  • Game Theory and Decision Science (AREA)
  • Mathematical Physics (AREA)
  • Quality & Reliability (AREA)
  • Operations Research (AREA)
  • Human Resources & Organizations (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention relates to the field of warehouse logistics and discloses a billing method, a billing device, billing equipment and a storage medium based on an SQL algorithm. The method comprises the following steps: establishing a database for storing order data, wherein the order data at least comprises an order number, a product name, the quantity and unit price; screening order data by adopting SQL sentences to obtain screened order data; writing SQL sentences and calculating the cost according to the screened order data to obtain a charging result; updating the charging result into the order data and displaying the order data and the charging result. The use of a hash algorithm may avoid missing some expense details or miscalculating some expense details. The use of encryption algorithms can prevent illegal users from tampering with the data. Errors in transmission can be effectively detected and corrected using redundancy checks. The use of checksum algorithms can effectively detect digital conversion errors, truncation errors, rounding errors, and the like.

Description

SQL algorithm-based charging method, device, equipment and storage medium
Technical Field
The invention relates to the field of warehouse logistics, in particular to a billing method, a billing device, a billing equipment and a storage medium based on an SQL algorithm.
Background
In daily work and life, a great deal of fee circulation is involved, and the charging mode is mostly to collect fixed fees through a fixed period. This charging method for charging a fixed fee with a fixed period requires periodic manual introduction of a bill for charging.
The existing scheme has the following technical problems: the fixed cost is received in fixed cycle, needs the expense management personnel to do the repetitive work at every turn, and complex operation increases the cost of labor, and inefficiency simultaneously.
In addition, the fee calculation error rate caused by the consideration or various factors is high; existing solutions lack the associated fee checking process.
Disclosure of Invention
The invention mainly aims to solve the problems that in the prior art, fixed fees are collected in a fixed period, and a fee manager needs to do repeated work each time, so that the operation is complicated, the labor cost is increased, and the efficiency is low; the method of the present invention allows a user to quickly calculate an order price without requiring manual calculation. In addition, the method can also be used for data verification, so that the calculation efficiency and accuracy are improved.
The first aspect of the present invention provides a billing method based on an SQL algorithm, the billing method based on the SQL algorithm comprising:
establishing a database for storing order data, wherein the order data at least comprises an order number, a product name, the quantity and unit price; screening order data by adopting SQL sentences to obtain screened order data; writing SQL sentences and calculating the cost according to the screened order data to obtain a charging result; updating the charging result into the order data and displaying the order data and the charging result.
Optionally, in a second implementation manner of the first aspect of the present invention, the creating a database for storing order data, where the order data at least includes an order number, a product name, a quantity, and a unit price includes:
designing a data table structure for storing order data, and determining data fields and data types; creating a data table, and designating a table name, a field name and a data type; and manually adding data into the data table, or inserting the data into the data table by using an INSERTINTO statement to obtain a database for storing order data.
Optionally, in a third implementation manner of the first aspect of the present invention, the filtering the order data using SQL statements to obtain filtered order data further includes:
writing a SELECT statement according to the conditions needing to be screened; selecting a required field from an order data table using the SELECT statement; and screening order data meeting the conditions through a WHERE clause to obtain screened order data.
Optionally, in a fourth implementation manner of the first aspect of the present invention, after updating the charging result to the order data and displaying the order data and the charging result, the method further includes the following steps:
carrying out hash algorithm calculation on the screened order data to generate a corresponding hash value; storing the charging result and the hash value of each screened order data in a verification data table; when the charging result is required to be checked to be correct, calculating the hash value of the screened order data again to obtain a new hash value; according to the screened order data, calculating to obtain a verification charging result; and comparing the new hash value with the verification charging result and the charging result in the verification data table, and if the new hash value and the verification charging result are equal to the hash value, indicating that the charging result of the order is correct.
Optionally, in a fifth implementation manner of the first aspect of the present invention, after updating the charging result to the order data and displaying the order data and the charging result, the method further includes the following steps:
merging the screened order data into a character string according to the sequence; encrypting the character string by using an encryption algorithm to generate a ciphertext; storing the ciphertext of the screened order data and the actual charging result in a verification data table; when the charging result is required to be checked to be correct, calculating the cost again according to the screened order data to obtain a verified charging result; combining the screened order data into a character string according to the same sequence; encrypting the combined character strings by using an encryption algorithm to generate a new ciphertext; comparing the new ciphertext, the verification charging result with the ciphertext and the actual charging result in the verification data table, and if the new ciphertext and the verification charging result are equal to the actual charging result, indicating that the charging result of the order is correct.
Optionally, in a sixth implementation manner of the first aspect of the present invention, after updating the charging result to the order data and displaying the order data and the charging result, the method further includes the following steps:
redundancy check is carried out on the screened order data, and corresponding redundancy information is generated; storing the redundant information of the screened order data and the actual charging result in a verification data table; when the charging result is required to be checked to be correct, calculating to obtain a verification charging result according to the screened order data; and performing redundancy check on the screened order data to generate new redundancy information. And comparing the new redundant information and the verification charging result with the redundant information and the actual charging result in the verification data table, and if the two are equal, indicating that the charging result of the order is correct.
Optionally, in a seventh implementation manner of the first aspect of the present invention, after updating the charging result to the order data and displaying the order data and the charging result, the method further includes the following steps:
performing checksum algorithm calculation on the screened order data to generate a corresponding checksum value; storing the checksum value of the screened order data and the actual charging result in a verification data table; when the charging result is required to be checked to be correct, calculating to obtain a verification charging result according to the screened order data; and calculating the checksum value of the screened order data to generate a new checksum value. And comparing the new checksum value and the verification charging result with the checksum value and the actual charging result in the verification data table, and if the new checksum value and the verification charging result are equal to the actual charging result, indicating that the charging result of the order is correct.
The second aspect of the present invention provides a billing apparatus based on SQL algorithm, comprising:
the system comprises a building module, a storage module and a storage module, wherein the building module is used for building a database for storing order data, and the order data at least comprises order numbers, product names, quantity and unit price;
the screening module is used for screening the order data by adopting SQL sentences to obtain screened order data;
the charging module is used for writing SQL sentences and calculating the cost according to the screened order data to obtain a charging result;
and the updating display module is used for updating the charging result into the order data and displaying the order data and the charging result.
A third aspect of the present invention provides an electronic device, comprising: a memory and at least one processor, the memory having instructions stored therein, the memory and the at least one processor being interconnected by a line; the at least one processor invokes the instructions in the memory to cause the electronic device to perform the SQL algorithm based billing method described above.
A fourth aspect of the invention provides a computer readable storage medium having instructions stored therein which, when run on a computer, cause the computer to perform the above described SQL algorithm based charging method.
According to the technical scheme, the problem that fixed fees are collected in a fixed period, and a fee manager needs to do repeated work each time is solved, so that the operation is complex, the labor cost is increased, and meanwhile, the efficiency is low.
The use of a hash algorithm may avoid missing some expense details or miscalculating some expense details.
The encryption algorithm can ensure the correctness of the charging result and prevent illegal users from tampering with the data.
Errors in transmission can be effectively detected and corrected by using redundancy check, so that the correctness of the charging result is ensured.
Errors that may occur during the calculation of the cost detail, such as digital conversion errors, truncation errors, rounding errors, etc., can be effectively detected using a checksum algorithm.
In addition, the invention can also use hash algorithm, encryption algorithm, redundancy check, check sum algorithm to check the charging result.
Drawings
Fig. 1 is a first flowchart of a billing method based on an SQL algorithm according to an embodiment of the present invention;
fig. 2 is a second flowchart of a billing method based on an SQL algorithm according to an embodiment of the present invention;
fig. 3 is a third flowchart of a billing method based on an SQL algorithm according to an embodiment of the present invention;
fig. 4 is a fourth flowchart of a billing method based on an SQL algorithm according to an embodiment of the present invention;
fig. 5 is a fifth flowchart of a billing method based on SQL algorithm according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a billing device based on SQL algorithm according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a billing method, a billing device, billing equipment and a storage medium based on an SQL algorithm. The method comprises the following steps: establishing a database for storing order data, wherein the order data at least comprises an order number, a product name, the quantity and unit price; screening order data by adopting SQL sentences to obtain screened order data; writing SQL sentences and calculating the cost according to the screened order data to obtain a charging result; updating the charging result into the order data and displaying the order data and the charging result. The use of a hash algorithm may avoid missing some expense details or miscalculating some expense details. The use of encryption algorithms can prevent illegal users from tampering with the data. Errors in transmission can be effectively detected and corrected using redundancy checks. The use of checksum algorithms can effectively detect digital conversion errors, truncation errors, rounding errors, and the like.
The terms "first," "second," "third," "fourth" and the like in the description and in the claims and in the above drawings, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments described herein may be implemented in other sequences than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed or inherent to such process, method, article, or apparatus.
For easy understanding, the following describes a specific flow of an embodiment of the present invention, referring to fig. 1, and a first embodiment of a billing method based on an SQL algorithm in the embodiment of the present invention includes:
101. establishing a database for storing order data, wherein the order data at least comprises an order number, a product name, the quantity and unit price;
specifically, a data table structure for storing order data is designed, and data fields and data types are determined; creating a data table, and designating a table name, a field name and a data type; and manually adding data into the data table, or inserting the data into the data table by using an INSERTINTO statement to obtain a database for storing order data.
In an embodiment of the present invention, the method specifically includes the following steps:
creating a data table: creating a data TABLE using an SQL statement in the format of "CREATE TABLE name ] ([ field 1] [ data type 1], [ field 2] [ data type 2],..) wherein" [ field 1] [ data type 1] "means the first field in the TABLE and its data type, e.g." OrderID INT ", means that there is one field in the TABLE called" OrderID ", the data type is integer;
adding fields: a field is added to an existing data table using an SQL statement in the format of "ALTERTABLE [ table name ] ADD [ field 3] [ data type 3]";
inserting data: data is inserted into the data table using an SQL statement in the format of "insert intoo table name ] ([ field 1], [ field 2],.) value ([ value 1], [ value 2],.)", where "[ field 1], [ field 2],." is a list of fields into which data is to be inserted, "[ value 1], [ value 2],." is a data value of the corresponding field.
102. Screening order data by adopting SQL sentences to obtain screened order data;
specifically, writing a SELECT statement according to conditions needing screening; selecting a required field from an order data table using the SELECT statement; and screening order data meeting the conditions through a WHERE clause to obtain screened order data.
In logistics order billing, screening order data typically requires consideration of a number of conditions, such as order time, shipping address, merchandise category, and the like. Here, we screen the order data using the order time and the receiving address as screening conditions. Assuming that the order data to be screened is between 1 st 2019 and 12 nd 31 st 2020, and the order data is received at the Guangdong province, the following SELECT statement may be used for screening.
In this SELECT statement, we have selected the fields order number, product name, quantity, unit price, total price, order time, and shipping address in the order data table. Meanwhile, the order time is screened as between 1 month 1 in 2019 and 12 months 31 in 2020 through a WHERE clause, and the receiving address is screened as Guangdong province (LIKE keywords can be used for fuzzy matching so as to screen out addresses beginning with Guangdong province), so that order data meeting the conditions are obtained.
In addition, specific fields may be filtered as well, as may rules for order time filtering.
103. Writing SQL sentences and calculating the cost according to the screened order data to obtain a charging result; creating rule tables
In an embodiment of the present invention, the rule table contains weight and distance based freight calculation rules including minimum and maximum weight, minimum and maximum distance, base cost, weight cost and distance cost. These rules will be used to calculate the cost of the order.
Adding rule data
In an embodiment of the invention, some example rules are inserted into the rule table for calculating the cost of orders in different weight and distance ranges. These rules can be adjusted according to actual requirements.
Calculating order cost
In the embodiment of the invention, a SELECT statement and a LEFTJOIN operation are used to match the weight and distance of each order to rules in the rules table and then calculate the cost of each order. We use the coaesece () function to ensure that if there are no matching rules, the total cost is 0.
104. Updating the charging result into the order data and displaying the order data and the charging result.
To UPDATE the billing result into the order data and display the order data and billing result, the UPDATE statement and SELECT statement of SQL may be used.
First, an UPDATE statement needs to be written to UPDATE the billing result into the order data table. Next, the SELECT statement is used to SELECT the required fields from the order data table, as well as all fields including the billing result. And finally, running the two SQL sentences to update the charging result into the order data and display the order data and the charging result.
Referring to fig. 2, a second embodiment of the billing method based on the SQL algorithm in the embodiment of the invention includes:
201. establishing a database for storing order data, wherein the order data at least comprises an order number, a product name, the quantity and unit price;
202. screening order data by adopting SQL sentences to obtain screened order data;
203. writing SQL sentences and calculating the cost according to the screened order data to obtain a charging result;
204. updating the charging result into the order data and displaying the order data and the charging result.
205. Carrying out hash algorithm calculation on the screened order data to generate a corresponding hash value; and storing the charging result and the hash value of each screened order data in a verification data table.
And calculating the hash value of each screened order data through a hash algorithm. Common hash algorithms include MD5, SHA-1, SHA-2, and the like. And storing the charging result and the hash value of each screened order data in a verification data table. And when the charging result needs to be checked, the correctness of the charging result is verified by recalculating the hash value.
The above is a basic step of verifying the screened order data using a hash algorithm. It should be noted that the hash value calculated by the hash algorithm has the characteristics of uniqueness, irreversibility, collision resistance and the like, and can effectively ensure the integrity and the safety of data. In practical application, the problems in the aspects of performance, algorithm model selection, hash value storage, management and the like of the hash algorithm also need to be considered.
206. When the charging result is required to be checked to be correct, calculating the hash value of the screened order data again to obtain a new hash value; and calculating to obtain a verification charging result according to the screened order data.
207. And comparing the new hash value with the verification charging result and the charging result in the verification data table, and if the new hash value and the verification charging result are equal to the hash value, indicating that the charging result of the order is correct.
A hash algorithm is an algorithm that compresses a message of arbitrary length to a certain fixed length, and its output result is generally called a hash value or digest. The hash algorithm has the following characteristics:
the hash algorithm is one-way, i.e. the original message cannot be deduced from the hash value.
The hash algorithm produces different hash values for any small changes to the input data.
The hash algorithm may compress an arbitrary length of input into a fixed length hash value.
In this case, a hash algorithm may be used to combine all the cost details of each order into a hash value, and compare the hash value with the hash value of the actual charging result to ensure the correctness of the charging result. The hash algorithm can avoid missing some expense details or miscalculating some expense details, and ensure the correctness of the charging result. Meanwhile, as the hash value is of a fixed length, the use of the storage space can be greatly reduced, and the query efficiency is improved.
Referring to fig. 3, a third embodiment of the billing method based on the SQL algorithm in the embodiment of the invention includes:
301. establishing a database for storing order data, wherein the order data at least comprises an order number, a product name, the quantity and unit price;
302. screening order data by adopting SQL sentences to obtain screened order data;
303. writing SQL sentences and calculating the cost according to the screened order data to obtain a charging result;
304. updating the charging result into the order data and displaying the order data and the charging result.
305. Merging the screened order data into a character string according to the sequence; encrypting the character string by using an encryption algorithm to generate a ciphertext; and storing the ciphertext of the screened order data and the actual charging result in a verification data table.
The screened order data may be combined into a string in sequence using the following steps, ciphertext is generated using an encryption algorithm, and the ciphertext and billing result are stored in a validation data table:
and creating a verification data table for storing the charging result and ciphertext of the screened order data.
And merging the screened order data into a character string according to the sequence. The fields of order number, product name, quantity, unit price, etc. may be combined into one string in a certain order using a string function of SQL (e.g., CONCAT). To avoid the problem of data inconsistency during the computational hashing and encryption process, it is necessary to ensure that the order and content of each field is consistent.
The string is encrypted using an encryption algorithm (e.g., SHA-256 or MD 5) to generate ciphertext. The string may be encrypted using an encryption function of SQL (e.g., SHA2 or MD 5).
And storing the ciphertext of the screened order data and the actual charging result in a verification data table. Corresponding fields are created in the verification data table to store the charging result and the ciphertext, and the charging result and the ciphertext of the screened order data can be inserted into the verification data table by using an INSERT statement of SQL.
It should be noted that in order to ensure accuracy of verification data, it is necessary to ensure integrity and uniqueness of the data when calculating the hash value and generating the ciphertext. Meanwhile, when storing verification data, security and confidentiality of the data also need to be ensured.
306. When the charging result is required to be checked to be correct, calculating the cost again according to the screened order data to obtain a verified charging result; combining the screened order data into a character string according to the same sequence; and encrypting the combined character strings by using an encryption algorithm to generate a new ciphertext.
307. Comparing the new ciphertext, the verification charging result with the ciphertext and the actual charging result in the verification data table, and if the new ciphertext and the verification charging result are equal to the actual charging result, indicating that the charging result of the order is correct.
An encryption algorithm is an algorithm that converts plaintext into ciphertext, and typically requires a key to perform encryption and decryption operations. Encryption algorithms can ensure confidentiality, integrity and reliability of data, and are a very important ring in network security and data protection.
The encryption algorithm can ensure the correctness of the charging result and prevent illegal users from tampering with the data. However, unlike the hash algorithm, the encryption algorithm is bi-directional, i.e., the original plaintext can be deduced from the ciphertext. Therefore, it is necessary to ensure security of the key, and prevent leakage of the key from causing leakage of data or tampering.
Referring to fig. 4, a fourth embodiment of the billing method based on the SQL algorithm in the embodiment of the invention includes:
401. establishing a database for storing order data, wherein the order data at least comprises an order number, a product name, the quantity and unit price;
402. screening order data by adopting SQL sentences to obtain screened order data;
403. writing SQL sentences and calculating the cost according to the screened order data to obtain a charging result;
404. updating the charging result into the order data and displaying the order data and the charging result.
405. Redundancy check is carried out on the screened order data, and corresponding redundancy information is generated; storing the redundant information of the screened order data and the actual charging result in a verification data table;
the method can use the following steps to carry out redundancy check on the screened order data, generate corresponding redundancy information, and store the redundancy information and the actual charging result of the screened order data in a verification data table:
and creating a verification data table for storing the charging result and redundant information of the screened order data.
And performing redundancy check on the screened order data to generate corresponding redundancy information. Redundant information for the filtered order data may be calculated using a redundant check function of SQL (e.g., CHECKSUM).
And storing the redundant information of the screened order data and the actual charging result in a verification data table. Corresponding fields are created in the verification data table to store the charging result and the redundant information, and the charging result and the redundant information of the screened order data can be inserted into the verification data table by using an INSERT statement of SQL.
406. When the charging result is required to be checked to be correct, calculating to obtain a verification charging result according to the screened order data; and performing redundancy check on the screened order data to generate new redundancy information.
407. And comparing the new redundant information and the verification charging result with the redundant information and the actual charging result in the verification data table, and if the two are equal, indicating that the charging result of the order is correct.
Redundancy check is a method of detecting and correcting errors in transmission by adding redundant information to data. The redundant information is typically generated based on the original data, and if an error occurs during transmission, the redundant information and the original data may be mismatched so that the error may be detected and corrected.
Errors in transmission can be effectively detected and corrected by using redundancy check, so that the correctness of the charging result is ensured. Different from the Hash algorithm, the redundancy check can correct errors instead of just detecting errors, and the application scene of the invention is to quickly realize calculation cost and has higher requirement on the accuracy of the charging result. Therefore, the redundancy check has a good effect.
Referring to fig. 5, a fifth embodiment of the billing method based on the SQL algorithm according to the embodiment of the present invention includes:
501. establishing a database for storing order data, wherein the order data at least comprises an order number, a product name, the quantity and unit price;
502. screening order data by adopting SQL sentences to obtain screened order data;
503. writing SQL sentences and calculating the cost according to the screened order data to obtain a charging result;
504. updating the charging result into the order data and displaying the order data and the charging result.
505. Performing checksum algorithm calculation on the screened order data to generate a corresponding checksum value; and storing the checksum value of the screened order data and the actual charging result in a verification data table.
The method comprises the following steps of calculating to obtain a verification charging result according to the screened order data, and calculating a checksum value of the screened order data to generate a new checksum value:
and according to the screening conditions, querying the screened order data from the order data table by using a SELECT statement of SQL.
And calculating the checksum value of the screened order data to generate a new checksum value. The filtered order data may be calculated using a hash function of SQL (e.g., MD 5) to generate a corresponding checksum value.
And returning the verification charging result and the checksum value to the user, and comparing the verification charging result and the checksum value with the actual charging result and the previous checksum value by the user to determine the correctness of the charging result.
It should be noted that, in order to ensure the accuracy of the check result, it is necessary to ensure the integrity and uniqueness of the data when calculating the checksum value. Meanwhile, when data is stored and transmitted, the security and confidentiality of the data also need to be ensured.
506. When the charging result is required to be checked to be correct, calculating to obtain a verification charging result according to the screened order data; and calculating the checksum value of the screened order data to generate a new checksum value.
507. And comparing the new checksum value and the verification charging result with the checksum value and the actual charging result in the verification data table, and if the new checksum value and the verification charging result are equal to the actual charging result, indicating that the charging result of the order is correct.
The checksum algorithm is an algorithm for detecting data transmission errors, and it computes data according to a certain rule to obtain a value with a fixed length, which is called checksum. In transmitting data, the sender may append a checksum to the end of the data, and the receiver calculates the checksum of the data as it is received and then compares it to the checksum provided by the sender to determine whether the data was transmitted correctly.
Errors that may occur during the calculation of the cost detail, such as digital conversion errors, truncation errors, rounding errors, etc., can be effectively detected using a checksum algorithm. And similar to the Hash algorithm, the checksum algorithm can also improve the verification efficiency and the storage efficiency of the charging result, and ensure the correctness of the charging result.
The method for modifying the dispatch address of the express mail in the embodiment of the present invention is described above, and the device for modifying the dispatch address of the express mail in the embodiment of the present invention is described below, referring to fig. 6, a charging device based on SQL algorithm is provided in a second aspect of the present invention, which includes:
601. the system comprises a building module, a storage module and a storage module, wherein the building module is used for building a database for storing order data, and the order data at least comprises order numbers, product names, quantity and unit price;
602. the screening module is used for screening the order data by adopting SQL sentences to obtain screened order data;
603. the charging module is used for writing SQL sentences and calculating the cost according to the screened order data to obtain a charging result;
604. and the updating display module is used for updating the charging result into the order data and displaying the order data and the charging result.
Fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, where the electronic device 700 may have a relatively large difference due to different configurations or performances, and may include one or more processors (central processing units, CPU) 710 (e.g., one or more processors) and a memory 720, and one or more storage media 730 (e.g., one or more mass storage devices) storing application programs 733 or data 732. Wherein memory 720 and storage medium 730 may be transitory or persistent. The program stored in the storage medium 730 may include one or more modules (not shown), each of which may include a series of instruction operations in the electronic device 700. Still further, the processor 710 may be configured to communicate with the storage medium 730 and execute a series of instruction operations in the storage medium 730 on the electronic device 700.
The electronic device 700 may also include one or more power supplies 740, one or more wired or wireless network interfaces 750, one or more input/output interfaces 750, and/or one or more operating systems 731, such as Windows Serve, mac OS X, unix, linux, freeBSD, and the like. It will be appreciated by those skilled in the art that the electronic device structure shown in fig. 7 is not limiting on the electronic device-based and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
The present invention also provides a computer readable storage medium, which may be a non-volatile computer readable storage medium, and which may also be a volatile computer readable storage medium, having instructions stored therein that, when executed on a computer, cause the computer to perform the steps of a billing method based on the SQL algorithm.
It will be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the system or apparatus and unit described above may refer to the corresponding process in the foregoing method embodiment, which is not repeated herein.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium, including instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. The SQL algorithm-based charging method is characterized by comprising the following steps of:
establishing a database for storing order data, wherein the order data at least comprises an order number, a product name, the quantity and unit price;
screening order data by adopting SQL sentences to obtain screened order data;
writing SQL sentences and calculating the cost according to the screened order data to obtain a charging result;
updating the charging result into the order data and displaying the order data and the charging result.
2. The method for billing according to claim 1, wherein creating a database storing order data, the order data including at least order number, product name, quantity, unit price, comprises:
designing a data table structure for storing order data, and determining data fields and data types;
creating a data table, and designating a table name, a field name and a data type;
and manually adding data INTO the data table, or inserting the data INTO the data table by using an INSERT INTO statement to obtain a database for storing order data.
3. The method for billing according to claim 1, wherein the step of screening the order data using SQL statements to obtain screened order data, further comprises:
writing a SELECT statement according to the conditions needing to be screened;
selecting a required field from an order data table using the SELECT statement;
and screening order data meeting the conditions through a WHERE clause to obtain screened order data.
4. The method for billing according to claim 1, wherein after updating the billing result to the order data and displaying the order data and billing result, further comprising the steps of:
carrying out hash algorithm calculation on the screened order data to generate a corresponding hash value;
storing the charging result and the hash value of each screened order data in a verification data table;
when the charging result is required to be checked to be correct, calculating the hash value of the screened order data again to obtain a new hash value;
according to the screened order data, calculating to obtain a verification charging result;
and comparing the new hash value with the verification charging result and the charging result in the verification data table, and if the new hash value and the verification charging result are equal to the hash value, indicating that the charging result of the order is correct.
5. The method for billing according to claim 1, wherein after updating the billing result to the order data and displaying the order data and billing result, further comprising the steps of:
merging the screened order data into a character string according to the sequence;
encrypting the character string by using an encryption algorithm to generate a ciphertext;
storing the ciphertext of the screened order data and the actual charging result in a verification data table;
when the charging result is required to be checked to be correct, calculating the cost again according to the screened order data to obtain a verified charging result;
combining the screened order data into a character string according to the same sequence;
encrypting the combined character strings by using an encryption algorithm to generate a new ciphertext;
comparing the new ciphertext, the verification charging result with the ciphertext and the actual charging result in the verification data table, and if the new ciphertext and the verification charging result are equal to the actual charging result, indicating that the charging result of the order is correct.
6. The method for billing according to claim 1, wherein after updating the billing result to the order data and displaying the order data and billing result, further comprising the steps of:
redundancy check is carried out on the screened order data, and corresponding redundancy information is generated;
storing the redundant information of the screened order data and the actual charging result in a verification data table;
when the charging result is required to be checked to be correct, calculating to obtain a verification charging result according to the screened order data;
performing redundancy check on the screened order data to generate new redundancy information;
and comparing the new redundant information and the verification charging result with the redundant information and the actual charging result in the verification data table, and if the two are equal, indicating that the charging result of the order is correct.
7. The method for billing according to claim 1, wherein after updating the billing result to the order data and displaying the order data and billing result, further comprising the steps of:
performing checksum algorithm calculation on the screened order data to generate a corresponding checksum value;
storing the checksum value of the screened order data and the actual charging result in a verification data table;
when the charging result is required to be checked to be correct, calculating to obtain a verification charging result according to the screened order data;
calculating the checksum value of the screened order data to generate a new checksum value;
and comparing the new checksum value and the verification charging result with the checksum value and the actual charging result in the verification data table, and if the new checksum value and the verification charging result are equal to the actual charging result, indicating that the charging result of the order is correct.
8. A billing apparatus based on an SQL algorithm, comprising:
the system comprises a building module, a storage module and a storage module, wherein the building module is used for building a database for storing order data, and the order data at least comprises order numbers, product names, quantity and unit price;
the screening module is used for screening the order data by adopting SQL sentences to obtain screened order data;
the charging module is used for writing SQL sentences and calculating the cost according to the screened order data to obtain a charging result;
and the updating display module is used for updating the charging result into the order data and displaying the order data and the charging result.
9. An electronic device comprising a memory and at least one processor, the memory having instructions stored therein;
the at least one processor invoking the instructions in the memory to cause the electronic device to perform the steps of the SQL algorithm-based billing method of any of claims 1-7.
10. A computer readable storage medium having instructions stored thereon, which when executed by a processor, implement the steps of the SQL algorithm-based billing method of any one of claims 1 to 7.
CN202310161282.2A 2023-02-24 2023-02-24 SQL algorithm-based charging method, device, equipment and storage medium Pending CN116109243A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310161282.2A CN116109243A (en) 2023-02-24 2023-02-24 SQL algorithm-based charging method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310161282.2A CN116109243A (en) 2023-02-24 2023-02-24 SQL algorithm-based charging method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116109243A true CN116109243A (en) 2023-05-12

Family

ID=86267270

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310161282.2A Pending CN116109243A (en) 2023-02-24 2023-02-24 SQL algorithm-based charging method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116109243A (en)

Similar Documents

Publication Publication Date Title
US11182366B2 (en) Comparing data stores using hash sums on disparate parallel systems
US8891768B2 (en) Increasing data security in enterprise applications by obfuscating encryption keys
US20190073646A1 (en) Consolidated blockchain-based data transfer control method and system
US20090031135A1 (en) Tamper Proof Seal For An Electronic Document
JP5785315B2 (en) Method, computer system and computer program for retrieving protected data
WO2005098571A1 (en) Methods and systems for verifying the accuracy of reported information
US20050038787A1 (en) Document authentication
CN112163412A (en) Data verification method and device, electronic equipment and storage medium
CN113822675A (en) Block chain based message processing method, device, equipment and storage medium
CN114612047A (en) Electronic bill generation method, device, equipment and storage medium
CN111866134B (en) Method and system for generating hash value and address of block chain transaction and storage medium
Zhang et al. Do you know where your data’s been?–tamper-evident database provenance
CN116109243A (en) SQL algorithm-based charging method, device, equipment and storage medium
WO2020134637A1 (en) Key component verification method and apparatus, and terminal device
US20090193224A1 (en) Techniques for reducing storage space and detecting corruption in hash-based application
CN102270323A (en) Multi-security cigarette digital anti-counterfeiting method
CN112286910A (en) Data verification method and device
CN113392077B (en) File detection method, device, equipment and storage medium
CN112015594A (en) Backup method, device and equipment of rollback file and storage medium
WO2020028732A1 (en) Linking events with lineage rules
CN113888131B (en) Block chain-based man-hour information processing method, device, equipment and storage medium
CN113468173B (en) Data storage method, device, equipment and storage medium
CN113992334B (en) Storage method and verification method and device of equipment side data and electronic equipment
CN118432953B (en) Equipment management method, device, medium and equipment applied to FTTR network
Nguyen et al. A Novel Solution to Query Assurance Verification for Dynamic Outsourced XML Databases.

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination