The treating method and apparatus of business datum
Technical field
The application is related to communication technical field, more particularly to a kind for the treatment of method and apparatus of business datum.
Background technology
With the fast development of Internet technology, increasing business can pass through real-time performance.At present, many business
Positive business and the reverse business opposite with positive business can all be included in scene, such as:Payment is positive business, and reimbursement
It is then reverse business etc..
In correlation technique, for the inquiry of reverse business datum, it usually needs by corresponding positive business datum together with this
Reverse business datum together returns to issuer, and this is often accomplished by repeatedly inquiring about database, and search efficiency is relatively low, together
When can also influence the performance of system.
The content of the invention
In view of this, the application provides a kind for the treatment of method and apparatus of business datum.
Specifically, the application is achieved by the following technical solution:
A kind of processing method of business datum, methods described includes:
When receiving reverse business datum, judge whether to have cached the corresponding positive business number of the reverse business datum
According to;
If having cached the corresponding positive business datum of the reverse business datum, to the positive business datum and described
Reverse business datum is cleaned, and is preserved wash result as reverse business record into database;
If the corresponding positive business datum of the uncached reverse business datum, is carried out clear to the reverse business datum
Wash, and preserved wash result as reverse business record into database.
A kind of processing unit of business datum, described device includes:
Reverse receiving unit, when receiving reverse business datum, judges whether to have cached the reverse business datum pair
The positive business datum answered;
Reverse process unit, if the corresponding positive business datum of the reverse business datum has been cached, to the forward direction
Business datum and the reverse business datum are cleaned, and are preserved wash result as reverse business record to database
In;If the corresponding positive business datum of the uncached reverse business datum, is cleaned to the reverse business datum, and
Preserved wash result as reverse business record into database.
The application is directed to the reverse data received it can be seen from above description, however, it is determined that cached the reverse industry
The corresponding positive business datum of data of being engaged in, then can in the lump clean to the positive business datum and the reverse business datum
Preserved afterwards as reverse business record into database, whole process is without database query operations, subsequently to reverse business
When data are inquired about, one query, which can be got, includes positive and reverse full service data, substantially increases inverse
To the search efficiency of business datum, while the performance of the system of raising.
Brief description of the drawings
Fig. 1 is a kind of schematic flow sheet of the processing method of business datum shown in the exemplary embodiment of the application one.
Fig. 2 is the positive processing logical schematic of one kind shown in the exemplary embodiment of the application one.
Fig. 3 is a kind of reverse process logical schematic shown in the exemplary embodiment of the application one.
Fig. 4 is an a kind of structural representation of processing unit for business datum shown in the exemplary embodiment of the application one
Figure.
Fig. 5 is a kind of block diagram of the processing unit of business datum shown in the exemplary embodiment of the application one.
Embodiment
Here exemplary embodiment will be illustrated in detail, its example is illustrated in the accompanying drawings.Following description is related to
During accompanying drawing, unless otherwise indicated, the same numbers in different accompanying drawings represent same or analogous key element.Following exemplary embodiment
Described in embodiment do not represent all embodiments consistent with the application.On the contrary, they be only with it is such as appended
The example of the consistent apparatus and method of some aspects be described in detail in claims, the application.
It is the purpose only merely for description specific embodiment in term used in this application, and is not intended to be limiting the application.
" one kind ", " described " and "the" of singulative used in the application and appended claims are also intended to including majority
Form, unless context clearly shows that other implications.It is also understood that term "and/or" used herein refers to and wrapped
It may be combined containing one or more associated any or all of project listed.
It will be appreciated that though various information, but this may be described using term first, second, third, etc. in the application
A little information should not necessarily be limited by these terms.These terms are only used for same type of information being distinguished from each other out.For example, not departing from
In the case of the application scope, the first information can also be referred to as the second information, similarly, and the second information can also be referred to as
One information.Depending on linguistic context, word as used in this " if " can be construed to " ... when " or " when ...
When " or " in response to determining ".
In correlation technique, for reverse business datum query performance it is relatively low the problem of, can store the reverse business number
According to when, corresponding positive business datum is inquired about, and the positive business datum and reverse business datum are together stored, for follow-up
Inquiry.However, such implementation is also required to data base querying of many progress, the storage of the reverse business datum of influence
Energy.
The application provides a kind of processing scheme of business datum, can effectively improve the search efficiency of reverse business datum,
Lifting system performance.
Fig. 1 is a kind of schematic flow sheet of the processing method of business datum shown in the exemplary embodiment of the application one.
Refer to Fig. 1, the processing method of the business datum can apply the server disposed in service provider or
In server cluster, such as:For data platform for being cleaned, being stored to data etc..The processing method of the business datum
It may comprise steps of:
Step 101, when receiving reverse business datum, judge whether to have cached the reverse business datum corresponding just
To business datum.
In the present embodiment, when the positive business datum is payment data, corresponding reverse business datum is usually
Reimbursement data;It is corresponding reverse when the positive business datum is the granting data of the virtual resources such as reward voucher, virtual item
Business datum is usually that the respective virtual resource such as reward voucher, virtual item recalls data.Certainly, in actual applications, it is described
Positive business datum and the reverse business datum can also be other kinds of business datum, and the application does not make special limit to this
System.
In the present embodiment, when receiving reverse business datum, it can be determined that whether be cached with this in caching reverse
The corresponding positive business datum of business datum, such as:Carried out according to the positive service identification carried in the reverse business datum
Judge.Wherein, the positive business datum in the caching is typically to be stored when receiving the positive business datum.
Step 102, if having cached the corresponding positive business datum of the reverse business datum, to the positive business number
Cleaned, and preserved wash result as reverse business record into database according to the reverse business datum.
In the present embodiment, the cleaning operation of data can be included:Adjustment to data attribute structure, to data attribute
The adjustment of form, to calculating of data property value etc., can specifically be entered by developer according to service conditions and Database Requirements
Row is set.
Step 103, if the corresponding positive business datum of the uncached reverse business datum, to the reverse business number
According to being cleaned, and preserved wash result as reverse business record into database.
The application is directed to the reverse data received it can be seen from above description, however, it is determined that cached the reverse industry
The corresponding positive business datum of data of being engaged in, then can in the lump clean to the positive business datum and the reverse business datum
Preserved afterwards as reverse business record into database, whole process is without database query operations, subsequently to reverse business
When data are inquired about, one query, which can be got, includes positive and reverse full service data, substantially increases inverse
To the search efficiency of business datum, while the performance of the system of raising.
Below by payment data of positive business datum, reverse business datum be reimbursement data instance, respectively pass through payment
Processing, the processing of reimbursement data and three aspects of the out of order situation of data of data describe the implementation process of the application.
First, the processing of payment data
In the present embodiment, data platform can be cleaned, so after payment data is received to the payment data
Preserved afterwards using the payment data after cleaning as positive transaction record into corresponding database.As an example it is assumed that certain pen is paid
Amount of money is according to being:100 yuan of commodity price, 20 yuan of freight charges, and need to preserve in database be this transaction total amount, then data
Platform can calculate 120 yuan of total amount of transaction according to this payment data, and 120 yuan are stored into database.Certainly, in reality
In, payment data generally also includes a lot of other information, such as:Order number, Send only Account, collecting account, commodity details
Etc. information, this is no longer going to repeat them by the application.
In the present embodiment, the payment data can also be cached in caching by data platform, such as:Will be unwashed
Original payment data are preserved into the internal memory of system.
2nd, the processing of reimbursement data
In the present embodiment, data platform can first judge whether to have cached the reimbursement number after reimbursement data are received
According to corresponding payment data.In general, payment data can reach data platform prior to reimbursement data under normal circumstances, therefore
Based on the handling process of foregoing payment data, the corresponding payment data of reimbursement data is generally cached with caching, data are put down
Platform can be cleaned to the payment data and reimbursement data in the lump, and be arrived wash result as reverse a swap record storage
In corresponding database.Subsequently, when inquiring about the reimbursement data, reimbursement disposably can be got from the database
Data payment data corresponding with its, without repeatedly inquiry database, improves the search efficiency of reimbursement data, while improving system
The performance of system.
In the present embodiment, data platform the payment data and the reimbursement data are cleaned and fall storehouse it
Afterwards, the payment data of caching can also be deleted.
3rd, the out of order situation of data (reimbursement data are reached prior to payment data)
In actual applications, in high concurrent distributed system, data are out of order very universal, such as:Parallel processing, network prolong
When, the factor such as message flood storage may all cause reimbursement data payment data corresponding prior to its to reach data platform.Correlation technique
In, when reimbursement data are first reached, due to corresponding payment data can not be inquired in database, in addition it is also necessary to foundation retry or
Person's waiting mechanism, considerably increases the expense of system.
In the present embodiment, to solve the above problems, data platform is when receiving reimbursement data, however, it is determined that uncached to be somebody's turn to do
The corresponding payment data of reimbursement data, it may be determined that the out of order situation of data occur.For such case, one side data platform can
To be cleaned to the reimbursement data, and it is saved in wash result as reverse a swap record in Relational database;The opposing party
Face, data platform can also cache the reimbursement data, such as:By in the reimbursement data Cun Chudao Installed System Memories.
In the present embodiment, data platform can first judge that the payment data is corresponding and move back when receiving payment data
Whether amount of money, if corresponding reimbursement data are not reached, can determine do not occur the out of order situation of data, be referred to according to having reached
The handling process of foregoing payment data is handled payment data, such as:The payment data is cleaned, described will be paid
Money data buffer storage etc..It if corresponding reimbursement data have arrived at, can determine the out of order situation of data occur, and then can be based on being somebody's turn to do
Payment data updates the data reverse a swap record corresponding with the reimbursement data in storehouse, to ensure to wrap in reverse a swap record
Payment data and corresponding reimbursement data have been included, the search efficiency of follow-up reimbursement data is improved.Meanwhile, using such real-time side
Formula, retries or waiting mechanism without setting up, greatlys save the expense of system.
In the present embodiment, it can judge whether the corresponding reimbursement data of payment data have arrived using following two modes
Reach.In one example, if when reimbursement data are first reached the uncached reimbursement data, can be based on reverse in database
Transaction record judges whether the corresponding reimbursement data of the payment data have reached, such as:If it is corresponding to be stored with database
Reverse a swap is recorded, then can determine that reimbursement data are first reached, if not storing corresponding reverse a swap record in database,
It can determine that reimbursement data are not yet reached.In another example, if when reimbursement data are first reached by the reimbursement data buffer storage,
It can then be judged based on caching, such as:If having cached the corresponding reimbursement data of the payment data, reimbursement can be determined
Data are first reached, if the corresponding reimbursement data of the uncached payment data, can determine that reimbursement data are not yet reached.
In actual applications, and not all payment transaction can all produce reimbursement, in other words, and not all payment data all
There can be corresponding reimbursement data, therefore corresponding time-out time can be set for the payment data of caching, reach the time-out
During the time, if not receiving the corresponding reimbursement data of the payment data cached yet, the payment number of caching is deleted
According to.Wherein, the time-out time is usually the most long service interval of positive business and reverse business.
As an example it is assumed that the reimbursement timeliness of certain payment business is 72 hours after paying, then data platform is by this pair
After money data buffer storage, time-out time can be set 72 hours for it, if being to receive corresponding reimbursement data in 72 hours,
The payment data of caching can be then deleted, because exceeding most long service interval, it is impossible to initiate reimbursement again.
In actual applications, when stating the handling process of business datum in realization, two can be set up in database platform
Individual processing logic, one can handle logic for the positive of processing payment data, and another can be the inverse of processing reimbursement data
To processing logic.
Specifically, the input of positive processing logic only includes payment data, and the input of reverse process logic includes and paid
Amount of money evidence and reimbursement data.Fig. 2 and Fig. 3 example are refer to, in such implementation, forward direction processing logical sum is inversely located
The data that reason logic monitoring reception is arrived, if listening to payment data, forward direction processing logical sum reverse process logic is both needed to this
Payment data is handled, such as:For forward direction processing logic, the payment data can be cleaned, and cleaning is tied
Fruit (falls storehouse) into Relational database as positive transaction record storage for the cleaning in accompanying drawing;For reverse process logic
Speech, can determine whether whether its corresponding reimbursement data has reached, when corresponding reimbursement data have been reached according to the payment data more
Reverse a swap record in new database, the payment data is cached when corresponding reimbursement data are not reached.
Reimbursement data are being listened to, then positive processing logic is without being handled, it is only necessary to which reverse process logic is to the reimbursement
Data are handled, such as:Judge whether to have cached corresponding payment data, if caching if can to the payment data and this move back
Amount of money evidence is cleaned in the lump, and preserves into database (one in respective figure using wash result as reverse business record
And clean storehouse), the reimbursement data can be only cleaned if uncached and fall storehouse etc..
Data are handled based on positive processing logical sum reverse process logic it can be seen from above description, can be with
The business effectively solved between payment data and reimbursement data is relied on, and lifts the search efficiency of follow-up reimbursement data, is saved simultaneously
The expense of system.
Embodiment with the processing method of foregoing business datum is corresponding, and present invention also provides the processing of business datum dress
The embodiment put.
The embodiment of the processing unit of the application business datum can apply service provider dispose server or
On server cluster.Device embodiment can be realized by software, can also be real by way of hardware or software and hardware combining
It is existing.Exemplified by implemented in software, as the device on a logical meaning, being will be non-volatile by the processor of server where it
Property memory in corresponding computer program instructions read in internal memory what operation was formed.For hardware view, such as Fig. 4 institutes
Show, be the application business datum processing unit where server a kind of hardware structure diagram, except the processor shown in Fig. 4,
Outside internal memory, network interface and nonvolatile memory, the server in embodiment where device is generally according to the server
Actual functional capability, can also include other hardware, this is repeated no more.
Fig. 5 is a kind of block diagram of the processing unit of business datum shown in the exemplary embodiment of the application one.
Fig. 5 is refer to, the processing unit 400 of the business datum can be applied in the server shown in earlier figures 4, wrapped
Include:Reverse receiving unit 401, reverse process unit 402, positive processing unit 403 and caching delete unit 404.
Wherein, reverse receiving unit 401, when receiving reverse business datum, judges whether to have cached the reverse industry
The corresponding positive business datum of data of being engaged in;
Reverse process unit 402, if having cached the corresponding positive business datum of the reverse business datum, to it is described just
Cleaned, and preserved wash result as reverse business record to database to business datum and the reverse business datum
In;If the corresponding positive business datum of the uncached reverse business datum, is cleaned to the reverse business datum, and
Preserved wash result as reverse business record into database.
Positive processing unit 403, also when receiving positive business datum, is cleaned to the positive business datum,
And preserved wash result as positive business record into database;And judge the corresponding reverse industry of the positive business datum
Whether business data have reached;If the corresponding reverse business datum of the positive business datum is not yet reached, the forward direction is cached
Business datum;If the corresponding reverse business datum of the positive business datum has been reached, based on the positive business datum more
Reverse business record corresponding with the reverse business datum in new database.
Optionally, the positive processing unit 403, the reverse business record being specifically based in database judges the forward direction
Whether the corresponding reverse business datum of business datum has reached.
Optionally, the reverse process unit 402, also in the corresponding positive business number of the uncached reverse business datum
According to when, cache the reverse business datum;
The positive processing unit 403, specifically judges whether to have cached the corresponding reverse business of the positive business datum
Data.
Caching deletes unit 404, when reaching default time-out time, if not receiving the positive industry cached yet
The corresponding reverse business datum of data of being engaged in, then delete the positive business datum of caching.
Optionally, the time-out time is the most long service interval of positive business and reverse business.
Optionally, the reverse process unit 402, also enters to the positive business datum and the reverse business datum
Row cleaning, and after wash result is preserved into database as reverse business record, delete the positive business of caching
Data.
Optionally, the positive business datum is payment data, and the reverse business datum is reimbursement data.
Optionally, the positive business datum is that virtual resource provides data, and the reverse business datum is virtual resource
Recall data.
The function of unit and the implementation process of effect specifically refer to correspondence step in the above method in said apparatus
Implementation process, will not be repeated here.
For device embodiment, because it corresponds essentially to embodiment of the method, so related part is real referring to method
Apply the part explanation of example.Device embodiment described above is only schematical, wherein described be used as separating component
The unit of explanation can be or may not be physically separate, and the part shown as unit can be or can also
It is not physical location, you can with positioned at a place, or can also be distributed on multiple NEs.Can be according to reality
Selection some or all of module therein is needed to realize the purpose of application scheme.Those of ordinary skill in the art are not paying
In the case of going out creative work, you can to understand and implement.
System, device, module or unit that above-described embodiment is illustrated, can specifically be realized by computer chip or entity,
Or realized by the product with certain function.A kind of typically to realize that equipment is computer, the concrete form of computer can
To be personal computer, laptop computer, cell phone, camera phone, smart phone, personal digital assistant, media play
In device, navigation equipment, E-mail receiver/send equipment, game console, tablet PC, wearable device or these equipment
The combination of any several equipment.
The preferred embodiment of the application is the foregoing is only, not to limit the application, all essences in the application
God is with principle, and any modification, equivalent substitution and improvements done etc. should be included within the scope of the application protection.