Data processing method and device, medium, equipment and computer program product

By updating the available quantity in the cache and database and combining the verification status, the data consistency problem of the refund results of the e-commerce transaction system is solved, and data consistency processing is achieved in resource-constrained scenarios, and data processing methods are suitable for the e-commerce transaction system.

CN120278790APending Publication Date: 2025-07-08BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510400025.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-31
Publication Date
2025-07-08

AI Technical Summary

Technical Problem

In e-commerce transactions, merchant business systems under the distributed architecture are difficult to ensure data consistency of the refund order verification results when network failures are made, especially when cached databases cannot support distributed transaction protocols, resulting in data inconsistency problems during data processing.

Method used

By updating the first available quantity in the cache and creating data records, and updating the second available quantity in the database in combination with the write-off status to ensure data consistency, the data consistency problem in scenarios where cached databases cannot support distributed transaction protocols.

Benefits of technology

实现了在有限资源场景下数据处理的数据一致性,克服了分布式事务对数据库的高要求和资源消耗大的问题,拓宽了方法的使用范围。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120278790A_ABST
    Figure CN120278790A_ABST
Patent Text Reader

Abstract

A data processing method, apparatus, medium, device and computer program product, the method comprising: in response to receiving cancel-after-verification data, updating a first available quantity of the cancel-after-verification data in a cache according to the cancel-after-verification data; if it is determined that the first available quantity is successfully updated, creating a data record corresponding to the cancel-after-verification data; determining a cancel-after-verification state of the data record based on the cancel-after-verification data According to the cancel-after-verification state of the data record, a second available quantity of the cancel-after-verification data in the database is updated, and the initial value of the first available quantity is the same as the initial value of the second available quantity. Therefore, the data consistency in the data processing process can be ensured by combining the second available quantity in the database and the first available quantity in the cache. Moreover, based on the scheme disclosed by the invention, the problems of high requirements of distributed transactions on a database and high resource consumption are solved, the method can be suitable for data processing in a scene with limited resources, and the application range of the method disclosed by the invention is widened.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing, and in particular, to a data processing method, apparatus, medium, device, and computer program product. Background Art

[0002] In the e-commerce transaction process, when a user conducts a transaction and triggers a deduction operation, the merchant needs to bear additional expenses such as order-related service fees and insurance fees. Merchant business parties associated with the merchant, such as service-providing business parties or insurance-providing business parties, etc., can provide certain order discounts or subsidies for the merchant. For example, a certain number of free order discounts can be provided for the merchant. Taking insurance services as an example, the insurance business party can give 1000 free orders to the merchant, that is, within 1000 orders, the insurance premium required for each order generated by the user at this merchant is borne by the business party, and the merchant does not need to pay, so as to achieve subsidies for the merchant.

[0003] In actual application scenarios, the systems of merchant business parties are usually built using a distributed architecture to ensure high availability of the system in high-concurrency scenarios. However, the occurrence of network failures (such as system timeouts, request losses, etc.) may affect the verification results of free orders and it is difficult to ensure data consistency during the data processing process. For example, the verification result indicates that the free order verification is successful, but due to the timeout return of the verification result, the merchant actually does not enjoy the free order. Summary of the Invention

[0004] This Summary of the Invention section is provided to introduce concepts in a concise form, which will be described in detail in the subsequent Detailed Description section. This Summary of the Invention section is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to be used to limit the scope of the claimed technical solution.

[0005] In a first aspect, the present disclosure provides a data processing method, the method comprising: In response to receiving verification data, updating a first available quantity of the verification data in a cache according to the verification data; If it is determined that the update of the first available quantity is successful, creating a data record corresponding to the verification data; Determining a verification status of the data record based on the verification data; Updating a second available quantity of the verification data in a database according to the verification status of the data record, wherein an initial value of the first available quantity is the same as an initial value of the second available quantity.

[0006] In a second aspect, the present disclosure provides a data processing apparatus, the apparatus comprising: The first update module is configured to update a first available quantity of the write-off data in a cache in response to receiving the write-off data; The creation module is configured to create a data record corresponding to the write-off data if it is determined that the update of the first available quantity is successful; The first determination module is configured to determine a write-off status of the data record based on the write-off data; The second update module is configured to update a second available quantity of the write-off data in a database according to the write-off status of the data record, where an initial value of the first available quantity is the same as an initial value of the second available quantity.

[0007] In a third aspect, the present disclosure provides a computer-readable medium having a computer program stored thereon, and when the computer program is executed by a processing device, the steps of the method described in the first aspect are implemented.

[0008] In a fourth aspect, the present disclosure provides an electronic device, including: A storage device having a computer program stored thereon; A processing device configured to execute the computer program in the storage device to implement the steps of the method described in the first aspect.

[0009] In a fifth aspect, the present disclosure provides a computer program product including a computer program, and when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.

[0010] Thus, through the above technical solutions, the creation of a data record can be realized based on the update of the first available quantity, and finally the update of the second available quantity in the database can be realized through the write-off status of the data record, so that the available quantity in the database can be updated when it is determined that the inventory of the write-off data is used. By combining the second available quantity in the database and the first available quantity in the cache, the data consistency in the data processing process is ensured, and the data consistency problem in the scenario where the cache-type database cannot support the distributed transaction protocol is solved. Moreover, based on the solution of the present disclosure, the high requirements of the distributed transaction for the database and the large resource consumption are overcome, and it can be applied to data processing in scenarios with limited resources, broadening the application scope of the method of the present disclosure.

