Delayed settlement processing method and device

In the delay settlement processing, the data storage structure is optimized by using the hash ring and time shard value calculation methods, and the problem of unstable system traffic is solved, achieving the effect of stable system traffic and timely service processing.

CN113238845BActive Publication Date: 2025-08-19BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110536422.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-17
Publication Date
2025-08-19
Estimated Expiration
2041-05-17

AI Technical Summary

Technical Problem

During the delay settlement process, the system traffic is unstable and the processing of delay settlement services is not timely.

Method used

By obtaining the delay execution time of the delay settlement data, the time shard value is calculated and stored in the hash ring in memory, the delay data reading time is updated at a preset time interval, and the data is obtained from the hash ring based on the to-be-set time shard value and submitted to the thread pool to perform settlement.

Benefits of technology

It realizes the stability of system traffic and the timely processing of delayed settlement services, reduces the delay in system data processing and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113238845B_ABST
    Figure CN113238845B_ABST
Patent Text Reader

Abstract

The present application discloses a delayed settlement processing method and device, which relates to the field of computer technology. A specific implementation method includes obtaining delayed settlement data, calculating the corresponding time slicing value through the delayed execution time of the delayed settlement data, and storing it in the corresponding position on the hash ring of the memory; updating the delayed data reading time at a preset time interval to calculate the time slicing value to be settled based on the updated delayed data reading time; obtaining the corresponding delayed settlement data from the hash ring of the memory based on the time slicing value to be settled; and submitting the corresponding delayed settlement data to the thread pool to execute delayed settlement. The present application optimizes the design of the data storage structure, determines the delayed settlement data to be obtained based on the current delayed data reading time, rather than uniformly pulling data within a certain time range to execute delayed settlement, thereby achieving stable system traffic and timely processing of delayed settlement services.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a delayed settlement processing method and device. Background Art

[0002] For delayed settlement, the system obtains data through periodic polling and determines settlement timeliness. It then sets scheduled tasks to pull data from the database within a certain time range and then process it in batches. During delayed settlement, if the system polling cycle is too long, the resulting large number of pulls can significantly impact system stability and the database. If the polling cycle is too short, unfinished tasks from a single processing session can accumulate.

[0003] During the implementation of this application, the inventors discovered that the prior art has at least the following problems:

[0004] During the delayed settlement process, the system traffic is not stable and the delayed settlement business is not handled in a timely manner. Summary of the Invention

[0005] In view of this, the embodiments of the present application provide a delayed settlement processing method and apparatus, which can solve the problems of unstable system traffic and untimely processing of delayed settlement services in the existing delayed settlement process.

[0006] To achieve the above-mentioned purpose, according to one aspect of an embodiment of the present application, a delayed settlement processing method is provided, comprising:

[0007] Obtain delayed settlement data, calculate the corresponding time slice value based on the delayed execution time of the delayed settlement data, and store it in the corresponding position on the hash ring of the memory;

[0008] Update the delayed data reading time at a preset time interval to calculate the time shard value to be settled based on the updated delayed data reading time;

[0009] Obtain the corresponding delayed settlement data from the hash ring in memory based on the shard value of the pending settlement time;

[0010] Submit the corresponding delayed settlement data to the thread pool to perform delayed settlement.

[0011] Optionally, obtain delayed settlement data, including:

[0012] Receive order information and determine the delayed settlement time of the order information;

[0013] The database is polled periodically to obtain delayed settlement data corresponding to the delayed settlement time within the preset delayed settlement time range from the database.

[0014] Optionally, the corresponding time slice value is calculated by delaying the execution time of the delayed settlement data, including:

[0015] Get the minutes and seconds of the delayed execution time to determine the total time value;

[0016] According to the hash remainder algorithm, the remainder of the total time value and the preset value is taken, and the obtained remainder value is determined as the time slice value.

[0017] Optionally, the corresponding location on the hash ring stored in the memory includes:

[0018] In response to determining that the corresponding position on the hash ring of the memory corresponding to the time slice value has stored historical delayed settlement data, the delayed settlement data is stored at the corresponding position on the hash ring of the memory using a red-black tree.

