Method and device for realizing order state change, electronic equipment and storage medium
By receiving client identifier and version information on the server, querying product order information, and using the binary characteristics of integer power of two for XOR operation, the order status is rapidly changed, and the problems of large computing resources and low response efficiency in the prior art are solved.
Patent Information
- Application Number
- CN202411658775.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-03-11
AI Technical Summary
In the prior art, order status changes are realized through the comparison of commodity order tables and commodity equity tables, resulting in large consumption of computing resources, low response efficiency, and slow order status changes.
By receiving client identifiers and version information sent by the client, querying product order information, using the binary characteristics of integer powers of two, performing XOR operations to determine the target order status of the product, thereby achieving rapid change of order status.
Reduce database operations, avoid unnecessary waste of computing resources, improve server response efficiency, and achieve rapid order status changes.
Smart Images

Figure CN119597775A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for implementing order status change. Background Art
[0002] The rapid development of the Internet of Vehicles has greatly satisfied users' demands for vehicle comfort. Users can purchase the virtual goods they need through the client where the vehicle is located, such as steering wheel heating, seat heating, etc. Usually after purchasing the goods, it is necessary to change the order status of the goods according to the actual effectiveness, such as effective or not issued.
[0003] In the prior art, the actual status of the product order is determined by comparing the product order table with the product rights table, thereby changing the order status. However, the table-to-table comparison process consumes a lot of computing resources, which affects the response efficiency of the server and slows down the order status change. Summary of the invention
[0004] The present application provides a method, device, electronic device and storage medium for implementing order status change, which reduces database operations to a certain extent and can quickly implement order status change.
[0005] In a first aspect, the present application provides a method for implementing order status change, which is applied to a server, wherein the server is in communication connection with a client, and the method comprises:
[0006] Receive a client identifier and client version information sent by the client, and query order information of a first commodity set of the client; the order information includes a first commodity identification set, a target expiration time, and a first order status, the first order status being unissued; commodity identifications in the first commodity identification set are represented in binary using integer powers of two;
[0007] Changing the first order status to a second order status, where the second order status is issued;
[0008] Sending the first commodity identification set to the client to obtain actual expiration times of commodities in the first commodity set;
[0009] Acquire a second commodity identification set, the second commodity identification set corresponds to a second commodity set, and the actual expiration time of commodities in the second commodity set is inconsistent with the target expiration time;
[0010] Performing an XOR operation on the first total commodity identifier and the commodity identifiers in the second commodity identifier set to obtain a target order status of the commodities in the first commodity identifier set; the first total commodity identifier is obtained by performing an XOR operation on the commodity identifiers in the first commodity identifier set;
[0011] The second order status of the products in the first product set is modified to the target order status.
[0012] Optionally, performing an XOR operation on the first total commodity identifier and the commodity identifiers in the second commodity identifier set to obtain the target order status of the commodities in the first commodity set includes:
[0013] Performing an XOR operation on the first total product identification and the product identifications in the second product identification set to obtain a third product identification set, wherein the third product identification set corresponds to a third product set, and the products in the third product set are products that have been successfully installed; the first product set includes the second product set and the third product set;
[0014] Obtaining that the target order status of the products in the second product set is the first order status;
[0015] The target order status of the products in the third product set is obtained as a third order status, and the third order status is effective.
[0016] Optionally, performing an XOR operation on the first total commodity identifier and the commodity identifiers in the second commodity identifier set to obtain a third commodity identifier set includes:
[0017] Performing an XOR operation on the first total commodity identification and the commodity identifications in the second commodity identification set to obtain a second total commodity identification;
[0018] The second total commodity identification is separated to obtain the third commodity identification set.
[0019] Optionally, the method further comprises:
[0020] Obtaining a product identifier in the third product identifier set;
[0021] If the result of the AND operation of the product identifier and the second total product identifier is inconsistent with the product identifier, obtaining the product corresponding to the product identifier;
[0022] Deleting the product identifier from the third product identifier set, deleting the product from the third product set, and obtaining an updated third product identifier set and an updated third product set;
[0023] The commodity mark is added to the second commodity identification set, and the commodity is added to the second commodity set to obtain an updated second commodity identification set and an updated second commodity set.
[0024] Optionally, obtaining the second commodity identification set includes:
[0025] Obtaining a fourth product identification set, a fourth product set, and an actual expiration time corresponding to the fourth product set, wherein the fourth product identification set corresponds to the fourth product set;
[0026] Compare the target expiration time of the first product set with the actual expiration time of the fourth product set to obtain an initial product identification set; the initial product identification set corresponds to an initial product set, and the target expiration time and the actual expiration time of the products in the initial product set are inconsistent; the second product set is a subset of the fourth product set;
[0027] Obtaining an initial commodity identifier in the initial commodity identifier set;
[0028] Performing an AND operation on the initial commodity identifier and the first total commodity identifier to obtain an AND operation result;
[0029] If the AND operation result is consistent with the initial commodity identifier, the initial commodity identifier is added to the second commodity identifier set until the last initial commodity identifier in the initial commodity identifier set is obtained.
[0030] Optionally, the order information further includes an ordering effective time of the products in the first product set and an ordering useful life of the products in the first product set, and obtaining a target expiration time corresponding to the first product set includes:
[0031] The target expiration time of the commodities in the first commodity set is obtained by summing the subscription effective time and the subscription usage period.
[0032] In a second aspect, the present application further provides a device for implementing order status change, which is applied to a server, and the server is connected to a client for communication, and the device includes:
[0033] a query unit, configured to receive a client identifier and client version information sent by the client, and query order information of a first commodity set of the client; the order information includes a first commodity identification set, a target expiration time, and a first order status, the first order status being unissued; commodity identifications in the first commodity identification set are represented in binary using integer powers of two;
[0034] A first state changing unit, used to change the first order state to a second order state, where the second order state is issued;
[0035] a sending unit, configured to send the first commodity identification set to the client, so as to obtain actual expiration times of commodities in the first commodity set;
[0036] An acquiring unit, configured to acquire a second commodity identification set, wherein the second commodity identification set corresponds to a second commodity set, and the actual expiration time of commodities in the second commodity set is inconsistent with the target expiration time;
[0037] an obtaining unit, configured to perform an XOR operation on the first total commodity identifier and the commodity identifiers in the second commodity identifier set to obtain a target order status of the commodities in the first commodity identifier set; the first total commodity identifier is obtained by performing an XOR operation on the commodity identifiers in the first commodity identifier set;
[0038] The second state changing unit changes the second order state of the goods in the first product set to the target order state.
[0039] Optionally, the obtaining unit includes:
[0040] an XOR operation module, configured to perform an XOR operation on the first total product identifier and the product identifiers in the second product identifier set to obtain a third product identifier set, wherein the third product identifier set corresponds to a third product set, and the products in the third product set are products that have been successfully installed; the first product set includes the second product set and the third product set;
[0041] A first obtaining module, configured to obtain a target order status of a commodity in the second commodity set as the first order status;
[0042] The second obtaining module is used to obtain that the target order status of the products in the third product set is a third order status, and the third order status is effective.
[0043] Optionally, the XOR operation module is specifically used to:
[0044] Performing an XOR operation on the first total commodity identification and the commodity identifications in the second commodity identification set to obtain a second total commodity identification;
[0045] The second total commodity identification is separated to obtain the third commodity identification set.
[0046] Optionally, the XOR operation module is further used for:
[0047] Obtaining a product identifier in the third product identifier set;
[0048] If the result of the AND operation of the product identifier and the second total product identifier is inconsistent with the product identifier, obtaining the product corresponding to the product identifier;
[0049] Deleting the product identifier from the third product identifier set, deleting the product from the third product set, and obtaining an updated third product identifier set and an updated third product set;
[0050] The commodity mark is added to the second commodity identification set, and the commodity is added to the second commodity set to obtain an updated second commodity identification set and an updated second commodity set.
[0051] Optionally, the acquisition unit is specifically used to:
[0052] Obtaining a fourth product identification set, a fourth product set, and an actual expiration time corresponding to the fourth product set, wherein the fourth product identification set corresponds to the fourth product set;
[0053] Compare the target expiration time of the first product set with the actual expiration time of the fourth product set to obtain an initial product identification set; the initial product identification set corresponds to an initial product set, and the target expiration time and the actual expiration time of the products in the initial product set are inconsistent; the second product set is a subset of the fourth product set;
[0054] Obtaining an initial commodity identifier in the initial commodity identifier set;
[0055] Performing an AND operation on the initial commodity identifier and the first total commodity identifier to obtain an AND operation result;
[0056] If the AND operation result is consistent with the initial commodity identifier, the initial commodity identifier is added to the second commodity identifier set until the last initial commodity identifier in the initial commodity identifier set is obtained.
[0057] Optionally, the order information further includes the ordering effective time of the commodities in the first commodity set and the ordering useful life of the commodities in the first commodity set. The query unit is further configured to:
[0058] The target expiration time of the commodities in the first commodity set is obtained by summing the subscription effective time and the subscription usage period.
[0059] In a third aspect, the present application further provides an electronic device, the electronic device comprising a processor and a memory:
[0060] The memory is used to store computer programs;
[0061] The processor is used to execute the method provided in the first aspect according to the computer program.
[0062] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and the computer program is used to execute the method provided in the first aspect above.
[0063] It can be seen that this application has the following beneficial effects:
[0064] The present application provides a method, device, electronic device and storage medium for implementing order status change. In the method, a client identifier and client version information sent by a client are received, and order information of a first product set of the client is queried; the order information includes a first product identification set, a target expiration time and a first order status, and the first order status is not issued; the product identifications in the first product identification set are represented by a binary number corresponding to an integer power of two; the first order status is modified to a second order status, and the second order status is issued; the first product identification set is sent to the client to obtain the actual expiration time of the products in the first product set; the second product identification set is obtained, the second product identification set corresponds to the second product set, and the actual expiration time and target expiration time of the products in the second product set are inconsistent; an XOR operation is performed on the product identifications in the first total product identification and the second product identification set to obtain the target order status of the products in the first product set; the first total product identification is obtained by performing an OR operation on the product identifications in the first product identification set; and the second order status of the products in the first product set is modified to the target order status.
[0065] In this way, the product identification is represented by binary using an integer power of two, and the binary characteristics of an integer power of two are utilized to obtain the product that failed to be installed based on the product identification and the actual expiration time. Then, the successfully installed product can be obtained based on the first total product identification and the product identification of the product that failed to be installed, thereby realizing the order status change. Moreover, because the entire process is the interaction between the product identification and the actual expiration time, compared with the existing technology, database operations are reduced, unnecessary waste of computing resources is avoided, and the order status change can be realized quickly. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0067] Figure 1 A flowchart of a method for implementing order status change in an embodiment of the present application;
[0068] Figure 2This is a flow chart of an embodiment of a method for implementing order status change in an embodiment of the present application;
[0069] Figure 3 A schematic diagram of the structure of a device 300 for implementing order status change provided in an embodiment of the present application;
[0070] Figure 4 A schematic diagram of the structure of an electronic device 400 provided in an embodiment of the present application. DETAILED DESCRIPTION
[0071] The multiple involved in the embodiments of the present application means greater than or equal to two. It should be noted that in the description of the embodiments of the present application, the words "first", "second", etc. are only used for the purpose of distinguishing the description, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying an order.
[0072] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the embodiments of the present application are further described in detail below in conjunction with the accompanying drawings and specific implementation methods. It is understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. In addition, it should be noted that, for ease of description, only the parts related to the present application are shown in the accompanying drawings, not all structures.
[0073] In the prior art, the actual status of the product order is determined by comparing the product order table with the product rights table, thereby changing the order status. However, the table-to-table comparison process consumes a lot of computing resources, which affects the response efficiency of the server and slows down the order status change.
[0074] Based on this, an embodiment of the present application provides a method, device, electronic device and storage medium for implementing order status change. In the method, a client identifier and client version information sent by a client are received, and order information of a first product set of the client is queried; the order information includes a first product identification set, a target expiration time and a first order status, and the first order status is not issued; the product identification in the first product identification set uses a binary representation corresponding to an integer power of two; the first order status is modified to a second order status, and the second order status is issued; the first product identification set is sent to the client to obtain the actual expiration time of the products in the first product set; the second product identification set is obtained, the second product identification set corresponds to the second product set, and the actual expiration time and target expiration time of the products in the second product set are inconsistent; an XOR operation is performed on the first total product identification and the product identification in the second product identification set to obtain the target order status of the products in the first product set; the first total product identification is obtained by performing an OR operation on the product identification in the first product identification set; the second order status of the products in the first product set is modified to the target order status.
[0075] In this way, the product identification is set to use the binary representation of an integer power of two, and the binary characteristics of an integer power of two are utilized to obtain the product that failed to be installed based on the product identification and the actual expiration time. Then, the successfully installed product can be obtained based on the first total product identification and the product identification of the product that failed to be installed, thereby realizing the order status change. Moreover, because the entire process is the interaction between the product identification and the actual expiration time, compared with the existing technology, it reduces database operations, avoids unnecessary waste of computing resources, and can realize rapid realization of order status changes.
[0076] To facilitate understanding of the specific implementation of the method for implementing order status change provided in the embodiment of the present application, it will be described below with reference to the accompanying drawings.
[0077] It should be noted that the subject implementing the method for changing the order status may be the device for changing the order status provided in the embodiment of the present application, and the device for changing the order status may be carried in an electronic device or a functional module of an electronic device. The electronic device of the embodiment of the present application may be any device capable of implementing the method for changing the order status in the embodiment of the present application, such as an Internet of Things (IoT) device.
[0078] See also Figure 1 , Figure 1 A flow chart of a method for implementing order status change provided in an embodiment of the present application is provided. The method can be applied to a device for implementing order status change. The device for implementing order status change can be as follows: Figure 3 The device 300 for implementing order status change shown in FIG. Figure 4 Functional modules in the electronic device 400 are shown.
[0079] like Figure 1 As shown, the method may include, for example:
[0080] S10: Receive the client identifier and client version information sent by the client, and query the order information of the first commodity set of the client.
[0081] It should be noted that the order information includes a first product identification set, a target expiration time, and a first order status. Since the first order status is the default order status generated when creating an order, the first order status is not issued. The product identifications in the first product identification set use binary representations corresponding to integer powers of two. The first product identification set corresponds to the first product set. The products in the first product set can be one or more, which does not affect the implementation of the embodiments of the present application.
[0082] As an example, the first product set includes product 1, product 2, and product 3, and the product identifiers in the first product identifier set are binary 10 (product identifier of product 1), binary 01 (product identifier of product 2), and binary 100 (product identifier of product 3). It can be understood that 10=2 1 , 01 = 2 0 , 100 = 2 2 , so the product identification in the product identification set is called the binary representation corresponding to the integer power of two.
[0083] It should be noted that the target expiration time is used to characterize the future expiration time of the product after normal purchase. In a possible implementation, the order information also includes the ordering effective time of the products in the first product set and the ordering use period of the products in the first product set, then the process of obtaining the target expiration time may include: summing the ordering effective time and the ordering use period to obtain the target expiration time of the products in the first product set.
[0084] As an example, the ordering effective time of product 1 is 00:00 on January 1st, and the ordering period is 31 days, then the target expiration time of product 1 is 23:59 on January 31st; the ordering effective time of product 2 is 00:00 on January 1st, and the ordering period is 31 days, then the target expiration time of product 2 is 23:59 on January 31st; the ordering effective time of product 3 is 00:00 on January 1st, and the ordering period is 31 days, then the target expiration time of product 3 is 23:59 on January 31st.
[0085] S20: Change the first order status to the second order status.
[0086] It should be noted that the status of the second order is issued.
[0087] In the specific implementation process, when the client purchases the first set of goods, the first order status generated is not issued by default. After the server obtains the order information of the first set of goods after querying, it proves that the client has purchased it, and the server will change the unissued status to the issued status. It should be noted that the issued status at this time is unconfirmed, and subsequent steps S30 to S60 need to be performed to determine whether the goods are successfully effective on the client. If they are successfully effective, the issued status will be changed to the effective status. If they are not successfully effective, the issued status needs to be changed to the unissued status, thereby ensuring the correct change of the order status of the goods during the entire ordering process, and avoiding changing the order status of incorrectly effective goods to issued.
[0088] S30: Send the first commodity identification set to the client to obtain the actual expiration time of the commodities in the first commodity set.
[0089] As an example, the product identifiers 10, 01, and 100 of product 1, product 2, and product 3 are sent to the client respectively, so that the client can query and obtain the corresponding actual expiration time according to the product identifiers. Assume that the actual expiration time of product 1 is 23:59 on January 31, the actual expiration time of product 2 is 23:59 on January 31, and the actual expiration time of product 3 is 00:00 on January 30.
[0090] In a possible implementation, the embodiment of the present application will also send the first total product identifier to the client in order to accurately obtain the actual expiration time of each product corresponding to the first total product identifier. The first total product identifier is obtained by performing an OR operation on the product identifiers in the first product identifier set. The calculation process of the first total product identifier refers to the relevant description in S50.
[0091] S40: Obtain a second product identification set.
[0092] It should be noted that the second product identification set corresponds to the second product set, and the actual expiration time and the target expiration time of the products in the second product set are inconsistent.
[0093] As an example, it can be obtained that the target expiration time and the actual expiration time of commodity 3 are inconsistent, so the second commodity set includes commodity 3, and the second commodity identifier set includes 100.
[0094] In a possible implementation, the client may send the product identifier and actual expiration time of other products, which are not required by the server. Therefore, in order to prevent the situation where the product identifier and actual expiration time returned by the client are not required by the server, it is necessary to perform an AND operation result judgment on the returned product identifier, and S40 may include:
[0095] S401: Acquire a fourth commodity identification set, a fourth commodity set, and an actual expiration time corresponding to the fourth commodity set, wherein the fourth commodity identification set corresponds to the fourth commodity set.
[0096] S402: Compare the target expiration time of the first product set with the actual expiration time of the fourth product set to obtain an initial product identifier set.
[0097] It should be noted that the initial product identification set corresponds to the initial product set, and the target expiration time of the products in the initial product set is inconsistent with the actual expiration time; the second product set is a subset of the fourth product set.
[0098] S403: Obtain an initial commodity identifier in the initial commodity identifier set.
[0099] S404: Perform an AND operation on the initial commodity identifier and the first total commodity identifier to obtain an AND operation result.
[0100] It should be noted that the first general commodity identifier refers to the relevant description in S50.
[0101] S405: If the result of the AND operation is consistent with the initial commodity identifier, the initial commodity identifier is added to the second commodity identifier set until the last initial commodity identifier in the initial commodity identifier set is obtained.
[0102] As an example, the first commodity identification set includes 10, 01 and 100, and the fourth commodity identification set includes 10, 01, 100 and 1000; the initial commodity identification set obtained by comparison, in which the target expiration time and the actual expiration time are inconsistent, includes 100 and 1000. If 100 is obtained in the initial commodity identification, 100 and 111 are ANDed, that is, 100and 111=100, 100=100, then 100 is determined to be a commodity in the first commodity set; if 1000 is obtained in the initial commodity identification, 1000 and 111 are ANDed, that is, 1000and 111=0000, 1000≠0000, then 1000 is determined not to be a commodity in the first commodity set, and the second commodity identification set finally obtained includes 100.
[0103] S50: Perform an XOR operation on the first total product identifier and the product identifiers in the second product identifier set to obtain a target order state of the first product set.
[0104] It should be noted that the first total product identifier is obtained by performing an OR operation on the product identifiers in the first product identifier set. The OR operation means that the result bit is 1 if there is 1 in the bit value, otherwise it is 0; the XOR operation means that the result bit is 0 if the bit values are the same, otherwise it is 1. The target order status includes not issued or effective.
[0105] As an example, first perform a bitwise OR operation on 10, 01, and 100, 10or 01or 100=111, that is, obtain the first total product identification of 111. Then perform an XOR operation on 111 and 100, 111xor100=011. Since the product identification uses the binary property corresponding to the integer power of two, 011 can only be divided into 10 and 01. Therefore, the XOR operation can not only filter out 111 with inconsistent effective time, but also obtain the set of products that have been successfully effective according to the result, that is, obtain the target order status of each product in the first product set.
[0106] In a possible implementation, S50 provided in the embodiment of the present application may include: S501: perform an XOR operation on the first total product identification and the product identification in the second product identification set to obtain a third product identification set, the third product identification set corresponds to the third product set, and the products in the third product set are successfully installed products; the first product set includes the second product set and the third product set. S502: obtain the target order status of the products in the second product set as the first order status. S503: obtain the target order status of the products in the third product set as the third order status, and the third order status is effective.
[0107] As an example, the first total product identifier is 111, the second product identifier set includes 100, the second product set includes product 3, the third product identifier set includes 011, and the third product set includes product 1 and product 2. Then the target order status for product 3 is not issued, and the target product order status for products 1 and 2 is effective.
[0108] As another example, the first total product identification is 111, and the second product identification set includes at least two product identifications, for example, the second product identification set includes 01 and 100, then 01xor 100=101, 111xor 101=10, and the third product identification set obtained at this time includes 10.
[0109] In one possible implementation, S501 provided in an embodiment of the present application may include: performing an XOR operation on the first total product identification and the product identification in the second product identification set to obtain the second total product identification; the second total product identification is used to represent the set of successfully installed products; and separating the second total product identification to obtain a third product identification set.
[0110] As an example, the first total product identification is 111, and the second product identification set includes 100. An XOR operation is performed on 111 and 100, 111xor 100=011, that is, the second total product identification is 011. Because the product identification uses the binary property corresponding to the integer power of two, the second total product identification can be divided into 10 and 01, and the obtained third product identification set includes 10 and 01.
[0111] In one possible implementation, in order to ensure the accuracy of the target order status obtained, the order status of the products in the third product set that have been successfully installed can be judged again to avoid errors. Then, after S503, the method provided in the embodiment of the present application may further include: obtaining the product identification in the third product identification set; if the result of the AND operation of the product identification and the second total product identification is inconsistent with the product identification, obtaining the product corresponding to the product identification; deleting the product identification from the third product identification set, deleting the product from the third product set, and obtaining an updated third product identification set and an updated third product set; adding the product tag to the second product identification set, adding the product to the second product set, and obtaining an updated second product identification set and an updated second product set.
[0112] As an example, the third product identification set includes 10 and 01, the second total product identification = 011, 011and 10 = 10, 011and 01 = 01, and the result of the AND operation of the product identification and the second total product identification is consistent with the product identification, so the order status of the products corresponding to 10 and 01 is actually modified to be effective. If the result of the AND operation of the product identification and the second total product identification is inconsistent with the product identification, the corresponding product identification is deleted from the third product identification set indicating successful installation, and the corresponding product identification is added to the second product identification set indicating failed installation; the corresponding product is deleted from the third product set, and the corresponding product is added to the second product set, so that the order status of the product can be changed based on the updated second product set and the updated third product set.
[0113] S60: Modify the second order status of the products in the first product set to the target order status.
[0114] It should be noted that the first product set is regarded as the total set, and the first product set can be divided into the second product set and the third product set. In the specific implementation process, the products in the first product set and the second product set are modified from "has been issued" to "has not been issued", and the products in the first product set and the third product set are modified from "has been issued" to "has taken effect".
[0115] It can be seen that through the method provided in the embodiment of the present application, the binary characteristics of integer powers of two are utilized, and the products that failed to be installed can be obtained according to the product identification and the actual expiration time; and then the successfully installed products can be obtained according to the first total product identification and the product identification of the product that failed to be installed, thereby realizing the order status change. Moreover, because the entire process is the interaction between the product identification and the actual expiration time, compared with the prior art, on the one hand, it reduces database operations and improves the response efficiency of the server. On the other hand, it avoids unnecessary waste of computing resources, reduces the traffic consumption of the interaction process, and can realize the rapid realization of order status changes.
[0116] In order to make the method provided in the embodiment of the present application clearer and easier to understand, Figure 1 A specific example of this method is described in the following scenario.
[0117] Prior to this, the calculation method that may be involved in the embodiments of the present application is explained:
[0118] ①BigInteger.or() is used to perform a bitwise OR operation on two bigIntegers; that is, as long as there is 1 in the bit value, the result bit is 1, otherwise it is 0;
[0119] ②BigInteger.and() is used to perform a bitwise AND operation on two bigIntegers; that is, if both bit values are 1, the result bit is 1, otherwise it is 0;
[0120] ③BigInteger.xor() is used to perform a bitwise XOR operation on two bigIntegers; that is, the result bit is 0 if the bit values are the same, otherwise it is 1;
[0121] In the specific implementation process, the server side can be, for example, the cloud side, and the client side can be, for example, the vehicle side. There are usually three database tables in the cloud side, namely, the product table, the vehicle side order table, and the vehicle side product rights table. The product table is a database table for storing products that users can purchase. Products have the concepts of versions and parts. For example, a product can be installed on part A of version A.1.1. The vehicle side order table is the auxiliary functions purchased by the vehicle side, and each purchased product corresponds to an order. The product rights table is a usage rights table for products purchased by the vehicle side, recording the usage time range of the products.
[0122] like Figure 2 As shown in the flowchart, this embodiment may include:
[0123] S11: The vehicle goes online and reports its identification to the cloud.
[0124] It should be noted that the vehicle side usually refers to the equipment or software installed on the vehicle side. The vehicle side online means that the equipment or software on the vehicle side has been started and is online, and can transmit and communicate data with the cloud. The vehicle side identification is used to realize the unique identity authentication and data tracking of the vehicle.
[0125] Usually before S11, the vehicle has reported the current version of the vehicle to the cloud, and the cloud updates the version of the vehicle on the cloud. In the specific implementation process, when a user purchases a product on the vehicle and creates an order, the default order status is not issued.
[0126] S21: The cloud queries the order set of the goods purchased by the vehicle according to the vehicle-side identification and the current version of the vehicle-side, modifies the order status corresponding to each order in the order set to the issued status, calculates the first total TCN, and sends the first total TCN and the product order information to the vehicle-side.
[0127] It should be noted that the commodity order information includes the commodity TCN, the commodity effective time and the commodity target expiration time, and the first total TCN is obtained by performing an OR operation on the commodity TCN.
[0128] In a possible implementation, S21 provided in the embodiment of the present application may include:
[0129] S211: Query the order set of the goods purchased by the vehicle. S212: Calculate the effective time of the vehicle's use of the goods based on the purchase time of each order in the order set, and obtain the target expiration time of each order. As an example, expiration time = effective time + number of days for purchase of all orders of the goods; the effective time is the current time, where the effective time can be the current time corresponding to the purchase. S213: Calculate the first total TCN based on new BigInteger(commodityTCN).or(new BigInteger(commodityTCN)).
[0130] S31: The vehicle reports the first total TCN, product TCN and actual expiration time to the cloud.
[0131] S41: The cloud updates the order status of the purchased product order according to the first total TCN reported by the vehicle end, and the order status includes effective and not issued.
[0132] In a possible implementation, S41 provided in the embodiment of the present application may include:
[0133] S411: The cloud queries the product list based on the product TCN reported by the vehicle.
[0134] S412: Compare the actual expiration time of the product reported by the vehicle end with the target expiration time of the product queried in the cloud.
[0135] It should be noted that if the actual expiration time is different from the target expiration time, the comparison result is obtained according to new BigInteger(first total TCN).and(new BigInteger(product TCN)).equals(new BigInteger(product TCN)).
[0136] During the specific execution process, if the comparison results are different, it proves that the vehicle side has a product TCN that is not recognized by the cloud side, and the second total TCN is not calculated; if the comparison results are the same, the second total TCN is calculated according to new BigInteger(first total TCN).xor(newBigInteger(product TCN)).
[0137] It should be noted that when the vehicle fails to install a product, if S412 is not executed, the status in the cloud will become effective, which is inconsistent with the actual situation. By executing S412, the failed product TCN can be filtered out to avoid setting the order status of the failed product to effective. After S412, the failed product status, effective time, and expiration time are rolled back, waiting for the next trigger of the vehicle to generate product information.
[0138] S413: According to the second total TCN, the successfully installed product set and the rolled back product set of the vehicle are obtained, and according to the successfully installed product set and the rolled back product set, the order status of the purchased product order is updated.
[0139] It should be noted that the second total TCN is the TCN of the product that is successfully installed on the vehicle. This successfully installed product set is looped. If new BigInteger(second total TCN).and(new BigInteger(product TCN)) is not equal to the product TCN, the order information of the product is put into the rollback set and deleted from the successfully installed product set. The product loop in the successfully installed product set ends, the order status in the successfully installed product set is changed to effective, the order status in the rollback set is changed to not issued, and the effective time and expiration time are changed to empty.
[0140] Thus, in the embodiment of the present application, the BigInteger function is used to calculate the data, and the goods purchased on the vehicle side can be known only based on the total TCN, and it can be determined whether the goods are actually successfully installed on the vehicle side. Specifically, the total TCN and the actual expiration time can be used to know the failed installation goods, which reduces the database operation, improves the response efficiency of the service, and at the same time, the order status can be modified in one session, which can effectively avoid the traffic consumption caused by unnecessary vehicle-cloud interaction.
[0141] See also Figure 3 The embodiment of the present application also provides a device 300 for implementing order status change. Applied to a server, the server communicates with a client, and the device 300 includes:
[0142] A query unit 301 is configured to receive a client identifier and client version information sent by the client, and query order information of a first commodity set of the client; the order information includes a first commodity identification set, a target expiration time, and a first order status, the first order status being unissued; commodity identifications in the first commodity identification set are represented in binary using integer powers of two;
[0143] A first state changing unit 302, configured to change the first order state to a second order state, wherein the second order state is issued;
[0144] A sending unit 303, configured to send the first commodity identification set to the client, so as to obtain actual expiration times of commodities in the first commodity set;
[0145] An acquiring unit 304 is configured to acquire a second commodity identification set, where the second commodity identification set corresponds to a second commodity set, and the actual expiration time of commodities in the second commodity set is inconsistent with the target expiration time;
[0146] The obtaining unit 305 is configured to perform an XOR operation on the first total commodity identifier and the commodity identifiers in the second commodity identifier set to obtain the target order status of the commodities in the first commodity identifier set; the first total commodity identifier is obtained by performing an XOR operation on the commodity identifiers in the first commodity identifier set;
[0147] The second state changing unit 306 changes the second order state of the product in the first product set to the target order state.
[0148] Optionally, the obtaining unit 305 includes:
[0149] an XOR operation module, configured to perform an XOR operation on the first total product identifier and the product identifiers in the second product identifier set to obtain a third product identifier set, wherein the third product identifier set corresponds to a third product set, and the products in the third product set are products that have been successfully installed; the first product set includes the second product set and the third product set;
[0150] A first obtaining module, configured to obtain a target order status of a commodity in the second commodity set as the first order status;
[0151] The second obtaining module is used to obtain that the target order status of the products in the third product set is a third order status, and the third order status is effective.
[0152] Optionally, the XOR operation module is specifically used to:
[0153] Performing an XOR operation on the first total commodity identification and the commodity identifications in the second commodity identification set to obtain a second total commodity identification;
[0154] The second total commodity identification is separated to obtain the third commodity identification set.
[0155] Optionally, the XOR operation module is further used for:
[0156] Obtaining a product identifier in the third product identifier set;
[0157] If the result of the AND operation of the product identifier and the second total product identifier is inconsistent with the product identifier, obtaining the product corresponding to the product identifier;
[0158] Deleting the product identifier from the third product identifier set, deleting the product from the third product set, and obtaining an updated third product identifier set and an updated third product set;
[0159] The commodity mark is added to the second commodity identification set, and the commodity is added to the second commodity set to obtain an updated second commodity identification set and an updated second commodity set.
[0160] Optionally, the acquiring unit 304 is specifically configured to:
[0161] Obtaining a fourth product identification set, a fourth product set, and an actual expiration time corresponding to the fourth product set, wherein the fourth product identification set corresponds to the fourth product set;
[0162] Compare the target expiration time of the first product set with the actual expiration time of the fourth product set to obtain an initial product identification set; the initial product identification set corresponds to an initial product set, and the target expiration time and the actual expiration time of the products in the initial product set are inconsistent; the second product set is a subset of the fourth product set;
[0163] Obtaining an initial commodity identifier in the initial commodity identifier set;
[0164] Performing an AND operation on the initial commodity identifier and the first total commodity identifier to obtain an AND operation result;
[0165] If the AND operation result is consistent with the initial commodity identifier, the initial commodity identifier is added to the second commodity identifier set until the last initial commodity identifier in the initial commodity identifier set is obtained.
[0166] Optionally, the order information further includes the ordering effective time of the products in the first product set and the ordering useful life of the products in the first product set. The query unit 301 is further configured to:
[0167] The target expiration time of the commodities in the first commodity set is obtained by summing the subscription effective time and the subscription usage period.
[0168] It should be noted that the specific implementation method of the device 300 and the technical effects achieved can be found in Figure 1 or Figure 2 The relevant description in the method shown.
[0169] In addition, the present application embodiment also provides an electronic device 400, such as Figure 4 As shown, the electronic device 400 includes a processor 401 and a memory 402:
[0170] The memory 402 is used to store computer programs;
[0171] The processor 401 is used to execute according to the computer program Figure 1 or Figure 2 The method provided.
[0172] In addition, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and the computer program is used to execute the method provided by the embodiment of the present application.
[0173] Through the description of the above implementation methods, it can be known that those skilled in the art can clearly understand that all or part of the steps in the above-mentioned embodiment method can be implemented by means of software plus a general hardware platform. Based on such an understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a storage medium, such as a read-only memory (ROM) / RAM, a magnetic disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network communication device such as a router) to execute the methods described in each embodiment of the present application or some parts of the embodiments.
[0174] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is only schematic, in which the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the goals of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.
[0175] The above is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. It should be noted that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the present application, and these improvements and modifications should also be regarded as the protection scope of the present application.
Claims
1. A method for implementing order status change, characterized in that: Applied to a server, the server is connected to a client for communication, and the method includes: Receive a client identifier and client version information sent by the client, and query order information of a first commodity set of the client; the order information includes a first commodity identification set, a target expiration time, and a first order status, the first order status being unissued; commodity identifications in the first commodity identification set are represented in binary using integer powers of two; Changing the first order status to a second order status, where the second order status is issued; Sending the first commodity identification set to the client to obtain actual expiration times of commodities in the first commodity set; Acquire a second commodity identification set, the second commodity identification set corresponds to a second commodity set, and the actual expiration time of commodities in the second commodity set is inconsistent with the target expiration time; Performing an XOR operation on the first total commodity identifier and the commodity identifiers in the second commodity identifier set to obtain a target order status of the commodities in the first commodity identifier set; the first total commodity identifier is obtained by performing an XOR operation on the commodity identifiers in the first commodity identifier set; The second order status of the products in the first product set is modified to the target order status.
2. The method according to claim 1, characterized in that The performing an XOR operation on the first total commodity identifier and the commodity identifiers in the second commodity identifier set to obtain the target order status of the commodities in the first commodity set includes: Performing an XOR operation on the first total product identification and the product identifications in the second product identification set to obtain a third product identification set, wherein the third product identification set corresponds to a third product set, and the products in the third product set are products that have been successfully installed; the first product set includes the second product set and the third product set; Obtaining that the target order status of the products in the second product set is the first order status; The target order status of the products in the third product set is obtained as a third order status, and the third order status is effective.
3. The method according to claim 2, characterized in that The performing an XOR operation on the first total commodity identifier and the commodity identifiers in the second commodity identifier set to obtain a third commodity identifier set includes: Performing an XOR operation on the first total commodity identification and the commodity identifications in the second commodity identification set to obtain a second total commodity identification; The second total commodity identification is separated to obtain the third commodity identification set.
4. The method according to claim 3, characterized in that The method further comprises: Obtaining a product identifier in the third product identifier set; If the result of the AND operation of the product identifier and the second total product identifier is inconsistent with the product identifier, obtaining the product corresponding to the product identifier; Deleting the product identifier from the third product identifier set, deleting the product from the third product set, and obtaining an updated third product identifier set and an updated third product set; The commodity mark is added to the second commodity identification set, and the commodity is added to the second commodity set to obtain an updated second commodity identification set and an updated second commodity set.
5. The method according to claim 1, characterized in that The obtaining of the second commodity identification set includes: Obtaining a fourth product identification set, a fourth product set, and an actual expiration time corresponding to the fourth product set, wherein the fourth product identification set corresponds to the fourth product set; Compare the target expiration time of the first product set with the actual expiration time of the fourth product set to obtain an initial product identification set; the initial product identification set corresponds to an initial product set, and the target expiration time and the actual expiration time of the products in the initial product set are inconsistent; the second product set is a subset of the fourth product set; Obtaining an initial commodity identifier in the initial commodity identifier set; Performing an AND operation on the initial commodity identifier and the first total commodity identifier to obtain an AND operation result; If the AND operation result is consistent with the initial commodity identifier, the initial commodity identifier is added to the second commodity identifier set until the last initial commodity identifier in the initial commodity identifier set is obtained.
6. The method according to claim 1, characterized in that The order information also includes the ordering effective time of the commodities in the first commodity set and the ordering useful life of the commodities in the first commodity set. The method further includes: The target expiration time of the commodities in the first commodity set is obtained by summing the subscription effective time and the subscription usage period.
7. A device for implementing order status change, characterized in that: Applied to a server, the server is connected to a client for communication, and the device comprises: a query unit, configured to receive a client identifier and client version information sent by the client, and query order information of a first commodity set of the client; the order information includes a first commodity identification set, a target expiration time, and a first order status, the first order status being unissued; commodity identifications in the first commodity identification set are represented in binary using integer powers of two; A first state changing unit, used to change the first order state to a second order state, where the second order state is issued; a sending unit, configured to send the first commodity identification set to the client, so as to obtain actual expiration times of commodities in the first commodity set; An acquiring unit, configured to acquire a second commodity identification set, wherein the second commodity identification set corresponds to a second commodity set, and the actual expiration time of commodities in the second commodity set is inconsistent with the target expiration time; an obtaining unit, configured to perform an XOR operation on the first total commodity identifier and the commodity identifiers in the second commodity identifier set to obtain a target order status of the commodities in the first commodity identifier set; the first total commodity identifier is obtained by performing an XOR operation on the commodity identifiers in the first commodity identifier set; The second state changing unit changes the second order state of the goods in the first product set to the target order state.
8. The device according to claim 7, characterized in that The obtaining unit comprises: an XOR operation module, configured to perform an XOR operation on the first total product identifier and the product identifiers in the second product identifier set to obtain a third product identifier set, wherein the third product identifier set corresponds to a third product set, and the products in the third product set are products that have been successfully installed; the first product set includes the second product set and the third product set; A first obtaining module, configured to obtain a target order status of a commodity in the second commodity set as the first order status; The second obtaining module is used to obtain that the target order status of the products in the third product set is a third order status, and the third order status is effective.
9. An electronic device, characterized in that: The electronic device comprises a processor and a memory: The memory is used to store computer programs; The processor is configured to execute the method according to any one of claims 1 to 6 according to the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and the computer program is used to execute the method according to any one of claims 1 to 6.