[0011] Other features and advantages of the present disclosure will be described in detail in the subsequent detailed implementation section. Brief Description of the Drawings

[0012] In conjunction with the accompanying drawings and with reference to the following specific embodiments, the above and other features, advantages, and aspects of the various embodiments of the present disclosure will become more apparent. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic and that the original and the elements are not necessarily drawn to scale. In the drawings: Figure 1 is a flowchart of a data processing method provided based on an embodiment of the present disclosure.

[0013] Figure 2 is a flowchart of a first available quantity creation process provided based on an embodiment of the present disclosure.

[0014] Figure 3 is a flowchart of determining the write-off status of a data record provided based on an embodiment of the present disclosure.

[0015] Figure 4 is an architecture diagram of a data processing method provided based on an embodiment of the present disclosure Figure 5 is a block diagram of a data processing device provided based on an embodiment of the present disclosure.

[0016] Figure 6 shows a schematic structural diagram of an electronic device suitable for implementing the embodiments of the present disclosure. Specific Embodiments

[0017] The embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although some embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Instead, these embodiments are provided to more thoroughly and completely understand the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not used to limit the protection scope of the present disclosure.

[0018] It should be understood that the various steps recited in the method embodiments of the present disclosure can be executed in a different order and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this regard.

[0019] As used herein, the term "comprising" and its variations are open-ended, i.e., "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0020] It should be noted that the concepts such as "first" and "second" mentioned in this disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0021] It should be noted that the modification of "one" and "multiple" mentioned in this disclosure is illustrative rather than restrictive. Those skilled in the art should understand that unless otherwise clearly specified in the context, it should be understood as "one or more".

[0022] The names of the messages or information exchanged between multiple devices in the embodiments of this disclosure are only for illustrative purposes, and are not used to limit the scope of these messages or information.

[0023] It can be understood that before using the technical solutions disclosed in the embodiments of this disclosure, the types, usage scopes, usage scenarios, etc. of the personal information involved in this disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0024] For example, when responding to receiving an active request from the user, a prompt message is sent to the user to clearly prompt the user that the operation requested by the user will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, an application program, a server, or a storage medium that performs the operations of the technical solutions of this disclosure according to the prompt message.

[0025] As an optional but non-limiting implementation manner, the way of sending a prompt message to the user in response to receiving an active request from the user can be, for example, in the form of a pop-up window. The prompt message can be presented in text in the pop-up window. In addition, the pop-up window can also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0026] It can be understood that the above process of notifying and obtaining the user's authorization is only illustrative and does not limit the implementation manners of this disclosure. Other ways that meet relevant laws and regulations can also be applied to the implementation manners of this disclosure.

[0027] At the same time, it can be understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) should comply with the requirements of the corresponding laws, regulations and related provisions.

[0028] In related technologies, a distributed transaction protocol can be adopted to ensure data consistency among various business systems. For example, the TCC (Try - Confirm - Cancel) mode is used to ensure data consistency. However, in this mode, it is required that the deduction component itself must support the distributed transaction protocol and also support hot updates with high TPS (Transactions Per Second). In a scenario with limited resources, it is difficult to apply the above data consistency processing methods that consume a large amount of resources. To support hot data updates, a cache - type database such as Redis is usually used to perform the deduction operation. However, such cache - type databases do not support the distributed transaction protocol. Based on this, the present disclosure provides the following embodiments to achieve data consistency during inventory processing in a resource - constrained scenario.

[0029] Figure 1 As shown, it is a flowchart of a data processing method provided based on an embodiment of the present disclosure. As Figure 1 shown, the method may include: In step 11, in response to receiving the verification data, update the first available quantity of the verification data in the cache according to the verification data.

[0030] As an example, the method of the present disclosure can be applied to an inventory verification service, and the verification data is used to represent the data that triggers inventory updates. As an example, in the scenario of gift order verification, the verification data can be an order identifier. After a user creates an order on an e - commerce platform, a verification request can be sent, and the order identifier of the order can be included in the verification request.

[0031] Among them, in the scenario of a distributed system, various services are usually connected through a network. When a network failure occurs, it may trigger the retry of the verification request, that is, multiple requests may be received for the same verification data. Therefore, in this embodiment, to avoid the repeated creation of data records, it can be determined whether there is a corresponding data record based on the verification data. For example, the data record can be queried based on the identifier in the verification data. If the data record corresponding to the identifier is not queried, that is, there is no data record corresponding to the verification data, at this time, the first available quantity of the verification data in the cache can be decremented by one to achieve the update. As an example, the first available quantity can be the inventory created in the cache - type database to record the available quantity in the cache - type database and implement the intermediate process record of the available quantity corresponding to the verification data.

[0032] In step 12, if it is determined that the update of the first available quantity is successful, create a data record corresponding to the verification data.

[0033] Among them, updating the first available quantity can be achieved by performing a decrement operation. As an example, to ensure the validity of data records, when the first available quantity obtained after performing this decrement operation is greater than or equal to zero, it is considered that the update of the first available quantity is successful, and at this time, data records can be created. When the first available quantity obtained after performing this decrement operation is less than zero, it is considered that the update of the first available quantity fails. At this time, it indicates that the first available quantity has been completely used up and there is no available inventory, and a failure message can be directly prompted without proceeding with subsequent processes. As an example, based on the verification data, the corresponding data records are created in the database and persistently stored. For example, the data records can include fields in the verification data, such as identifiers, merchant information, user information, etc. The fields included in the verification data can be configured based on the actual application scenario, and the present disclosure does not limit this.