[0019] Optionally, calculate the time slice value to be settled, including:

[0020] According to the minute and second values of the updated delayed data reading time, the corresponding total delayed data reading time value is calculated, and then according to the hash division and remainder algorithm, the remainder of the total delayed data reading time value and the preset value is taken, and the obtained remainder value is determined as the time slice value corresponding to the updated delayed data reading time.

[0021] Optionally, corresponding delayed settlement data is obtained from the hash ring in memory, including:

[0022] Get the updated year, month, day, and hour values of the delayed data reading time;

[0023] Determine the year, month, day, and hour values corresponding to each time slice value on the hash ring in memory, and then obtain the delayed settlement data corresponding to the time slice value corresponding to the year, month, day, and hour values of the updated delayed data reading time and the time slice value to be settled from the hash ring in memory.

[0024] In addition, the present application also provides a delayed settlement processing device, comprising:

[0025] an acquiring unit configured to acquire delayed settlement data, calculate a corresponding time slice value according to a delayed execution time of the delayed settlement data, and store the calculated time slice value in a corresponding position on a hash ring of a memory;

[0026] a calculation unit configured to update the delayed data reading time at a preset time interval, so as to calculate the time slice value to be settled according to the updated delayed data reading time;

[0027] The delayed settlement data acquisition unit is configured to acquire corresponding delayed settlement data from the hash ring in the memory based on the time slice value to be settled;

[0028] The execution unit is configured to submit corresponding delayed settlement data to the thread pool to perform delayed settlement.

[0029] Optionally, the acquiring unit is further configured to:

[0030] Receive order information and determine the delayed settlement time of the order information;

[0031] The database is polled periodically to obtain delayed settlement data corresponding to the delayed settlement time within the preset delayed settlement time range from the database.

[0032] Optionally, the acquiring unit is further configured to:

[0033] Get the minutes and seconds of the delayed execution time to determine the total time value;

[0034] According to the hash remainder algorithm, the remainder of the total time value and the preset value is taken, and the obtained remainder value is determined as the time slice value.

[0035] Optionally, the acquiring unit is further configured to:

[0036] In response to determining that the corresponding position on the hash ring of the memory corresponding to the time slice value has stored historical delayed settlement data, the delayed settlement data is stored at the corresponding position on the hash ring of the memory using a red-black tree.

[0037] Optionally, the computing unit is further configured to:

[0038] According to the minute and second values of the updated delayed data reading time, the corresponding total delayed data reading time value is calculated, and then according to the hash division and remainder algorithm, the remainder of the total delayed data reading time value and the preset value is taken, and the obtained remainder value is determined as the time slice value corresponding to the updated delayed data reading time.

[0039] Optionally, the delayed settlement data acquiring unit is further configured to:

[0040] Get the updated year, month, day, and hour values of the delayed data reading time;

[0041] Determine the year, month, day, and hour values corresponding to each time slice value on the hash ring in memory, and then obtain the delayed settlement data corresponding to the time slice value corresponding to the year, month, day, and hour values of the updated delayed data reading time and the time slice value to be settled from the hash ring in memory.

[0042] In addition, the present application also provides a delayed settlement processing electronic device, including: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by one or more processors, the one or more processors implement the delayed settlement processing method as described above.

[0043] In addition, the present application also provides a computer-readable medium on which a computer program is stored. When the program is executed by a processor, the delayed settlement processing method as described above is implemented.

[0044] One embodiment of the above invention has the following advantages or beneficial effects: the present application obtains delayed settlement data, calculates the corresponding time slicing value by the delayed execution time of the delayed settlement data, and stores it in the corresponding position on the hash ring of the memory; updates the delayed data reading time at a preset time interval, and calculates the time slicing value to be settled based on the updated delayed data reading time; obtains the corresponding delayed settlement data from the hash ring of the memory based on the time slicing value to be settled; and submits the corresponding delayed settlement data to the thread pool to execute delayed settlement. The present application optimizes the design of the data storage structure, determines the delayed settlement data to be obtained based on the updated current delayed data reading time, rather than uniformly pulling data within a certain time range to execute delayed settlement, thereby achieving smooth system traffic and timely processing of delayed settlement services.

