[go: up one dir, main page]

CN107886424B - Settlement data processing method and device, computer equipment and storage medium - Google Patents

Settlement data processing method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN107886424B
CN107886424B CN201711218490.2A CN201711218490A CN107886424B CN 107886424 B CN107886424 B CN 107886424B CN 201711218490 A CN201711218490 A CN 201711218490A CN 107886424 B CN107886424 B CN 107886424B
Authority
CN
China
Prior art keywords
settlement
settlement data
data
item
buffer area
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201711218490.2A
Other languages
Chinese (zh)
Other versions
CN107886424A (en
Inventor
林浩杰
陈煜东
李德铠
黄荣坚
李力
王旻
庞博
潘礼
黄奕坤
曾君亮
陈佩意
张金栋
李斌
刘鑫
郭志强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201711218490.2A priority Critical patent/CN107886424B/en
Publication of CN107886424A publication Critical patent/CN107886424A/en
Application granted granted Critical
Publication of CN107886424B publication Critical patent/CN107886424B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/12Accounting

Landscapes

  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Engineering & Computer Science (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention provides a settlement data processing method, which comprises the following steps: acquiring a user identifier to be settled and each settlement item of the user identifier; carrying out expense settlement on each settlement item of the user identification through a producer thread to obtain item settlement data corresponding to each settlement item and storing the item settlement data into a data buffer area; and pulling the item settlement data from the data buffer area through a consumer thread, and integrating the item settlement data of the same user identifier to obtain settlement data and pushing the settlement data. The producer thread and the consumer thread are not affected with each other, but share the data of the data buffer, so that the producer thread production item settlement data and the consumer use item settlement data are integrated into settlement data and pushed to be processed in parallel, the original processing of the same data is divided into two threads to be processed in parallel, the processing time is saved, and the processing efficiency of the settlement data is improved.

Description

Settlement data processing method and device, computer equipment and storage medium
Technical Field
The invention relates to the technical field of internet, in particular to a settlement data processing method and device, computer equipment and a storage medium.
Background
The settlement data refers to a network platform providing paid services, and generally includes service types, fees, and the like, and is fee settlement data provided to a user according to a service purchased by the user.
In a traditional settlement data processing method, in a settlement period, the cost of each user is settled in sequence to generate a bill, and the bill is pushed in a mode selected by the user. For example, the message is pushed to a mobile phone reserved by the user in a short message form, or sent to a mailbox of the user, and the like.
And one processing process can process the settlement data of another user after finishing the whole expense settlement and bill pushing of one user, so that the time is long and the processing efficiency is low.
Disclosure of Invention
Based on this, it is necessary to provide a settlement data processing method and apparatus, a computer device, and a storage medium with high processing efficiency for solving the problem of low processing efficiency of the conventional settlement data.
In order to achieve the above purpose, one embodiment adopts the following technical scheme:
a settlement data processing method comprising:
acquiring a user identifier to be settled and each settlement item of the user identifier;
carrying out expense settlement on each settlement item of the user identification through a producer thread to obtain item settlement data corresponding to each settlement item and storing the item settlement data into a data buffer area;
and pulling the item settlement data from the data buffer area through a consumer thread, and integrating the item settlement data of the same user identifier to obtain settlement data and pushing the settlement data.
A settlement data processing apparatus comprising: an acquisition module, a production module and a consumption module;
the acquisition module is used for acquiring the user identification to be settled and each settlement item of the user identification;
the production module is used for carrying out expense settlement on each settlement item of the user identification through a producer thread to obtain item settlement data corresponding to each settlement item and storing the item settlement data into a data buffer area;
and the consumption module is used for pulling the item settlement data from the data buffer area through a consumer thread, integrating the item settlement data of the same user identifier to obtain the settlement data and pushing the settlement data.
A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the settlement data processing method as described above when executing the program.
A storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the settlement data processing method described above.
According to the settlement data processing method and device, the computer equipment and the storage medium, the producer thread is responsible for producing item settlement data and caching the item settlement data into the data buffer area, the consumer thread is responsible for using the item settlement data of the data buffer area, the settlement data of the same user identification are integrated and obtained and pushed, the serial processing mode of the traditional settlement data is changed, namely the producer thread is responsible for producing the item settlement data, after the settlement item of one user identification is subjected to cost settlement, the next settlement item can be subjected to cost settlement and stored into the data buffer area, when the consumer thread has the item settlement data in the data buffer area, the item settlement data of the same user identification is integrated to obtain the settlement data and pushed, and after one settlement data is processed, the next settlement data can be processed, therefore, the data processing between the producer thread and the consumer thread does not influence each other, only the data in the data buffer area is shared, the settlement data generated by the producer thread and the consumer thread are integrated into the item settlement data and pushed to be processed in parallel, the original settlement data can be processed in two parallel processing threads, and the settlement efficiency is improved.
Drawings
Fig. 1 is a schematic diagram of an application environment of a settlement data processing method and apparatus according to an embodiment;
fig. 2 is a schematic diagram of the internal configuration of the settlement data processing server of an embodiment;
fig. 3 is a flowchart of a settlement data processing method of another embodiment;
FIG. 4 is a schematic diagram of a settlement model according to one embodiment;
fig. 5 is a flowchart of a settlement data processing method of yet another embodiment;
FIG. 6 is a schematic diagram of a settlement cycle according to one embodiment;
fig. 7 is a block diagram showing the structure of a settlement data processing apparatus according to an embodiment;
fig. 8 is a block diagram showing the configuration of still another settlement data processing apparatus.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the detailed description and specific examples, while indicating the scope of the invention, are intended for purposes of illustration only and are not intended to limit the scope of the invention.
Fig. 1 is a schematic application environment diagram of a settlement data processing method and apparatus according to an embodiment. As shown in fig. 1, the application environment includes a settlement data processing server 101, a settlement data push server 103, and a client 105. The settlement data processing server 101 is in communication connection with the settlement data push server 103, and the settlement data push server 103 is in communication connection with the client 105. The settlement data processing method is executed on the settlement data processing server 101, when settlement conditions are met, the user identification to be settled and each settlement item of the user identification are obtained, the producer thread performs expense settlement on each settlement item of the user identification, item settlement data corresponding to each settlement item are obtained and stored in the data buffer area, the messenger thread pulls the item settlement data from the data buffer area, and the item settlement data of the same user identification are integrated to obtain the settlement data. The settlement data processing server 101 pushes the settlement data to the settlement data pushing server 103, and the settlement data pushing server generates a settlement bill according to the settlement data and pushes the settlement bill to the client 105 corresponding to the user identifier.
Fig. 2 is a schematic diagram of the internal configuration of the settlement data processing server 101 according to an embodiment. As shown in fig. 2, the settlement data processing server in this embodiment includes: a processor, a storage medium, an internal memory, and a network interface connected by a system bus. Wherein, the processor is used for providing calculation and control capability and supporting the operation of the whole server. The storage medium of the settlement data processing server stores an operating system and a computer program of a settlement data processing device for implementing a settlement data processing method when executed by a processor. The internal memory of the settlement data processing server provides an environment for the operation of the settlement data processing device in the storage medium. The network interface of the server is used for network communication with the settlement data push server, for example, sending settlement data to the push data server. It will be understood by those skilled in the art that the structure shown in fig. 2 is a block diagram of only a part of the structure related to the scheme of the present invention, and does not constitute a limitation of the server to which the scheme of the present invention is applied, and a specific settlement data processing server may include more or less components than those shown in the figure, or combine some components, or have a different arrangement of components.
A settlement data processing method operating in a settlement data processing server 101 shown in fig. 1, as shown in fig. 3, the method comprising the steps of:
s302, acquiring the user identification to be settled and each settlement item of the user identification.
The user identifier is an identifier that uniquely identifies user information, and is typically a user ID.
The network platform provides paid service for the user, the user generates corresponding cost after purchasing the service, and the purchased service is settled through service items and service price. The service items refer to provided service contents, one service item corresponds to one service content, and a network platform may provide multiple service items. The specific settlement items are related to the services provided by the network platform. The settlement item refers to a service item purchased by the user identifier to be settled. In this embodiment, a list of user identifiers to be settled, a settlement item of each user identifier, and configuration information of the settlement item are obtained.
Taking a cloud service as an example, the service items include a cloud host and a network. The cloud host and the network flow are respectively provided with charging rules (including service prices). The cloud host provides the rental service of the servers, and the configured service prices of different servers are different. The network comprises broadband and usage flow, and the network respectively has different charging modes, for example, the time unit of charging is second. For a user who purchased a cloud host, the settlement item is the cloud host.
Specifically, whether the set settlement time is reached is detected, and when the set settlement time is detected to be reached, the step of acquiring the user identifier to be settled and each settlement item of the user identifier is executed. The settlement time corresponds to the settlement period. In the embodiment, the settlement time can be flexibly set to meet the requirements of different network platforms. For example, for a network platform with high charging accuracy requirement and flexible computing mode, a shorter settlement period can be set, such as once per hour settlement.
S304: and carrying out expense settlement on each settlement item of the user identification through a producer thread to obtain item settlement data corresponding to each settlement item and storing the item settlement data into a data buffer area.
The producer thread refers to a process for producing data, and the producer thread in this embodiment is used for producing project settlement data. Specifically, the producer thread pulls the user identifier to be settled and each settlement item of the user identifier, and performs fee settlement on each settlement item of the user according to the configuration information, the service price and the charging rule to obtain item settlement data corresponding to each settlement item of the user identifier. And the expense settlement is carried out through the user identification, so that the bill of the user can be integrated conveniently.
And for the user identification with a plurality of settlement items, respectively carrying out expense settlement on each settlement item of the user identification to obtain item settlement data corresponding to each settlement item.
The data buffer is used for caching data produced by the producer thread, and is used for caching item settlement data in the embodiment.
S306: and pulling the item settlement data from the data buffer area through a consumer thread, and integrating the item settlement data of the same user identifier to obtain settlement data and pushing the settlement data.
A consumer thread refers to a process that uses data produced by a producer thread. In this embodiment, the consumer thread pulls settlement data from the data buffer and integrates the item settlement data of the same user identifier, so that the settlement data of the same user is integrated together, and a bill is conveniently formed.
The integration data is used for merging single item settlement data belonging to the same user identifier into one piece of settlement data and providing support for the settlement data pushing server. Specifically, the integration amount may be set according to the push requirement of the settlement data server, i.e. the integration amount of the messenger thread corresponds to the maximum settlement item number of the bill generated by the settlement data server. And the consumer thread sequentially pulls the user identification according to the user identification list to be settled, pulls all item settlement data of the user identification from the data buffer area, pulls the item settlement data with the quantity corresponding to the integrated quantity from the user identification for integration when the quantity of the item settlement data of the user identification is more than the set integrated quantity, obtains the user identification settlement data, pushes the user identification settlement data to a settlement data pushing server, and generates and sends the user identification settlement data to a corresponding user by the settlement data pushing server. In the embodiment, the project settlement data of the same user identifier are integrated through the consumer thread, so that the settlement data of the same user identifier can be integrated, the interaction between the settlement data processing server and the settlement data pushing server is reduced, and network resources are saved.
According to the settlement data processing method, the producer thread carries out expense settlement on each settlement item of the user identification to obtain item settlement data corresponding to each settlement item and stores the item settlement data in the data buffer area, and the consumer thread can directly use the item settlement data in the data buffer area, integrate the item settlement data of the same user identification to obtain the settlement data and push the settlement data. The producer thread is responsible for producing the item settlement data and caching the item settlement data to the data buffer area, the consumer thread is responsible for using the item settlement data of the data buffer area, the settlement data of the same user identifier is integrated and obtained and pushed, the serial processing mode of the traditional settlement data is changed, namely the producer thread is responsible for producing the item settlement data, after the settlement item of one user identifier is subjected to cost settlement, the next settlement item can be subjected to cost settlement and stored in the data buffer area, when the consumer thread has the item settlement data in the data buffer area, the item settlement data of the same user identifier is integrated and obtained and pushed, and after one settlement data is processed, the next settlement data can be processed, therefore, the data processing between the producer thread and the consumer thread is not influenced mutually, only the data of the data buffer area is shared, so the producer thread production item settlement data and the consumer use item settlement data are integrated into the settlement data and pushed, and can be processed in parallel, the original processing of the same data is divided into two threads for parallel processing, the processing time is saved, and the processing efficiency of the settlement data is improved.
The settlement model in one embodiment is shown in FIG. 4 and includes a producer thread, a data buffer, and a producer thread. In the model, multithreading parallel processing is adopted, namely n producer threads and m consumer threads are processed in parallel, wherein n and m are both positive integers greater than 1.
Specifically, each producer thread sequentially acquires a user identifier from a user identifier list to be settled, and calculates item settlement data of the settlement item according to one settlement item of the user identifier matched with the user identifier and configuration information of the settlement item.
And each consumer thread sequentially acquires the user identification from the user identification list to be settled, and pulls the item settlement data of the same user identification from the data buffer area according to the user identification to integrate to obtain settlement data and pushes the settlement data.
Since the plurality of producer threads and messenger threads are processed in parallel, the processing efficiency of the settlement data can be further improved.
In one embodiment, the number of producer threads n is greater than the number of consumer threads m in the settlement model to ensure that enough item settlement data is produced to be stored in the data buffer for use by the consumer threads.
In another embodiment, the settlement data processing method further includes: the processing performance of the settlement data is monitored and the number of producer threads and consumer threads is adjusted based on the processing performance.
The processing performance of the settlement data refers to the service performance of hardware and software in the settlement data processing process, and comprises the settlement data processing efficiency and the hardware performance in the settlement data processing process. The processing performance of settlement data is monitored, and the number of producer threads and consumer threads is adjusted according to the processing performance. For example, in the case where the settlement data processing efficiency is low, the concurrent processing capability of the settlement data is improved by increasing the number of threads of the producer and the consumer, so that the settlement data processing efficiency is improved. For another example, when a decrease in hardware performance during settlement data processing is monitored, server load is reduced by reducing the number of producer and consumer threads. In this embodiment, by monitoring the processing performance of the settlement processing, the number of threads of the producer and the consumer can be flexibly set, and the settlement data processing is optimized.
Specifically, the step of monitoring the processing performance of the settlement data includes the processing time of the current settlement data, the processing performance of the settlement data, and adjusting the number of the producer threads and the consumer threads according to the processing performance includes: when the current settlement data is processed, counting the processing time of the current settlement data; when the secondary processing time is greater than a preset value, the number of producer threads and consumer threads is increased.
In this embodiment, a fixed settlement period may be set, and when one settlement period is reached, the fee generated in the settlement period is settled. The time of the settlement period may be a month, week, day, or hour. The shorter the settlement period is, the more flexible the service mode provided by the network platform is, the user can purchase short-term service according to the requirement, the use cost of the network platform is saved, and the use threshold of the network platform is reduced. Taking the settlement period as one hour as an example, the fee of the network platform is settled every other hour. In the current settlement period, the usage amount of the network platform in the last hour is settled.
And when the current settlement data processing is finished, namely the settlement data processing of the current settlement period is finished, counting the processing time of the current settlement data. The processing time of the secondary settlement data can reflect the processing efficiency. When the secondary processing time is greater than a preset value, the number of producer threads and consumer threads is increased.
Specifically, whether the current settlement data processing is completed or not is judged according to the item settlement fee of the data buffer area. And sending the settlement data integrated by the consumer thread three times to a settlement data pushing server, caching the item settlement data corresponding to the settlement data to a data buffer area if the settlement data integrated by the consumer thread fails for three times, marking the item settlement data, and deleting the item settlement data corresponding to the data buffer area for the settlement data which is successfully sent. When the item settlement data is not cached in the data buffer area or only the item settlement data with marks is cached, the processing of the secondary settlement data is judged to be finished.
In one embodiment, the processing capabilities of the settlement data include hardware performance parameters of the host at the time of settlement data processing. The step of monitoring the processing performance of the settlement data and adjusting the number of producer threads and consumer threads in accordance with the processing performance comprises: monitoring hardware performance parameters of a host computer during settlement data processing; and when the monitored hardware performance parameters meet the adjusting conditions, adjusting the number of the producer threads or the consumer threads.
The host in this embodiment is a settlement data processing server host. The hardware performance parameter of the host refers to a hardware performance index capable of reflecting the host load condition in the settlement data processing process. Such as CPU occupancy and disk usage. And respectively setting an upper limit and a lower limit for each hardware performance parameter. When the hardware performance parameter exceeds the upper limit, the number of the producer threads and the consumer threads is reduced, and when the hardware performance parameter is lower than the lower limit, the number of the producer threads and the consumer threads is increased. For example, when the CPU occupancy exceeds its corresponding upper limit, the number of producer threads and consumer threads is reduced to reduce the load on the server host. When the CPU occupancy is lower than the corresponding lower limit, the number of the producer threads and the consumer threads is increased, the resources of the server host are fully utilized, and the settlement data processing efficiency is further improved.
In this embodiment, the number of producer threads and consumer threads can be flexibly adjusted by monitoring the processing performance of the settlement data, so as to achieve the balance between the settlement data processing efficiency and the host load.
In other embodiments, the purchase amount of the network platform service can be monitored, the purchase amount is in positive correlation with the number of the producer threads and the consumer threads, and the number of the producer threads and the consumer threads is adjusted according to the purchase amount.
In one embodiment, when the pushing of the settlement data is successful, the item settlement data corresponding to the data buffer is deleted.
And when the pushing of the settlement data fails, marking the item settlement data corresponding to the data buffer area.
By deleting the item settlement data corresponding to the settlement data which is successfully pushed in the data buffer area and marking the item settlement data corresponding to the settlement data which is unsuccessfully pushed, only the item settlement data which is unsuccessfully pushed in the next settlement period can be reserved.
Before the step of obtaining the user identifier to be settled and each settlement item of the user identifier, the method further comprises the following steps:
when the data buffer area stores item settlement data with marks, the item settlement data with marks is pulled from the data buffer area through a consumer thread, and the item settlement data with marks of the same user identification is integrated to obtain compensation settlement data and is pushed.
When a new settlement period starts, if the data buffer area stores item settlement data with marks, the consumer thread pulls the item settlement data with the marks from the data buffer area, namely the item settlement data which is not successfully pushed in the previous settlement period, integrates the item settlement data with the marks of the same user mark to obtain compensation settlement data and pushes the compensation settlement data to the settlement data pushing server.
According to the settlement data processing method, when settlement starts each time, data which are failed to be pushed in the previous period are processed, and the marked project settlement data of the same user identifier are integrated to obtain the compensation settlement data and pushed, so that retry of pushing of the settlement data in the same settlement period can be realized, the delay of data pushing is not more than two periods, and the real-time performance of bill pushing is realized.
In other embodiments, the settlement model has a relatively complete warning function, and by setting a warning mode, such as an information warning and setting a contact mode of a processor, when abnormal phenomena such as termination of a settlement process, overlong settlement time and the like occur, the settlement model can warn corresponding processors in short messages, weChat and other modes, so that research and development personnel can sense and intervene in processing problems at the first time.
The cloud service charge settlement is described below using the above settlement data processing method. As shown in fig. 5, the method comprises the steps of:
s502: whether the set settlement time is reached is detected.
The settlement time in this embodiment corresponds to the settlement period, and in order to reduce the use threshold of the cloud service, improve the flexibility of the settlement, and reduce the cost of the user for using the cloud service, the settlement period in this embodiment is set to be per hour, that is, the cost of the cloud service is settled per hour.
S504: when the set settlement time is up, judging whether the data buffer area stores the item settlement data with marks or not. If yes, go to step S506, otherwise go to step S508.
S506: and pulling the marked item settlement data from the data buffer area through a consumer thread, and integrating the marked item settlement data of the same user identifier to obtain the compensation settlement data and pushing the compensation settlement data.
The settlement model for one embodiment is shown in FIG. 4 and includes a producer thread, a data buffer, and a consumer thread. The producer thread refers to a process for producing data, and the producer thread in this embodiment is used for producing project settlement data. The data buffer is used for caching data produced by the producer thread, and is used for caching item settlement data in the embodiment. A consumer thread refers to a data process for producing using a producer thread.
The marked item settlement data of the data buffer area is data with a last settlement push period failure, when settlement starts each time, the data with the push period failure in the last period is processed firstly, the marked item settlement data with the same user identification are integrated to obtain the compensation push settlement data and pushed, so that retry of pushing the settlement data in the same settlement period can be realized, the delay of data pushing is ensured not to exceed two periods, and the real-time performance of bill pushing is realized.
After the execution of step S506 is completed, step S508 is executed.
S508: and acquiring the user identification to be settled and each settlement item of the user identification.
In this embodiment, the service items provided by the cloud service include a cloud host and a network service. The cloud host comprises a CPU, a memory and a data disk according to the volume charging. That is, cloud host price per hour = CPU price + memory price + data disk price. The cloud host deducts the fee per hour according to the fixed price, the network charging according to the amount comprises charging according to the bandwidth and charging according to the using flow, and the charging time unit is second. In this embodiment, a list of user identifiers to be settled, a settlement item of each user identifier, and configuration information of the settlement item are obtained.
S510: and (4) carrying out expense settlement on each settlement item of the user identifier through a producer thread to obtain item settlement data corresponding to each settlement item and storing the item settlement data into a data buffer area.
Specifically, the producer thread pulls the user identifier to be settled and each settlement item of the user identifier, and performs fee settlement on each settlement item of the user according to the configuration information, the service price and the charging rule to obtain item settlement data corresponding to each settlement item.
By adopting the settlement data processing method of the embodiment, a certain balance needs to be reserved in the user account, after the user starts using the settlement data processing method, the host cost (including a CPU, an internal memory and a data disc) of the host for one hour can be pre-frozen, settlement is carried out once at each integral point (Beijing time), and fee deduction is carried out according to the actual use duration of the host in the last hour. And the price is counted according to the actual use seconds during settlement. And the settlement model settles the account at regular time every hour, and in the current settlement stage, the use amount of the cloud server in the last hour is settled, and the settlement of terminating the charging is carried out on the returned cloud host. In addition, if the settlement period of the cloud host is as shown in 6, the cloud host is purchased and timed, and the cloud host is returned, destroyed and timed, the cloud host is in a defaulting shutdown state for a period of time in the middle, the cloud host is not charged, the settlement is continued after the recharging startup, and the sectional settlement can be carried out according to different configurations even if the configuration is changed in the middle.
S512: and pulling the item settlement data from the data buffer area through a consumer thread, and integrating the item settlement data of the same user identifier to obtain settlement data and pushing the settlement data.
In this embodiment, the consumer thread pulls settlement data from the data buffer, and integrates the item settlement data of the same user identifier. The integration data is used for merging single item settlement data belonging to the same user identifier into one piece of settlement data and providing support for the settlement data pushing server.
S514: and when the settlement data is pushed successfully, deleting the item settlement data corresponding to the data buffer area.
S516: and when the pushing of the settlement data fails, marking the item settlement data corresponding to the data buffer area.
And sending the settlement data integrated by the consumer thread to a settlement data pushing server for three times, and caching the item settlement data corresponding to the settlement data to a data buffer area and marking if the three times fail. By deleting the item settlement data corresponding to the settlement data which is successfully pushed in the data buffer area and marking the item settlement data corresponding to the settlement data which is unsuccessfully pushed, only the item settlement data which is unsuccessfully pushed in the next settlement period can be reserved.
After step S514 and step S516, it is judged whether the current settlement data processing is completed, that is, the item settlement data of the data buffer judges whether the current settlement data processing is completed. When the item settlement data is not cached in the data buffer area or only the item settlement data with the marks is cached, the processing of the secondary settlement data is judged to be finished.
S518: and when the processing of the current settlement data is finished, counting the processing time of the current settlement data.
When the secondary settlement data processing is not completed, the process returns to step S510.
After step S518, the processing time of the current settlement data is compared with a preset value.
S520: when the secondary processing time is greater than a preset value, the number of producer threads and consumer threads is increased.
And when the current settlement data is processed, namely the settlement data in the current settlement period is processed, counting the processing time of the current settlement data. The processing time of the secondary settlement data can reflect the processing efficiency. When the secondary processing time is greater than a preset value, the number of producer threads and consumer threads is increased.
According to the settlement data processing method, the producer thread production project settlement data and the consumer use project settlement data are integrated into settlement data and pushed to be processed in parallel, the original processing of the same data is divided into two threads to be processed in parallel, processing time is saved, processing efficiency of the settlement data is improved, meanwhile, the number of threads of the producer and the consumer can be flexibly set through monitoring processing performance of settlement processing, and processing efficiency is further improved.
A schematic structural diagram of the settlement data processing apparatus according to an embodiment is shown in fig. 7, and includes: an acquisition module 701, a production module 702, and a consumption module 703.
The obtaining module 701 is configured to obtain a user identifier to be settled and each settlement item of the user identifier.
The production module 702 is configured to perform cost settlement on each settlement item of the user identifier through a producer thread, obtain item settlement data corresponding to each settlement item, and store the item settlement data in a data buffer.
The consumption module 703 is configured to pull the item settlement data from the data buffer through a consumer thread, integrate the item settlement data of the same user identifier to obtain the settlement data, and push the settlement data.
In the settlement data processing device, the producer thread performs expense settlement on each settlement item of the user identifier to obtain item settlement data corresponding to each settlement item and stores the item settlement data in the data buffer area, and the consumer thread can directly use the item settlement data in the data buffer area, integrate the item settlement data of the same user identifier to obtain the settlement data and push the settlement data. The producer thread is responsible for producing the item settlement data and caching the item settlement data to the data buffer area, the consumer thread is responsible for using the item settlement data of the data buffer area, the settlement data of the same user identifier is integrated and obtained and pushed, the serial processing mode of the traditional settlement data is changed, namely the producer thread is responsible for producing the item settlement data, after the settlement item of one user identifier is subjected to cost settlement, the next settlement item can be subjected to cost settlement and stored in the data buffer area, when the consumer thread has the item settlement data in the data buffer area, the item settlement data of the same user identifier is integrated and obtained and pushed, and after one settlement data is processed, the next settlement data can be processed, therefore, the data processing between the producer thread and the consumer thread is not influenced mutually, only the data of the data buffer area is shared, so the producer thread production item settlement data and the consumer use item settlement data are integrated into the settlement data and pushed, and can be processed in parallel, the original processing of the same data is divided into two threads for parallel processing, the processing time is saved, and the processing efficiency of the settlement data is improved.
In another embodiment, as shown in fig. 8, the settlement data processing apparatus further comprises a monitoring module 704 and an adjusting module 705.
The monitoring module 704 is configured to monitor processing performance of settlement data.
The adjusting module 705 is configured to adjust the number of the producer threads and the consumer threads according to the processing performance.
In this embodiment, by monitoring the processing performance of the settlement processing, the number of threads of the producer and the consumer can be flexibly set, and the settlement data processing is optimized.
Specifically, the processing performance of the settlement data includes the processing time of the current settlement data.
The monitoring module 704 is configured to count the processing time of the current settlement data after the current settlement data is processed.
The adjusting module 705 is configured to increase the number of the producer threads and the consumer threads when the secondary processing time is greater than a preset value.
Specifically, the processing performance of the settlement data comprises hardware performance parameters of the host computer when the settlement data is processed.
The monitoring module 704 is configured to monitor hardware performance parameters of the host during settlement data processing.
The adjusting module 705 is configured to adjust the number of the producer threads or the consumer threads when it is monitored that the hardware performance parameter satisfies the adjusting condition.
In still another embodiment, the settlement data processing apparatus further includes a buffer management module 706, configured to delete the item settlement data corresponding to the data buffer when the settlement data is successfully pushed; and the system is also used for marking the project settlement data corresponding to the data buffer area when the settlement data fails to be pushed.
The consuming module 703 is further configured to, when the data buffer stores marked item settlement data, pull the marked item settlement data from the data buffer through a consumer thread, and integrate the marked item settlement data of the same user identifier to obtain post settlement data and push the post settlement data.
According to the settlement data processing device, the producer thread production project settlement data and the consumer use project settlement data are integrated into the settlement data and pushed to be processed in parallel, the original processing of the same data is divided into two threads to be processed in parallel, processing time is saved, processing efficiency of the settlement data is improved, meanwhile, the number of threads of the producer and the consumer can be flexibly set through monitoring processing performance of settlement processing, and processing efficiency is further improved.
It will be understood by those skilled in the art that all or part of the processes in the methods of the embodiments described above may be implemented by a computer program, which is stored in a non-volatile computer readable storage medium, and in the embodiments of the present invention, the program may be stored in the storage medium of a computer system and executed by at least one processor in the computer system to implement the processes of the embodiments including the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
Accordingly, in an embodiment, there is also provided a computer device including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements any one of the settlement data processing methods in the above embodiments when executing the program.
In one embodiment, a storage medium is further provided, on which a computer program is stored, which when executed by a processor, implements any one of the settlement data processing methods in the above embodiments.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is specific and detailed, but not to be understood as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A settlement data processing method, comprising:
when the set settlement time is detected to be reached, acquiring a user identifier to be settled and each settlement item of the user identifier;
carrying out fee settlement on each settlement item of the user identification through a producer thread according to configuration information, service price and charging rules to obtain item settlement data corresponding to each settlement item and storing the item settlement data into a data buffer area;
pulling the item settlement data from the data buffer area through a consumer thread, integrating the item settlement data of the same user identifier to obtain settlement data and pushing the settlement data;
when the item settlement data is not stored in the data buffer area or only the item settlement data with marks is cached, judging that the secondary settlement data is processed; when settlement data obtained by the project settlement data integration are pushed for three times and all the times fail, caching the project settlement data corresponding to the settlement data into the data buffer area, and marking;
when the current settlement data is processed, counting the processing time of the current settlement data;
when the processing time of the secondary settlement data is greater than a preset value, increasing the number of the producer threads and the consumer threads.
2. The settlement data processing method according to claim 1, further comprising:
monitoring hardware performance parameters of a host computer during settlement data processing;
and when the hardware performance parameters are monitored to meet the adjusting conditions, adjusting the number of the producer threads or the consumer threads.
3. The settlement data processing method according to claim 1, further comprising deleting the item settlement data corresponding to the data buffer when the settlement data is successfully pushed;
when the pushing of the settlement data fails, marking the item settlement data corresponding to the data buffer area;
before the step of obtaining the user identifier to be settled and each settlement item of the user identifier, the method further comprises the following steps:
when the item settlement data with the marks are stored in the data buffer area, the item settlement data with the marks are pulled from the data buffer area through a consumer thread, and the item settlement data with the marks of the same user identification are integrated to obtain compensation settlement data and are pushed.
4. The method of claim 2, wherein adjusting the number of producer threads or consumer threads when the hardware performance parameter is monitored to satisfy an adjustment condition comprises:
and when the hardware performance parameter is larger than the upper limit of the preset performance parameter, reducing the number of the producer threads and the consumer threads.
5. The method of claim 4, wherein the number of producer threads and consumer threads is increased when the hardware performance parameter is less than the preset performance parameter lower limit.
6. A settlement data processing apparatus characterized by comprising: the system comprises an acquisition module, a production module, a consumption module, a monitoring module and an adjustment module;
the acquisition module is used for acquiring the user identification to be settled and each settlement item of the user identification when the set settlement time is detected;
the production module is used for carrying out expense settlement on each settlement item of the user identification through a producer thread according to configuration information, service price and charging rules to obtain item settlement data corresponding to each settlement item and storing the item settlement data into a data buffer area;
the consumption module is used for pulling the item settlement data from the data buffer area through a consumer thread, integrating the item settlement data of the same user identifier to obtain settlement data and pushing the settlement data;
the monitoring module is used for judging that the secondary settlement data processing is finished when the project settlement data is not stored in the data buffer area or only the project settlement data with marks is cached; when settlement data obtained by the project settlement data integration are pushed for three times and all the times fail, caching the project settlement data corresponding to the settlement data into the data buffer area, and marking; after the current settlement data is processed, counting the processing time of the current settlement data;
the adjusting module is used for increasing the number of the producer threads and the consumer threads when the processing time of the current settlement data is larger than a preset value.
7. The settlement data processing device according to claim 6, wherein the monitoring module is further configured to monitor hardware performance parameters of the host during the settlement data processing;
and the adjusting module is further used for adjusting the number of the producer threads or the consumer threads when the hardware performance parameters are monitored to meet the adjusting conditions.
8. The settlement data processing device according to claim 6, further comprising a buffer management module configured to delete the item settlement data corresponding to the data buffer when the settlement data is successfully pushed; the system is also used for marking the item settlement data corresponding to the data buffer area when the settlement data is failed to be pushed;
the consumption module is further configured to, when the data buffer stores the item settlement data with the mark, pull the item settlement data with the mark from the data buffer through a consumer thread, and integrate the item settlement data with the mark of the same user identifier to obtain the push-up settlement data and push the push-up settlement data.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the settlement data processing method of any one of claims 1 to 5 when executing the program.
10. A storage medium on which a computer program is stored, characterized in that the program, when executed by a processor, implements the steps of the settlement data processing method of any one of claims 1 to 5.
CN201711218490.2A 2017-11-28 2017-11-28 Settlement data processing method and device, computer equipment and storage medium Active CN107886424B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711218490.2A CN107886424B (en) 2017-11-28 2017-11-28 Settlement data processing method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711218490.2A CN107886424B (en) 2017-11-28 2017-11-28 Settlement data processing method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN107886424A CN107886424A (en) 2018-04-06
CN107886424B true CN107886424B (en) 2022-12-16

Family

ID=61775923

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711218490.2A Active CN107886424B (en) 2017-11-28 2017-11-28 Settlement data processing method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN107886424B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108897613A (en) * 2018-05-07 2018-11-27 广西英腾教育科技股份有限公司 Data processing method, system and computer equipment
CN109034910A (en) * 2018-08-16 2018-12-18 中国建设银行股份有限公司 A kind of fee calculation procedure and device
CN109472584A (en) * 2018-09-27 2019-03-15 中国建设银行股份有限公司 Arrearage processing system, method and storage medium
CN111161019B (en) * 2019-12-18 2021-03-26 口碑(上海)信息技术有限公司 Data processing system and method
CN113988999B (en) * 2021-09-27 2025-01-14 上海数禾信息科技有限公司 Method, device, computer equipment and storage medium for settling business placement fees
CN114445214A (en) * 2022-01-21 2022-05-06 中国建设银行股份有限公司 Processing method and device for special fund engagement extraction, computer equipment and storage medium

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101620702A (en) * 2008-06-30 2010-01-06 中国移动通信集团黑龙江有限公司 Expenditure presentation processing method, device and system
CN102026138A (en) * 2009-09-16 2011-04-20 广州从兴电子开发有限公司 Communication fee bill output method and system
CN102760126B (en) * 2011-04-26 2015-04-01 阿里巴巴集团控股有限公司 Data synchronization method in distributive system, and distributive system
CN104717625A (en) * 2013-12-12 2015-06-17 中国移动通信集团河南有限公司 Credit control processing method and device
CN106293674B (en) * 2015-06-08 2020-02-14 宏碁股份有限公司 Method for automatically increasing and decreasing data consumers and device using method
CN106157187A (en) * 2016-07-04 2016-11-23 北京佳阳科技有限公司 A kind of guest room account due management method and device
CN106651443A (en) * 2016-12-19 2017-05-10 中国联合网络通信集团有限公司 User portrait information processing method and device
CN106790549B (en) * 2016-12-23 2021-01-15 北京奇虎科技有限公司 Data updating method and device
CN107239343B (en) * 2017-06-02 2020-10-16 浪潮金融信息技术有限公司 Data processing method and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Using python inbuild modules for effective pharmacy billing application;D. Jayaprakash;《2017 International Conference on IoT and Application (ICIOT)》;20171019;全文 *
大数据量多进程环境下生产者消费者模式实现研究;陈勇;《电脑编程技巧与维护》;20151218(第24期);全文 *

Also Published As

Publication number Publication date
CN107886424A (en) 2018-04-06

Similar Documents

Publication Publication Date Title
CN107886424B (en) Settlement data processing method and device, computer equipment and storage medium
CN108776934B (en) Distributed data calculation method and device, computer equipment and readable storage medium
JP6731203B2 (en) Risk identification method, client device and risk identification system
CN106815254B (en) Data processing method and device
CN111404838A (en) Message processing method, device and equipment
US20150172134A1 (en) Prioritizing service requests
CN111314747B (en) Resource outage control method, device, equipment and storage medium
CN112817753B (en) Task processing method and device, storage medium, and electronic device
CN104410993A (en) Method, device, terminal and system for flow monitoring
CN111182479A (en) Information sending control method and device
CN112419085A (en) Information push method, device, server and storage medium
US20150120940A1 (en) Apparatus and method for changing resource using pattern information, and recording medium using the same
CN112988417A (en) Message processing method and device, electronic equipment and computer readable medium
CN106530084B (en) Information processing method and server
CN116128351B (en) Resource transfer method and device based on charging pile and computer equipment
CN110351345B (en) Method and device for processing service request
CN114331446B (en) Method, device, equipment and medium for realizing out-of-chain service of block chain
CN118132646A (en) Data processing method, device, equipment, medium and program product of energy storage power station
CN113570411B (en) Popularization information display method and device, electronic equipment and storage medium
CN109218062B (en) Internet service alarm method and device based on confidence interval
EP2763098A1 (en) Information processing system, information processing method and computer-readable storage medium
CN111401819B (en) Intersystem data pushing method and system
US11950173B2 (en) Method of determining shared service index based on shared service of communication credential
CN113591005B (en) Information pushing method, device and terminal
US20170366602A1 (en) Server apparatus, information processing method, and computer program product

Legal Events

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