[0034] In step 13, determine the verification status of the data record based on the verification data.

[0035] Among them, the verification status of the data record is used to represent the final state of the data record, that is, it indicates whether the verification data has actually been verified. As in the above example, it is possible to further determine whether the merchant uses the gift order discount in the order generated by the user based on the verification data.

[0036] In step 14, according to the verification status of the data record, update the second available quantity of the verification data in the database, where the initial value of the first available quantity is the same as the initial value of the second available quantity. The second available quantity in the database is used to represent the actual available quantity corresponding to the verification data.

[0037] As an example, this step may include: if the verification status of the data record is confirmed, then decrement the second available quantity by one; if the verification status of the data record is cancelled, then the second available quantity does not need to be updated. The verification status of the data record can indicate whether the verification data actually uses the inventory. Then, update the second available quantity after determining the verification status to ensure the accuracy of the inventory update.

[0038] Thus, through the above technical solution, the creation of data records can be achieved based on the update of the first available quantity, and finally, the update of the second available quantity in the database can be achieved through the verification status of the data records. Therefore, when it is determined that the inventory of the verification data is used, the available quantity in the database can be updated. By combining the second available quantity in the database and the first available quantity in the cache, the data consistency during the data processing is ensured, and the data consistency problem in the scenario where the cache-type database does not support the distributed transaction protocol is solved. Moreover, based on the solution of the present disclosure, the high requirements of the distributed transaction for the database and the large resource consumption are overcome, and it can be applied to data processing in scenarios with limited resources, broadening the scope of use of the method of the present disclosure.

[0039] In some embodiments, as Figure 2 shown, the first available quantity can be determined in the following manner: In response to receiving a request to write the available quantity of the cancellation data, write the second available quantity in the database. The initial value of the second available quantity is the total available quantity indicated by the available quantity write request.

[0040] Among them, the inventory of the cancellation data, that is, the total available quantity, can be determined based on the actual application scenario. After that, the inventory release of the cancellation data can be achieved by triggering a request to write the available quantity. For example, in the scenario of premium gift order cancellation, if it is set to give premiums to 1000 orders of merchant A, then the inventory corresponding to the cancellation data (such as orders) in this scenario is 1000. After the configuration is completed, a request to write the available quantity can be triggered. Then, an inventory can be created in the database, that is, the second available quantity is written, and its initial value is 1000, such as writing the total available quantity into the database.

[0041] After that, in response to the successful writing of the second available quantity, write the first available quantity in Redis based on the total available quantity indicated by the available quantity write request. The initial value of the first available quantity is the total available quantity indicated by the available quantity write request.

[0042] After the second available quantity is successfully written into the database, that is, after the inventory is created in the database, the first available quantity can be written in Redis as the inventory in the cache. If the writing of the first available quantity is successful, its initial value is 1000, and the result is fed back. For example, when initializing, the total available quantity is written into Redis to perform inventory cancellation processing in combination with the second available quantity and the first available quantity in the subsequent processing process, ensuring the integrity and consistency of data processing.

[0043] In some embodiments, if the writing of the first available quantity fails, that is, the creation of the inventory in Redis fails, then the retry creation can be performed based on the retry policy in the retry framework. For example, the retry policy can be configured in the policy engine. The retry policy can indicate the number of retries c1 and the retry interval t1. That is, after the writing of the first available quantity fails, it can be rewritten after an interval of t1. If it fails again, wait for t1 and retry until the number of retries reaches c1 and it is considered that the writing of the first available quantity fails, so as to support the retry mechanism in the process of writing the first available quantity.

[0044] In some embodiments, the cancellation status of the data record is initially in the used state. For example, after the data record is created, the cancellation status is initialized to the used state to indicate that a data record has been created for the cancellation data and there is no need to create it again subsequently.

[0045] Correspondingly, determining the write-off status of the data record based on the write-off data may include: Obtain associated business data from the business system associated with the write-off data based on the identifier of the write-off data.

[0046] Among them, the business system associated with the write-off data can be pre-configured. As an example, data can be obtained through the data acquisition interface opened by the business system.

[0047] As an example, if there is one business system associated with the write-off data, data can be obtained based on the identifier of the write-off data and the data acquisition interface of this business system, and the data associated with the identifier of the write-off data in this business system is obtained as the associated business data. For example, in the scenario of gift order write-off, the business system associated with the write-off data is the order system, then the order information corresponding to the identifier of the write-off data can be queried in the order system based on the identifier of the write-off data through the data acquisition interface, and used as the associated business information.

[0048] As another example, if there are multiple business systems associated with the write-off data, data can be obtained based on the identifier of the write-off data and the data acquisition interface of each business system, and the comprehensive data of the data associated with the identifier of the write-off data in each obtained business system is used as the associated business data. For example, this comprehensive data can be the sum of the data in each business system. Another example is that the data obtained from each business system can be cleaned and transformed to unify the data into a preset recognizable format, or missing data can be supplemented based on a preset data filling method to improve the efficiency of subsequent data processing. For example, in the scenario of gift order write-off, the business systems associated with the write-off data are the order system and the user system, then the order information and user information corresponding to the identifier of the write-off data can be queried in the order system and the user system based on the identifier of the write-off data through the corresponding data acquisition interfaces, and the order information and user information are further integrated to obtain the overall associated business information, as Figure 3 shown.