[0045] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] The accompanying drawings are provided to facilitate a better understanding of the present application and do not constitute an undue limitation on the present application.

[0047] Figure 1 1 is a schematic diagram of the main process of the delayed settlement processing method according to the first embodiment of the present application;

[0048] Figure 2 2 is a schematic diagram of the main process of the delayed settlement processing method according to the second embodiment of the present application;

[0049] Figure 3 2 is a schematic diagram of an application scenario of the delayed settlement processing method according to the third embodiment of the present application;

[0050] Figure 4 is a schematic diagram of main modules of a delayed settlement processing apparatus according to an embodiment of the present application;

[0051] Figure 5 is an exemplary system architecture diagram to which embodiments of the present application may be applied;

[0052] Figure 6It is a structural diagram of a computer system of a terminal device or server suitable for implementing an embodiment of the present application. DETAILED DESCRIPTION

[0053] The following description of exemplary embodiments of the present application is made in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding. These details should be considered as merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0054] Figure 1 This is a schematic diagram of the main process of the delayed settlement processing method according to the first embodiment of the present application. Figure 1 As shown, the delayed settlement processing methods include:

[0055] Step S101: Obtain delayed settlement data, calculate the corresponding time slice value according to the delayed execution time of the delayed settlement data, and store it in the corresponding position on the hash ring of the memory.

[0056] In this embodiment, in order to avoid business risks, the execution entity needs to settle according to the set delay time after receiving the settlement data. Among them, obtaining delayed settlement data includes Figure 1 Not shown:

[0057] Step S1011: Receive order information and then determine the delayed settlement time of the order information.

[0058] The execution entity of the delayed settlement processing method (for example, a server) can obtain order information from the terminal device through a wired connection or a wireless connection, and then set the delayed settlement time of the received order based on the merchant dimension and the business dimension. For example, the upstream billing system has a payment of 30 yuan. According to the rules, the order is pushed to the settlement system after completion (the current system time is 2021-04-13 18:01:09). The settlement system recognizes that the merchant has delayed settlement for 5 days and sets the settlement time to 2021-04-18 18:01:09 to start settlement. The system needs to delay the execution of the settlement instruction until 2021-04-18 18:01:09.

[0059] Step S1012: Periodically poll the database and obtain from the database delayed settlement data corresponding to the delayed settlement time within the preset delayed settlement time range.

[0060] Polling can be performed by periodically scanning the database. Since delayed settlement data may be large in size and cannot be directly stored in memory, it needs to be stored in the database first. Then, the delayed settlement data in the database is periodically scanned in advance and then moved to memory for storage. For example, the execution entity can poll the database for delayed settlement data with a delayed settlement time range of 5 minutes to 35 minutes at a fixed period, such as 30 minutes (adjustable), and obtain it. This application does not specifically limit the delayed settlement time range for polling.

[0061] This embodiment periodically polls the database to obtain delayed settlement data within a preset delayed settlement time range, so that the amount of delayed settlement data obtained is preset and controllable, to ensure the timeliness of the delayed settlement data processing and to ensure smooth system traffic.

[0062] After obtaining the delayed settlement data, the execution entity can calculate the corresponding time slice value (i.e., slot value) based on the delayed execution time of the delayed settlement data. Specifically, the execution entity can calculate the corresponding time slice value based on the hour, minute, and second values of the delayed execution time. Specifically, the execution entity can convert both the hour and minute values into seconds to obtain a total second value. The execution entity can then divide the total second value by a preset value, such as 3600, and obtain the remainder. The remainder obtained is the corresponding time slice value, i.e., slot value. After obtaining the time slice value, the execution entity can store the delayed settlement data corresponding to the time slice value in a corresponding position on a hash ring in memory. Storing the delayed settlement data corresponding to the time slice value in a corresponding position on the hash ring in memory includes storing the delayed settlement data corresponding to the time slice value in the position on the hash ring in memory corresponding to the calculated time slice value. For example, the hash ring can be a circular ring divided into 3600 parts. The specific number of parts is not limited in this application and can be determined based on specific circumstances.

