The content of the invention
For above-mentioned technical problem, the application provides a kind of multi-business multiplexing processing method, device and system,
Technical scheme is as follows:
According to the first aspect of the application, there is provided a kind of multi-business multiplexing processing method, for processing two species
Business more than type, comprising same operation logic, the method includes:
Business operation request is received, pending type of service and corresponding action type is determined;
According to pending type of service, storage location of the business datum in database is determined;
According to the action type of pending business, the default general service for processing the action type is obtained
Operational order, the actual storage locations of not specified operation object data in the general service operational order;
Using identified business datum storage location and the general service operational order for being obtained, build actual
Business operating instructions;
The practical business operational order is performed, is asked with responding the business operation.
According to the second aspect of the application, there is provided a kind of multi-business multiplexing processing unit, for processing two species
Business more than type, comprising same operation logic, the device includes:
Request receiving module, for receiving business operation request, determines pending type of service and corresponding
Action type;
Storage location determining module, for according to pending type of service, determining business datum in database
Storage location;
General operation instruction obtains module, for the action type according to pending business, obtains default use
In the general service operational order for processing the action type, not specified operation in the general service operational order
The actual storage locations of object data;
Practical operation instruction builds module, for the business datum storage location determined by and is obtained
General service operational order, builds practical business operational order;
Performing module, for performing the practical business operational order, is asked with responding the business operation.
According to the third aspect of the application, there is provided a kind of multi-business multiplexing processing system, for processing two species
Business more than type, comprising same operation logic, the system includes:Business interface floor, business datum road
By layer, universal command storehouse and database;
Business interface layer, for the business operation for the issuing system request outside reception system;
Business datum routing layer, for calling general service operational order from universal command storehouse, according to pending
Type of service builds practical business operational order, and the business operation request that business interface layer is received is routed to
Corresponding database;
Universal command storehouse:Be stored with general service operational order, not specified in the general service operational order
The actual storage locations of operation object data;
Database, for storage service data.
Technical scheme provided herein, based on the reusability of business operation logic, is increasing new business
When, it is only necessary to newly-increased a set of database configuration, it is possible to be directly realized by business function, significantly reduce out
Hair and maintenance cost.Further, by data routing algorithm, the use of database can be configured flexibly
Mode, so as to realize the Optimum utilization of database resource.
It should be appreciated that the general description of the above and detailed description hereinafter are only exemplary and explanatory,
The application can not be limited.
Specific embodiment
Found by studying, it is in actual applications, actual although the business of many systems treatment is different
The operation being related to all is example that is similar, such as being mentioned in background technology, either deposits, manages money matters, goes back
It is the operation systems such as remaining sum, red packet, requires with the function such as inquiring about, be stored in, taking out, freezing, thawing,
From from the perspective of database manipulation, the corresponding treatment logic of operation of the same race between different business is identical
, difference is only different from corresponding target database is operated.In view of the situation, the side that the application is proposed
Case is:A set of general database manipulation logic is developed, is multiplexed for multiple business, processing certain tool
During body business, general operation need to only be pointed to the database corresponding to the business.
In order that those skilled in the art more fully understand the technical scheme in the application, below in conjunction with this Shen
Accompanying drawing that please be in embodiment, is described in detail, it is clear that institute to the technical scheme in the embodiment of the present application
The embodiment of description is only some embodiments of the present application, rather than whole embodiments.Based on the application
In embodiment, the every other embodiment that those of ordinary skill in the art are obtained should all belong to this Shen
The scope that please be protect.
Still by taking billing and accounting system as an example, service integration scheme provided herein is illustrated, Fig. 2 institutes
Show, be a kind of configuration diagram of integrated account system provided herein.The system includes:Business connects
Mouth layer 100, business datum routing layer 200, universal command storehouse 300, database 400.
Business interface layer 100:It is responsible for the business operation for the issuing system request outside reception system, in the application
In scheme, system can receive the request of polytype business.As shown in figure 1, integrated account system can be with
The operation requests of the multiple business such as deposit business, finance services, card certificate business are received, and in interface aspect,
The reception logic of the operation requests of different business is unified.
Business datum routing layer 200:The business operation request for being responsible for receiving on business interface layer 100 is routed to
Corresponding database.Major function among these includes:
According to action type, corresponding general service operational order is called from universal command storehouse 300;
According to type of service, the actual storage locations of this business operation object data are determined, and according to institute
The general service operational order for calling, builds the practical business operational order for processing this business.According to
The actual service condition of database, storage location here is potentially included " warehouse compartment is put " and " epitope is put "
Two kinds of specifying informations, the embodiment below will will be further described.
Universal command storehouse 300:Be stored with some general service operational order codes, such as inquiry operation sentence,
Freeze operation sentence, defrosting action statement etc..In these sentences, and need not indicate specifically operate it is right
As the storage location in database, appropriate section can leave a blank or be substituted with certain mark in sentence.Certain
One specific sentence can apply to all of type of service.When certain general service operational order is by business
After data routing layer 200 is called, by together with the actual storage locations of business operation object data, weighed
Newly it is configured to a practical business operational order.
Database 400:Storage service data, in scheme provided herein, between different business not
Only can respectively use independent physical database, can also use the mode of shared same physical database with
Improve the utilization rate of database resource.For latter approach, can by the data storage location of different business with
The mode of logical data base is divided, and with reference to the routing function of business datum routing layer 200, business is grasped
Make to point to corresponding logical data base, so that the data isolation between guarantee business.
It can be seen that, in multi-business multiplexing system provided herein, business datum routing layer 200 is core
Functional unit, below in conjunction with specific example, the basic function to business datum routing layer 200 is said
It is bright:
1) database configuration:
Scheme provided herein, had both supported that different business used independent physical data base resource respectively,
Also support that different business shares identical physical data base resource.Wherein, former mode and prior art
Database resource occupation mode is identical, is not described further in this application;And latter approach can be entered
One step be divided into whether point library storage, whether divide table store situation.The visit capacity of some business is very big, needs
Database is carried out into Fen Ku, point table to support huge Operational Visit amount.If conversely, Operational Visit
Amount is little, then do not need waste of resource to carry out point storehouse or point table, it is only necessary to the single storehouse list table of configuration or single storehouse point table.
Assuming that there is M physical database in system:Db0, db1 ... dbM-1, then for any one business x:
If x is configured so that single storehouse, that is, divide storehouse quantity mx=1, it is possible to use in M physical database
Any 1 storage service data;
If x is configured so that a point storehouse, that is, divide storehouse quantity 1<mx≤ M, it is possible to use M physical database
In any mxIndividual storage service data;
When single storehouse, can directly be configured to single table storage, a point table storage can also be configured to;It is right
In the situation in point storehouse, a point table storage can only be configured to.For the ease of unifiedly calculating and extending, typically by data
The quantity n of tablexIt is set to mxIntegral multiple.
Tables of data between different business, is made a distinction with service identification, for example:
For business x, the tables of data that its correspondence is used is entitled:x_000、x_001、x_002、……
For business y, the tables of data that its correspondence is used is entitled:y_000、y_001、y_002、……
Certainly, above-mentioned naming rule is only used for schematically illustrating, and should not be construed as the limitation to application scheme.
2) data route:
Data route includes two parts, storehouse route and table route, it is necessary to according to type of service during practical application
And a certain feature of business operation target data is accurately routed to specific Fen Ku and point table.
Assuming that for business x, its user data is sequentially stored in m according to Customs Assigned Number accountNoxIndividual point
The n in storehousexIn individual point of table, then storehouse route and table route computing method are as follows:
Storehouse route:
In the case of Dan Ku, point warehouse compartment=type of service numbering %M;
In the case of Fen Ku, point warehouse compartment=(accountNo%nx)/(nx/mx)
Table route:
In the case of single table, in the absence of a point epitope, corresponding table name is referred to as " service identification ";
In the case of point table, point epitope=(accountNo%nx), corresponding table name is referred to as " service identification
_ point epitope ".
In above-mentioned formula, " % " represents complementation, and "/" is represented and divides exactly computing.
With reference to specific example, the database configuration of the application and data routing plan are illustrated:
Assuming that system supports deposit business, finance services and card certificate business simultaneously, and have 5 physical datas
Storehouse db0, db1 ... db4.According to business demand, configure as follows:
Deposit business:Using 5 databases, totally 100 tables of data, 20 numbers are included in each database
According to table;
Finance services:Use 1 database, totally 10 tables of data;
Card certificate business:Use 1 database, 1 tables of data;
Specific configuration information is as shown in table 1, wherein " type of service coding " is used to distinguish different business, " class
Type is numbered " it is used to distinguish point table of different business for distinguishing different point storehouses, " type suffix ".
Type of service |
Type of service is encoded |
Type number |
Type suffix |
Whether storehouse is divided |
Divide storehouse quantity |
Whether table is divided |
Divide table quantity |
Deposit business |
DTTRANS |
0 |
dt |
true |
5 |
true |
100 |
Finance services |
FDTRANS |
1 |
fd |
false |
1 |
true |
10 |
Card certificate business |
FDTRANS |
2 |
cp |
false |
1 |
false |
1 |
Table 1
Assuming that Customs Assigned Number accountNo=2015092201234, according to the configuration in the numbering and table 1,
The corresponding database in every business datum of the data and tables of data can respectively be calculated.
For deposit business:
mx=5, nx=100;
Divide warehouse compartment=(accountNo%nx)/(nx/mx)=34/20=1, correspondence physical database is db1;
Divide epitope=(accountNo%nx)=34, corresponding table name is referred to as dt_034.
For finance services:
mx=1, nx=10
Divide warehouse compartment=type of service numbering %M=1, correspondence physical database is db1;
Divide epitope=(accountNo%nx)=4, corresponding table name is referred to as fd_004.
For card certificate business:
mx=1, nx=1
Divide warehouse compartment=type of service numbering %M=2, correspondence physical database is db2;
Point epitope does not exist, and corresponding table name is referred to as cp.
It is understood that above-mentioned database configuration and data routing plan, are not unique the application
Implementation method.Illustrate:Above-mentioned single storehouse point warehouse compartment uses computing formula:Type of service numbering %M, its mesh
Be that different single storehouse business is evenly distributed in each physical database, and the database configuration side of reality
Formula has a lot, for example, for existing during 5 physical databases, all list storehouse business can all be divided
Database db0 is fitted on, storehouse traffic assignments to database db1~db4 will be divided, then data router-level topology formula is also needed
It is adjusted correspondingly.Additionally, the naming rule of the database, tables of data in practical application, every number
According to the factor such as storage allocation rule, can all have influence on corresponding data router-level topology formula.In a word, it is above-mentioned
Specific embodiment, should not be construed as the limitation to the application.
On the basis of the configuration of above-mentioned database and data routing plan, the application provides a kind of multi-business multiplexing
Processing method, the executive agent of the method is the business datum routing layer 200 in system, in the process of implementation,
Need from by business interface layer 100 forwarding business operation request in obtain business operation essential information, from
General service operational order is called and using database 400 as final operation object in universal command storehouse 300,
Shown in Figure 3, the method may comprise steps of:
S101, receives business operation request, determines pending type of service and corresponding action type;
Still by taking foregoing billing and accounting system as an example, pending type of service is potentially included:Deposit business, financing
Business, card certificate business, etc., and corresponding action type is potentially included:Inquire about, be stored in, take out, freeze
Tie, thaw, etc., these information can be parsed by business operation request, the application
It is not described in further details.
S102, according to pending type of service, determines storage location of the business datum in database;
If between different business respectively use independent physical database, directly according to business datum with
The corresponding relation of physical database, determines storage location of the business datum in database;
If sharing identical physical database between different business, provided using preceding embodiment
Method, determines logical storage location of the business datum in general purpose physical data storehouse.According to specific business number
According to storage condition, the operations such as determination point warehouse compartment, point epitope are potentially included, specific process is in the present embodiment
Explanation is not repeated.
In multithreading operation environment, can be to each type for the treatment of line of the distribution with constant mark feature
Journey, for example, type of service title is encoded in a particular manner, sets in business interface layer 100 and blocks
Device is cut, thread variable is set according to default rule, from from the point of view of thread, each thread is kept for one
Implicit reference to its thread local variable copy, thread variable has always in a life cycle for thread
Imitate and can be accessed to, therefore during the treatment of data routing layer, can directly according to current business treatment progress
Variable extract operation code, then further determine that corresponding business datum storage location.This mode
Do not need substantially data routing layer really to understand type of service, need to only be carried out according to the identification characteristics of thread
Inquiry, and can preferably meet sharing problem of the multithreading for resource.Certainly, this mode
And should not be construed restriction to application scheme.
S103, according to the action type of pending business, obtains default for processing the logical of the action type
Use business operating instructions;
In universal command storehouse, some general service operational order codes are previously stored with, in these instructions
In code, only comprising basic treatment logic, without indicating specific operation object depositing in database
Storage space is put.
Assuming that the action type of pending business is " inquiry ", as a example by inquiring about accounts information, its is general to look into
Ask instruction code form as follows:
Connect to [library name]
// expression is connected to specified bank, is herein false code, and implementation is different under different operating environments;
Select*from [table name] where account_no=[Customs Assigned Number]
// it is herein sql sentences
Content in bracket is not particularly pointed out, and is that the variable in bracket indicates tool in subsequent step
After holding in vivo, the sentence just can accordingly be used to process looking into for the miscellaneous services such as deposit, financing, card certificate business
Ask operation.
It should be noted that S102 and S103 be not specific on execution sequence successively limiting.
S104, using identified business datum storage location and the general service operational order for being obtained, structure
Build practical business operational order;
Assuming that Customs Assigned Number is 2015092201234, it is necessary to the type of service for the treatment of is " deposit business ", behaviour
Make type for " accounts information inquiry ",
Calculated according to S102 and understood, business datum is stored in the tables of data dt_034 of database db1, according to
The general polling instruction code that S103 is obtained, replaces wherein unspecified content, and reconstruct obtains practical business
Operational order code is as follows:
connect to db1
// false code, expression is connected to db1;
Select*from dt_034in where account_no=' 2015092201234 '
//sql sentences;
S105, performs practical business operational order, is asked with responding the business operation.
It can be seen that, scheme provided herein, the database horizontal extension based on business channel will be different
Business datum is completely isolated, is set up under different business system and supports multiple business system, to following new business
Access both provide total solution;Due to the reusability of operation logic, therefore increasing new industry
During business, it is only necessary to newly-increased a set of database configuration, it is possible to be directly realized by business function, significantly reduce
Development and maintenance cost.In addition, by data routing algorithm, the user of database can be configured flexibly
Formula, so as to realize the Optimum utilization of database resource.
In addition, although above-described embodiment is only illustrated with billing and accounting system application, the application scenarios are not
It is interpreted as the restriction to application scheme.For example, in gaming platform, the management of information in difference game
Logic is identical, including user's registration, login, integration, interior purchase, achievement are reached etc., can be by phase
Answer operation logic to be designed as general operation to instruct, realize same gaming platform to multiple using the scheme of the application
The unified management of game.Similar application scenarios are no longer enumerated here, in a word according to provided herein
Scheme, those skilled in the art can design and be applied to it without creative efforts
The multi-business multiplexing scheme of his scene.
Corresponding to above method embodiment, the application also provides a kind of multi-business multiplexing processing unit, the device
Shown in Figure 4 functionally equivalent to the business datum routing layer in preceding embodiment, the device can be with
Including:
Request receiving module 110, for receiving business operation request, determines pending type of service and correspondence
Action type;
Storage location determining module 120, for according to pending type of service, determining business datum in database
In storage location;
General operation instruction obtains module 130, for the action type according to pending business, obtains default
General service operational order for processing the action type, not specified behaviour in the general service operational order
Make the actual storage locations of object data;
Practical operation instruction builds module 140, for utilizing identified business datum storage location and being obtained
General service operational order, build practical business operational order;
Performing module 150, for performing the practical business operational order, is asked with responding the business operation.
In a kind of specific embodiment of the application, each type of business correspondence has constant mark feature
Treatment thread;Correspondingly, storage location determining module 120 can be specifically for according to currently used industry
Business treatment thread identification feature, determines storage location of the business datum in database.
In a kind of specific embodiment of the application, different types of business shares identical physical database;
Correspondingly, storage location determining module 120 can be specifically for determining business datum in general purpose physical data storehouse
In logical storage location.
The function of modules and the implementation process of effect specifically refer to correspondence step in the above method in said apparatus
Rapid implementation process, will not be repeated here.
As seen through the above description of the embodiments, those skilled in the art can be understood that this
Application can add the mode of required general hardware platform to realize by software.Based on such understanding, this Shen
The part that technical scheme please substantially contributes to prior art in other words can be in the form of software product
Embody, the computer software product can be stored in storage medium, such as ROM/RAM, magnetic disc,
CD etc., including some instructions are used to so that computer equipment (can be personal computer, server,
Or the network equipment etc.) perform method described in some parts of each embodiment of the application or embodiment.
Each embodiment in this specification is described by the way of progressive, identical phase between each embodiment
As part mutually referring to what each embodiment was stressed is the difference with other embodiment.
For especially for device embodiment, because it is substantially similar to embodiment of the method, so describing to compare
Simply, the relevent part can refer to the partial explaination of embodiments of method.Device embodiment described above is only
It is only illustrative, wherein the module illustrated as separating component can be or may not be physics
It is upper separate, when application scheme is implemented can the function of each module in same or multiple softwares and/or
Realized in hardware.Some or all of module therein can also be according to the actual needs selected to realize this reality
Apply the purpose of a scheme.Those of ordinary skill in the art are without creative efforts, you can with
Understand and implement.
The above is only the specific embodiment of the application, it is noted that common for the art
For technical staff, on the premise of the application principle is not departed from, some improvements and modifications can also be made,
These improvements and modifications also should be regarded as the protection domain of the application.