[0049] In some embodiments, the method may further include: If the associated business data is not obtained from the business system based on the identifier of the write-off data, retry the acquisition based on the retry rule.

[0050] Among them, during the process of docking with the business system to obtain data, problems such as network failures and business system busyness may be encountered, resulting in data acquisition failures. To ensure the stability of data processing, a retry mechanism is introduced in this embodiment, as Figure 3As shown, retries can be performed based on a retry framework. If the retry rule includes the number of retries c2 and the retry interval t2, then when data acquisition fails, data can be automatically retried based on the retry rule. For example, after an interval of t2, data is retrieved again from the business system based on the identifier of the write-off data. If associated business data is retrieved, the subsequent process is executed. If no associated business data is retrieved, the retry is performed again based on the retry rule.

[0051] If the number of retries reaches the preset number, the acquisition of the associated business data from the business system is stopped.

[0052] In this embodiment, to prevent excessive retry acquisitions from consuming system resources, when the number of retry acquisitions reaches the number of retries c2, the acquisition of the associated business data from the business system can be stopped.

[0053] Thus, through the above technical solution, the efficiency of obtaining associated business data can be improved through the retry mechanism, providing effective data support for the subsequent determination of the write-off status. At the same time, through the fuse mechanism, when the number of retry acquisitions reaches the preset number, the acquisition of the associated business data from the business system is stopped, avoiding the data request pressure on the business system caused by excessive retry acquisitions and reducing the impact on the operation of the business system.

[0054] In some embodiments, when stopping the acquisition of the associated business data from the business system, an alarm message can be sent to notify relevant personnel so that they can handle it in a timely manner to ensure the stable operation of data processing.

[0055] After obtaining the write-off rule of the write-off data, the write-off rule can be retrieved, and matching can be performed based on the associated business data and the write-off rule.

[0056] Among them, different write-off rules can be preset for different business types. For example, Figure 3 multiple versions of write-off rules can be set based on a rule engine. For example, the business type is the random discount type, that is, a subsidy can be randomly given to the user for each order. Then the corresponding write-off rule can be that the actual payment amount is less than the payable amount. Then the actual payment amount and the payable amount in the associated business data can be compared. If the two are the same, it means that the associated business data does not match the write-off rule of the write-off data, and it can be considered that the random discount subsidy is not used in the order processing; if the actual payment amount is less than the payable amount, it is determined that the associated business data matches the write-off rule of the write-off data, and it can be considered that the random discount subsidy is used in the order processing.

[0057] As another example, changes in marketing activities may lead to changes in the write-off rules. To ensure the effectiveness of the write-off rules, multiple versions of the write-off rules can be set for the same business type, and the effective time of each version of the write-off rules can be determined. For example, it can be determined whether to use a complimentary order based on the marketing activity information on the order. For example, the write-off rule H1 corresponding to the marketing activity information D1 can be set, and its effective time is from March 1st to March 4th. After the marketing activity information changes on March 5th, the write-off rule H2 corresponding to the marketing activity information D2 can be set, and its generation time is from March 5th to March 10th.

[0058] Correspondingly, the write-off rule for obtaining the write-off data may include: Determine the generation time of the write-off data. Among them, the generation time of the write-off data can be obtained from the corresponding fields of the write-off data, or the generation time of the write-off data can be obtained by querying the business system through the identifier of the write-off data. In the scenario of the complimentary order business, the generation time of the write-off data can be the creation time of the order.

[0059] After that, if the generation time is within the effective time of the write-off rule, obtain the write-off rule.

[0060] Among them, the generation time being within the effective time of the write-off rule means that the write-off rule is effective when the write-off data is generated. Continuing with the above example, if the generation time is March 3rd, the write-off rule H2 can be obtained to match the write-off data based on the write-off rule H2.

[0061] Thus, through the above technical solution, multiple versions of the write-off rules can be set based on the actual application scenario, so as to comprehensively consider various business factors when determining the write-off status, realize the flexible management and dynamic adjustment of the write-off rules. And it can achieve the effective update of the write-off rules with the continuous development and change of the business. By recording each version of the write-off rules and their effective times, when determining the write-off status of the data record, the corresponding version of the write-off rule can be automatically selected based on the generation time of the write-off data for judgment, ensuring the accuracy and consistency of data processing.

[0062] Furthermore, the write-off status of the data record can be determined based on the matching result. If it is determined that the write-off rules of the associated business data and the write-off data match, it is determined that the write-off status of the data record is confirmed; if it is determined that the write-off rules of the associated business data and the write-off data do not match, it is determined that the write-off status of the data record is cancelled.

[0063] Among them, if the verification rules of the associated business data and the verification data match, it is considered that the inventory occupied by the verification data is actually used, then the inventory needs to be written off, and the verification status of the data record is determined as confirmed. If the verification rules of the associated business data and the verification data do not match, it is considered that the inventory occupied by the verification data is actually not used, then the inventory should not be written off, that is, its status is determined as cancelled.