[0063] Step S102: updating the delayed data reading time at a preset time interval, and calculating the time slice value to be settled according to the updated delayed data reading time.

[0064] Specifically, the execution entity may update the delayed data reading time at a preset time interval, and calculate the pending settlement time slice value based on the updated delayed data reading time. Specifically, the pending settlement time slice value may correspond to the time slice value calculated based on the currently updated delayed data reading time.

[0065] For example, when performing delayed data reading on the hash ring, the execution entity can execute the reading logic once per second to calculate the time shard value.

[0066] The calculation of the time slice value to be settled includes:

[0067] According to the minute value and second value of the updated delayed data reading time, the corresponding total delayed data reading time value is calculated, and then according to the hash division and remainder algorithm, the remainder of the total delayed data reading time value and the preset value is taken, and the obtained remainder value is determined as the time slicing value corresponding to the updated delayed data reading time. Specifically, the hash division and remainder algorithm can be: (the current time minute value of the updated delayed data reading time * 60 + seconds) hash3600, where hash means the remainder. 3600 means dividing the hash ring into 3600 parts. That is to say, the minute value and second value of the updated delayed data reading time are converted into the total second value, and then divided by 3600 to take the remainder, and then the time slicing value to be settled is obtained. For example, the updated delayed data reading time is 2021-04-13 18:02:09, then (2*60+9)%3600=129 is the time slicing value to be settled.

[0068] Step S103: Obtain corresponding delayed settlement data from the hash ring in the memory based on the time slice value to be settled.

[0069] In this embodiment, obtaining corresponding delayed settlement data from the hash ring in the memory includes:

[0070] Get the updated year, month, day, and hour values of the delayed data reading time;

[0071] Determine the year, month, day, and hour values corresponding to each time slice value on the hash ring in memory, and then obtain the delayed settlement data corresponding to the time slice value corresponding to both the year, month, day, and hour values of the updated delayed data read time and the time slice value to be settled from the hash ring in memory. Specifically, the execution entity may determine the time slice value on the hash ring in memory that is identical to the time slice value corresponding to the updated delayed data read time and that has the same corresponding date and hour as the time slice value that meets the reading requirements, and then read the delayed settlement data stored at the location of the time slice value on the hash ring.

[0072] Step S104: submitting the corresponding delayed settlement data to the thread pool to perform delayed settlement.

[0073] The execution entity can submit the corresponding delayed settlement data to the thread pool, so that the corresponding thread in the thread pool pushes the delayed settlement data to the data processing link to perform delayed settlement and delete the current data processing node.

[0074] This embodiment obtains delayed settlement data, calculates the corresponding time slice value based on the delayed execution time of the delayed settlement data, and stores it in the corresponding position on the hash ring of the memory; updates the delayed data reading time at a preset time interval to calculate the time slice value to be settled based on the updated delayed data reading time; obtains the corresponding delayed settlement data from the hash ring of the memory based on the time slice value to be settled; and submits the corresponding delayed settlement data to the thread pool to execute delayed settlement. This application optimizes the design of the data storage structure, determines the delayed settlement data to be obtained based on the updated current delayed data reading time, rather than uniformly pulling data within a certain time range to execute delayed settlement, thereby achieving stable system traffic and timely processing of delayed settlement services.

[0075] Figure 2 This is a schematic diagram of the main flow of the delayed settlement processing method according to the second embodiment of the present application. Figure 2 As shown, the delayed settlement processing methods include:

[0076] Step S201: Obtain delayed settlement data, calculate the corresponding time slice value according to the delayed execution time of the delayed settlement data, and store it in the corresponding position on the hash ring of the memory.

[0077] The principle of step S201 is similar to that of step S101 and will not be described again here.

[0078] Specifically, the "calculating the corresponding time slice value by delaying the execution time of the delayed settlement data" in step S201 can also be implemented through steps S2011 to S2012:

