Summary of the invention
For overcoming problem present in correlation technique, the present invention provides a kind of data processing method and device.
First aspect according to embodiments of the present invention, it is provided that a kind of data processing method, described method includes:
Receive pending data, described pending data at least include following field: data type field, data content
Field and at least one dimension field;
Data type field from described pending data extracts the mark of the data type of described pending data;
Search the target computing mode corresponding with the mark of described data type, and search the mark with described data type
Corresponding target computing dimension;
Mark according to described data type determines the content storing described target computing dimension in described pending data
Target dimension field;
Described target dimension field in described pending data extracts the content of target computing dimension;
Described data content fields from described pending data extracts target data content;
Obtain locally stored, the last number corresponding with the mark of described data type according to described target computing mode
The first operation result that the content of target computing dimension that obtain according to type operation, described is corresponding;
According to described target computing mode, described target data content and described first operation result are carried out computing and obtain
Two operation results.
Further, described method also includes:
Described second operation result is utilized to replace described first operation result.
Wherein, the target computing mode that described lookup is corresponding with the mark of described data type, including:
Obtain the first corresponding relation between mark and the computing mode of preset data type;
The computing mode corresponding with the mark of described data type is obtained in described first corresponding relation, and as target
Computing mode.
Wherein, the target computing dimension that described lookup is corresponding with the mark of described data type, including:
Obtain the second corresponding relation between mark and the computing dimension of preset data type;
The computing dimension corresponding with the mark of described data type is obtained in described second corresponding relation, and as described
Target computing dimension.
Wherein, the described mark according to described data type determines that storing described target computing in described pending data ties up
The target dimension field of the content of degree, including:
The 3rd corresponding relation between default computing dimension and the field identification of the mark correspondence obtaining described data type;
The field identification corresponding with described target computing dimension is obtained in described 3rd corresponding relation;
Field corresponding for described field identification in described pending data is determined as storing described target computing dimension
The target dimension field of content.
Second aspect according to embodiments of the present invention, it is provided that a kind of data processing equipment, described device includes:
Receiver module, is used for receiving pending data, at least includes following field in described pending data: data type
Field, data content fields and at least one dimension field;
First extraction module, extracts described pending data in the data type field from described pending data
The mark of data type;
First searches module, for searching the target computing mode corresponding with the mark of described data type;
Second searches module, for searching the target computing dimension corresponding with the mark of described data type;
Determine module, in described pending data, store described target fortune for determining according to the mark of described data type
Calculate the target dimension field of the content of dimension;
Second extraction module, extracts target computing dimension in the described target dimension field in described pending data
The content of degree;
3rd extraction module, extracts in target data in the described data content fields from described pending data
Hold;
Acquisition module, locally stored, the last according to described target computing mode and described data type for obtaining
Data type computing corresponding to mark obtains, the first operation result that the content of described target computing dimension is corresponding;
Computing module, for entering described target data content and described first operation result according to described target computing mode
Row operation obtains the second operation result.
Further, described device also includes:
Replacement module, is used for utilizing described second operation result to replace described first operation result.
Wherein, described first lookup module includes:
First acquiring unit, for obtaining the first corresponding relation between the mark of preset data type and computing mode;
Second acquisition unit, for obtaining the fortune corresponding with the mark of described data type in described first corresponding relation
Calculation mode, and as target computing mode.
Wherein, described second lookup module includes:
3rd acquiring unit, for obtaining the second corresponding relation between the mark of preset data type and computing dimension;
4th acquiring unit, for obtaining the fortune corresponding with the mark of described data type in described second corresponding relation
Calculate dimension, and as described target computing dimension.
Wherein, described determine that module includes:
5th acquiring unit, for obtaining between default computing dimension and the field identification that the mark of described data type is corresponding
The 3rd corresponding relation;
6th acquiring unit, for obtaining the field corresponding with described target computing dimension in described 3rd corresponding relation
Mark;
Determine unit, for being defined as storing described mesh by field corresponding for the described field identification in described pending data
The target dimension field of the content of mark computing dimension.
The technical scheme that embodiments of the invention provide can include following beneficial effect: in the present invention, receives pending
Data, extract the mark of the data type of pending data in the data type field from pending data;Search with
The target computing mode of the mark correspondence of data type, and search the target computing dimension corresponding with the mark of data type;
Mark according to data type determines the target dimension field of the content storing target computing dimension in pending data;?
The content of the target computing dimension extracted in the target dimension field in pending data;Data from pending data
Content field extracts target data content;Without all data in historical record are added up again, only need to obtain
Take and locally stored, the last obtain with the corresponding data type computing that identifies of data type according to target computing mode
, the first operation result that the content of target computing dimension is corresponding;According to target computing mode to target data content and
One operation result carries out computing and obtains the second operation result.Whole process only need to once calculate, and decreases statistic,
Save plenty of time and memory source.
It should be appreciated that it is only exemplary and explanatory that above general description and details hereinafter describe, can not
Limit the present invention.
Detailed description of the invention
Here will illustrate exemplary embodiment in detail, its example represents in the accompanying drawings.Explained below relates to attached
During figure, unless otherwise indicated, the same numbers in different accompanying drawings represents same or analogous key element.Following exemplary is implemented
Embodiment described in example does not represent all embodiments consistent with the present invention.On the contrary, they be only with
The example of apparatus and method consistent in terms of some that described in detail in appended claims, the present invention.
Fig. 1 is the flow chart according to a kind of data processing method shown in an exemplary embodiment, as it is shown in figure 1, the party
Method comprises the following steps.
In step S101, receive pending data.
Wherein, it is generally the case that a data is made up of multiple fields, in each field, storage has field contents.
In embodiments of the present invention, pending data at least include following field: data type field, data content word
Section and at least one dimension field.
Pending data can be order data, transaction data or logon data etc., it is also possible to for other kinds of data,
Present invention contrast is not limited.
The executive agent of the embodiment of the present invention can be server or electricity business's platform etc..With the executive agent of the present invention for service
Device is illustrated, but not as limiting the scope of the invention.
Such as, user needs to buy commodity, and user can pass through registration in advance in the electric business's client being arranged in terminal
User account and user cipher log in electricity business's server;Wherein, user needs in the login page of electricity business's client defeated
Access customer account and user cipher, and submit to log on command to electricity business's client, this log on command carry this user account and
This user cipher.
Electricity business's client receives the log on command that user submits to, the user account that electricity business's client is carried according to this log on command
Generate logon data with user cipher according to predetermined data genaration rule, this logon data is sent to this electricity business's server;
Electricity business's server receives this logon data.
Login successfully rear user and can enter the shopping page of a certain trade company in electricity business's client, select from this shopping page
Selecting the commodity needing to buy, and submit order order to electricity business's client, the order amount of money, user's account are carried in this order order
Number and trade company's account;Electricity business's client receives the order order that user submits to, the order then carried according to this order order
The amount of money, user account and trade company's account generate order data according to predetermined data genaration rule, this order data are sent
To this electricity business's server;Electricity business's server receives this order data.
After this order is confirmed by electricity business's server, if user will be to this order payment, can be in electricity business's client
Upper submission trade command, this trade command carries dealing money, user account and trade company's account;Electricity business's client receives to be used
The trade command that family is submitted to, dealing money, user account and the trade company's account then carried according to this trade command are according in advance
Fixed data genaration rule generates transaction data, and this transaction data is sent to this electricity business's server;This electricity business's server connects
Receive this transaction data.
Predetermined data genaration rule can be: regulation data include altogether several field, and specify in these fields
Each field is used for storing which category information.
Such as, in embodiments of the present invention, predetermined data genaration rule can be: regulation data include at least 4 words
Section, it is stipulated that the first field of data is data type field, for storing the mark of data type;The second of regulation data
Field is content field, for storing the content of data;3rd field of regulation data is the first dimension field, is used for depositing
The account of storage seller user;4th field of regulation data is the second dimension field, for storing the account of buyer user.
In step s 102, the data type field from pending data extracts the data type of pending data
Mark.
Wherein, client, when generating data, can generate data according to predetermined data genaration rule, therefore, and service
Device it is known that client send data include which field and each field for storing any category information, so,
When receiving the pending data that client sends, directly the data type field from pending data extracts and treat
Process the mark of the data type of data.
Wherein, in data type field, the content of storage is used for representing the data type of data.Such as, transaction data, order
Forms data and logon data are three kinds of different types of data.
Wherein, content field is for storing the content of data, and such as, the order amount of money in order data is order data
Data content, therefore in order data, the second field stores the order amount of money of order data;Friendship in transaction data
Easily the amount of money is the data content of transaction data, and therefore in transaction data, the second field stores the trade gold of transaction data
Volume;There is not data content in logon data, therefore in logon data, there is the second field, but the second field is not
Store any content, i.e. the second field is null field.
For storing the account of the account relevant with data in dimension field, wherein, the account of the user of storage is computing dimension
The content of degree.Such as, in embodiments of the present invention, the first dimension field stores seller user account;Second dimension
Field stores the account of buyer user.
In step s 103, search the target computing mode corresponding with the mark of this data type, and search and this number
According to the target computing dimension that the mark of type is corresponding.
Wherein, the operation of the target computing mode corresponding with the mark of this data type is searched, Ke Yiwei:
Obtain the first corresponding relation between mark and the computing mode of preset data type;First corresponding relation obtains
The computing mode corresponding with the mark of this data type, and as target computing mode.
Wherein, the computing mode that different types of data carry out computing is different, such as, generally, for arbitrary
User, no matter this user is buyer user or seller user, and server may need to add up the History Order note of this user
Blanket order number in record, adds up the blanket order amount of money in the History Order record of this user, and the history adding up this user is handed over
Easily the total number of transactions number in record, adds up this user total dealing money in historical transaction record, and adds up this user
Total login times in historical log record.
Wherein, the computing mode of statistics blanket order number and total number of transactions number is " counting " computing, adds up the blanket order amount of money
Being " adding up " computing with the computing mode of total dealing money, the computing mode adding up total login times is " counting " computing.
Therefore, technical staff can with in advance in the computing mode that locally located different types of data are corresponding, for example, it is assumed that
For order data, both needed to add up blanket order number, it is also desirable to the statistics blanket order amount of money, for transaction data, both needed
Total number of transactions number to be added up, it is also desirable to add up total dealing money, and need to add up total login times, then technical staff can
To arrange the corresponding relation between the mark of data type as shown in table 1 below and computing mode at server local, wherein,
In the corresponding relation shown in table 1,001 is the Data Identification of order data, and 002 is the Data Identification of transaction data, 003
Data Identification for logon data.
Table 1
The mark of storage data type |
Computing mode |
001 |
Cumulative |
001 |
Counting |
002 |
Cumulative |
002 |
Counting |
003 |
Cumulative |
So, when searching the target computing mode corresponding with the mark of data type, it is possible to obtain as shown in table 2
Corresponding relation;In corresponding relation as shown in table 2, obtain the computing mode corresponding with the mark of data type, and make
For target computing mode.
Wherein, the operation of the target computing dimension corresponding with the mark of data type is searched, Ke Yiwei:
Obtain the second corresponding relation between mark and the computing dimension of preset data type, obtain in the second corresponding relation
The computing dimension corresponding with the mark of data type, and as target computing dimension.
Computing dimension is for representing in the enterprising row operation of which dimension, such as, and the enterprising row operation of angle buyer user,
And/or the enterprising row operation of angle in seller user.
For example, it is assumed that for order data, technical staff want to allow server should in the enterprising row operation of the angle of buyer user,
Also will be in the enterprising row operation of the angle of seller user;For transaction data, technical staff wants server should be used the buyer
The enterprising row operation of angle at family, also will be in the enterprising row operation of the angle of seller user;Then technical staff can be in advance in service
The second corresponding relation between mark and the computing dimension of the locally located data type as shown in table 2 of device.Shown in table 2
Corresponding relation in, 001 is the Data Identification of order data, and 002 is the Data Identification of transaction data.
Table 2
The mark of data type |
Computing dimension |
001 |
Buyer user |
001 |
Seller user |
002 |
Buyer user |
002 |
Seller user |
So, when searching the target computing dimension corresponding with the mark of data type, number as shown in table 2 can be obtained
According to the second corresponding relation between mark and the computing dimension of type, obtain in the second corresponding relation and this data type
Identify corresponding dimension, and as target computing dimension.
Such as, when the data type of pending data is order data, can according to the mark 001 of order data,
The computing dimension finding correspondence in table 2 is buyer user and seller user.
In step S104, determine according to the mark of this data type in pending data, store target computing dimension
The target dimension field of content.
Specifically, the 3rd between default computing dimension and the field identification of the mark correspondence obtaining preset data type is corresponding
Relation;The field identification corresponding with this computing dimension is obtained in the 3rd corresponding relation;By the field in pending data
The field of mark correspondence is as the target dimension field of the content of storage target computing dimension.
In step S105, the content of the target computing dimension extracted in the target dimension field in pending data.
Wherein, when target computing dimension is seller user dimension, from the field of seller user dimension, extracts the seller use
The account at family.When target computing dimension is buyer user's dimension, from the field of buyer user's dimension, extracts the buyer use
The account at family.
Such as, in embodiments of the present invention, when target computing dimension is seller user dimension, from the 3rd field, i.e. from
First dimension field extracts the account of seller user, as the content of target computing dimension.When target computing dimension is
During buyer user's dimension, from the 4th field, from the second dimension field, i.e. extract the account of buyer user, as target
The content of computing dimension.
In step s 106, the data content fields from pending data extracts target data content.
Wherein, client, when generating data, can generate data according to predetermined data genaration rule, therefore, and service
Device is it is known that the data that client sends include which category information which field and each field for storing.So,
When receiving the pending data that client sends, directly the data content fields from pending data extracts and treat
Process the data content of data, as target data content.
Wherein, such as, when pending data are order data, from the content field of pending data, order is extracted
The amount of money;When pending data are transaction data, from the content field of pending data, extract dealing money;When treating
When process data are logon data, owing to logon data not storing data content, therefore without the number from pending data
Carry out extracting operation according to field in content.
In step s 107, obtain locally stored, the last according to target computing mode and the mark of this data type
Know the first operation result that content that corresponding data type computing obtains, target computing dimension is corresponding.
Operation result all can be stored in this locality after carrying out once-through operation by server every time, and each computing at least needs to obtain
Three information, including: the mark of data type, computing mode, the content of computing dimension, so, every time according to one
The content of the mark of data type, a computing mode and a computing dimension all can obtain a fortune after carrying out once-through operation
Calculate result, then can by the mark of this data type, this computing mode and the content of this computing dimension and
This operation result obtained is stored in budget mode, the mark of data type, the content of computing dimension and the fortune of this locality
Calculate in the corresponding relation between result.
So, in this step, locally stored budget mode, the mark of data type, the content of computing dimension and
Corresponding relation between operation result is searched the target computing mode that includes, the mark of data type and target computing dimension
The record of content of degree, using the operation result in this record as the last time according to target computing mode and data type
The first operation result that content that the data type computing of mark correspondence obtains, target computing dimension is corresponding.
In step S108, according to target computing mode, target data content and the first operation result are carried out computing and obtain
Second operation result.
Further, after step S108, further comprise the steps of: and utilize the second operation result replacement to include target computing
Operation result in the record of the content of mode, the mark of this data type and target computing dimension.
So, so that the operation result of this record storage is up-to-date operation result.
In the embodiment shown in Fig. 1 of the present invention, receive pending data, the data type field from pending data
In extract the mark of data type of pending data;Search the target computing mode corresponding with the mark of data type,
And search the target computing dimension corresponding with the mark of data type;Mark according to data type determines at pending number
Target dimension field according to the content of middle storage target computing dimension;Target dimension field in pending data is extracted
The content of the target computing dimension gone out;Data content fields from pending data extracts target data content;Nothing
All data in historical record need to be added up again, only need to obtain and locally stored, the last transport according to target
Identifying of calculation mode and data type content that corresponding data type computing obtains, target computing dimension corresponding first
Operation result;According to target computing mode, target data content and the first operation result are carried out computing and obtain the second computing knot
Really.Whole process only need to once calculate, and decreases statistic, saves plenty of time and memory source.
Fig. 2 is the block diagram according to a kind of data processing equipment shown in an exemplary embodiment.With reference to Fig. 2, this device bag
Include:
Receiver module 11, is used for receiving pending data, at least includes following field in described pending data: data class
Type-word section, data content fields and at least one dimension field;
First extraction module 12, extracts described pending number in the data type field from described pending data
According to the mark of data type;
First searches module 13, for searching the target computing mode corresponding with the mark of described data type;
Second searches module 14, for searching the target computing dimension corresponding with the mark of described data type;
Determine module 15, in described pending data, store described target for determining according to the mark of described data type
The target dimension field of the content of computing dimension;
Second extraction module 16, extracts target computing in the described target dimension field in described pending data
The content of dimension;
3rd extraction module 17, extracts target data in the described data content fields from described pending data
Content;
Acquisition module 18, locally stored, the last according to described target computing mode and described data class for obtaining
The first operation result that content that the data type computing of the mark correspondence of type obtains, described target computing dimension is corresponding;
Computing module 19, is used for according to described target computing mode described target data content and described first operation result
Carry out computing and obtain the second operation result.
In the embodiment shown in Fig. 2 of the present invention, receive pending data, the data type field from pending data
In extract the mark of data type of pending data;Search the target computing mode corresponding with the mark of data type,
And search the target computing dimension corresponding with the mark of data type;Mark according to data type determines at pending number
Target dimension field according to the content of middle storage target computing dimension;Target dimension field in pending data is extracted
The content of the target computing dimension gone out;Data content fields from pending data extracts target data content;Nothing
All data in historical record need to be added up again, only need to obtain and locally stored, the last transport according to target
Identifying of calculation mode and data type content that corresponding data type computing obtains, target computing dimension corresponding first
Operation result;According to target computing mode, target data content and the first operation result are carried out computing and obtain the second computing knot
Really.Whole process only need to once calculate, and decreases statistic, saves plenty of time and memory source.
Further, described device also includes:
Replacement module, is used for utilizing described second operation result to replace described first operation result.
Wherein, described first lookup module 13 includes:
First acquiring unit, for obtaining the first corresponding relation between the mark of preset data type and computing mode;
Second acquisition unit, for obtaining the fortune corresponding with the mark of described data type in described first corresponding relation
Calculation mode, and as target computing mode.
Wherein, described second lookup module 14 includes:
3rd acquiring unit, for obtaining the second corresponding relation between the mark of preset data type and computing dimension;
4th acquiring unit, for obtaining the fortune corresponding with the mark of described data type in described second corresponding relation
Calculate dimension, and as described target computing dimension.
Wherein, described determine that module 15 includes:
5th acquiring unit, for obtaining between default computing dimension and the field identification that the mark of described data type is corresponding
The 3rd corresponding relation;
6th acquiring unit, for obtaining the field corresponding with described target computing dimension in described 3rd corresponding relation
Mark;
Determine unit, for being defined as storing described mesh by field corresponding for the described field identification in described pending data
The target dimension field of the content of mark computing dimension.
About the device in above-described embodiment, wherein modules performs the concrete mode of operation in relevant the method
Embodiment is described in detail, explanation will be not set forth in detail herein.
Those skilled in the art, after considering description and putting into practice invention disclosed herein, will readily occur to other of the present invention
Embodiment.The application is intended to any modification, purposes or the adaptations of the present invention, these modification, purposes
Or adaptations follow the present invention general principle and include the present invention undocumented in the art known often
Know or conventional techniques means.Description and embodiments is considered only as exemplary, true scope and spirit of the invention by under
The claim in face is pointed out.
It should be appreciated that the invention is not limited in precision architecture described above and illustrated in the accompanying drawings, and
Various modifications and changes can carried out without departing from the scope.The scope of the present invention is only limited by appended claim.