[0064] Thus, through the above technical solution, the identification of the verification data used to create the data record can be used to connect with the business system through the interface of the associated business system to obtain the associated business data. Furthermore, based on the verification rules, the actual usage status of the inventory occupied by the verification data can be clarified for the obtained associated business data, so as to accurately judge the usage status of the inventory, thereby providing accurate data support for the subsequent update of the second available quantity in the database and ensuring data consistency and accuracy in the data processing process.

[0065] In some embodiments, the method may further include: Determine the target metrics corresponding to the verification data; among them, the target metrics are used to monitor the data processing process, and the target metrics include at least one of the following: Determine the duration of the verification status of the data record, that is, the duration from the creation time of the data record to the determination of the verification status. The shorter this duration, the higher the data processing efficiency. If the time is too long, it indicates that there may be data acquisition anomalies or data judgment anomalies in the data processing process.

[0066] The update success rate of the second available quantity, where the update success rate can be the ratio of the update amount of the second available quantity to the update amount of the first available quantity. For example, if the update amount of the first available quantity determined based on the verification data is 100, and the update amount of the second available quantity is 97, then the update success rate is 97%, indicating that 97% of the inventory occupied by the verification data is actually used. The higher the update success rate, the higher the verification efficiency and accuracy. If the update success rate is relatively low, it indicates that there may be anomalies in the business system to which the verification data belongs.

[0067] The response duration corresponding to the verification data, where the response duration is used to represent the duration from receiving the verification data to the completion of the update of the second available quantity. The shorter the response duration, the higher the data processing efficiency. If the time is too long, it indicates that there may be data acquisition anomalies or data judgment anomalies in the data processing process.

[0068] The verification status of the data record of the verification data. If there are too many data records with a used status, it indicates that some verification data has not yet determined its final state, and there may be data acquisition anomalies or data judgment anomalies in the data processing process.

[0069] Among them, the above target metrics can be determined at preset time intervals to achieve metric monitoring during the data processing process.

[0070] Furthermore, in the case of meeting the abnormal conditions of the target metrics, a notification message is output.

[0071] Among them, the personnel and abnormal conditions corresponding to different metrics can be preset. For example, for the duration of determining the cancellation status of the data record, the abnormal condition can be that the duration exceeds a duration threshold. Then, when it is determined that the abnormal condition is met, a notification message can be output to notify the corresponding personnel so that the personnel can timely discover the problems and potential risks existing in the data processing process and ensure the stability and security of the data processing process.

[0072] In some embodiments, reports can also be generated at preset time intervals based on the determined target metrics and the reports are output. For example, a line chart or a table can be generated based on the chronological order of determining the target metrics, so that relevant personnel can analyze based on the reports to discover potential improvement spaces in the data processing process, provide data references for business decisions and configurations, and at the same time provide data support for the configuration of cancellation rules, improving the efficiency and quality of data processing.

[0073] In some embodiments, the method may further include: If the first available quantity is zero and the cancellation status of the data record has been determined, after the second available quantity is updated based on the cancellation status of each of the data records created based on the first available quantity, the current value of the second available quantity is obtained.

[0074] Among them, the first available quantity in the cache is updated before creating the data record, and then whether to update the second available quantity in the database is determined based on the cancellation status of the data record. When the cancellation status is cancelled, the second available quantity will not be updated, but the first available quantity has been updated in this scenario. Therefore, the first available quantity can record the theoretical inventory, that is, the available quantity after each cancellation data is defaulted to be cancelled successfully, and the second available quantity can record the actual inventory, that is, the available quantity after each cancellation data is actually cancelled successfully. When the cancellation status of the data record corresponding to the cancellation data is cancelled, that is, the cancellation data is actually not cancelled, there will be a difference between the second available quantity and the first available quantity. Therefore, in this embodiment, the first available quantity can be synchronized based on the second available quantity.

[0075] As an example, a synchronization task can be triggered at an interval, and the current value of the second available quantity can be obtained when the synchronization condition is met. Among them, the second available quantity is updated based on the cancellation status of the data record, so the synchronization condition can be that the first available quantity is zero and the cancellation status of the data record has been determined, and the second available quantity is updated based on the cancellation status of each data record corresponding to the first available quantity. Among them, the first available quantity being zero means that no new data records will be created, and this condition can be determined by obtaining the first available quantity; the cancellation status of the data record being determined means that there are no data records in an intermediate state, and this condition can be determined by obtaining the cancellation status of each data record; the second available quantity is updated based on the cancellation status of each data record created based on the first available quantity, indicating that the second available quantity does not change. As an example, the number of data records traversed when updating the second available quantity can be the same as the initial value of the first available quantity, and it is determined that this condition is met when the update of the second available quantity is completed. As another example, an observation duration can be set. When it is determined that the first available quantity is zero and the cancellation status of the data record has been determined, the observation duration is started. When the observation duration reaches the duration threshold, it is considered that this condition is met. This observation duration can be determined based on the actual situation of the business and combined with the historical data processing efficiency. For example, for a time period or activity with large business fluctuations, the duration threshold corresponding to this observation duration can be appropriately increased to ensure that the usage of all data records corresponding to the cancellation data can be accurately recorded and processed; for a relatively stable period of the business, the duration threshold can be reduced to adjust the first available quantity in a timely manner and improve the response speed.

[0076] It should be noted that after the above conditions are met, the cancellation status of the data records created based on the first available quantity will be reflected in the record of the second available quantity, and no new data records will be created based on the first available quantity. At this time, the current value of the second available quantity is obtained, that is, the current actual available quantity is obtained.