[0079] Specifically, in this embodiment, the corresponding time slice values are calculated for each of the acquired delayed settlement data. The execution entity can calculate the corresponding time slice value based on the delayed execution time corresponding to the delayed settlement data.

[0080] Specifically, as shown in step S2011, the minute value and second value of the delayed execution time are obtained, and then the total time value is determined.

[0081] The execution entity can obtain the minute value and second value of the delayed execution time of each delayed settlement data, and then determine the total second value, that is, the total time value.

[0082] Step S2012: Obtain the remainder between the total time value and the preset value according to the Hash remainder algorithm, and determine the obtained remainder value as the time slice value.

[0083] The hash remainder algorithm can be: (the current number of minutes of the delayed execution time of each delayed settlement data * 60 + seconds) hash3600, where the hash represents the remainder. 3600 means that the hash ring is divided into 3600 parts. In other words, the minutes and seconds of the delayed execution time are converted into a total second value, then divided by 3600 to obtain the remainder, thereby obtaining the time slice value to be settled. For example, if the delayed execution time of a delayed settlement data is 2021-04-13 18:02:09, then (2*60+9)%3600=129 is the corresponding time slice value.

[0084] This embodiment determines the time slice value based only on the minute and second values of the delayed execution time, thereby streamlining the calculation process, increasing the calculation rate of the time slice value, reducing system data processing delays, and improving user experience while ensuring the correctness of the calculated time slice value.

[0085] The "storage to the corresponding position on the hash ring in the memory" in step S201 can also be achieved through step S2013:

[0086] Step S2013: In response to determining that the corresponding position on the hash ring of the memory corresponding to the time slice value has stored historical delayed settlement data, the delayed settlement data is stored in the corresponding position on the hash ring of the memory using a red-black tree.

[0087] Specifically, all non-real-time runnable processes are linked to a red-black tree using their virtual run time as the key value to achieve fair and efficient task scheduling. During scheduling, a red-black tree, keyed by time, is used to select the next task. Task priority is determined based on the CPU time usage of all tasks. A red-black tree is a self-balancing binary search tree in which each node is colored red or black. This color is used to check the tree's balance. Red-black trees can achieve better performance as indexing mechanisms in embedded databases. A red-black tree is a binary search tree in which each node is colored either red or black. Node arrangement rules in a red-black tree can be: nodes are either red or black, the root node is black, all leaves are black, both child nodes of each red node are black, no two consecutive red nodes can exist on any path from any leaf to the root, and all paths from any node to each leaf contain the same number of black nodes. Newly inserted nodes are set to red. The execution entity can store delayed settlement data according to the aforementioned requirements for red-black tree nodes. Specifically, when the same time slice value corresponds to the same multiple delayed settlement data, the execution entity can use a red-black tree, and based on the node arrangement rules of the above-mentioned red-black tree, add the same multiple delayed settlement data corresponding to the same time slice value as multiple nodes to the red-black tree for storage. Specifically, the situation where the same time slice value corresponds to the same multiple delayed settlement data can be, for example, there are two delayed settlement data: the time slice value corresponding to 2021-04-13 18:01:00 is (1*60+0)%3600=60, and the time slice value corresponding to 2021-04-1318:00:60 is (0*60+60)%3600=60. At this time, the time slice values corresponding to the two are both 60, which are the same. Then the execution entity can store these two delayed settlement data on the red-black tree.

[0088] This embodiment stores multiple delayed settlement data in a red-black tree when there are multiple delayed settlement data corresponding to the same time slice value, so as to achieve fairer and more efficient scheduling of delayed data processing tasks, thereby enabling the delayed data processing mechanism to achieve better performance.

[0089] Step S202: updating the delayed data reading time at a preset time interval, and calculating the time slice value to be settled according to the updated delayed data reading time.

[0090] Step S203: Obtain corresponding delayed settlement data from the hash ring in the memory based on the time slice value to be settled.

[0091] Step S204: submitting the corresponding delayed settlement data to the thread pool to perform delayed settlement.

