Summary of the invention
To overcome the problems in correlation technique, the present invention provides a kind of data processing method and device.
According to a first aspect of the embodiments of the present invention, a kind of data processing method is provided, which comprises
Pending data is received, includes at least following field: data type field, data content in the pending data
Field and at least one dimension field;
The mark of the data type of the pending data is extracted from the data type field in the pending data
Know;
Target operation mode corresponding with the mark of the data type is searched, and searches the mark with the data type
Know corresponding target operation dimension;
It is determined according to the mark of the data type and is stored in the target operation dimension in the pending data
The target dimension field of appearance;
The content of target operation dimension is extracted in the target dimension field in the pending data;
Target data content is extracted from the data content fields in the pending data;
It obtains being locally stored, the last corresponding according to the mark of the target operation mode and the data type
Corresponding first operation result of content of the target operation dimension that data type operation obtains, described;
Operation is carried out to the target data content and first operation result according to the target operation mode to obtain
Second operation result.
Further, the method also includes:
First operation result is replaced using second operation result.
It is wherein, described to search target operation mode corresponding with the mark of the data type, comprising:
Obtain the first corresponding relationship between the mark and operation mode of preset data type;
Operation mode corresponding with the mark of the data type is obtained in first corresponding relationship, and as mesh
Mark operation mode.
It is wherein, described to search target operation dimension corresponding with the mark of the data type, comprising:
Obtain the second corresponding relationship between the mark and operation dimension of preset data type;
Operation dimension corresponding with the mark of the data type is obtained in second corresponding relationship, and as institute
State target operation dimension.
Wherein, described that the target operation is stored in the pending data according to the determination of the mark of the data type
The target dimension field of the content of dimension, comprising:
Obtain the third corresponding relationship between the corresponding default operation dimension of mark of the data type and field identification;
Field identification corresponding with the target operation dimension is obtained in the third corresponding relationship;
The corresponding field of the field identification in the pending data is determined as the storage target operation dimension
The target dimension field of the content of degree.
According to a second aspect of the embodiments of the present invention, a kind of data processing equipment is provided, described device includes:
Receiving module includes at least following field: data type in the pending data for receiving pending data
Field, data content fields and at least one dimension field;
First extraction module, for extracting the number to be processed from the data type field in the pending data
According to data type mark;
First searching module, for searching target operation mode corresponding with the mark of the data type;
Second searching module, for searching target operation dimension corresponding with the mark of the data type;
Determining module, for storing the target in the pending data according to the determination of the mark of the data type
The target dimension field of the content of operation dimension;
Second extraction module, for extracting target operation in the target dimension field in the pending data
The content of dimension;
Third extraction module, for extracting target data from the data content fields in the pending data
Content;
Module is obtained, for obtaining be locally stored, the last time according to the target operation mode and the data class
Corresponding first operation result of content of the target operation dimension that the corresponding data type operation of mark of type obtains, described;
Computing module is used for according to the target operation mode to the target data content and first operation result
It carries out operation and obtains the second operation result.
Further, described device further include:
Replacement module, for replacing first operation result using second operation result.
Wherein, first searching module includes:
First acquisition unit, for obtaining the first corresponding relationship between the mark of preset data type and operation mode;
Second acquisition unit, it is corresponding with the mark of the data type for being obtained in first corresponding relationship
Operation mode, and as target operation mode.
Wherein, second searching module includes:
Third acquiring unit, for obtaining the second corresponding relationship between the mark of preset data type and operation dimension;
4th acquiring unit, it is corresponding with the mark of the data type for being obtained in second corresponding relationship
Operation dimension, and as the target operation dimension.
Wherein, the determining module includes:
5th acquiring unit, the corresponding default operation dimension of mark for obtaining the data type and field identification it
Between third corresponding relationship;
6th acquiring unit, for obtaining word corresponding with the target operation dimension in the third corresponding relationship
Segment identification;
Determination unit, for the corresponding field of the field identification in the pending data to be determined as described in storage
The target dimension field of the content of target operation dimension.
The technical solution that the embodiment of the present invention provides can include the following benefits: in the present invention, receive wait locate
Data are managed, the mark of the data type of pending data is extracted from the data type field in pending data;Search with
The corresponding target operation mode of the mark of data type, and search target operation dimension corresponding with the mark of data type;
The target dimension field that the content of target operation dimension is stored in pending data is determined according to the mark of data type;To
The content of the target operation dimension extracted in target dimension field in processing data;From the data content in pending data
Target data content is extracted in field;Without being counted again to all data in historical record, local need to be only obtained
Storage, the corresponding data type operation of the last mark according to target operation mode and data type obtains, target
Corresponding first operation result of the content of operation dimension;According to target operation mode to target data content and the first operation result
It carries out operation and obtains the second operation result.Whole process only needs once to calculate, and reduces statistic, saves the plenty of time
And memory source.
It should be understood that above general description and following detailed description be only it is exemplary and explanatory, not
It can the limitation present invention.
Specific embodiment
Example embodiments are described in detail here, and the example is illustrated in the accompanying drawings.Following description is related to
When attached drawing, unless otherwise indicated, the same numbers in different drawings indicate the same or similar elements.Following exemplary embodiment
Described in embodiment do not represent all embodiments consistented with the present invention.On the contrary, they be only with it is such as appended
The example of device and method being described in detail in claims, some aspects of the invention are consistent.
Fig. 1 is a kind of flow chart of data processing method shown according to an exemplary embodiment, as shown in Figure 1, the party
Method includes the following steps.
In step s101, pending data is received.
Wherein, it is generally the case that a data is made of multiple fields, is stored in field in each field
Hold.
In embodiments of the present invention, following field: data type field, data content word is included at least in pending data
Section and at least one dimension field.
Pending data can be order data, transaction data or logon data etc., or other kinds of data,
Present invention comparison is not limited.
The executing subject of the embodiment of the present invention can be server or electric business platform etc..It is clothes with executing subject of the invention
Business device is illustrated, but not as limiting the scope of the invention.
For example, user needs to buy commodity, user can be in the electric business client of installation at the terminal by infusing in advance
The user account and user password of volume log in electric business server;Wherein, user needs defeated in the login page of electric business client
Access customer account and user password, and log on command is submitted to give electric business client, which carries the user account and should
User password.
Electric business client receives the log on command that user submits, user's account that electric business client is carried according to the log on command
Number and user password according to scheduled data create-rule generate logon data, which is sent to the electric business service
Device;Electric business server receives the logon data.
The shopping page of a certain trade company can be entered in electric business client by logining successfully rear user, from the shopping page
Selection needs the commodity bought, and submits order order to electric business client, which carries the order amount of money, user account
With trade company's account;Electric business client receive user submit order order, then according to the order order carry the order amount of money,
The order data is sent to the electric business according to scheduled data create-rule generation order data by user account and trade company's account
Server;Electric business server receives the order data.
It, can be in electric business client if user will be to the order payment after electric business server confirms the order
Trade command is submitted on end, which carries transaction amount, user account and trade company's account;Electric business client receives user
The trade command of submission, transaction amount, user account and the trade company's account then carried according to the trade command is according to scheduled
Data create-rule generates transaction data, which is sent to the electric business server;The electric business server receives the friendship
Easy data.
Scheduled data create-rule can be with are as follows: it includes several fields that regulation data, which have altogether, and provides these fields
In each field for any category information to be stored.
For example, in embodiments of the present invention, scheduled data create-rule can be with are as follows: regulation data include at least four word
Section is, it is specified that the first field of data is data type field, for storing data mark of type;Provide the second field of data
For content field, content for storing data;The third field for providing data is the first dimension field, is used for storing the seller
The account at family;The 4th field for providing data is the second dimension field, for storing the account of buyer user.
In step s 102, the data type of pending data is extracted from the data type field in pending data
Mark.
Wherein, client can generate data according to scheduled data create-rule when generating data, therefore, service
Device is it is known that include which field and each field in the data that client is sent for which category information to be stored, in this way, working as
When receiving the pending data of client transmission, directly extracted from the data type field in pending data to be processed
The mark of the data type of data.
Wherein, the content stored in data type field is used to indicate the data type of data.For example, transaction data, ordering
Forms data and logon data are three kinds of different types of data.
Wherein, the content of content field for storing data, for example, 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;Trade gold in transaction data
Volume is the data content of transaction data, therefore in transaction data, the second field stores the transaction amount of transaction data;It logs in
Data content is not present in data, therefore in logon data, there are the second fields, but the second field does not store in any
Hold, that is, be null field in the second field.
For storing the account of account related with data in dimension field, wherein the account of the user of storage is operation
The content of dimension.For example, in embodiments of the present invention, storing seller user account in the first dimension field;Second dimension word
The account of buyer user is stored in section.
In step s 103, target operation mode corresponding with the mark of the data type is searched, and is searched and the number
According to the corresponding target operation dimension of the mark of type.
Wherein, the operation of corresponding with the mark of data type target operation mode is searched, it can be with are as follows:
Obtain the first corresponding relationship between the mark and operation mode of preset data type;It is obtained in the first corresponding relationship
Operation mode corresponding with the mark of the data type is taken, and as target operation mode.
Wherein, different types of data are carried out with the operation mode difference of operation, for example, under normal circumstances, for any
User, no matter the user is buyer user or seller user, and server may need to count the History Order record of the user
In blanket order number, count the user History Order record in the blanket order amount of money, count the user historical trading note
Total number of transactions number in record counts total transaction amount of the user in historical transaction record, and counts the user in history
Total login times in login record.
Wherein, the operation mode for counting blanket order number and total number of transactions number is " counting " operation, counts the blanket order amount of money
Operation mode with total transaction amount is " cumulative " operation, and the operation mode for counting total login times is " counting " operation.
Therefore, technical staff can be locally located in a manner of the corresponding operation of different types of data by advance, for example, it is assumed that
It for order data, both needs to count blanket order number, it is also desirable to count the blanket order amount of money, for transaction data, both need to unite
Count total number of transactions number, it is also desirable to count total transaction amount, and need to count total login times, then technical staff can service
The corresponding relationship between the mark of data type as shown in table 1 below and operation mode is locally located in device, wherein shown in table 1
Corresponding relationship in, 001 is the Data Identification of order data, 002 is the Data Identification of transaction data, and 003 is logon data
Data Identification.
Table 1
The mark of storing data type |
Operation mode |
001 |
It is cumulative |
001 |
It counts |
002 |
It is cumulative |
002 |
It counts |
003 |
It is cumulative |
In this way, when searching target operation mode corresponding with the mark of data type, so that it may obtain as shown in Table 2
Corresponding relationship;Operation mode corresponding with the mark of data type is obtained in corresponding relationship as shown in Table 2, and as mesh
Mark operation mode.
Wherein, the operation of corresponding with the mark of data type target operation dimension is searched, it can be with are as follows:
The second corresponding relationship between the mark and operation dimension of preset data type is obtained, is obtained in the second corresponding relationship
Operation dimension corresponding with the mark of data type is taken, and as target operation dimension.
Operation dimension carries out operation for indicating in which dimension, for example, operation is carried out in the angle of buyer user,
And/or operation is carried out in the angle of seller user.
For example, it is assumed that technical staff wants that server should be transported in the angle of buyer user for order data
It calculates, operation is also carried out in the angle of seller user;For transaction data, technical staff wants that server should be used in buyer
Operation is carried out in the angle at family, and operation is also carried out in the angle of seller user;Then technical staff can be in advance in server
The second corresponding relationship between the mark of data type as shown in Table 2 and operation dimension is locally located.It is corresponding shown in table 2
In relationship, 001 is the Data Identification of order data, and 002 is the Data Identification of transaction data.
Table 2
The mark of data type |
Operation dimension |
001 |
Buyer user |
001 |
Seller user |
002 |
Buyer user |
002 |
Seller user |
In this way, when searching target operation dimension corresponding with the mark of data type, available number as shown in Table 2
According to the second corresponding relationship between the mark and operation dimension of type, the mark with the data type is obtained in the second corresponding relationship
Sensible corresponding dimension, and as target operation dimension.
For example, when the data type of pending data is order data, it can be according to the mark 001, In of order data
It is buyer user and seller user that corresponding operation dimension is found in table 2.
In step S104, is determined according to the mark of the data type and store target operation dimension in pending data
The target dimension field of content.
Specifically, the third pair between the corresponding default operation dimension of mark of preset data type and field identification is obtained
It should be related to;Field identification corresponding with the operation dimension is obtained in third corresponding relationship;By the field in pending data
Identify target dimension field of the corresponding field as the content of storage target operation dimension.
In step s105, in the target operation dimension extracted in the target dimension field in pending data
Hold.
Wherein, when target operation dimension is seller user dimension, the seller is extracted from the field of seller user dimension
The account of user.When target operation dimension is buyer user's dimension, buyer's use is extracted from the field of buyer user's dimension
The account at family.
For example, in embodiments of the present invention, when target operation dimension is seller user dimension, from third field, i.e., from
The account that seller user is extracted in first dimension field, the content as target operation dimension.When target operation dimension is to buy
When square user's dimension, from the 4th field, i.e., the account of buyer user is extracted from the second dimension field, tie up as target operation
The content of degree.
In step s 106, target data content is extracted from the data content fields in pending data.
Wherein, client can generate data according to scheduled data create-rule when generating data, therefore, service
Device is it is known that include which field and each field in the data that client is sent for which category information to be stored.In this way, working as
When receiving the pending data of client transmission, directly extracted from the data content fields in pending data to be processed
The data content of data, as target data content.
Wherein, for example, extracting order from the content field of pending data when pending data is order data
The amount of money;When pending data is transaction data, transaction amount is extracted from the content field of pending data;When to be processed
When data are logon data, due to data content not stored in logon data, there is no need to the data contents from pending data
Middle field extracts operation.
In step s 107, the mark according to target operation mode and the data type be locally stored, the last is obtained
Know corresponding data type operation obtains, corresponding first operation result of target operation dimension content.
Server carries out that operation result can be all stored in local after once-through operation every time, and each operation at least needs to obtain
Take three information, comprising: mark, operation mode, the content of operation dimension of data type, in this way, every time according to a data
The content of the mark of type, an operation mode and an operation dimension can all obtain an operation knot after carrying out once-through operation
Then fruit by the mark of a data type, the content of an operation mode and an operation dimension and can obtain
One operation result is stored in local budget mode, the mark of data type, the content of operation dimension and operation result four
In corresponding relationship between person.
In this way, in this step, be locally stored budget mode, the mark of data type, the content of operation dimension and
Search in corresponding relationship between operation result includes target operation mode, the mark of data type and target operation dimension
Content record, using the operation result in the record as the last mark according to target operation mode and data type
Corresponding data type operation obtains, corresponding first operation result of target operation dimension content.
In step S108, operation is carried out to target data content and the first operation result according to target operation mode and is obtained
Second operation result.
Further, after step S108, further comprising the steps of: using the replacement of the second operation result includes target operation side
Operation result in the record of the content of formula, the mark of the data type and target operation dimension.
In this way, the operation result of the record storage can be made to be newest operation result.
In present invention embodiment shown in FIG. 1, pending data is received, from the data type field in pending data
In extract pending data data type mark;Target operation mode corresponding with the mark of data type is searched, with
And search target operation dimension corresponding with the mark of data type;It is determined in pending data according to the mark of data type
Store the target dimension field of the content of target operation dimension;The mesh extracted in target dimension field in pending data
Mark the content of operation dimension;Target data content is extracted from the data content fields in pending data;Without to history
All data in record are counted again, need to only obtain be locally stored, the last time according to target operation mode sum number
Corresponding first operation result of content obtained according to the corresponding data type operation of mark of type, target operation dimension;It presses
Operation is carried out to target data content and the first operation result according to target operation mode and obtains the second operation result.Whole process is only
It need to once calculate, reduce statistic, save plenty of time and memory source.
Fig. 2 is a kind of block diagram of data processing equipment shown according to an exemplary embodiment.Referring to Fig. 2, the device packet
It includes:
Receiving module 11 includes at least following field: data class in the pending data for receiving pending data
Type-word section, data content fields and at least one dimension field;
First extraction module 12, it is described to be processed for being extracted from the data type field in the pending data
The mark of the data type of data;
First searching module 13, for searching target operation mode corresponding with the mark of the data type;
Second searching module 14, for searching target operation dimension corresponding with the mark of the data type;
Determining module 15, for storing the mesh in the pending data according to the determination of the mark of the data type
Mark the target dimension field of the content of operation dimension;
Second extraction module 16, for extracting target fortune in the target dimension field in the pending data
Calculate the content of dimension;
Third extraction module 17, for extracting number of targets from the data content fields in the pending data
According to content;
Module 18 is obtained, for obtaining be locally stored, the last time according to the target operation mode and the data
Corresponding first operation result of content of the target operation dimension that the corresponding data type operation of mark of type obtains, described;
Computing module 19 is used for according to the target operation mode to the target data content and the first operation knot
Fruit carries out operation and obtains the second operation result.
In present invention embodiment shown in Fig. 2, pending data is received, from the data type field in pending data
In extract pending data data type mark;Target operation mode corresponding with the mark of data type is searched, with
And search target operation dimension corresponding with the mark of data type;It is determined in pending data according to the mark of data type
Store the target dimension field of the content of target operation dimension;The mesh extracted in target dimension field in pending data
Mark the content of operation dimension;Target data content is extracted from the data content fields in pending data;Without to history
All data in record are counted again, need to only obtain be locally stored, the last time according to target operation mode sum number
Corresponding first operation result of content obtained according to the corresponding data type operation of mark of type, target operation dimension;It presses
Operation is carried out to target data content and the first operation result according to target operation mode and obtains the second operation result.Whole process is only
It need to once calculate, reduce statistic, save plenty of time and memory source.
Further, described device further include:
Replacement module, for replacing first operation result using second operation result.
Wherein, first searching module 13 includes:
First acquisition unit, for obtaining the first corresponding relationship between the mark of preset data type and operation mode;
Second acquisition unit, it is corresponding with the mark of the data type for being obtained in first corresponding relationship
Operation mode, and as target operation mode.
Wherein, second searching module 14 includes:
Third acquiring unit, for obtaining the second corresponding relationship between the mark of preset data type and operation dimension;
4th acquiring unit, it is corresponding with the mark of the data type for being obtained in second corresponding relationship
Operation dimension, and as the target operation dimension.
Wherein, the determining module 15 includes:
5th acquiring unit, the corresponding default operation dimension of mark for obtaining the data type and field identification it
Between third corresponding relationship;
6th acquiring unit, for obtaining word corresponding with the target operation dimension in the third corresponding relationship
Segment identification;
Determination unit, for the corresponding field of the field identification in the pending data to be determined as described in storage
The target dimension field of the content of target operation dimension.
About the device in above-described embodiment, wherein modules execute the concrete mode of operation in related this method
Embodiment in be described in detail, no detailed explanation will be given here.
Those skilled in the art after considering the specification and implementing the invention disclosed here, will readily occur to of the invention its
Its embodiment.This application is intended to cover any variations, uses, or adaptations of the invention, these modifications, purposes or
Person's adaptive change follows general principle of the invention and including the undocumented common knowledge in the art of the present invention
Or conventional techniques.The description and examples are only to be considered as illustrative, and true scope and spirit of the invention are by following
Claim is pointed out.
It should be understood that the present invention is not limited to the precise structure already described above and shown in the accompanying drawings, and
And various modifications and changes may be made without departing from the scope thereof.The scope of the present invention is limited only by the attached claims.