[0077] After that, the current value of the first available quantity is updated based on the current value of the second available quantity. For example, the current value of the first available quantity is updated to the current value of the second available quantity.

[0078] As an example, the initial values of the second available quantity and the first available quantity are 100. 100 data records are created based on the first available quantity through the above steps, and the first available quantity becomes 0. After determining its cancellation status, the second available quantity is updated. If the current value of the second available quantity is 3, then the current value of the first available quantity can be updated to 3 so as to enable data synchronization in the first available quantity. Thus, through the above technical solution, the current value of the first available quantity can be updated based on the second available quantity to correct the first available quantity, new data records can be created based on the first available quantity, and while ensuring data consistency in the data processing process, full use of the second available quantity of the cancellation data can be achieved.

[0079] As Figure 4 shown, it is an architecture diagram of a data processing method provided based on an embodiment of the present disclosure. Among them, the second available quantity and data records can be stored in a database, and the first available quantity can be stored in Redis. The process interaction and implementation methods of each step in this architecture diagram have been described in detail above and will not be elaborated here.

[0080] Based on the same inventive concept, the present disclosure also provides a data processing device, as Figure 5 shown, the device 10 includes: A first update module 100, configured to update the first available quantity of the cancellation data in the cache according to the cancellation data in response to receiving the cancellation data; A creation module 200, configured to create a data record corresponding to the cancellation data if it is determined that the update of the first available quantity is successful; A first determination module 300, configured to determine the cancellation status of the data record based on the cancellation data; A second update module 400, configured to update the second available quantity of the cancellation data in the database according to the cancellation status of the data record, where the initial values of the first available quantity and the second available quantity are the same.

[0081] Optionally, the cancellation status of the data record is initially in a used state; The first determination module includes: A first acquisition sub-module, configured to acquire associated service data from the service system associated with the cancellation data based on the identifier of the cancellation data; A first processing sub-module, configured to acquire the cancellation rule of the cancellation data and perform matching based on the associated service data and the cancellation rule; A second processing sub-module, configured to determine that the verification status of the data record is confirmed if it is determined that the verification rules of the associated service data and the verification data match; and determine that the verification status of the data record is cancelled if it is determined that the verification rules of the associated service data and the verification data do not match.

[0082] Optionally, the verification rule corresponds to an effective time; The first processing sub-module includes: A first determination sub-module, configured to determine the generation time of the verification data; A second acquisition sub-module, configured to acquire the verification rule if the generation time is within the effective time of the verification rule.

[0083] Optionally, the apparatus further includes: A first acquisition module, configured to perform a retry acquisition based on a retry rule if the associated service data is not acquired from the service system based on the identifier of the verification data; A processing module, configured to stop acquiring the associated service data from the service system if the number of retry acquisitions reaches a preset number.

[0084] Optionally, the second update module is configured to: If the verification status of the data record is confirmed, decrement the second available quantity by one.

[0085] Optionally, the apparatus further includes: A second acquisition module, configured to acquire the current value of the second available quantity after the second available quantity is updated based on the verification status of each data record created based on the first available quantity if the first available quantity is zero and the verification status of the data record has been determined; A third update module, configured to update the current value of the first available quantity based on the current value of the second available quantity.

[0086] Optionally, the first available quantity is determined by the following method: In response to receiving an available quantity write request for the verification data, write the second available quantity into the database, where the initial value of the second available quantity is the total available quantity indicated by the available quantity write request; In response to the successful writing of the second available quantity, write the first available quantity into Redis based on the total available quantity indicated by the available quantity write request, where the initial value of the first available quantity is the total available quantity indicated by the available quantity write request.

[0087] Optionally, the apparatus further includes: A second determination module, configured to determine a target metric corresponding to the cancellation data; An output module, configured to output a notification message when an abnormal condition for the target metric is satisfied; Wherein, the target metric includes at least one of the following: The duration for determining the cancellation status of the data record; The update success rate of the second available quantity; The response duration corresponding to the cancellation data, where the response duration is used to represent the duration from receiving the cancellation data to the completion of the update of the second available quantity; The cancellation status of the data record of the cancellation data.

[0088] Reference is made below to Figure 6 , which shows a schematic structural diagram of an electronic device (such as a terminal device or a server) 600 suitable for implementing embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Tablet Computers), PMPs (Portable Multimedia Players), in-vehicle terminals (such as in-vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The electronic device shown is merely an example and should not impose any limitation on the functions and usage scope of the embodiments of the present disclosure.

[0089] As Figure 6 shown, the electronic device 600 may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 601, which may perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0090] Generally, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or wiredly to exchange data. Although Figure 6An electronic device 600 with various devices is shown, but it should be understood that it is not required to implement or have all the shown devices. Instead, more or fewer devices can be implemented or had.

[0091] In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, an embodiment of the present disclosure includes a computer program product that includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program codes for executing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from a network via a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by a processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0092] It should be noted that the above-mentioned computer-readable medium in the present disclosure can be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, the computer-readable storage medium can be any tangible medium that contains or stores a program, and the program can be used by or in combination with an instruction execution system, apparatus, or device. And in the present disclosure, the computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, in which computer-readable program codes are carried. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, and the computer-readable signal medium can send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The program codes contained on the computer-readable medium can be transmitted by any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0093] In some embodiments, the client and the server can communicate using any currently known or future-developed network protocol such as HTTP (HyperText Transfer Protocol), and can be interconnected with digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include local area networks ("LAN"), wide area networks ("WAN"), the Internet (e.g., the Internet), and end-to-end networks (e.g., ad hoc end-to-end networks), as well as any currently known or future-developed networks.