[0092] The principles of steps S202 to S204 are similar to those of steps S102 to S104 and are not described again here.

[0093] Figure 3 Schematic diagram of the application scenario of the delayed settlement processing method according to the third embodiment of the present application. The delayed settlement processing method is applied to the delayed settlement scenario. Figure 3 As shown, server 303 obtains delayed settlement data 301 and calculates a corresponding time slice value 304 based on the delayed execution time 302 of the delayed settlement data. The calculated value is then stored in a corresponding location A or B on a hash ring 305 in memory. Server 303 updates the delayed data read time at a preset time interval 306 to obtain an updated delayed data read time 307. Based on the updated delayed data read time 307, server 303 calculates a pending settlement time slice value 308. Based on the pending settlement time slice value 308, server 303 obtains corresponding delayed settlement data 309 from the hash ring 305 in memory. Server 303 submits the corresponding delayed settlement data 309 to a thread pool 310 to execute delayed settlement.

[0094] Figure 4 Schematic diagram of the main modules of the delayed settlement processing device according to an embodiment of the present application. Figure 4 As shown, the delayed settlement processing device includes an acquisition unit 401, a calculation unit 402, a delayed settlement data acquisition unit 403 and an execution unit 404.

[0095] The acquisition unit 401 is configured to acquire delayed settlement data, calculate a corresponding time slice value according to the delayed execution time of the delayed settlement data, and store the value in a corresponding position on the hash ring of the memory.

[0096] The calculation unit 402 is configured to update the delayed data reading time at a preset time interval, so as to calculate the time slice value to be settled according to the updated delayed data reading time.

[0097] The delayed settlement data acquisition unit 403 is configured to acquire corresponding delayed settlement data from the hash ring in the memory based on the time slice value to be settled.

[0098] The execution unit 404 is configured to submit the corresponding delayed settlement data to the thread pool to perform delayed settlement.

[0099] In some embodiments, the acquisition unit 401 is further configured to: receive order information, and then determine the delayed settlement time of the order information; periodically poll the database and obtain delayed settlement data corresponding to the delayed settlement time within a preset delayed settlement time range from the database.

[0100] In some embodiments, the acquisition unit 401 is further configured to: obtain the minute value and second value of the delayed execution time, and then determine the total time value; according to the hash division remainder algorithm, take the remainder of the total time value and the preset value, and determine the obtained remainder value as the time slice value.

[0101] In some embodiments, the acquisition unit 401 is further configured to: in response to determining that the corresponding position on the hash ring of the memory corresponding to the time slice value has stored historical delayed settlement data, store the delayed settlement data at the corresponding position on the hash ring of the memory using a red-black tree.

[0102] In some embodiments, the calculation unit 402 is further configured to: calculate the corresponding total delayed data reading time value based on the minute value and second value of the updated delayed data reading time, and then take the remainder of the total delayed data reading time value and the preset value based on the hash division and remainder algorithm, and determine the obtained remainder value as the time slice value corresponding to the updated delayed data reading time.

[0103] In some embodiments, the delayed settlement data acquisition unit 403 is further configured to: obtain the year, month, day, and hour values of the updated delayed data reading time; determine the year, month, day, and hour values corresponding to each time slice value on the hash ring of the memory, and then obtain the delayed settlement data corresponding to the time slice value corresponding to the year, month, day, and hour values of the updated delayed data reading time and the time slice value to be settled from the hash ring of the memory.

[0104] It should be noted that the delayed settlement processing method and the delayed settlement processing device in this application have a corresponding relationship in terms of specific implementation content, so the repeated content will not be explained again.

[0105] Figure 5 An exemplary system architecture 500 is shown to which the delayed settlement processing method or delayed settlement processing apparatus according to the embodiments of the present application can be applied.

[0106] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired or wireless communication links or fiber optic cables.

[0107] Users can use terminal devices 501, 502, and 503 to interact with server 505 via network 504 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 501, 502, and 503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).

[0108] The terminal devices 501 , 502 , and 503 may be various electronic devices having a delayed settlement processing screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.