[0094] The above computer-readable medium can be included in the above electronic device; or can exist separately without being assembled into the electronic device.

[0095] The above computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to: in response to receiving write-off data, update the first available quantity of the write-off data in the cache according to the write-off data; if it is determined that the update of the first available quantity is successful, create the data record; determine the write-off status of the data record based on the write-off data; and update the second available quantity of the write-off data in the database according to the write-off status of the data record, where the initial values of the first available quantity and the second available quantity are the same.

[0096] Computer program code for performing the operations of the present disclosure can be written in one or more programming languages or combinations thereof. The above programming languages include, but are not limited to, object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, executed as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., by using an Internet service provider to connect through the Internet).

[0097] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a segment of a program, or a part of code that contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0098] The modules described in the embodiments of the present disclosure can be implemented in software or in hardware. Among them, the name of the module does not constitute a limitation on the module itself in some cases. For example, the first update module can also be described as "the module that updates the first available quantity of the write-off data in the cache according to the received write-off data in response to receiving the write-off data".

[0099] The functions described above herein can be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that can be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip (SOCs), complex programmable logic devices (CPLDs), and so on.

[0100] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media would include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0101] According to one or more embodiments of the present disclosure, Example 1 provides a data processing method, the method comprising: In response to receiving the cancellation data, update the first available quantity of the cancellation data in the cache according to the cancellation data; If it is determined that the update of the first available quantity is successful, create the data record; Determine the cancellation status of the data record based on the cancellation data; Update the second available quantity of the cancellation data in the database according to the cancellation status of the data record, wherein the initial values of the first available quantity and the second available quantity are the same.

[0102] According to one or more embodiments of the present disclosure, Example 2 provides the method of Example 1, and the initial cancellation status of the data record is the used state; The determining the cancellation status of the data record based on the cancellation data includes: Based on the identifier of the cancellation data, obtain associated business data from the business system associated with the cancellation data; Obtain the cancellation rule of the cancellation data, and perform matching based on the associated business data and the cancellation rule; If it is determined that the associated business data and the cancellation rule of the cancellation data match, determine that the cancellation status of the data record is confirmed; If it is determined that the associated business data and the cancellation rule of the cancellation data do not match, determine that the cancellation status of the data record is cancelled.

[0103] According to one or more embodiments of the present disclosure, Example 3 provides the method of Example 2, and the cancellation rule corresponds to an effective time; The obtaining the cancellation rule of the cancellation data includes: Determine the generation time of the cancellation data; If the generation time is within the effective time of the cancellation rule, obtain the cancellation rule.

[0104] According to one or more embodiments of the present disclosure, Example 4 provides the method of Example 2, and the method further comprises: If the associated business data is not obtained from the business system based on the identifier of the cancellation data, perform a retry acquisition based on the retry rule; If the number of retry acquisitions reaches the preset number of times, stop obtaining the associated business data from the business system.

[0105] According to one or more embodiments of the present disclosure, Example 5 provides the method of Example 1, which updating the second available quantity of the write-off data in the database according to the write-off status of the data record, includes: If the write-off status of the data record is confirmed, subtract one from the second available quantity.

[0106] According to one or more embodiments of the present disclosure, Example 6 provides the method of Example 1, and the method further includes: If the first available quantity is zero and the write-off status of the data record has been determined, after the update of the second available quantity is completed based on the write-off status of each data record created based on the first available quantity, obtain the current value of the second available quantity; Update the current value of the first available quantity based on the current value of the second available quantity.

[0107] According to one or more embodiments of the present disclosure, Example 7 provides the method of Example 1, and the first available quantity is determined by the following method: In response to receiving the available quantity write request of the write-off data, write the second available quantity into the database, and the initial value of the second available quantity is the total available quantity indicated by the available quantity write request; In response to the successful writing of the second available quantity, write the first available quantity into Redis based on the total available quantity indicated by the available quantity write request, and the initial value of the first available quantity is the total available quantity indicated by the available quantity write request.

[0108] According to one or more embodiments of the present disclosure, Example 8 provides the method of Example 1, and the method further includes: Determine the target metric corresponding to the write-off data; Output a notification message when the abnormal condition of the target metric is met; Wherein, the target metric includes at least one of the following: The duration for determining the write-off status of the data record; The update success rate of the second available quantity; The response duration corresponding to the write-off data, and the response duration is used to represent the duration from receiving the write-off data to the completion of the update of the second available quantity; The write-off status of the data record of the write-off data.

[0109] According to one or more embodiments of the present disclosure, Example 9 provides a data processing device, and the device includes: A first update module, configured to update a first available quantity of the write-off data in a cache according to the write-off data in response to receiving the write-off data; A creation module, configured to create the data record if it is determined that the update of the first available quantity is successful; A first determination module, configured to determine a write-off status of the data record based on the write-off data; A second update module, configured to update a second available quantity of the write-off data in a database according to the write-off status of the data record, where an initial value of the first available quantity is the same as an initial value of the second available quantity.