[0109] Server 505 can be a server that provides various services, such as a background management server (only as an example) that provides support for delayed settlement data submitted by users using terminal devices 501, 502, and 503. The background management server can obtain delayed settlement data, calculate the corresponding time slicing value through the delayed execution time of the delayed settlement data, and store it in the corresponding position on the hash ring of the memory; update the delayed data reading time at a preset time interval to calculate the time slicing value to be settled based on the updated delayed data reading time; obtain the corresponding delayed settlement data from the hash ring of the memory based on the time slicing value to be settled; submit the corresponding delayed settlement data to the thread pool to execute delayed settlement. The present application performs design optimization in terms of data storage structure, and determines the delayed settlement data to be obtained based on the current delayed data reading time, rather than uniformly pulling data within a certain time range to execute delayed settlement, thereby achieving smooth system traffic and timely processing of delayed settlement services.

[0110] It should be noted that the delayed settlement processing method provided in the embodiment of the present application is generally executed by the server 505, and accordingly, the delayed settlement processing device is generally set in the server 505.

[0111] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as required.

[0112] Reference below Figure 6 , which shows a structural diagram of a computer system 600 of a terminal device suitable for implementing an embodiment of the present application. Figure 6 The terminal device shown is merely an example and should not limit the functions and scope of use of the embodiments of the present application.

[0113] like Figure 6As shown, the computer system 600 includes a central processing unit (CPU) 601, which can 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 unit 608 into a random access memory (RAM) 603. Various programs and data required for the operation of the computer system 600 are also stored in the RAM 603. The CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0114] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, and the like; an output section 607 including displays such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 608 including a hard disk; and a communication section 609 including a network interface card such as a LAN card or a modem. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. Removable media 611, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 610 as needed, so that computer programs read therefrom can be installed into the storage section 608 as needed.

[0115] In particular, according to the embodiments disclosed in the present application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed in the present application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program comprising program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 609, and / or installed from a removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present application are executed.

[0116] It should be noted that the computer-readable medium shown in this application 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, device, or device, or any combination of the above. More specific examples of computer-readable storage media 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 this application, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. This propagated data signal can take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wireline, optical fiber cable, RF, or any suitable combination thereof.

[0117] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of the boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0118] The units described in the embodiments of this application may be implemented in software or hardware. The units described may also be provided in a processor. For example, a processor may be described as comprising an acquisition unit, a calculation unit, a delayed settlement data acquisition unit, and an execution unit. The names of these units do not, in some cases, limit the units themselves.

[0119] As another aspect, the present application also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by a device, the device obtains delayed settlement data, calculates the corresponding time slicing value through the delayed execution time of the delayed settlement data, and stores it in the corresponding position on the hash ring of the memory; updates the delayed data reading time at a preset time interval to calculate the time slicing value to be settled based on the updated delayed data reading time; obtains the corresponding delayed settlement data from the hash ring of the memory based on the time slicing value to be settled; submits the corresponding delayed settlement data to the thread pool to execute delayed settlement. The present application optimizes the design of the data storage structure, determines the delayed settlement data to be obtained based on the current delayed data reading time, rather than uniformly pulling data within a certain time range to execute delayed settlement, thereby achieving smooth system traffic and timely processing of delayed settlement services.

[0120] According to the technical solution of the embodiment of the present application, by obtaining delayed settlement data, the corresponding time slicing value is calculated by the delayed execution time of the delayed settlement data, and stored in the corresponding position on the hash ring of the memory; the delayed data reading time is updated at a preset time interval, and the time slicing value to be settled is calculated according to the updated delayed data reading time; the corresponding delayed settlement data is obtained from the hash ring of the memory based on the time slicing value to be settled; and the corresponding delayed settlement data is submitted to the thread pool to execute delayed settlement. The present application optimizes the design of the data storage structure, and determines the delayed settlement data to be obtained based on the current delayed data reading time, rather than uniformly pulling data within a certain time range to execute delayed settlement, thereby achieving smooth system traffic and timely processing of delayed settlement services.

[0121] The above specific embodiments do not constitute a limitation on the scope of protection of this application. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application shall be included within the scope of protection of this application.

Claims

1. A delayed settlement processing method, characterized in that: include: Obtaining delayed settlement data, calculating a corresponding time slice value based on the delayed execution time of the delayed settlement data, and storing the value in a corresponding position on a hash ring in memory; Calculating the corresponding time slice value based on the delayed execution time of the delayed settlement data includes: obtaining the minute value and the second value of the delayed execution time, thereby determining the total time value; taking the remainder between the total time value and a preset value according to a hash remainder algorithm, and determining the obtained remainder value as the time slice value; determining the total time value includes: converting the minute value and the second value of the delayed execution time into a total second value as the total time value; Update the delayed data reading time at a preset time interval to calculate the time shard value to be settled based on the updated delayed data reading time; Obtaining corresponding delayed settlement data from the hash ring in memory based on the time slice value to be settled; Submit the corresponding delayed settlement data to the thread pool to perform delayed settlement.

2. The method according to claim 1, characterized in that The obtaining of corresponding delayed settlement data includes: Receiving order information, and then determining a delayed settlement time for the order information; The database is polled periodically to obtain delayed settlement data corresponding to the delayed settlement time within the preset delayed settlement time range from the database.

3. The method according to claim 1, characterized in that The corresponding position on the hash ring stored in the memory includes: In response to determining that the corresponding position on the hash ring of the memory corresponding to the time slice value has stored historical delayed settlement data, the delayed settlement data is stored in the corresponding position on the hash ring of the memory using a red-black tree.

4. The method according to claim 1, wherein The calculation of the time slice value to be settled includes: According to the minute and second values of the updated delayed data reading time, the corresponding total delayed data reading time value is calculated, and then according to the hash division and remainder algorithm, the remainder of the total delayed data reading time value and the preset value is taken, and the obtained remainder value is determined as the time slice value corresponding to the updated delayed data reading time.

5. The method according to claim 1, wherein The step of obtaining corresponding delayed settlement data from the hash ring in the memory includes: Get the updated year, month, day, and hour values of the delayed data reading time; Determine the year, month, day, and hour values corresponding to each time slice value on the hash ring of the memory, and then obtain the delayed settlement data corresponding to the time slice value corresponding to the year, month, day, and hour values of the updated delayed data reading time and the time slice value to be settled from the hash ring of the memory.

6. A delayed settlement processing device, characterized in that: include: an acquisition unit configured to acquire delayed settlement data, calculate a corresponding time slice value based on the delayed execution time of the delayed settlement data, and store the calculated value in a corresponding position on a hash ring in a memory; the acquisition unit is further configured to: acquire the minute value and the second value of the delayed execution time, thereby determining a total time value; and calculate a remainder between the total time value and a preset value according to a hash remainder algorithm, and determine the obtained remainder value as the time slice value; The determining of the total time value includes: converting the minute value and the second value of the delayed execution time into a total second value as the total time value; a calculation unit configured to update the delayed data reading time at a preset time interval, so as to calculate the time slice value to be settled according to the updated delayed data reading time; a delayed settlement data acquisition unit, configured to acquire corresponding delayed settlement data from a hash ring in a memory based on the to-be-settled time slice value; The execution unit is configured to submit the corresponding delayed settlement data to the thread pool to perform delayed settlement.

7. The device according to claim 6, characterized in that The acquisition unit is further configured to: Receiving order information, and then determining a delayed settlement time for the order information; The database is polled periodically to obtain delayed settlement data corresponding to the delayed settlement time within the preset delayed settlement time range from the database.

8. The device according to claim 6, characterized in that The acquisition unit is further configured to: In response to determining that the corresponding position on the hash ring of the memory corresponding to the time slice value has stored historical delayed settlement data, the delayed settlement data is stored at the corresponding position on the hash ring of the memory using a red-black tree.

9. An electronic device for delayed settlement processing, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.

10. A computer-readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Data processing method and device, computer readable medium and electronic equipment

    CN112162859A