[0110] According to one or more embodiments of the present disclosure, Example 10 provides a computer-readable medium, on which a computer program is stored, and when the computer program is executed by a processing device, the steps of the method described in any one of Examples 1-8 are implemented.

[0111] According to one or more embodiments of the present disclosure, Example 11 provides an electronic device, including: A storage device, on which a computer program is stored; A processing device, configured to execute the computer program in the storage device to implement the steps of the method described in any one of Examples 1-8.

[0112] According to one or more embodiments of the present disclosure, Example 12 provides a computer program product, including a computer program, and when the computer program is executed by a processor, the steps of the method described in any one of Examples 1-8 are implemented.

[0113] The above description is only a preferred embodiment of the present disclosure and an explanation of the applied technical principles. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above technical features, and should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosure concept. For example, a technical solution formed by mutually replacing the above features with (but not limited to) technical features having similar functions disclosed in the present disclosure.

[0114] In addition, although the operations are depicted in a particular order, this should not be construed as requiring that the operations be performed in the particular order shown or in sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, although several specific implementation details are included in the foregoing discussion, these should not be construed as limitations on the scope of the present disclosure. Certain features that are described in the context of separate embodiments may also be implemented in combination in a single embodiment. Conversely, the various features that are described in the context of a single embodiment may also be implemented separately or in any suitable sub-combination in multiple embodiments.

[0115] Although the subject matter has been described in language specific to structural features and / or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims. With regard to the apparatus in the foregoing embodiments, the specific manner in which each module performs an operation has been described in detail in the embodiments related to the method, and will not be elaborated herein.

Claims

1. A data processing method, characterized in that The method includes: In response to receiving the write-off data, updating the first available quantity of the write-off data in the cache according to the write-off data; If it is determined that the update of the first available quantity is successful, creating a data record corresponding to the write-off data; Determining the write-off status of the data record based on the write-off data; Updating the second available quantity of the write-off data in the database according to the write-off status of the data record, where the initial values of the first available quantity and the second available quantity are the same.

2. The method according to claim 1, wherein The write-off status of the data record is initially in the used state; The determining the write-off status of the data record based on the write-off data includes: Based on the identifier of the write-off data, obtaining associated business data from the business system associated with the write-off data; Obtaining the write-off rule of the write-off data, and performing matching based on the associated business data and the write-off rule; If it is determined that the associated business data matches the write-off rule of the write-off data, determining that the write-off status of the data record is confirmed; If it is determined that the associated business data does not match the write-off rule of the write-off data, determining that the write-off status of the data record is cancelled.

3. The method according to claim 2, wherein The write-off rule corresponds to an effective time; The obtaining the write-off rule of the write-off data includes: Determining the generation time of the write-off data; If the generation time is within the effective time of the write-off rule, obtaining the write-off rule.

4. The method according to claim 2, wherein The method further includes: If the associated business data is not obtained from the business system based on the identifier of the write-off data, performing a retry acquisition based on the retry rule; If the number of retry acquisitions reaches a preset number, stopping obtaining the associated business data from the business system.

5. The method according to claim 1, wherein The updating the second available quantity of the write-off data in the database according to the write-off status of the data record includes: If the write-off status of the data record is confirmed, decrementing the second available quantity by one.

6. The method according to claim 1, wherein The method further includes: If the first available quantity is zero and the write-off status of the data record has been determined, after the update of the second available quantity is completed based on the write-off status of each of the data records created based on the first available quantity, obtaining the current value of the second available quantity; Updating the current value of the first available quantity based on the current value of the second available quantity.

7. The method according to claim 1, wherein The first available quantity is determined by the following method: In response to receiving the available quantity write request of the write-off data, writing the second available quantity in the database, and the initial value of the second available quantity is the total available quantity indicated by the available quantity write request; In response to the successful writing of the second available quantity, writing the first available quantity in Redis based on the total available quantity indicated by the available quantity write request, and the initial value of the first available quantity is the total available quantity indicated by the available quantity write request.

8. The method according to claim 1, characterized in that, The method further includes: Determining the target metric corresponding to the write-off data; Outputting a notification message when an abnormal condition of the target metric is met; Wherein, the target metric includes at least one of the following: The duration of determining the write-off status of the data record; The update success rate of the second available quantity; The response duration corresponding to the write-off data, where the response duration is used to represent the duration from receiving the write-off data to the completion of the update of the second available quantity; The write-off status of the data record of the write-off data.

9. A data processing device, characterized in that, The device includes: A first update module, configured to update the first available quantity of the write-off data in the cache according to the write-off data in response to receiving the write-off data; A creation module, configured to create a data record corresponding to the write-off data if it is determined that the update of the first available quantity is successful; A first determination module, configured to determine the write-off status of the data record based on the write-off data; A second update module, configured to update the second available quantity of the write-off data in the database according to the write-off status of the data record, where the initial value of the first available quantity is the same as the initial value of the second available quantity.

10. A computer-readable medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processing device, it implements the steps of the method according to any one of claims 1-8.

11. An electronic device, characterized in that, Including: A storage device on which a computer program is stored; A processing device, configured to execute the computer program in the storage device to implement the steps of the method according to any one of claims 1-8.

12. A computer program product comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1-8.

Citation Information

Cited By

  • Asset bill cancel-after-verification management method, electronic equipment and medium

    CN120525650A