WO2015120696A1 - Data apportioning method, apparatus and device - Google Patents
Data apportioning method, apparatus and device Download PDFInfo
- Publication number
- WO2015120696A1 WO2015120696A1 PCT/CN2014/083041 CN2014083041W WO2015120696A1 WO 2015120696 A1 WO2015120696 A1 WO 2015120696A1 CN 2014083041 W CN2014083041 W CN 2014083041W WO 2015120696 A1 WO2015120696 A1 WO 2015120696A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- dimension
- record
- apportionment
- base
- data
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 60
- 238000012545 processing Methods 0.000 claims description 20
- 238000004891 communication Methods 0.000 claims description 6
- 238000012423 maintenance Methods 0.000 abstract description 8
- 238000010586 diagram Methods 0.000 description 5
- 230000001131 transforming effect Effects 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
- G06F16/278—Data partitioning, e.g. horizontal or vertical partitioning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/28—Databases characterised by their database models, e.g. relational or object models
- G06F16/283—Multi-dimensional databases or data warehouses, e.g. MOLAP or ROLAP
Definitions
- the present invention relates to electronic technologies, and in particular, to a data sharing method, apparatus, and device. Background technique
- the aggregated superior data needs to be distributed to the subordinate data, that is, the process from the total to the fine. For example, the sales of China's regional 100 million yuan will be distributed to the lower-level regions: East China, North China, South China, Northeast and Southwest.
- the existing data sharing scheme is divided according to the allocation scenario and is processed in the background corresponding to the database storage process (SP).
- An allocation scenario corresponds to a stored procedure.
- Each stored procedure includes the same operations as fetching, dimension definition, calculating ratios, and inserting data into the target table. If you add a new allocation scenario, you need to add a new stored procedure to redevelop the code in the same basic process. Therefore, the existing data sharing scheme is complicated to implement, low in flexibility, and high in maintenance cost. Summary of the invention
- Embodiments of the present invention provide a data sharing method, apparatus, and device, which are used to improve data sharing efficiency and reduce maintenance costs.
- an embodiment of the present invention provides a data sharing method, including:
- the distribution dimension name includes the name of the target dimension and the name of the numerical dimension
- the data in the distribution ratio dimension of each record in the allocation base is, the sum of the data in the numerical dimension of all records in the allocation base is in the allocation
- each record in the distribution object Distributing, according to each record in the difficulty base, each record in the distribution object into a plurality of records, wherein data in a target dimension in each record in the distribution object is allocated into the Assorting the data in the target dimension in each record in the cardinality, the data in the numerical dimension in each record in the apportionment object is divided into the apportionment ratio values in the apportionment ratio dimension in each record in the apportionment base respectively Corresponding data.
- obtaining a scale of the proportion of each record in the allocation base includes:
- Data in a numerical dimension of each record in the allocation base, respectively, and the allocation base The ratio of the sum of the data in the numerical dimension of all records in the record, determined as the scale of the sum of the data in the numerical dimension of all records in the allocation base in each of the allocation bases, and respectively
- the sum of the data in the numerical dimension of all records in the allocation base is the distribution ratio value in each record in the allocation base as the data in the distribution ratio dimension in each record in the allocation base.
- the name of the distribution dimension further includes a name of the associated dimension, and each of the allocation base and each of the distribution objects further includes an associated dimension;
- the method further includes:
- Obtaining the proportion of the proportion of each record in the allocation base includes: grouping all the records in the allocation base according to the data in the associated dimension, and grouping all the records in the allocation base according to the data in the associated dimension and the data in the target dimension; The data in the data dimension in each record obtained by grouping all the records in the allocation base according to the data in the associated dimension is grouped and summarized according to the data in the associated dimension and the data in the target dimension.
- the ratio of the sum of the data in the data dimension in each record is determined as the value of the sum of the data in the numerical dimension of all the records in the allocation base in each of the allocation bases, and respectively
- the sum of the data in the numerical dimension of all records in the allocation base is the distribution ratio value in each record in the allocation base as the data in the distribution ratio dimension in each record in the allocation base.
- the allocation is performed according to each record in the hard-working base
- Each record in the object is spread into multiple records, including:
- processing the first record in the distribution object according to the manner of processing the first record in the distribution object, and processing the first record in the distribution object includes:
- the first record is associated with each record, and the first record is divided into a plurality of records, wherein data in the target dimension in the first record is allocated into the allocation base and is related to the first record Data in the target dimension in each of the associated records, the data in the numerical dimension in the first record is distributed into the proportion of the proportion of the proportions in the records associated with the first record in the allocation base
- the record associated with the first record in the allocation base is a record in which the data in the associated dimension is the same as the data in the associated dimension in the first record.
- an embodiment of the present invention provides a data sharing device, including:
- a setting module configured to determine, according to a name of the allocation dimension input by the user, an allocation dimension of each record in the allocation base, and an allocation dimension of each record in the distribution object;
- the distribution dimension name includes a name of the target dimension and a numerical dimension Name
- a calculation module configured to obtain a distribution ratio dimension of each record in the allocation base, where data in a distribution ratio dimension of each record in the allocation base is data in a numerical dimension of all records in the allocation base The sum of the proportions in each record in the allocation base;
- a distribution module configured to allocate, according to each record in the difficulty base, each record in the distribution object into a plurality of records, where data in a target dimension in each record in the distribution object, The data in the target dimension in each record in the allocation base is distributed, and the data in the numerical dimension in each record in the distribution object is allocated to the distribution ratio dimension in each record in the allocation base The data corresponding to the scaled value are respectively.
- the calculating module is specifically configured to separately use data in a numerical dimension of each record in the allocation base and a numerical dimension of all records in the allocation base
- the ratio of the sum of the data in the data is determined as the scale of the sum of the data in the numerical dimension of all records in the allocation base in each of the allocation bases, and respectively records all the records in the allocation base
- the sum of the data in the numerical dimension in each of the allocation bases is used as the data in the distribution ratio dimension in each record in the allocation base.
- the device further includes an association module
- the association module is configured to: after determining the allocation dimension of each record in the allocation base according to the name of the distribution dimension input by the user, remove the record that is not related to the allocation base in the distribution object, where the allocation is performed
- the record in the cardinality is unrelated to the allocation object
- the record in the allocation object that is not related to the allocation base is: the data in the associated dimension and the data in the associated dimension in each record in the allocation base a record that is not the same as the record in the allocation base, wherein the data in the associated dimension is different from the data in the associated dimension in each record in the distribution object
- the dimension name further includes a name of the associated dimension
- each of the allocation base and each of the distribution objects further includes an associated dimension
- the calculation module is specifically configured to group all the records in the allocation base according to the data in the associated dimension, and group all the records in the allocation base according to the data in the associated dimension and the data in the target dimension; The data in the data dimension in each record obtained by grouping all the records in the allocation base, and the data in each record obtained by grouping all the records in the allocation base according to the data in the associated dimension and the data in the target dimension.
- a ratio of the sum of the data in the dimension determined as a scale of the sum of the data in the numerical dimension of all the records in the allocation base in each of the allocation bases, and respectively records all the records in the allocation base
- the sum of the data in the numerical dimension is the value of the scale in each record in the allocation base as the data in the scale of proportions in each record in the allocation base.
- the distribution module is configured to process each record in the distribution object in a manner of processing the first record in the distribution object, and the manner of processing the first record in the distribution object includes: Decoding each record associated with the first record in a difficult base, and distributing the first record into a plurality of records, wherein data in a target dimension in the first record is allocated into the allocation base Data in a target dimension in each record associated with the first record, data in a numerical dimension in the first record, is distributed into respective records associated with the first record in the allocation base Data corresponding to the distribution ratio values in the distribution ratio dimension; the records associated with the first record in the allocation base are: The data in the joint dimension is the same as the data in the associated dimension in the first record.
- an embodiment of the present invention provides a data sharing device, including: a processor, a memory, a communication interface, and a bus; wherein the processor, the memory, and the communication interface are connected by using the bus;
- the memory is used to store a program; the processor is configured to execute the program stored in the memory; and the program is configured to:
- the distribution dimension name includes the name of the target dimension and the name of the numerical dimension
- the data in the distribution ratio dimension of each record in the allocation base is, the sum of the data in the numerical dimension of all records in the allocation base is in the allocation
- each record in the distribution object Distributing, according to each record in the difficulty base, each record in the distribution object into a plurality of records, wherein data in a target dimension in each record in the distribution object is allocated into the Assorting the data in the target dimension in each record in the cardinality, the data in the numerical dimension in each record in the apportionment object is divided into the apportionment ratio values in the apportionment ratio dimension in each record in the apportionment base respectively Corresponding data.
- the program is further configured to: respectively, data in a numerical dimension of each record in the allocation base, and a numerical dimension of all records in the allocation base
- the ratio of the sum of the data in the data is determined as the scale of the sum of the data in the numerical dimension of all records in the allocation base in each of the allocation bases, and respectively records all the records in the allocation base
- the sum of the data in the numerical dimension in each of the allocation bases is used as the data in the distribution ratio dimension in each record in the allocation base.
- the program is further configured to:
- the records After determining the allocation dimension of each record in the allocation base according to the name of the distribution dimension input by the user, deleting the record that is not related to the allocation base in the allocation object, and removing the allocation in the allocation base a record that is not related to the object;
- the record in which the number of bases is not related is that the data in the associated dimension is different from the data in the associated dimension in each record in the allocation base;
- the record in the allocation base that is not related to the allocation object is a record in which the data in the associated dimension is different from the data in the associated dimension in each record in the record object;
- the share dimension name further includes a name of the associated dimension, and the share of the share and each of the share objects
- the records also include the associated dimensions;
- the calculation module is specifically configured to group all the records in the allocation base according to the data in the associated dimension, and group all the records in the allocation base according to the data in the associated dimension and the data in the target dimension; The data in the data dimension in each record obtained by grouping all the records in the allocation base, and the data in each record obtained by grouping all the records in the allocation base according to the data in the associated dimension and the data in the target dimension.
- a ratio of the sum of the data in the dimension determined as a scale of the sum of the data in the numerical dimension of all the records in the allocation base in each of the allocation bases, and respectively records all the records in the allocation base
- the sum of the data in the numerical dimension is the value of the scale in each record in the allocation base as the data in the scale of proportions in each record in the allocation base.
- processing the first record in the distribution object according to the manner of processing the first record in the distribution object, and processing the first record in the distribution object includes: The first record is associated with each record, and the first record is divided into a plurality of records, wherein data in the target dimension in the first record is allocated into the allocation base and is related to the first record Data in the target dimension in each of the associated records, the data in the numerical dimension in the first record is distributed into the proportion of the proportion of the proportions in the records associated with the first record in the allocation base The data corresponding to the value respectively; the record associated with the first record in the allocation base is a record in which the data in the associated dimension is the same as the data in the associated dimension in the first record.
- the target dimension and the numerical dimension of the allocation object and the allocation base are set according to the user input, and then the allocation proportion dimension of each record in the allocation base is obtained, and then, according to each record in the difficulty base
- Each record in the distribution object is divided into a plurality of records, wherein data in the target dimension in each record in the distribution object is divided into The data in the target dimension in each record in the allocation base, the data in the numerical dimension in each record in the allocation object is allocated and distributed among the distribution ratio dimensions in each record in the allocation base
- the data corresponding to the scale values respectively realizes the purpose of apportioning the data in the target dimension and the numerical dimension in the distribution object according to the data in the target dimension and the numerical dimension in the allocation base.
- the allocation dimension and the distribution dimension are respectively set according to the target dimension name and the numerical dimension name input by the user, and different allocation scenarios can be formed by transforming the distribution object and the allocation dimension of the allocation base. Therefore, this embodiment provides The method is adapted to various allocation scenarios, and the embodiment can be used to implement the allocation regardless of how the allocation dimension is changed.
- the allocation method provided in this embodiment improves the allocation flexibility, reduces the allocation complexity, reduces the code maintenance cost, and improves the allocation efficiency.
- FIG. 1 is a flowchart of a data sharing method according to an embodiment of the present invention
- FIG. 2 is a flowchart of another data sharing method according to an embodiment of the present invention.
- FIG. 3 is a flowchart of still another data sharing method according to an embodiment of the present invention.
- FIG. 4 is a schematic structural diagram of a data sharing device according to an embodiment of the present invention
- FIG. 5 is a schematic structural diagram of another data sharing device according to an embodiment of the present invention
- FIG. 6 is still another data sharing device according to an embodiment of the present invention
- FIG. 7 is a schematic structural diagram of a data sharing device according to an embodiment of the present invention.
- the allocation object may be a data table composed of one or more records.
- the first allocation base may also be a data table composed of one or more records. Among them, one column in the data table corresponds to one dimension.
- the allocation base includes dimensions such as product, department, region, and current balance
- the distribution objects include dimensions such as product, department, region, and debit amount.
- the allocation scenario may be based on the department dimension and the current balance dimension of the product with the same object in the allocation base, and the department dimension and the debit amount of the distribution object are apportioned, and the allocation is to refine the department dimension and the debit amount of the distribution object. process.
- the allocation scenario may also be based on the department dimension and the current balance dimension in the allocation base, and the department dimension and the debit amount of the distribution object are apportioned, and the department dimension corresponding to the current occurrence quota in the allocation base can be compared with the department dimension in the allocation object.
- the product dimensions corresponding to the current quota are different.
- the non-numeric dimension of the assessed base is called the target dimension of the apportionment object
- the dimension used to associate the apportionment base can be called the associated dimension of the apportionment object; in the apportionment base, the non-numeric value of the apportionment object is apportioned.
- the dimension is called the target dimension of the allocation base.
- the dimension used to associate the allocation object can be called the associated dimension of the allocation base.
- the associated dimension in the allocation object is the same as the associated dimension in the allocation base. If the allocation scenario does not require the allocation of the distribution object according to the allocation base associated with the distribution object, but only the allocation of the distribution object according to the allocation base, it is not necessary to set the association dimension, if the assessment dimension requires the allocation according to the allocation object. If the cardinality is used to allocate the object, you need to set the associated dimension.
- the execution body of the method provided by the embodiment of the present invention may be any device having a CPU.
- a personal computer etc.
- FIG. 1 is a flowchart of a data sharing method according to an embodiment of the present invention. As shown in FIG. 1, the method provided in this embodiment includes:
- Step 11 Determine, according to a name of the distribution dimension input by the user, an allocation dimension of each record in the allocation base, and an allocation dimension of each record in the distribution object; the distribution dimension name includes a name of the target dimension and a name of the numerical dimension .
- the name of the target dimension entered by the user can include the name of one dimension or the name of multiple dimensions.
- the name of the target dimension of the distribution object is the same as the name of the target dimension of the allocation base.
- the name of the numerical dimension of the distribution object may be the same as the name of the numerical dimension of the allocation base, or may be different from the name of the numerical dimension of the allocation base. According to the user input, one or more non-numeric dimensions that need to be apportioned are extracted from all non-numeric dimensions of the apportioned object as the target dimension, and one or more numerical dimensions that need to be apportioned are extracted from all numerical dimensions of the apportioned object.
- the non-numeric dimension of the apportioned object in the apportionment object is called the target dimension of the apportionment object
- the non-numeric dimension of the apportionment object in the apportionment base is called the target dimension of the apportionment base.
- the departmental dimension of the allocation object and the debit amount are used as the target dimension according to the department dimension and the current balance dimension in the allocation base.
- the department dimension in the allocation object can be used as the target dimension
- the current quota dimension in the allocation object is taken as Numerical dimension Degree, you can use the product dimension in the allocation base as the associated dimension, the department dimension as the target dimension, and the debit amount dimension as the numerical dimension.
- the allocation dimension of the distribution object may further include a carrying dimension, and the data in the carrying dimension is used to display information related to the target dimension and the numerical dimension.
- the data in the dimension of the object to be distributed does not change before and after the allocation.
- the carrying dimension is displayed in the allocation result table of the object to be distributed.
- all the records in the allocation object may be grouped according to the data in the target dimension in the allocation object.
- all the records in the allocation base can be grouped and summarized according to the data in the target dimension in the allocation base.
- Step 12 Obtain a distribution ratio dimension of each record in the allocation base, and the data in the distribution ratio dimension of each record in the allocation base is the sum of the data in the numerical dimension of all records in the allocation base The value of the scale in each record in the allocation base.
- the ratio of the data in the numerical dimension of each record in the allocation base to the sum of the data in the numerical dimension of all the records in the allocation base may be determined as the data in the numerical dimension of all the records in the allocation base.
- the sum of the scales in each record in the allocation base, and the sum of the data in the numerical dimension of all the records in the allocation base, respectively, in the score of each of the records The data in the scaled proportion dimension in each record in the allocation base.
- Step 13 Each record in the distribution object is distributed into a plurality of records according to each record in the difficulty base, wherein data in a target dimension in each record in the distribution object is The data in the target dimension in each record in the allocation base is distributed, and the data in the numerical dimension in each record in the allocation object is allocated to the distribution ratio dimension in each record in the allocation base The data corresponding to the scaled value are respectively.
- Each record in the allocation object is divided into multiple records in the allocation base.
- the data in the target dimension of these records is the data in the target dimension of the allocation base.
- the numerical dimension of these records is the product of the data in the original value dimension in the distribution object and the data corresponding to the distribution ratio value in the distribution ratio dimension in each record in the allocation base.
- each record of the allocation object and the allocation base is set according to the user input.
- the assigned allocation dimension the user can form different allocation scenarios by transforming the distribution object and the allocation dimension of the allocation base. After the allocation is performed based on the distribution scenario, you can set different allocation dimensions for the distribution object and the allocation base based on the different allocation scenarios. You can use the same allocation basis to distribute the same distribution object multiple times to obtain different allocation results.
- the carrying dimension of the allocation object is set, and after the allocation object is allocated according to the allocation base, the data in the carrying dimension remains unchanged.
- the target dimension and the numerical dimension of the allocation object and the allocation base are set according to the user input, and then the allocation proportion dimension of each record in the allocation base is obtained, and then, according to the difficulty base
- Each record distributes each record in the distribution object into a plurality of records, wherein data in a target dimension in each record in the distribution object is allocated into each record in the allocation base
- data in the target dimension, the data in the numerical dimension in each record in the distribution object is allocated into data corresponding to the distribution ratio value in the distribution ratio dimension in each record in the allocation base, thereby realizing The purpose of apportioning the data in the target dimension and the numerical dimension in the allocation object according to the data in the target dimension and the numerical dimension in the allocation base.
- the allocation dimension and the distribution dimension are respectively set according to the target dimension name and the numerical dimension name input by the user, and different allocation scenarios can be formed by transforming the distribution object and the allocation dimension of the allocation base. Therefore, this embodiment provides The method is adapted to various allocation scenarios, and the embodiment can be used to implement the allocation regardless of how the allocation dimension is changed.
- the allocation method provided in this embodiment improves the allocation flexibility, reduces the sharing complexity, reduces the code maintenance cost, and improves the allocation efficiency.
- FIG. 2 is a flowchart of another data sharing method according to an embodiment of the present invention.
- the allocation dimension of the distribution object and the allocation base also includes an association dimension.
- the method provided in this embodiment includes:
- Step 21 Determine, according to a name of the distribution dimension input by the user, an allocation dimension of each record in the allocation base, and an allocation dimension of each record in the allocation object; the allocation dimension name includes a name of the target dimension, and a name of the numerical dimension And the name of the associated dimension.
- the allocation scenario may be to allocate the target dimension and the numerical dimension of the distribution object according to the target dimension and the numerical dimension of the allocation base after the association dimension is associated with the distribution object.
- the allocation dimension after setting the allocation dimension, before obtaining the distribution ratio dimension of each record in the allocation base, according to the data and association in the target dimension in the allocation object
- the data in the dimension grouping all the records in the distribution object.
- all the records in the allocation base may be grouped and summarized according to the data in the target dimension and the data in the associated dimension in the allocation base.
- the distribution object includes the following dimensions: department dimension, debit amount dimension, credit amount dimension, product dimension, accounting period dimension, and region dimension; as shown in Table 2A, the allocation base Y1 includes the following dimensions: department dimension product dimension, accounting Period and area dimensions and current balance dimensions.
- the allocation scenario is to allocate the department dimension, the debit amount dimension, and the credit amount dimension in the allocation object according to the department dimension and the current generation dimension in the allocation base for a certain product.
- the accounting period dimension and the regional dimension are displayed in the assessment result. Since the allocation base Y1 is the basis for apportioning the distribution objects, each dimension does not need to be presented in the distribution result. Therefore, it is not necessary to set the carrying dimension in the allocation base.
- the numerical dimension of the allocation base is the basis for apportioning the numerical dimension in the allocation object. In the case where only one allocation basis is allowed, only one numerical dimension is set in the allocation base. Therefore, as shown in Table 2B, the department dimension in the allocation base Y1 in Table 2A can be extracted, the product dimension and the current balance dimension generate the allocation base Y2, and the allocation base Y2 includes the target dimension: department, associated dimension: product, and numerical value Dimensions: Current balance.
- the allocation object XI set the department dimension to the target dimension, the product dimension to the associated dimension, the debit amount and the credit amount to the numeric dimension, and the accounting period dimension and the region dimension to the carrying dimension. It should be noted that if the dimension other than the product, department, and debit amount is not displayed in the distribution result, the carrying dimension may not be set in the allocation object XI, and the sharing dimension is not included in the allocation object.
- the department dimension Set as the target dimension, set the product dimension to the associated dimension, and set the current balance to the numeric dimension.
- Table 1 shows the allocation object XI
- Table 2A is the allocation base Y1
- Table 2B is the allocation base Y2
- Step 22 Remove the records that are not related to the allocation base in the allocation object, and remove the records that are not related to the allocation object in the allocation base; the records in the allocation object that are not related to the allocation base are the data in the associated dimension in the allocation object A record that is different from the data in the associated dimension in each record in the allocation base; the record in the allocation base that is not related to the allocation object is the data in the associated dimension in the data in the associated dimension in the allocation base and the data in the associated dimension in each record in the allocation object Different records.
- Table 1 and Table 2B as an example, after the allocation object XI and the allocation base Y 1 are associated by the product dimension, the record about the printer B is removed in Table 1 to obtain the distribution object X2 shown in Table 3, because in Table 2B There are no records about printer B.
- the record for printer C is removed in Table 2B as shown in Table 4 as the allocation base Y3, since there is no record for printer C in Table 1.
- Table 3 is the object of distribution ⁇ 2
- Table 4 shows the allocation base Y3 Step 23: Group all the records in the allocation base according to the data in the associated dimension, and group all the records in the allocation base according to the data in the associated dimension and the data in the target dimension.
- Step 24 The data in the data dimension in each record obtained by grouping all the records in the allocation base according to the data in the associated dimension, and all the records in the allocation base according to the data in the associated dimension and the data in the target dimension.
- the ratio of the sum of the data in the data dimension in each record obtained after the grouping is determined, and the sum of the data in the numerical dimension of all records in the allocation base is determined in each record of the allocation base.
- the sum of the data in the numerical dimension of all records in the allocation base in each of the allocation bases as the data in the distribution ratio dimension in each record in the allocation base .
- the step of obtaining the scale of the proportion of each record in the allocation base is specifically step 23 and step 24.
- Table 5 is the allocation base ⁇ 4
- the manner of the first record includes: distributing the first record into a plurality of records according to each record associated with the first record in the hard base.
- the first record is any one of the objects in the distribution object after the allocation object is associated with the allocation base.
- the data in the target dimension in the first record, the data in the target dimension in each record associated with the first record in the aggregated base, the data in the numerical dimension in the first record, and the number of shares in the base Recording data corresponding to the proportions of the proportions in the proportions of the associated records; the records associated with the first record in the allocation base are: the data in the associated dimension and the data in the associated dimension in the first record The same record.
- Table 6 shows the distribution result of the object X2.
- the associated dimensions for association are added in the allocation object and the allocation base respectively.
- the data of the numerical dimension in the associated allocation object is allocated according to the data of the proportioned dimension in the associated allocation base
- the data of the target dimension in the associated allocation object is allocated according to the data of the target dimension in the associated allocation base. Therefore, the purpose of apportioning the data in the target dimension and the numerical dimension in the allocation object according to the data in the target dimension and the numerical dimension in the allocation base is realized.
- the allocation object and the sub-division are respectively set according to the target dimension name and the numerical dimension name and the name of the associated dimension input by the user.
- the allocation dimension of the base number can be used to transform the allocation object and the allocation dimension of the allocation base.
- the method provided in this embodiment can be applied to various allocation scenarios, and the embodiment can be adopted regardless of how the allocation dimension is changed. To achieve the allocation, therefore.
- the allocation method provided in this embodiment improves the allocation flexibility, reduces the allocation complexity, reduces the code maintenance cost, and improves the allocation efficiency.
- an associated dimension and a target dimension are set in Tables 1 and 2.
- the allocation object and the allocation base have two associated dimensions and two target dimensions, respectively.
- the apportionment objects include the following dimensions: Accounting Period Dimensions, Company Dimensions, Product Dimensions, Department Dimensions, User Dimensions, Regional Dimensions, Amounts RMB Dimensions, and Amounts USD Dimensions.
- the allocation base includes the following dimensions: company dimension, product dimension, department dimension, user dimension, and duration dimension. The allocation scenario is based on the department dimension and the user dimension in the allocation base, and the department dimension and the user dimension in the distribution object are allocated, and the amount RMB dimension and the amount USD dimension in the object are allocated according to the usage length dimension in the allocation base.
- the product dimension and the company dimension are set as the associated dimension
- the department dimension and the user dimension are set as the target dimension
- the amount RMB dimension and amount are set.
- the USD dimension is set to a numeric dimension
- the area dimension is set to carry a dimension.
- the accounting period dimension and the area dimension may be used as carrying dimensions to display the accounting period dimension and the area dimension in the distribution results shown in Table 12.
- the allocation base shown in Table 8A set the product and company dimensions as the associated dimensions, the department and user dimensions as the target dimensions, and the usage time dimension as the numeric dimension.
- Table 8B Extract the base of the allocation, the product dimension, the company dimension, the department dimension, the user dimension, and the usage time dimension in D 1 to generate the allocation base D2
- Table 7 is the allocation object C1
- Table 8A is the allocation base D1 201201 HiSilicon Printer AA Implementation Department Zhang San US 8
- Table 8B is the allocation base D2
- the allocation object C2 shown in Table 9 and the allocation base D3 shown in Table 10 are obtained.
- Table 10 all the records in which the company is Huitong and the product is a copy machine are removed in Table 8, because there is no record in Table 7 that the company is Huitong and the product is a copy machine.
- Table 9 is the allocation object C2
- the allocation base D4 shown in Table 11 is generated.
- the allocation base D3 the company dimension, the product dimension, the department dimension, the user dimension, and the third allocation base D3.
- the time-division dimension is used for grouping and summarizing to obtain the summary 1 dimension shown in Table 11, and the product dimension and the company dimension of the allocation base D3 are grouped and summarized according to the usage duration dimension of the allocation base D3 to obtain the summary 2 dimension shown in Table 11. Divide the summary 1 dimension by the summary 2 dimension to generate the scaled dimension as shown in Table 11.
- Table 11 is the allocation base D4
- the department dimension and the user dimension of the allocation object C2 are allocated, and the amount of the object C2 and the amount of USD are allocated according to the distribution ratio dimension of the allocation base D4.
- the dimensions are allocated and the results of the allocation shown in Table 12 are generated.
- the printer A of HiSilicon is used by Zhang San of the BIS department and Li Si of the BIS department, and the volume B calculated according to the duration of use is 100 ( 8/12 ) and 100 ( 12/20 respectively). ).
- Table 12 shows the results of the allocation of the object C2.
- FIG. 3 is a flowchart of still another method for allocating according to an embodiment of the present invention.
- the embodiment first determines the distribution ratio dimension according to the allocation base, and then associates the allocation base with the distribution ratio dimension with the distribution object to obtain the associated allocation base and the distribution object.
- the method provided in this embodiment includes: Step 31: Determine, according to a name of the distribution dimension input by the user, an allocation dimension of each record in the allocation base, and an allocation dimension of each record in the distribution object; the distribution dimension name includes a name of the target dimension, and a name of the numerical dimension And the name of the associated dimension.
- Step 32 Group all the records in the allocation base according to the data in the associated dimension, and group all the records in the allocation base according to the data in the associated dimension and the data in the target dimension.
- Step 33 The data in the data dimension in each record obtained by grouping all the records in the allocation base according to the data in the associated dimension, and all the records in the allocation base according to the data in the associated dimension and the data in the target dimension.
- the ratio of the sum of the data in the data dimension in each record obtained after the grouping is summarized, and respectively the sum of the data in the numerical dimension of all records in the allocation base in each record of the allocation base.
- the value is used as the data in the scale of the scale in each record in the allocation base.
- the step of obtaining the scale of the proportion of each record in the allocation base is specifically step 32 and step 33.
- the allocation dimension after setting the allocation dimension, before obtaining the distribution ratio dimension of each record in the allocation base, according to the data and association in the target dimension in the allocation object
- the data in the dimension grouping all the records in the distribution object.
- all the records in the allocation base may be grouped and summarized according to the data in the target dimension and the data in the associated dimension in the allocation base.
- the allocation ratio dimension is increased in the allocation base Y2 shown in Table 2B to generate the allocation base Y5 as shown in Table 13.
- the current balance dimension of Table 2 ⁇ is grouped and summarized according to the product dimension and the department dimension, and the summary 1 dimension in Table 13 is obtained, and the current balance dimension of Table 2 ⁇ is grouped and summarized according to the department dimension, and the summary in Table 13 is obtained.
- Dimensions, the data in summary 1 of each record in Table 13 is divided by the data in summary 2 of each record in Table 13, and the data in the scale of proportions in Table 13 is obtained.
- the allocation ratio dimension is increased in the allocation base D1 shown in Table 8B to obtain the allocation base D5 as shown in Table 14.
- the summary 1 dimension shown in Table 14 is obtained, according to the product dimension and the product dimension in the allocation base D2
- the company dimension uniteds the usage time dimension of the allocation base D2 into a summary 2 dimension shown in Table 14, and divides the summary 1 dimension by the summary 2 dimension to generate the distribution ratio dimension as shown in Table 14.
- Table 14 is the allocation base D5
- Step 34 Remove the record that is not related to the allocation base in the allocation object, and remove the record that is not related to the allocation object in the allocation base;
- the record in the allocation object that is not related to the allocation base is the data in the associated dimension in the allocation object A record that is different from the data in the associated dimension in each record in the allocation base;
- the record in the allocation base that is not related to the allocation object is the data in the associated dimension in the data in the associated dimension in the allocation base and the data in the associated dimension in each record in the allocation object Different records.
- the allocation base Y5 shown in Table 13 is associated with the distribution object XI shown in Table 1 according to the department dimension, and the record about the printer B is removed in Table 1.
- the distribution object X2, the record on the printer C is removed in Table 13, and the allocation base Y4 as shown in Table 5 is also obtained.
- the fourth allocation base D4 shown in Table 14 is associated with the first allocation object C 1 shown in Table 7 according to the product dimension and the company dimension, and the first table shown in Table 9 is obtained.
- the two objects C2 and the allocation base D4 as shown in Table 11.
- Table 11 all the records in Table 14 in which the company is Huitong and the products are copiers are removed, because there is no record in Table 7 that the company is Huitong and the products are copiers.
- Step 35 processing each record in the distribution object according to the first record in the processing object, and processing the first record in the object to be distributed includes: associating with the first record according to the difficulty base For each record, the first record is divided into multiple records.
- Step 35 is the same as step 25.
- the allocation dimension includes a target dimension, a data dimension, and an associated dimension.
- the following is an example of the allocation base F1 shown in Table 15 and the allocation base F1 shown in Table 16. If the association dimension is not set in the object and the allocation base, how to allocate the distribution object according to the allocation base.
- the allocation scenario may be based on the department dimension and the usage duration dimension in the allocation base, and the department dimension and the amount RMB dimension and the amount USD dimension in the distribution object are allocated. Therefore, the name of the target dimension in the distribution object E1 input by the user is the department, the name of the numerical dimension in the distribution object E 1 is the amount RMB and the amount USD, and the remaining dimensions are set to carry the dimension, and the name of the target dimension of the allocation base F1 is Department, the name of the numerical dimension of the allocation base F1 is the length of use.
- Table 15 is the allocation object E1 Accounting period company Guangkoukou department area amount RMB amount USD
- the department dimension is the target dimension
- the current amount is the data dimension.
- the target dimension and numerical dimension of the extracted base number F1 are obtained as shown in Table 17.
- Table 16 is the allocation base F1
- Table 17 is the allocation base F2
- the data in the usage duration dimension of all the records in the table ⁇ is summarized, and the sum of the data in the data dimension of all the records is 30, and the data in the data dimension of each record in Table 17 is in the sum of the data in the data dimensions of all the records.
- the occupied ratio is shown in Table 18.
- the allocation base F3 shown in Table 18 adds the scale of proportions to the allocation base F2 shown in Table 17.
- Table 18 is the allocation base F3
- the department dimension of the allocation object E1 is allocated according to the department dimension of the allocation base F3, and the root
- the amount of the RMB dimension and the amount of USD in the first allocation object E 1 are distributed according to the distribution ratio dimension in the allocation base F3, and the distribution result table as shown in Table 19 is obtained.
- the department dimension "IT implementation department” in the allocation object E1 is divided into three departments "A implementation department, B implementation department, and C implementation department", and the allocation ratio of each record in the allocation base F3 is divided.
- the middle data is multiplied by the data in the data dimension in the distribution object E 1 to obtain data in the data dimension corresponding to each department in the "A implementation unit, the B implementation unit, and the C implementation unit".
- Table 19 shows the distribution result table after the distribution object F1
- each record in the distribution object E1 is divided into three records.
- the data in the department dimension of the three records are the data in the department dimension of each record in the allocation base F3, and the three records are The data in the data dimension, which is the allocation ratio of each record in the allocation base F3
- the carrying dimensions in the allocation object E1 are: The accounting period, company, product, and region have not changed.
- the allocation base and the distribution object are related by Cartesian product, so that each record of the distribution object is divided into multiple records by the base of the distribution.
- the allocation object has n records
- the allocation base has m records
- the apportioned object includes n X m records.
- FIG. 4 is a schematic structural diagram of a data sharing device according to an embodiment of the present invention.
- the apparatus provided in this embodiment includes: a setting module 41, a calculating module 42 and an apportioning module 43.
- a setting module 41 configured to determine, according to a name of the distribution dimension input by the user, an allocation dimension of each record in the allocation base, and an allocation dimension of each record in the distribution object; the distribution dimension name includes a name and a numerical dimension of the target dimension The name.
- the name of the target dimension entered by the user can include the name of one dimension or the name of multiple dimensions.
- the name of the target dimension of the distribution object is the same as the name of the target dimension of the allocation base.
- the name of the numerical dimension of the distribution object may be the same as the name of the numerical dimension of the allocation base, or may be different from the name of the numerical dimension of the allocation base. According to the user input, one or more non-numeric dimensions that need to be apportioned are extracted from all non-numeric dimensions of the apportioned object as the target dimension, and one or more numerical dimensions that need to be apportioned are extracted from all numerical dimensions of the apportioned object.
- the non-numeric dimension of the apportioned base in the apportionment object is called the target dimension of the apportionment object
- the non-numeric dimension in the apportionment base that apportions the apportionment object is called the target dimension of the apportionment base.
- the departmental dimension of the allocation object and the debit amount are used as the target dimension according to the department dimension and the current balance dimension in the allocation base.
- the department dimension in the allocation object can be used as the target dimension
- the current quota dimension in the allocation object is taken as
- a calculation module 42 configured to obtain a distribution ratio dimension of each record in the allocation base, where data in a distribution ratio dimension of each record in the allocation base is all in the allocation base The sum of the values of the data in the recorded numerical dimension in each record in the allocation base.
- the calculating module is configured to respectively determine, as the allocation base, a ratio of data in a numerical dimension of each record in the allocation base to a sum of data in a numerical dimension of all records in the allocation base.
- the sum of the data in all recorded numerical dimensions in each of the allocation bases, and the sum of the data in the numerical dimensions of all records in the allocation base, respectively, in the allocation base The distribution ratio value in the record is used as the data in the distribution ratio dimension in each record in the distribution base.
- the ratio of the data in the numerical dimension of each record in the allocation base to the sum of the data in the numerical dimension of all the records in the allocation base may be determined as the data in the numerical dimension of all the records in the allocation base.
- the sum of the scales in each record in the allocation base, and the sum of the data in the numerical dimension of all the records in the allocation base, respectively, in the score of each of the records The data in the scaled proportion dimension in each record in the allocation base.
- the distribution module 43 is configured to allocate, for each record in the distribution object, each record in the distribution object into a plurality of records according to each record in the difficulty base, wherein the distribution object
- the data in the target dimension in each record is distributed into the data in the target dimension in each record in the allocation base, and the data in the numerical dimension in each record in the distribution object is allocated and described
- the target dimension and the numerical dimension of the allocation object and the allocation base are set according to the user input, and then the allocation proportion dimension of each record in the allocation base is obtained, and then, according to each record in the difficulty base
- Each record in the distribution object is distributed into a plurality of records, wherein data in the target dimension in each record in the distribution object is distributed into data in a target dimension in each record in the allocation base.
- the data in the numerical dimension in each record in the distribution object is allocated into data corresponding to the distribution ratio value in the distribution ratio dimension in each record in the allocation base, thereby realizing the target according to the allocation base
- the data in the dimension and numeric dimensions is used to apportion the data in the target dimension and the numeric dimension in the object.
- the target dimension name and the numerical dimension name respectively input by the user are respectively set.
- the allocation object and the allocation dimension of the allocation base can be used to form different allocation scenarios by transforming the distribution object and the allocation dimension of the allocation base. Therefore, the method provided in this embodiment is applicable to various allocation scenarios, and can be adopted regardless of how the allocation dimension is changed. This embodiment implements the allocation, and therefore.
- the allocation method provided in this embodiment improves the allocation flexibility, reduces the allocation complexity, reduces the code maintenance cost, and improves the allocation efficiency.
- the apparatus shown in FIG. 4 further includes: a first summary module 44.
- the first summary module 44 is configured to group all the records in the distribution object according to data in the target dimension in the distribution object before obtaining the distribution ratio dimension of each record in the distribution base.
- the apparatus shown in FIG. 4 further includes: a second summary module 45.
- the second summary module 45 is further configured to obtain a proportion of each record in the distribution base. Before the dimension, all the records in the allocation base are grouped and summarized according to the data in the target dimension in the allocation base.
- the distribution dimension name further includes a name of an associated dimension
- each of the allocation base and each of the distribution objects further includes an association dimension.
- the apparatus shown in FIG. 4 may further include an association module 46, a third summary module 47, and a fourth summary module 48.
- the allocation dimension also includes the associated dimension:
- the calculation module is specifically configured to group all the records in the allocation base according to the data in the associated dimension, and group all the records in the allocation base according to the data in the associated dimension and the data in the target dimension; The data in the data dimension in each record obtained by grouping all the records in the allocation base, and the data in each record obtained by grouping all the records in the allocation base according to the data in the associated dimension and the data in the target dimension.
- a ratio of the sum of the data in the dimension determined as a scale of the sum of the data in the numerical dimension of all the records in the allocation base in each of the allocation bases, and respectively records all the records in the allocation base
- the sum of the data in the numerical dimension is the value of the scale in each record in the allocation base as the data in the scale of proportions in each record in the allocation base.
- the association module 46 is configured to: after determining the allocation dimension of each record in the allocation base according to the name of the distribution dimension input by the user, remove the record that is not related to the allocation base in the allocation object, where A record that is not related to the allocation object is removed from the allocation base; the record in the allocation object that is not related to the allocation base is: the data in the associated dimension a record in which the data in the associated dimension is different in each record in the record base; the record in the share cardinus that is not related to the share object is: the data in the associated dimension and each record in the share object A record in which the data in the associated dimension is different; the assigned dimension name further includes a name of the associated dimension, and each of the allocation base and each of the distribution objects further includes an associated dimension.
- the distribution module 43 is configured to process each record in the distribution object according to a manner of processing the first record in the distribution object, and the manner of processing the first record in the distribution object includes:
- the respective records associated with the first record in the difficulty base are divided into the plurality of records, wherein the data in the target dimension in the first record is allocated into the allocation Data in a target dimension in each record associated with the first record in the cardinality, data in a numerical dimension in the first record, is distributed into each of the amortization bases associated with the first record Data corresponding to the distribution ratio value in the distribution ratio dimension in the record;
- the record associated with the first record in the allocation base is the data in the associated dimension and the data in the associated dimension in the first record
- the distribution dimension name further includes a name of the associated dimension
- the record base and each record in the share object further include an associated dimension .
- the third summary module 47 is configured to: in the data of the target dimension in the distribution object and the data in the associated dimension, obtain the distribution ratio dimension of each record in the distribution base, All records are grouped together.
- the fourth summary module 48 is configured to: in the data of the target dimension in the allocation base and the data in the associated dimension, before the distribution ratio dimension of each record in the allocation base, All records are grouped together.
- FIG. 7 is a schematic structural diagram of a data sharing device according to an embodiment of the present invention.
- the apparatus provided in this embodiment includes: a processor 72, a memory 71, a communication interface 74, and a bus 73; the processor 72, the memory 71, and the communication interface 74 are connected through the bus 73. ;
- the memory is used to store a program; the processor is configured to execute the program stored in the memory; and the program is configured to:
- the distribution dimension name includes a name of the target dimension and a name of the numerical dimension;
- Obtaining a distribution ratio dimension of each record in the allocation base the data in the distribution ratio dimension of each record in the allocation base is, the sum of the data in the numerical dimension of all records in the allocation base is in the allocation The scale of the scale in each record in the base;
- each record in the distribution object is distributed into a plurality of records according to each record in the difficulty base, wherein the target in each record in the distribution object
- the data in the dimension is distributed into the data in the target dimension in each record in the allocation base, and the data in the numerical dimension in each record in the distribution object is allocated to each record in the allocation base
- the program is further configured to:
- Determining, respectively, a ratio of data in a numerical dimension of each record in the allocation base to a sum of data in a numerical dimension of all records in the allocation base as data in a numerical dimension of all records in the allocation base Summing the value of the distribution in each record in the allocation base, and respectively taking the sum of the data in the numerical dimension of all the records in the allocation base in each of the allocation bases as the distribution ratio value The data in the scale of the dimension in each record in the allocation base.
- the program is further configured to:
- the record that is not related to the allocation base in the allocation object is a record in which the data in the associated dimension is different from the data in the associated dimension in each record in the allocation base;
- the records in the allocation base that are not related to the allocation object are records in which the data in the associated dimension is different from the data in the associated dimension in each record in the distribution object;
- the assigned dimension name also includes the associated dimension.
- a name, the allocation base, and each record in the distribution object further includes an association dimension;
- Obtaining the proportion of the proportion of each record in the allocation base includes: grouping all the records in the allocation base according to the data in the associated dimension, and grouping all the records in the allocation base according to the data in the associated dimension and the data in the target dimension; The data in the data dimension in each record obtained by grouping all the records in the allocation base according to the data in the associated dimension, and all the records in the allocation base according to the data in the associated dimension and the data in the target dimension. The ratio of the sum of the data in the data dimension in each record obtained after the grouping is determined, and the sum of the data in the numerical dimension of all records in the allocation base is determined in each record of the allocation base. And respectively using the sum of the data in the numerical dimension of all records in the allocation base in each of the allocation bases as the data in the distribution ratio dimension in each record in the allocation base .
- processing the first record in the distribution object according to the manner of processing the first record in the distribution object, and processing the first record in the distribution object includes: The first record is associated with each record, and the first record is divided into a plurality of records, wherein data in the target dimension in the first record is allocated into the allocation base and is related to the first record Data in the target dimension in each of the associated records, the data in the numerical dimension in the first record is distributed into the proportion of the proportion of the proportions in the records associated with the first record in the allocation base The data corresponding to the value respectively; the record associated with the first record in the allocation base is a record in which the data in the associated dimension is the same as the data in the associated dimension in the first record.
- the program is further configured to:
- All the records in the distribution object are grouped and summarized according to the data in the target dimension in the distribution object before the distribution ratio dimension of each record in the distribution base is obtained.
- the program is further configured to:
- All the records in the allocation base are grouped and summarized according to the data in the target dimension in the allocation base before the distribution ratio dimension of each record in the allocation base is obtained.
- the program is further configured to:
- All the records in the distribution object are grouped and summarized according to the data in the target dimension and the data in the associated dimension in the data of the target dimension in the allocation object before obtaining the distribution ratio dimension of each record in the allocation base;
- the target dimension and the numerical dimension of the allocation object and the allocation base are set according to the user input, and then the allocation proportion dimension of each record in the allocation base is obtained, and then, according to each record in the difficulty base
- Each record in the apportionment object is spread into multiple records,
- the data in the target dimension in each record in the allocation object is allocated into data in a target dimension in each record in the allocation base, and the numerical dimension in each record in the allocation object
- the data in the data is allocated to the data corresponding to the distribution ratio in the distribution ratio dimension in each record in the allocation base, thereby realizing the target dimension in the object in the target dimension and the numerical dimension in the allocation base.
- the purpose of apportioning the data in the numerical dimension is apportioning the data in the numerical dimension.
- the allocation dimension and the distribution dimension are respectively set according to the target dimension name and the numerical dimension name input by the user, and different allocation scenarios can be formed by transforming the distribution object and the allocation dimension of the allocation base. Therefore, this embodiment provides The method is adapted to various allocation scenarios, and the embodiment can be used to implement the allocation regardless of how the allocation dimension is changed.
- the allocation method provided in this embodiment improves the allocation flexibility, reduces the allocation complexity, reduces the code maintenance cost, and improves the allocation efficiency.
- the aforementioned program can be stored in a computer readable storage medium.
- the program when executed, performs the steps including the foregoing method embodiments; and the foregoing storage medium includes: a medium that can store program codes, such as ROM, RAM, disk or optical disk.
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Software Systems (AREA)
Abstract
A data apportioning method, apparatus and device. The method comprises: determining an apportioning dimensionality of each record in apportioning cardinal numbers and the apportioning dimensionality of each record in apportioning objects according to names of the apportioning dimensionality input by a user, the apportioning dimensionality comprising names of target dimensionality and numerical dimensionality; obtaining the apportioning proportion dimensionality of each record in the apportioning cardinal numbers, the data in the apportioning proportion dimensionality of each record in the apportioning cardinal numbers being an apportioning proportion value of the sum of data in the numerical dimensionality in all the records to each record in the apportioning cardinal numbers; and distributing each record in the apportioning objects into multiple records according to all the records in the apportioning cardinal numbers, the data in the target dimensionality in each record in the apportioning objects being distributed to data of the target dimensionality in each record in the apportioning cardinal numbers. The apportioning flexibility ratio is improved, the apportioning complexity is reduced, and the apportioning method code maintenance cost is reduced.
Description
数据分摊方法和装置及设备 技术领域 本发明涉及电子技术, 尤其涉及一种数据分摊方法和装置及设备。 背景技术 TECHNICAL FIELD The present invention relates to electronic technologies, and in particular, to a data sharing method, apparatus, and device. Background technique
由于业务需要, 需要将汇总的上级数据分摊给下级数据, 也就是由总 到细的过程。 例如, 将中国区域的销售任务 1亿元, 分摊给下级区域: 华 东地区、 华北地址、 华南地地区、 东北地区和西南地区。 Due to business needs, the aggregated superior data needs to be distributed to the subordinate data, that is, the process from the total to the fine. For example, the sales of China's regional 100 million yuan will be distributed to the lower-level regions: East China, North China, South China, Northeast and Southwest.
现有的数据分摊方案, 按照分摊场景划分, 在后台对应数据库的存储 过程 (SP ) 处理。 一个分摊场景对应一个存储过程。 每个存储过程都包括 取数、 维度定义、 计算比率和插入数据到目标表等相同的操作。 如果新增 一种分摊场景, 就需要新增一个存储过程, 按照基本相同的流程重新开发 代码。 因此, 现有的数据分摊方案, 实现复杂, 灵活度低, 维护成本高。 发明内容 The existing data sharing scheme is divided according to the allocation scenario and is processed in the background corresponding to the database storage process (SP). An allocation scenario corresponds to a stored procedure. Each stored procedure includes the same operations as fetching, dimension definition, calculating ratios, and inserting data into the target table. If you add a new allocation scenario, you need to add a new stored procedure to redevelop the code in the same basic process. Therefore, the existing data sharing scheme is complicated to implement, low in flexibility, and high in maintenance cost. Summary of the invention
本发明实施例提供一种数据分摊方法和装置及设备, 用于提高数据分 摊的效率, 减少维护成本。 Embodiments of the present invention provide a data sharing method, apparatus, and device, which are used to improve data sharing efficiency and reduce maintenance costs.
第一方面, 本发明实施例提供一种数据分摊方法, 包括: In a first aspect, an embodiment of the present invention provides a data sharing method, including:
根据用户输入的分摊维度的名称, 确定分摊基数中每条记录的分摊维 度, 以及分摊对象中每条记录的分摊维度; 所述分摊维度名称包括目标维 度的名称和数值维度的名称; Determining, according to the name of the allocation dimension input by the user, the distribution dimension of each record in the allocation base, and the allocation dimension of each record in the distribution object; the distribution dimension name includes the name of the target dimension and the name of the numerical dimension;
获得所述分摊基数中每条记录的分摊比例维度, 所述分摊基数中每条 记录的分摊比例维度中的数据为, 所述分摊基数中所有记录的数值维度中 的数据的总和在所述分摊基数中每条记录中的分摊比例值; Obtaining a distribution ratio dimension of each record in the allocation base, the data in the distribution ratio dimension of each record in the allocation base is, the sum of the data in the numerical dimension of all records in the allocation base is in the allocation The scale of the scale in each record in the base;
根据所述分难基数中各条记录将所述分摊对象中的每条记录分摊成 多条记录, 其中, 所述分摊对象中的每条记录中的目标维度中的数据, 被 分摊成所述分摊基数中各个记录中的目标维度中数据, 所述分摊对象中的 每条记录中的数值维度中数据, 被分摊成与所述分摊基数中各条记录中的 分摊比例维度中分摊比例值分别对应的数据。 Distributing, according to each record in the difficulty base, each record in the distribution object into a plurality of records, wherein data in a target dimension in each record in the distribution object is allocated into the Assorting the data in the target dimension in each record in the cardinality, the data in the numerical dimension in each record in the apportionment object is divided into the apportionment ratio values in the apportionment ratio dimension in each record in the apportionment base respectively Corresponding data.
结合第一方面, 在第一种可能的实现方式中, 获得所述分摊基数中每 条记录的分摊比例维度包括: In combination with the first aspect, in a first possible implementation manner, obtaining a scale of the proportion of each record in the allocation base includes:
分别将所述分摊基数中每条记录的数值维度中数据, 与所述分摊基数
中所有记录的数值维度中数据的总和的比值, 确定为所述分摊基数中所有 记录的数值维度中的数据的总和在所述分摊基数中每条记录中的分摊比 例值, 并分别将所述分摊基数中所有记录的数值维度中的数据的总和在所 述分摊基数中每条记录中的分摊比例值作为所述分摊基数中每条记录中 的分摊比例维度中的数据。 Data in a numerical dimension of each record in the allocation base, respectively, and the allocation base The ratio of the sum of the data in the numerical dimension of all records in the record, determined as the scale of the sum of the data in the numerical dimension of all records in the allocation base in each of the allocation bases, and respectively The sum of the data in the numerical dimension of all records in the allocation base is the distribution ratio value in each record in the allocation base as the data in the distribution ratio dimension in each record in the allocation base.
结合第一方面, 或结合第一方面的第一种可能实现方式, 在第二种可 能的实现方式中, In conjunction with the first aspect, or in combination with the first possible implementation of the first aspect, in a second possible implementation,
所述分摊维度的名称还包括关联维度的名称, 所述分摊基数和所述分 摊对象中的每条记录均还包括关联维度; The name of the distribution dimension further includes a name of the associated dimension, and each of the allocation base and each of the distribution objects further includes an associated dimension;
在所述根据用户输入的分摊维度的名称, 确定分摊基数中每条记录的 分摊维度, 以及分摊对象中每条记录的分摊维度之后, 还包括: After determining the allocation dimension of each record in the allocation base according to the name of the allocation dimension input by the user, and the allocation dimension of each record in the allocation object, the method further includes:
在所述分摊对象中去除与所述分摊基数不相关的记录, 在所述分摊基 数中去除与所述分摊对象不相关的记录; 所述分摊对象中与所述分摊基数 不相关的记录为, 其中的关联维度中数据与所述分摊基数中每个记录中关 联维度中数据都不相同的记录; 所述分摊基数中与所述分摊对象不相关的 记录为, 其中的关联维度中数据与所述分摊对象中每个记录中关联维度中 数据都不相同的记录; And deleting, in the allocation object, a record that is not related to the allocation base, and removing, from the allocation base, a record that is not related to the allocation object; and the record that is not related to the allocation base in the allocation object is: a record in which the data in the associated dimension is different from the data in the associated dimension in each record in the allocation base; the record in the allocation base that is not related to the allocation object is: the data and the location in the associated dimension a record in which the data in the associated dimension in each record in the allocation object is different;
获得所述分摊基数中每条记录的分摊比例维度包括: 按照关联维度中 数据对分摊基数中所有记录进行分组汇总, 按照关联维度中数据和目标维 度中数据对分摊基数中所有记录进行分组汇总; 将按照关联维度中数据对 分摊基数中所有记录进行分组汇总后得到的每条记录中的数据维度中数 据, 与按照关联维度中数据和目标维度中数据对分摊基数中所有记录进行 分组汇总后得到的每条记录中的数据维度中数据的总和的比值, 确定为所 述分摊基数中所有记录的数值维度中的数据的总和在所述分摊基数中每 条记录中的分摊比例值, 并分别将所述分摊基数中所有记录的数值维度中 的数据的总和在所述分摊基数中每条记录中的分摊比例值作为所述分摊 基数中每条记录中的分摊比例维度中的数据。 Obtaining the proportion of the proportion of each record in the allocation base includes: grouping all the records in the allocation base according to the data in the associated dimension, and grouping all the records in the allocation base according to the data in the associated dimension and the data in the target dimension; The data in the data dimension in each record obtained by grouping all the records in the allocation base according to the data in the associated dimension is grouped and summarized according to the data in the associated dimension and the data in the target dimension. The ratio of the sum of the data in the data dimension in each record is determined as the value of the sum of the data in the numerical dimension of all the records in the allocation base in each of the allocation bases, and respectively The sum of the data in the numerical dimension of all records in the allocation base is the distribution ratio value in each record in the allocation base as the data in the distribution ratio dimension in each record in the allocation base.
结合第一方面, 或结合第一方面的第一种可能实现方式和第二种可能 的实现方式, 在第三种可能的实现方式中, 根据所述分难基数中各条记录 将所述分摊对象中的每条记录分摊成多条记录, 包括:
将所述分摊对象中的每条记录按照处理所述分摊对象中的第一记录 的方式进行处理, 处理所述分摊对象中的第一记录的方式包括: 根据所述 分难基数中与所述第一记录相关联的各个记录, 将所述第一记录分摊成多 条记录, 其中, 所述第一记录中的目标维度中数据, 被分摊成所述分摊基 数中与所述第一记录相关联的各个记录中的目标维度中数据, 所述第一记 录中的数值维度中数据, 被分摊成所述分摊基数中与所述第一记录相关联 的各个记录中的分摊比例维度中分摊比例值分别对应的数据; 所述分摊基 数中与所述第一记录相关联的记录为, 其中的关联维度中数据与所述第一 记录中关联维度中的数据相同的记录。 With reference to the first aspect, or in combination with the first possible implementation of the first aspect and the second possible implementation manner, in a third possible implementation manner, the allocation is performed according to each record in the hard-working base Each record in the object is spread into multiple records, including: And processing the first record in the distribution object according to the manner of processing the first record in the distribution object, and processing the first record in the distribution object includes: The first record is associated with each record, and the first record is divided into a plurality of records, wherein data in the target dimension in the first record is allocated into the allocation base and is related to the first record Data in the target dimension in each of the associated records, the data in the numerical dimension in the first record is distributed into the proportion of the proportion of the proportions in the records associated with the first record in the allocation base The data corresponding to the value respectively; the record associated with the first record in the allocation base is a record in which the data in the associated dimension is the same as the data in the associated dimension in the first record.
第二方面, 本发明实施例提供一种数据分摊装置, 包括: In a second aspect, an embodiment of the present invention provides a data sharing device, including:
设置模块, 用于根据用户输入的分摊维度的名称, 确定分摊基数中每 条记录的分摊维度, 以及分摊对象中每条记录的分摊维度; 所述分摊维度 名称包括目标维度的名称和数值维度的名称; a setting module, configured to determine, according to a name of the allocation dimension input by the user, an allocation dimension of each record in the allocation base, and an allocation dimension of each record in the distribution object; the distribution dimension name includes a name of the target dimension and a numerical dimension Name
计算模块, 用于获得所述分摊基数中每条记录的分摊比例维度, 所述 分摊基数中每条记录的分摊比例维度中的数据为, 所述分摊基数中所有记 录的数值维度中的数据的总和在所述分摊基数中每条记录中的分摊比例 值; a calculation module, configured to obtain a distribution ratio dimension of each record in the allocation base, where data in a distribution ratio dimension of each record in the allocation base is data in a numerical dimension of all records in the allocation base The sum of the proportions in each record in the allocation base;
分摊模块, 用于根据所述分难基数中各条记录将所述分摊对象中的每 条记录分摊成多条记录, 其中, 所述分摊对象中的每条记录中的目标维度 中的数据, 被分摊成所述分摊基数中各个记录中的目标维度中数据, 所述 分摊对象中的每条记录中的数值维度中数据, 被分摊成与所述分摊基数中 各条记录中的分摊比例维度中分摊比例值分别对应的数据。 a distribution module, configured to allocate, according to each record in the difficulty base, each record in the distribution object into a plurality of records, where data in a target dimension in each record in the distribution object, The data in the target dimension in each record in the allocation base is distributed, and the data in the numerical dimension in each record in the distribution object is allocated to the distribution ratio dimension in each record in the allocation base The data corresponding to the scaled value are respectively.
结合第二方面, 在第一种可能的实现方式中, 所述计算模块, 具体用 于分别将所述分摊基数中每条记录的数值维度中数据, 与所述分摊基数中 所有记录的数值维度中数据的总和的比值, 确定为所述分摊基数中所有记 录的数值维度中的数据的总和在所述分摊基数中每条记录中的分摊比例 值, 并分别将所述分摊基数中所有记录的数值维度中的数据的总和在所述 分摊基数中每条记录中的分摊比例值作为所述分摊基数中每条记录中的 分摊比例维度中的数据。 With reference to the second aspect, in a first possible implementation manner, the calculating module is specifically configured to separately use data in a numerical dimension of each record in the allocation base and a numerical dimension of all records in the allocation base The ratio of the sum of the data in the data is determined as the scale of the sum of the data in the numerical dimension of all records in the allocation base in each of the allocation bases, and respectively records all the records in the allocation base The sum of the data in the numerical dimension in each of the allocation bases is used as the data in the distribution ratio dimension in each record in the allocation base.
结合第二方面, 或结合第二方面的第一种可能实现方式, 在第二种可
能的实现方式中, 所述装置还包括关联模块; In combination with the second aspect, or in combination with the first possible implementation of the second aspect, In an implementation manner, the device further includes an association module;
所述关联模块, 用于在根据用户输入的分摊维度的名称, 确定分摊基 数中每条记录的分摊维度之后, 在所述分摊对象中去除与所述分摊基数不 相关的记录, 在所述分摊基数中去除与所述分摊对象不相关的记录; 所述 分摊对象中与所述分摊基数不相关的记录为, 其中的关联维度中数据与所 述分摊基数中每个记录中关联维度中数据都不相同的记录; 所述分摊基数 中与所述分摊对象不相关的记录为, 其中的关联维度中数据与所述分摊对 象中每个记录中关联维度中数据都不相同的记录; 所述分摊维度名称还包 括关联维度的名称, 所述分摊基数和所述分摊对象中的每条记录均还包括 关联维度; The association module is configured to: after determining the allocation dimension of each record in the allocation base according to the name of the distribution dimension input by the user, remove the record that is not related to the allocation base in the distribution object, where the allocation is performed The record in the cardinality is unrelated to the allocation object; the record in the allocation object that is not related to the allocation base is: the data in the associated dimension and the data in the associated dimension in each record in the allocation base a record that is not the same as the record in the allocation base, wherein the data in the associated dimension is different from the data in the associated dimension in each record in the distribution object; The dimension name further includes a name of the associated dimension, and each of the allocation base and each of the distribution objects further includes an associated dimension;
所述计算模块, 具体用于按照关联维度中数据对分摊基数中所有记录 进行分组汇总, 按照关联维度中数据和目标维度中数据对分摊基数中所有 记录进行分组汇总; 将按照关联维度中数据对分摊基数中所有记录进行分 组汇总后得到的每条记录中的数据维度中数据, 与按照关联维度中数据和 目标维度中数据对分摊基数中所有记录进行分组汇总后得到的每条记录 中的数据维度中数据的总和的比值, 确定为所述分摊基数中所有记录的数 值维度中的数据的总和在所述分摊基数中每条记录中的分摊比例值, 并分 别将所述分摊基数中所有记录的数值维度中的数据的总和在所述分摊基 数中每条记录中的分摊比例值作为所述分摊基数中每条记录中的分摊比 例维度中的数据。 The calculation module is specifically configured to group all the records in the allocation base according to the data in the associated dimension, and group all the records in the allocation base according to the data in the associated dimension and the data in the target dimension; The data in the data dimension in each record obtained by grouping all the records in the allocation base, and the data in each record obtained by grouping all the records in the allocation base according to the data in the associated dimension and the data in the target dimension. a ratio of the sum of the data in the dimension, determined as a scale of the sum of the data in the numerical dimension of all the records in the allocation base in each of the allocation bases, and respectively records all the records in the allocation base The sum of the data in the numerical dimension is the value of the scale in each record in the allocation base as the data in the scale of proportions in each record in the allocation base.
结合第二方面, 或结合第二方面的第一种可能实现方式和第二种可能 的实现方式, 在第三种可能的实现方式中, With reference to the second aspect, or in combination with the first possible implementation of the second aspect and the second possible implementation manner, in a third possible implementation manner,
所述分摊模块, 具体用于将所述分摊对象中的每条记录按照处理所述 分摊对象中的第一记录的方式进行处理, 处理所述分摊对象中的第一记录 的方式包括: 根据所述分难基数中与所述第一记录相关联的各个记录, 将 所述第一记录分摊成多条记录,其中,所述第一记录中的目标维度中数据, 被分摊成所述分摊基数中与所述第一记录相关联的各个记录中的目标维 度中数据, 所述第一记录中的数值维度中数据, 被分摊成所述分摊基数中 与所述第一记录相关联的各个记录中的分摊比例维度中分摊比例值分别 对应的数据; 所述分摊基数中与所述第一记录相关联的记录为, 其中的关
联维度中数据与所述第一记录中关联维度中的数据相同的记录。 The distribution module is configured to process each record in the distribution object in a manner of processing the first record in the distribution object, and the manner of processing the first record in the distribution object includes: Decoding each record associated with the first record in a difficult base, and distributing the first record into a plurality of records, wherein data in a target dimension in the first record is allocated into the allocation base Data in a target dimension in each record associated with the first record, data in a numerical dimension in the first record, is distributed into respective records associated with the first record in the allocation base Data corresponding to the distribution ratio values in the distribution ratio dimension; the records associated with the first record in the allocation base are: The data in the joint dimension is the same as the data in the associated dimension in the first record.
第三方面, 本发明实施例提供一种数据分摊设备, 包括: 处理器、 存 储器、 通信接口和总线; 所述处理器、 所述存储器和所述通信接口通过所 述总线连接; In a third aspect, an embodiment of the present invention provides a data sharing device, including: a processor, a memory, a communication interface, and a bus; wherein the processor, the memory, and the communication interface are connected by using the bus;
所述存储器, 用于存储程序; 所述处理器, 用于执行所述存储器存储 的程序; 所述程序, 用于: The memory is used to store a program; the processor is configured to execute the program stored in the memory; and the program is configured to:
根据用户输入的分摊维度的名称, 确定分摊基数中每条记录的分摊维 度, 以及分摊对象中每条记录的分摊维度; 所述分摊维度名称包括目标维 度的名称和数值维度的名称; Determining, according to the name of the allocation dimension input by the user, the distribution dimension of each record in the allocation base, and the allocation dimension of each record in the distribution object; the distribution dimension name includes the name of the target dimension and the name of the numerical dimension;
获得所述分摊基数中每条记录的分摊比例维度, 所述分摊基数中每条 记录的分摊比例维度中的数据为, 所述分摊基数中所有记录的数值维度中 的数据的总和在所述分摊基数中每条记录中的分摊比例值; Obtaining a distribution ratio dimension of each record in the allocation base, the data in the distribution ratio dimension of each record in the allocation base is, the sum of the data in the numerical dimension of all records in the allocation base is in the allocation The scale of the scale in each record in the base;
根据所述分难基数中各条记录将所述分摊对象中的每条记录分摊成 多条记录, 其中, 所述分摊对象中的每条记录中的目标维度中的数据, 被 分摊成所述分摊基数中各个记录中的目标维度中数据, 所述分摊对象中的 每条记录中的数值维度中数据, 被分摊成与所述分摊基数中各条记录中的 分摊比例维度中分摊比例值分别对应的数据。 Distributing, according to each record in the difficulty base, each record in the distribution object into a plurality of records, wherein data in a target dimension in each record in the distribution object is allocated into the Assorting the data in the target dimension in each record in the cardinality, the data in the numerical dimension in each record in the apportionment object is divided into the apportionment ratio values in the apportionment ratio dimension in each record in the apportionment base respectively Corresponding data.
结合第三方面, 在第一种可能的实现方式中, 所述程序, 还用于: 分别将所述分摊基数中每条记录的数值维度中数据, 与所述分摊基数 中所有记录的数值维度中数据的总和的比值, 确定为所述分摊基数中所有 记录的数值维度中的数据的总和在所述分摊基数中每条记录中的分摊比 例值, 并分别将所述分摊基数中所有记录的数值维度中的数据的总和在所 述分摊基数中每条记录中的分摊比例值作为所述分摊基数中每条记录中 的分摊比例维度中的数据。 With reference to the third aspect, in a first possible implementation, the program is further configured to: respectively, data in a numerical dimension of each record in the allocation base, and a numerical dimension of all records in the allocation base The ratio of the sum of the data in the data is determined as the scale of the sum of the data in the numerical dimension of all records in the allocation base in each of the allocation bases, and respectively records all the records in the allocation base The sum of the data in the numerical dimension in each of the allocation bases is used as the data in the distribution ratio dimension in each record in the allocation base.
结合第三方面, 或结合第三方面的第一种可能实现方式, 在第二种可 能的实现方式中, 所述程序, 还用于: In conjunction with the third aspect, or in combination with the first possible implementation of the third aspect, in a second possible implementation, the program is further configured to:
在根据用户输入的分摊维度的名称, 确定分摊基数中每条记录的分摊 维度之后, 在所述分摊对象中去除与所述分摊基数不相关的记录, 在所述 分摊基数中去除与所述分摊对象不相关的记录; 所述分摊对象中与所述分
摊基数不相关的记录为, 其中的关联维度中数据与所述分摊基数中每个记 录中关联维度中数据都不相同的记录; 所述分摊基数中与所述分摊对象不 相关的记录为, 其中的关联维度中数据与所述分摊对象中每个记录中关联 维度中数据都不相同的记录; 所述分摊维度名称还包括关联维度的名称, 所述分摊基数和所述分摊对象中的每条记录均还包括关联维度; After determining the allocation dimension of each record in the allocation base according to the name of the distribution dimension input by the user, deleting the record that is not related to the allocation base in the allocation object, and removing the allocation in the allocation base a record that is not related to the object; The record in which the number of bases is not related is that the data in the associated dimension is different from the data in the associated dimension in each record in the allocation base; the record in the allocation base that is not related to the allocation object is a record in which the data in the associated dimension is different from the data in the associated dimension in each record in the record object; the share dimension name further includes a name of the associated dimension, and the share of the share and each of the share objects The records also include the associated dimensions;
所述计算模块, 具体用于按照关联维度中数据对分摊基数中所有记录 进行分组汇总, 按照关联维度中数据和目标维度中数据对分摊基数中所有 记录进行分组汇总; 将按照关联维度中数据对分摊基数中所有记录进行分 组汇总后得到的每条记录中的数据维度中数据, 与按照关联维度中数据和 目标维度中数据对分摊基数中所有记录进行分组汇总后得到的每条记录 中的数据维度中数据的总和的比值, 确定为所述分摊基数中所有记录的数 值维度中的数据的总和在所述分摊基数中每条记录中的分摊比例值, 并分 别将所述分摊基数中所有记录的数值维度中的数据的总和在所述分摊基 数中每条记录中的分摊比例值作为所述分摊基数中每条记录中的分摊比 例维度中的数据。 The calculation module is specifically configured to group all the records in the allocation base according to the data in the associated dimension, and group all the records in the allocation base according to the data in the associated dimension and the data in the target dimension; The data in the data dimension in each record obtained by grouping all the records in the allocation base, and the data in each record obtained by grouping all the records in the allocation base according to the data in the associated dimension and the data in the target dimension. a ratio of the sum of the data in the dimension, determined as a scale of the sum of the data in the numerical dimension of all the records in the allocation base in each of the allocation bases, and respectively records all the records in the allocation base The sum of the data in the numerical dimension is the value of the scale in each record in the allocation base as the data in the scale of proportions in each record in the allocation base.
结合第三方面, 或结合第三方面的第一种可能实现方式和第二种可能 的实现方式, 在第三种可能的实现方式中, With reference to the third aspect, or in combination with the first possible implementation of the third aspect and the second possible implementation manner, in a third possible implementation manner,
将所述分摊对象中的每条记录按照处理所述分摊对象中的第一记录 的方式进行处理, 处理所述分摊对象中的第一记录的方式包括: 根据所述 分难基数中与所述第一记录相关联的各个记录, 将所述第一记录分摊成多 条记录, 其中, 所述第一记录中的目标维度中数据, 被分摊成所述分摊基 数中与所述第一记录相关联的各个记录中的目标维度中数据, 所述第一记 录中的数值维度中数据, 被分摊成所述分摊基数中与所述第一记录相关联 的各个记录中的分摊比例维度中分摊比例值分别对应的数据; 所述分摊基 数中与所述第一记录相关联的记录为, 其中的关联维度中数据与所述第一 记录中关联维度中的数据相同的记录。 And processing the first record in the distribution object according to the manner of processing the first record in the distribution object, and processing the first record in the distribution object includes: The first record is associated with each record, and the first record is divided into a plurality of records, wherein data in the target dimension in the first record is allocated into the allocation base and is related to the first record Data in the target dimension in each of the associated records, the data in the numerical dimension in the first record is distributed into the proportion of the proportion of the proportions in the records associated with the first record in the allocation base The data corresponding to the value respectively; the record associated with the first record in the allocation base is a record in which the data in the associated dimension is the same as the data in the associated dimension in the first record.
本发明实施例先根据用户输入设置分摊对象和分摊基数的目标维度 和数值维度, 再获得所述分摊基数中每条记录的分摊比例维度, 然后, 根 据所述分难基数中各条记录将所述分摊对象中的每条记录分摊成多条记 录, 其中, 所述分摊对象中的每条记录中的目标维度中的数据, 被分摊成
所述分摊基数中各条记录中的目标维度中数据, 所述分摊对象中的每条记 录中的数值维度中数据, 被分摊成与所述分摊基数中各条记录中的分摊比 例维度中分摊比例值分别对应的数据, 从而实现了按照分摊基数中目标维 度和数值维度中的数据对分摊对象中目标维度和数值维度中的数据进行 分摊的目的。 本实施例中根据用户输入的目标维度名称和数值维度名称分 别设置分摊对象和分摊基数的分摊维度, 通过变换分摊对象和分摊基数的 分摊维度, 可以构成不同的分摊场景, 因此, 本实施例提供的方法适应于 各种分摊场景, 不论分摊维度如何变换均可采用本实施例来实现分摊, 因 此。 本实施例提供的分摊方法提高了分摊灵活度, 减小了分摊复杂度, 降 低了代码维护成本, 提高了分摊效率。 In the embodiment of the present invention, the target dimension and the numerical dimension of the allocation object and the allocation base are set according to the user input, and then the allocation proportion dimension of each record in the allocation base is obtained, and then, according to each record in the difficulty base Each record in the distribution object is divided into a plurality of records, wherein data in the target dimension in each record in the distribution object is divided into The data in the target dimension in each record in the allocation base, the data in the numerical dimension in each record in the allocation object is allocated and distributed among the distribution ratio dimensions in each record in the allocation base The data corresponding to the scale values respectively realizes the purpose of apportioning the data in the target dimension and the numerical dimension in the distribution object according to the data in the target dimension and the numerical dimension in the allocation base. In this embodiment, the allocation dimension and the distribution dimension are respectively set according to the target dimension name and the numerical dimension name input by the user, and different allocation scenarios can be formed by transforming the distribution object and the allocation dimension of the allocation base. Therefore, this embodiment provides The method is adapted to various allocation scenarios, and the embodiment can be used to implement the allocation regardless of how the allocation dimension is changed. The allocation method provided in this embodiment improves the allocation flexibility, reduces the allocation complexity, reduces the code maintenance cost, and improves the allocation efficiency.
附图说明 DRAWINGS
图 1为本发明实施例提供的一种数据分摊方法流程图; FIG. 1 is a flowchart of a data sharing method according to an embodiment of the present invention;
图 2为本发明实施例提供的另一种数据分摊方法流程图; 2 is a flowchart of another data sharing method according to an embodiment of the present invention;
图 3为本发明实施例提供的又一种数据分摊方法流程图; FIG. 3 is a flowchart of still another data sharing method according to an embodiment of the present invention;
图 4为本发明实施例提供的一种数据分摊装置结构示意图; 图 5为本发明实施例提供的另一种数据分摊装置结构示意图; 图 6为本发明实施例提供的又一种数据分摊装置结构示意图; 图 7为本发明实施例提供的一种数据分摊设备结构示意图。 4 is a schematic structural diagram of a data sharing device according to an embodiment of the present invention; FIG. 5 is a schematic structural diagram of another data sharing device according to an embodiment of the present invention; FIG. 6 is still another data sharing device according to an embodiment of the present invention; FIG. 7 is a schematic structural diagram of a data sharing device according to an embodiment of the present invention.
具体实施方式 detailed description
本发明实施例中分摊对象可以是由一条或多条记录组成的数据表, 同 样, 第一分摊基数也可以是由一条或多条记录组成的数据表。 其中, 数据 表中的一列对应一个维度。 分摊对象有多种维度, 同样分摊基数也有多种 维度。 例如, 分摊基数包括产品、 部门、 区域和当前发生额等维度, 分摊 对象包括产品、 部门、 区域和借方金额等维度。 分摊场景可以是根据分摊 基数中与分摊对象相同的产品的部门维度和当前发生额维度, 对分摊对象 的部门维度和借方金额进行分摊, 分摊是对分摊对象的部门维度和借方金 额进行细化的过程。 分摊场景也可以是根据分摊基数中部门维度和当前发 生额维度, 对分摊对象的部门维度和借方金额进行分摊, 分摊基数中部门 维度和当前发生额度对应的产品维度可以与分摊对象中部门维度和当前 发生额度对应的产品维度不相同。
在分摊对象中, 被分摊基数分摊的非数值维度称为分摊对象的目标维 度, 用于关联分摊基数的维度可以称为分摊对象的关联维度; 在分摊基数 中, 对分摊对象进行分摊的非数值维度称为分摊基数的目标维度, 用于关 联分摊对象的维度可以称为分摊基数的关联维度。 分摊对象中关联维度与 分摊基数中关联维度相同。 如果分摊场景不要求根据与分摊对象相关联的 分摊基数对分摊对象进行分摊, 只是要求根据分摊基数对分摊对象进行分 摊, 则不需要设置关联维度, 如果分摊维度要求根据与分摊对象相关联的 分摊基数对分摊对象进行分摊, 则需要设置关联维度。 In the embodiment of the present invention, the allocation object may be a data table composed of one or more records. Similarly, the first allocation base may also be a data table composed of one or more records. Among them, one column in the data table corresponds to one dimension. There are multiple dimensions for the allocation object, and the same allocation base also has multiple dimensions. For example, the allocation base includes dimensions such as product, department, region, and current balance, and the distribution objects include dimensions such as product, department, region, and debit amount. The allocation scenario may be based on the department dimension and the current balance dimension of the product with the same object in the allocation base, and the department dimension and the debit amount of the distribution object are apportioned, and the allocation is to refine the department dimension and the debit amount of the distribution object. process. The allocation scenario may also be based on the department dimension and the current balance dimension in the allocation base, and the department dimension and the debit amount of the distribution object are apportioned, and the department dimension corresponding to the current occurrence quota in the allocation base can be compared with the department dimension in the allocation object. The product dimensions corresponding to the current quota are different. In the allocation object, the non-numeric dimension of the assessed base is called the target dimension of the apportionment object, and the dimension used to associate the apportionment base can be called the associated dimension of the apportionment object; in the apportionment base, the non-numeric value of the apportionment object is apportioned. The dimension is called the target dimension of the allocation base. The dimension used to associate the allocation object can be called the associated dimension of the allocation base. The associated dimension in the allocation object is the same as the associated dimension in the allocation base. If the allocation scenario does not require the allocation of the distribution object according to the allocation base associated with the distribution object, but only the allocation of the distribution object according to the allocation base, it is not necessary to set the association dimension, if the assessment dimension requires the allocation according to the allocation object. If the cardinality is used to allocate the object, you need to set the associated dimension.
本发明实施例提供的方法的执行主体可以为任何具有 CPU的设备。 例 如, 个人计算机等。 The execution body of the method provided by the embodiment of the present invention may be any device having a CPU. For example, a personal computer, etc.
图 1为本发明实施例提供的一种数据分摊方法流程图。 如图 1所示, 本实施例提供的方法包括: FIG. 1 is a flowchart of a data sharing method according to an embodiment of the present invention. As shown in FIG. 1, the method provided in this embodiment includes:
歩骤 11 : 根据用户输入的分摊维度的名称, 确定分摊基数中每条记录 的分摊维度, 以及分摊对象中每条记录的分摊维度; 所述分摊维度名称包 括目标维度的名称和数值维度的名称。 Step 11: Determine, according to a name of the distribution dimension input by the user, an allocation dimension of each record in the allocation base, and an allocation dimension of each record in the distribution object; the distribution dimension name includes a name of the target dimension and a name of the numerical dimension .
用户输入的目标维度的名称可以包括一个维度的名称, 也可以包括多 个维度的名称。 分摊对象的目标维度的名称和分摊基数的目标维度的名称 相同, 分摊对象的数值维度的名称可以与分摊基数的数值维度的名称相 同, 也可以与分摊基数的数值维度的名称不相同。 根据用户输入从分摊对 象的所有非数值维度中提取出一个或多个需要被分摊的非数值维度作为 目标维度, 从分摊对象的所有数值维度中提取出一个或多个需要被分摊的 数值维度。 根据用户输入从分摊基数的所有非数值维度中提取出一个或多 个非数值维度作为目标维度, 用于对分摊对象中目标维度进行分摊, 并从 摊基数的所有数值维度中提取出一个数值维度, 用于对分摊对象中的数值 维度进行分摊。 The name of the target dimension entered by the user can include the name of one dimension or the name of multiple dimensions. The name of the target dimension of the distribution object is the same as the name of the target dimension of the allocation base. The name of the numerical dimension of the distribution object may be the same as the name of the numerical dimension of the allocation base, or may be different from the name of the numerical dimension of the allocation base. According to the user input, one or more non-numeric dimensions that need to be apportioned are extracted from all non-numeric dimensions of the apportioned object as the target dimension, and one or more numerical dimensions that need to be apportioned are extracted from all numerical dimensions of the apportioned object. Extracting one or more non-numeric dimensions from the non-numeric dimension of the allocation base as the target dimension according to the user input, for apportioning the target dimension in the distribution object, and extracting a numerical dimension from all numerical dimensions of the base number , used to apportion the numeric dimension in the allocation object.
在分摊场景中, 将分摊对象中被分摊基数分摊的非数值维度称为分摊 对象的目标维度, 将分摊基数中对分摊对象进行分摊的非数值维度称为分 摊基数的目标维度。 以根据分摊基数中部门维度和当前发生额维度, 对分 摊对象的部门维度和借方金额进行分摊的分摊场景为例, 可以将分摊对象 中部门维度作为目标维度, 将分摊对象中当前发生额度维度作为数值维
度,可以将分摊基数中产品维度作为关联维度,将部门维度作为目标维度, 将借方金额维度作为数值维度。 In the allocation scenario, the non-numeric dimension of the apportioned object in the apportionment object is called the target dimension of the apportionment object, and the non-numeric dimension of the apportionment object in the apportionment base is called the target dimension of the apportionment base. For example, the departmental dimension of the allocation object and the debit amount are used as the target dimension according to the department dimension and the current balance dimension in the allocation base. The department dimension in the allocation object can be used as the target dimension, and the current quota dimension in the allocation object is taken as Numerical dimension Degree, you can use the product dimension in the allocation base as the associated dimension, the department dimension as the target dimension, and the debit amount dimension as the numerical dimension.
可选地, 分摊对象的分摊维度还可以包括携带维度, 携带维度中数据 用于展示目标维度和数值维度相关的信息。 分摊对象中携带维度中的数据 在分摊前后不发生变化, 为分摊对象设置携带维度后, 在分摊对象的分摊 结果表中展示携带维度 Optionally, the allocation dimension of the distribution object may further include a carrying dimension, and the data in the carrying dimension is used to display information related to the target dimension and the numerical dimension. The data in the dimension of the object to be distributed does not change before and after the allocation. After the carrying dimension is set for the object to be distributed, the carrying dimension is displayed in the allocation result table of the object to be distributed.
可选地, 为减少分摊过程中的数据运算量, 在设置分摊维度后, 也就 是歩骤 12之前, 可以根据所述分摊对象中目标维度中的数据, 对所述分 摊对象中所有记录进行分组汇总, 歩骤 12之前还可以根据所述分摊基数 中目标维度中的数据, 对所述分摊基数中所有记录进行分组汇总。 Optionally, in order to reduce the amount of data calculation in the allocation process, after setting the allocation dimension, that is, before step 12, all the records in the allocation object may be grouped according to the data in the target dimension in the allocation object. In summary, before step 12, all the records in the allocation base can be grouped and summarized according to the data in the target dimension in the allocation base.
歩骤 12 : 获得所述分摊基数中每条记录的分摊比例维度, 所述分摊基 数中每条记录的分摊比例维度中的数据为, 分摊基数中所有记录的数值维 度中的数据的总和在所述分摊基数中每条记录中的分摊比例值。 Step 12: Obtain a distribution ratio dimension of each record in the allocation base, and the data in the distribution ratio dimension of each record in the allocation base is the sum of the data in the numerical dimension of all records in the allocation base The value of the scale in each record in the allocation base.
由于确定分摊比例时只能参照一个标准, 因此, 分摊基数中数值维度 只能有一个。 可以分别将所述分摊基数中每条记录的数值维度中数据, 与 所述分摊基数中所有记录的数值维度中数据的总和的比值, 确定为所述分 摊基数中所有记录的数值维度中的数据的总和在所述分摊基数中每条记 录中的分摊比例值, 并分别将所述分摊基数中所有记录的数值维度中的数 据的总和在所述分摊基数中每条记录中的分摊比例值作为所述分摊基数 中每条记录中的分摊比例维度中的数据。 Since only one standard can be referenced when determining the scale, there can only be one numerical dimension in the allocation base. The ratio of the data in the numerical dimension of each record in the allocation base to the sum of the data in the numerical dimension of all the records in the allocation base may be determined as the data in the numerical dimension of all the records in the allocation base. The sum of the scales in each record in the allocation base, and the sum of the data in the numerical dimension of all the records in the allocation base, respectively, in the score of each of the records The data in the scaled proportion dimension in each record in the allocation base.
歩骤 13 :根据所述分难基数中各条记录将所述分摊对象中的每条记录 分摊成多条记录, 其中, 所述分摊对象中的每条记录中的目标维度中的数 据, 被分摊成所述分摊基数中各条记录中的目标维度中数据, 所述分摊对 象中的每条记录中的数值维度中数据, 被分摊成与所述分摊基数中各条记 录中的分摊比例维度中分摊比例值分别对应的数据。 Step 13: Each record in the distribution object is distributed into a plurality of records according to each record in the difficulty base, wherein data in a target dimension in each record in the distribution object is The data in the target dimension in each record in the allocation base is distributed, and the data in the numerical dimension in each record in the allocation object is allocated to the distribution ratio dimension in each record in the allocation base The data corresponding to the scaled value are respectively.
分摊对象中一条记录被分摊基数中每条记录分摊成了多条记录, 这些 记录的目标维度中数据分别为分摊基数的目标维度中数据。 这些记录的数 值维度分别为分摊对象中原数值维度中数据与分摊基数中各条记录中的 分摊比例维度中分摊比例值分别对应的数据的乘积。 Each record in the allocation object is divided into multiple records in the allocation base. The data in the target dimension of these records is the data in the target dimension of the allocation base. The numerical dimension of these records is the product of the data in the original value dimension in the distribution object and the data corresponding to the distribution ratio value in the distribution ratio dimension in each record in the allocation base.
本发明实施例根据用户输入分别设置分摊对象和分摊基数的每条记
录的分摊维度, 用户可以通过变换分摊对象和分摊基数的分摊维度, 可以 构成不同的分摊场景。 在根据分摊场景进行一次分摊后, 还可以根据不同 的分摊场景为分摊对象和分摊基数设置不同的分摊维度, 从而可以通过同 一分摊基数对同一分摊对象进行多次分摊, 得到不同的分摊结果。 In the embodiment of the present invention, each record of the allocation object and the allocation base is set according to the user input. The assigned allocation dimension, the user can form different allocation scenarios by transforming the distribution object and the allocation dimension of the allocation base. After the allocation is performed based on the distribution scenario, you can set different allocation dimensions for the distribution object and the allocation base based on the different allocation scenarios. You can use the same allocation basis to distribute the same distribution object multiple times to obtain different allocation results.
可选地, 在根据分摊场景分别设置分摊对象的分摊维度和分摊基数的 分摊维度之后, 设置分摊对象的携带维度, 按照分摊基数对分摊对象进行 分摊后, 携带维度中数据保持不变。 Optionally, after the allocation dimension of the allocation object and the allocation dimension of the allocation base are respectively set according to the distribution scenario, the carrying dimension of the allocation object is set, and after the allocation object is allocated according to the allocation base, the data in the carrying dimension remains unchanged.
本实施例提供的数据分摊方法, 先根据用户输入设置分摊对象和分摊 基数的目标维度和数值维度, 再获得所述分摊基数中每条记录的分摊比例 维度, 然后, 根据所述分难基数中各条记录将所述分摊对象中的每条记录 分摊成多条记录, 其中, 所述分摊对象中的每条记录中的目标维度中的数 据, 被分摊成所述分摊基数中各条记录中的目标维度中数据, 所述分摊对 象中的每条记录中的数值维度中数据, 被分摊成与所述分摊基数中各条记 录中的分摊比例维度中分摊比例值分别对应的数据, 从而实现了按照分摊 基数中目标维度和数值维度中的数据对分摊对象中目标维度和数值维度 中的数据进行分摊的目的。 本实施例中根据用户输入的目标维度名称和数 值维度名称分别设置分摊对象和分摊基数的分摊维度, 通过变换分摊对象 和分摊基数的分摊维度, 可以构成不同的分摊场景, 因此, 本实施例提供 的方法适应于各种分摊场景, 不论分摊维度如何变换均可采用本实施例来 实现分摊, 因此。 本实施例提供的分摊方法提高了分摊灵活度, 减小了分 摊复杂度, 降低了代码维护成本, 提高了分摊效率。 In the data sharing method provided in this embodiment, the target dimension and the numerical dimension of the allocation object and the allocation base are set according to the user input, and then the allocation proportion dimension of each record in the allocation base is obtained, and then, according to the difficulty base Each record distributes each record in the distribution object into a plurality of records, wherein data in a target dimension in each record in the distribution object is allocated into each record in the allocation base Data in the target dimension, the data in the numerical dimension in each record in the distribution object is allocated into data corresponding to the distribution ratio value in the distribution ratio dimension in each record in the allocation base, thereby realizing The purpose of apportioning the data in the target dimension and the numerical dimension in the allocation object according to the data in the target dimension and the numerical dimension in the allocation base. In this embodiment, the allocation dimension and the distribution dimension are respectively set according to the target dimension name and the numerical dimension name input by the user, and different allocation scenarios can be formed by transforming the distribution object and the allocation dimension of the allocation base. Therefore, this embodiment provides The method is adapted to various allocation scenarios, and the embodiment can be used to implement the allocation regardless of how the allocation dimension is changed. The allocation method provided in this embodiment improves the allocation flexibility, reduces the sharing complexity, reduces the code maintenance cost, and improves the allocation efficiency.
图 2为本发明实施例提供的另一种数据分摊方法流程图。 本实施例中 分摊对象和分摊基数的分摊维度还包括关联维度。 如图 2所示, 本实施例 提供的方法包括: FIG. 2 is a flowchart of another data sharing method according to an embodiment of the present invention. In this embodiment, the allocation dimension of the distribution object and the allocation base also includes an association dimension. As shown in FIG. 2, the method provided in this embodiment includes:
歩骤 21 : 根据用户输入的分摊维度的名称, 确定分摊基数中每条记录 的分摊维度, 以及分摊对象中每条记录的分摊维度; 所述分摊维度名称包 括目标维度的名称、 数值维度的名称和关联维度的名称。 Step 21: Determine, according to a name of the distribution dimension input by the user, an allocation dimension of each record in the allocation base, and an allocation dimension of each record in the allocation object; the allocation dimension name includes a name of the target dimension, and a name of the numerical dimension And the name of the associated dimension.
由于确定分摊比例时只能参照一个标准, 因此, 分摊基数中数值维度 只能有一个。 进行分摊之前, 根据从分摊对象的所有维度中提取出一个或 多个与分摊基数中相同的维度作为关联维度, 并提取出一个或多个需要被
分摊的非数值维度作为目标维度, 提取出一个或多个需要被分摊的数值维 度。 从分摊基数的所有维度中提取出一个或多个维度与分摊对象相同的维 度作为关联维度、 并将分摊对象的目标维度作为分摊基数的目标维度, 提 取出作为分摊依据的数值维度。 分摊场景可以是按照通过关联维度与分摊 对象关联后的分摊基数的目标维度和数值维度, 对分摊对象的目标维度和 数值维度进行分摊。 Since only one standard can be referenced when determining the scale of assessment, there can only be one numerical dimension in the allocation base. Before the allocation, extract one or more dimensions from the distribution object from the same dimension as the associated dimension, and extract one or more needs to be The assigned non-numeric dimension is used as the target dimension to extract one or more numeric dimensions that need to be apportioned. Extracting one or more dimensions with the same dimension as the associated dimension from all the dimensions of the allocation base, and using the target dimension of the distribution object as the target dimension of the allocation base, extracting the numerical dimension as the basis for the allocation. The allocation scenario may be to allocate the target dimension and the numerical dimension of the distribution object according to the target dimension and the numerical dimension of the allocation base after the association dimension is associated with the distribution object.
可选地, 为减少分摊过程中的数据运算量, 在设置分摊维度后, 在获 得所述分摊基数中每条记录的分摊比例维度之前, 可以根据所述分摊对象 中目标维度中的数据和关联维度中的数据, 对所述分摊对象中所有记录进 行分组汇总。 在获得所述分摊基数中每条记录的分摊比例维度之前, 还可 以根据所述分摊基数中目标维度中的数据和关联维度中的数据, 对所述分 摊基数中所有记录进行分组汇总。 Optionally, in order to reduce the amount of data calculation in the allocation process, after setting the allocation dimension, before obtaining the distribution ratio dimension of each record in the allocation base, according to the data and association in the target dimension in the allocation object The data in the dimension, grouping all the records in the distribution object. Before obtaining the distribution ratio dimension of each record in the allocation base, all the records in the allocation base may be grouped and summarized according to the data in the target dimension and the data in the associated dimension in the allocation base.
举例来说, 分摊对象包括以下维度: 部门维度、 借方金额维度、 贷方 金额维度、 产品维度、 会计期维度和地区维度; 如表 2A所示, 分摊基数 Y1包括以下维度: 部门维度产品维度、会计期维度和地区维度和当前发生 额维度。 分摊场景是对于某件产品, 根据分摊基数中部门维度和当前发生 额维度分别对分摊对象中部门维度、借方金额维度和贷方金额维度进行分 摊。 同时在分摊结果中展示会计期维度和地区维度。 由于分摊基数 Y1是 对分摊对象进行分摊的依据,其中各维度不需要在分摊结果中展现,因此, 在分摊基数中不需要设置携带维度。 另外, 分摊基数的数值维度是对分摊 对象中数值维度进行分摊的依据, 在只允许有一个分摊依据的情况下, 在 分摊基数中只设置一个数值维度。 因此, 如表 2B所示, 可以提取出表 2A 中分摊基数 Y1中的部门维度, 产品维度和当前发生额维度生成分摊基数 Y2 , 分摊基数 Y2包括目标维度: 部门、 关联维度: 产品, 和数值维度: 当前发生额。 For example, the distribution object includes the following dimensions: department dimension, debit amount dimension, credit amount dimension, product dimension, accounting period dimension, and region dimension; as shown in Table 2A, the allocation base Y1 includes the following dimensions: department dimension product dimension, accounting Period and area dimensions and current balance dimensions. The allocation scenario is to allocate the department dimension, the debit amount dimension, and the credit amount dimension in the allocation object according to the department dimension and the current generation dimension in the allocation base for a certain product. At the same time, the accounting period dimension and the regional dimension are displayed in the assessment result. Since the allocation base Y1 is the basis for apportioning the distribution objects, each dimension does not need to be presented in the distribution result. Therefore, it is not necessary to set the carrying dimension in the allocation base. In addition, the numerical dimension of the allocation base is the basis for apportioning the numerical dimension in the allocation object. In the case where only one allocation basis is allowed, only one numerical dimension is set in the allocation base. Therefore, as shown in Table 2B, the department dimension in the allocation base Y1 in Table 2A can be extracted, the product dimension and the current balance dimension generate the allocation base Y2, and the allocation base Y2 includes the target dimension: department, associated dimension: product, and numerical value Dimensions: Current balance.
如表 1所示。 在分摊对象 XI中, 将部门维度设置为目标维度, 将产 品维度设置为关联维度, 将借方金额和贷方金额设置为数值维度, 将会计 期维度和地区维度设置为携带维度。 需要说明的是: 如果不需要在分摊结 果中展示除产品、 部门、 借方金额之外的维度, 可以在分摊对象 XI中不 设置携带维度, 分摊对象中不包括携度维度。 在分摊基数中, 将部门维度
设置为目标维度, 将产品维度设置为关联维度, 将当前发生额设置为数值 维度。 As shown in Table 1. In the allocation object XI, set the department dimension to the target dimension, the product dimension to the associated dimension, the debit amount and the credit amount to the numeric dimension, and the accounting period dimension and the region dimension to the carrying dimension. It should be noted that if the dimension other than the product, department, and debit amount is not displayed in the distribution result, the carrying dimension may not be set in the allocation object XI, and the sharing dimension is not included in the allocation object. In the allocation base, the department dimension Set as the target dimension, set the product dimension to the associated dimension, and set the current balance to the numeric dimension.
表 2A为分摊基数 Y1 Table 2A is the allocation base Y1
表 2B为分摊基数 Y2 Table 2B is the allocation base Y2
歩骤 22 : 在分摊对象中去除与分摊基数不相关的记录, 在分摊基数中 去除与分摊对象不相关的记录; 分摊对象中与分摊基数不相关的记录为, 分摊对象中的关联维度中数据与分摊基数中每个记录中关联维度中数据 都不相同的记录; 分摊基数中与分摊对象不相关的记录为, 分摊基数中的 关联维度中数据与分摊对象中每个记录中关联维度中数据都不相同的记 录。 Step 22: Remove the records that are not related to the allocation base in the allocation object, and remove the records that are not related to the allocation object in the allocation base; the records in the allocation object that are not related to the allocation base are the data in the associated dimension in the allocation object A record that is different from the data in the associated dimension in each record in the allocation base; the record in the allocation base that is not related to the allocation object is the data in the associated dimension in the data in the associated dimension in the allocation base and the data in the associated dimension in each record in the allocation object Different records.
以表 1和表 2B为例, 通过产品维度将分摊对象 XI和分摊基数 Y 1进 行关联后,在表 1去除了关于打印机 B的记录得到表 3所示的分摊对象 X2 , 因为在表 2B中没有关于打印机 B的记录。 在表 2B中去除了关于打印机 C 的记录如表 4所示的分摊基数 Y3, 因为表 1中没有关于打印机 C的记录。 Taking Table 1 and Table 2B as an example, after the allocation object XI and the allocation base Y 1 are associated by the product dimension, the record about the printer B is removed in Table 1 to obtain the distribution object X2 shown in Table 3, because in Table 2B There are no records about printer B. The record for printer C is removed in Table 2B as shown in Table 4 as the allocation base Y3, since there is no record for printer C in Table 1.
表 3为分摊对象 Χ2 Table 3 is the object of distribution Χ2
表 4为分摊基数 Y3
歩骤 23 : 按照关联维度中数据对分摊基数中所有记录进行分组汇总, 按照关联维度中数据和目标维度中数据对分摊基数中所有记录进行分组 汇总。 Table 4 shows the allocation base Y3 Step 23: Group all the records in the allocation base according to the data in the associated dimension, and group all the records in the allocation base according to the data in the associated dimension and the data in the target dimension.
歩骤 24:将按照关联维度中数据对分摊基数中所有记录进行分组汇总 后得到的每条记录中的数据维度中数据, 与按照关联维度中数据和目标维 度中数据对分摊基数中所有记录进行分组汇总后得到的每条记录中的数 据维度中数据的总和的比值, 确定为所述分摊基数中所有记录的数值维度 中的数据的总和在所述分摊基数中每条记录中的分摊比例值, 并分别将所 述分摊基数中所有记录的数值维度中的数据的总和在所述分摊基数中每 条记录中的分摊比例值作为所述分摊基数中每条记录中的分摊比例维度 中的数据。 Step 24: The data in the data dimension in each record obtained by grouping all the records in the allocation base according to the data in the associated dimension, and all the records in the allocation base according to the data in the associated dimension and the data in the target dimension. The ratio of the sum of the data in the data dimension in each record obtained after the grouping is determined, and the sum of the data in the numerical dimension of all records in the allocation base is determined in each record of the allocation base. And respectively using the sum of the data in the numerical dimension of all records in the allocation base in each of the allocation bases as the data in the distribution ratio dimension in each record in the allocation base .
在具有关联维度的情况下, 在本实施例中, 歩骤 12获得所述分摊基 数中每条记录的分摊比例维度具体为歩骤 23和歩骤 24。 In the case of having an associated dimension, in this embodiment, the step of obtaining the scale of the proportion of each record in the allocation base is specifically step 23 and step 24.
在表 4所示的分摊基数 Y3中增加分摊比例维度生成如表 5所示的分 摊基数 Y4。 参见表 5和表 4, 按照产品维度和部门维度对表 4的当前发生 额维度进行分组汇总后得到表 5中汇总 1维度, 按照部门维度对表 4的当 前发生额维度进行分组汇总后得到表 5中汇总 2维度。将表 5中各记录的 汇总 1中数据除以表 5中各记录的汇总 2中数据, 得到表 5中分摊比例维 度中数据。 Increasing the scale of proportions in the allocation base Y3 shown in Table 4 generates the basis of the allocation Y4 as shown in Table 5. Referring to Table 5 and Table 4, the current balance dimension of Table 4 is grouped and summarized according to the product dimension and the department dimension, and the summary 1 dimension in Table 5 is obtained, and the current balance dimension of Table 4 is grouped and summarized according to the department dimension to obtain a table. 5 is summarized in 2 dimensions. The data in summary 1 of each record in Table 5 is divided by the data in summary 2 of each record in Table 5 to obtain the data in the scale of the proportions in Table 5.
表 5为分摊基数 Υ4 Table 5 is the allocation base Υ4
打印机 A C实施部 30 30 100 30/100 打印机 A B实施部 68 68 100 68/100 歩骤 25 :将分摊对象中的每条记录按照处理分摊对象中的第一记录的 方式进行处理, 处理分摊对象中的第一记录的方式包括: 根据分难基数中 与第一记录相关联的各个记录, 将第一记录分摊成多条记录。 Printer AC Implementation Unit 30 30 100 30/100 Printer AB Implementation Unit 68 68 100 68/100 Step 25: Process each record in the distribution object in the same manner as the first record in the processing object, and process the distribution object. The manner of the first record includes: distributing the first record into a plurality of records according to each record associated with the first record in the hard base.
其中, 第一记录为分摊对象与分摊基数进行关联后, 分摊对象中的任 意一条记录。 第一记录中的目标维度中数据, 被分摊成分摊基数中与第一 记录相关联的各个记录中的目标维度中数据, 第一记录中的数值维度中数 据, 被分摊成分摊基数中与第一记录相关联的各个记录中的分摊比例维度 中分摊比例值分别对应的数据; 分摊基数中与第一记录相关联的记录为, 其中的关联维度中数据与第一记录中关联维度中的数据相同的记录。 The first record is any one of the objects in the distribution object after the allocation object is associated with the allocation base. The data in the target dimension in the first record, the data in the target dimension in each record associated with the first record in the aggregated base, the data in the numerical dimension in the first record, and the number of shares in the base Recording data corresponding to the proportions of the proportions in the proportions of the associated records; the records associated with the first record in the allocation base are: the data in the associated dimension and the data in the associated dimension in the first record The same record.
参见表 3、 5和 6, 对于表 3所示的分摊对象 X2中每条记录, 通过表 5中每条记录的部门维度中数据, 对其中的部分维度中数据进行分摊, 通 过表 5中分摊比例维度中数据, 对其中的借方金额维度中数据进行分摊, 得到如表 6所示的分摊结果。 如表 6所示, 表 3中部门 IT实施部被分摊 成了三个实施部: CRM实施总、 B实施部和 A实施部, 并且给出了每个实 施部的借方金额和贷方金额。 See Tables 3, 5, and 6. For each record in the distribution object X2 shown in Table 3, the data in some of the dimensions in the department dimension of each record in Table 5 is distributed, and the data is distributed in Table 5. The data in the proportional dimension is apportioned to the data in the debit amount dimension to obtain the distribution result as shown in Table 6. As shown in Table 6, the department IT implementation department in Table 3 is divided into three implementation departments: CRM implementation total, B implementation department and A implementation department, and the debit amount and credit amount of each implementation department are given.
表 6为分摊对象 X2的分摊结果 Table 6 shows the distribution result of the object X2.
本实施例提供的数据分摊方法, 在分摊对象和分摊基数中分别增加了 用于相互关联的关联维度。 根据关联后的分摊基数中分摊比例维度的数据 对关联后的分摊对象中数值维度的数据进行分摊, 根据关联后的分摊基数 中目标维度的数据对关联后的分摊对象中目标维度的数据进行分摊, 从而 实现了按照分摊基数中目标维度和数值维度中的数据对分摊对象中目标 维度和数值维度中的数据进行分摊的目的。 本实施例中根据用户输入的目 标维度名称和数值维度名称以及关联维度的名称分别设置分摊对象和分
摊基数的分摊维度, 通过变换分摊对象和分摊基数的分摊维度, 可以构成 不同的分摊场景, 因此, 本实施例提供的方法适应于各种分摊场景, 不论 分摊维度如何变换均可采用本实施例来实现分摊, 因此。 本实施例提供的 分摊方法提高了分摊灵活度, 减小了分摊复杂度, 降低了代码维护成本, 提高了分摊效率。 In the data distribution method provided in this embodiment, the associated dimensions for association are added in the allocation object and the allocation base respectively. The data of the numerical dimension in the associated allocation object is allocated according to the data of the proportioned dimension in the associated allocation base, and the data of the target dimension in the associated allocation object is allocated according to the data of the target dimension in the associated allocation base. Therefore, the purpose of apportioning the data in the target dimension and the numerical dimension in the allocation object according to the data in the target dimension and the numerical dimension in the allocation base is realized. In this embodiment, the allocation object and the sub-division are respectively set according to the target dimension name and the numerical dimension name and the name of the associated dimension input by the user. The allocation dimension of the base number can be used to transform the allocation object and the allocation dimension of the allocation base. The method provided in this embodiment can be applied to various allocation scenarios, and the embodiment can be adopted regardless of how the allocation dimension is changed. To achieve the allocation, therefore. The allocation method provided in this embodiment improves the allocation flexibility, reduces the allocation complexity, reduces the code maintenance cost, and improves the allocation efficiency.
在表 1和表 2中设置了一个关联维度和一个目标维度。 下面给出的实 施例中分摊对象和分摊基数分别有两个关联维度和两个目标维度。 以下场 景中, 分摊对象包括以下维度: 会计期维度、 公司维度、 产品维度、 部门 维度、 用户维度、 区域维度、 金额 RMB维度和金额 USD维度。 如表 8A所 示, 分摊基数包括以下维度: 公司维度、 产品维度、 部门维度、 用户维度 和使用时长维度。 分摊场景是根据分摊基数中部门维度和用户维度, 对分 摊对象中部门维度和用户维度进行分摊, 同时根据分摊基数中使用时长维 度对分摊对象中金额 RMB维度和金额 USD维度。 An associated dimension and a target dimension are set in Tables 1 and 2. In the embodiment given below, the allocation object and the allocation base have two associated dimensions and two target dimensions, respectively. In the following scenarios, the apportionment objects include the following dimensions: Accounting Period Dimensions, Company Dimensions, Product Dimensions, Department Dimensions, User Dimensions, Regional Dimensions, Amounts RMB Dimensions, and Amounts USD Dimensions. As shown in Table 8A, the allocation base includes the following dimensions: company dimension, product dimension, department dimension, user dimension, and duration dimension. The allocation scenario is based on the department dimension and the user dimension in the allocation base, and the department dimension and the user dimension in the distribution object are allocated, and the amount RMB dimension and the amount USD dimension in the object are allocated according to the usage length dimension in the allocation base.
首先, 根据用户输入的分摊维度名称, 在如表 7所示的分摊对象 C1 中, 将产品维度和公司维度设置为关联维度, 将部门维度和用户维度设置 为目标维度, 将金额 RMB维度和金额 USD维度设置为数值维度, 将区域维 度设置为携带维度。可选地,可以将会计期维度和区域维度作为携带维度, 以在表 12所示的分摊结果中展现会计期维度和区域维度。在如表 8A所示 的分摊基数中, 将产品维度和公司维度设置为关联维度, 将部门维度和用 户维度设置为目标维度, 将使用时长维度设置为数值维度。 如表 8B所示。 提取出分摊基数 D 1中的产品维度、 公司维度、 部门维度、 用户维度和使 用时长维度生成分摊基数 D2 First, according to the assigned dimension name input by the user, in the allocation object C1 shown in Table 7, the product dimension and the company dimension are set as the associated dimension, the department dimension and the user dimension are set as the target dimension, and the amount RMB dimension and amount are set. The USD dimension is set to a numeric dimension and the area dimension is set to carry a dimension. Alternatively, the accounting period dimension and the area dimension may be used as carrying dimensions to display the accounting period dimension and the area dimension in the distribution results shown in Table 12. In the allocation base shown in Table 8A, set the product and company dimensions as the associated dimensions, the department and user dimensions as the target dimensions, and the usage time dimension as the numeric dimension. As shown in Table 8B. Extract the base of the allocation, the product dimension, the company dimension, the department dimension, the user dimension, and the usage time dimension in D 1 to generate the allocation base D2
表 7为分摊对象 C1 Table 7 is the allocation object C1
表 8A为分摊基数 D1
201201 海思公司 打印机 A A实施部 张三 美国 8Table 8A is the allocation base D1 201201 HiSilicon Printer AA Implementation Department Zhang San US 8
201201 海思公司 打印机 A A实施部 李四 美国 12 201201 Hisilicon Corporation Printer A A Implementation Department Li Si United States 12
201201 海思公司 复印机 A实施部 李四 中国 10 201201 Haisi Company Copier A Implementation Department Li Si China 10
201201 海思公司 复印机 B实施部 张六 中国 5 201201 Haisi Company Copier B Implementation Department Zhang Six China 5
201201 慧通公司 复印机 B实施部 王五 中国 5 201201 Huitong Company Copier B Implementation Department Wang Wu China 5
201201 慧通公司 复印机 C实施部 周六 中国 15 201201 Huitong Company Copier C Implementation Department Saturday China 15
201201 慧通公司 打印机 A C实施部 赵七 中国 4 201201 Huitong Company Printer A C Implementation Department Zhao Qi China 4
201201 慧通公司 打印机 A B实施部 钱八 中国 6 201201 Huitong Company Printer A B Implementation Department Qian Ba China 6
201201 慧通公司 打印机 A B实施部 赵九 中国 8 201201 Huitong Company Printer A B Implementation Department Zhao Jiu China 8
表 8B为分摊基数 D2 Table 8B is the allocation base D2
接下来, 将分摊对象 C 1与分摊基数 D2按照关联维度进行关联后, 得 到如表 9所示的分摊对象 C2和如表 10所示的分摊基数 D3。如表 10表示, 在表 8中去除了公司为慧通公司且产品为复印机的所有记录, 因为在表 7 中没有公司为慧通公司且产品为复印机的记录。 Next, after the allocation object C 1 and the allocation base D2 are associated with the associated dimension, the allocation object C2 shown in Table 9 and the allocation base D3 shown in Table 10 are obtained. As shown in Table 10, all the records in which the company is Huitong and the product is a copy machine are removed in Table 8, because there is no record in Table 7 that the company is Huitong and the product is a copy machine.
表 9为分摊对象 C2 Table 9 is the allocation object C2
会计期 公司 广口口 部门 用户 区域 金额 RMB 金额 USDAccounting Period Company Guangkoukou Department User Area Amount RMB Amount USD
201201 海思公司 打印机 A IT实施部 公共 美国 100 15. 4201201 Hisilicon Corporation Printer A IT Implementation Department Public United States 100 15. 4
201201 海思公司 复印机 IT实施部 中国 200 15. 4201201 Haisi Company Copier IT Implementation Department China 200 15. 4
201201 慧通公司 打印机 A IT实施部 /\it 中国 150 25
表 10为分摊基数 D3201201 Huitong Printer A IT Implementation Department /\it China 150 25 Table 10 is the allocation base D3
然后, 根据如表 10所示的分摊基数 D3生成如表 1 1所示的分摊基数 D4 , 具体地, 根据分摊基数 D3中公司维度、 产品维度、 部门维度、 用户 维度、 对第三分摊基数 D3的使用时长维度进行分组汇总得到表 11中所示 的汇总 1维度, 根据分摊基数 D3中产品维度和公司维度对分摊基数 D3的 使用时长维度进行分组汇总得到表 1 1中所示的汇总 2维度, 将汇总 1维 度除以汇总 2维度生成如表 11所示的分摊比例维度。 Then, according to the allocation base D3 as shown in Table 10, the allocation base D4 shown in Table 11 is generated. Specifically, according to the allocation base D3, the company dimension, the product dimension, the department dimension, the user dimension, and the third allocation base D3. The time-division dimension is used for grouping and summarizing to obtain the summary 1 dimension shown in Table 11, and the product dimension and the company dimension of the allocation base D3 are grouped and summarized according to the usage duration dimension of the allocation base D3 to obtain the summary 2 dimension shown in Table 11. Divide the summary 1 dimension by the summary 2 dimension to generate the scaled dimension as shown in Table 11.
表 11为分摊基数 D4 Table 11 is the allocation base D4
慧通公 打印机 A B实施部 赵九 8 8 18 8/18 司 Huitonggong Printer A B Implementation Department Zhao Jiu 8 8 18 8/18 Division
最后, 根据如表 11所示的分摊基数 D4的部门维度和用户维度对分摊 对象 C2的部门维度和用户维度进行分摊, 根据分摊基数 D4的分摊比例维 度对分摊对象 C2的金额 RMB维度和金额 USD维度进行分摊, 生成如表 12 所示的分摊结果。 如表 12所示, 海思公司的打印机 A分别被 BIS部门的 张三和 BIS部门的李四使用, 且根据使用时长计算的金额體 B分别为 100 ( 8/12 ) 和 100 ( 12/20 ) 。 Finally, according to the department dimension and the user dimension of the allocation base D4 as shown in Table 11, the department dimension and the user dimension of the distribution object C2 are allocated, and the amount of the object C2 and the amount of USD are allocated according to the distribution ratio dimension of the allocation base D4. The dimensions are allocated and the results of the allocation shown in Table 12 are generated. As shown in Table 12, the printer A of HiSilicon is used by Zhang San of the BIS department and Li Si of the BIS department, and the volume B calculated according to the duration of use is 100 ( 8/12 ) and 100 ( 12/20 respectively). ).
表 12为分摊对象 C2的分摊结果 Table 12 shows the results of the allocation of the object C2.
图 3为本发明实施例提供的再一种分摊方法流程图。 本实施例与图 2 对应实施例区别在于, 本实施例先根据分摊基数确定分摊比例维度, 再将 增加有分摊比例维度的分摊基数与分摊对象进行关联得到相关联的分摊 基数和分摊对象。 如图 3和如图 3所示, 本实施例提供的方法包括:
歩骤 31 : 根据用户输入的分摊维度的名称, 确定分摊基数中每条记录 的分摊维度, 以及分摊对象中每条记录的分摊维度; 所述分摊维度名称包 括目标维度的名称、 数值维度的名称和关联维度的名称。 FIG. 3 is a flowchart of still another method for allocating according to an embodiment of the present invention. The difference between the embodiment and the corresponding embodiment of FIG. 2 is that the embodiment first determines the distribution ratio dimension according to the allocation base, and then associates the allocation base with the distribution ratio dimension with the distribution object to obtain the associated allocation base and the distribution object. As shown in FIG. 3 and FIG. 3, the method provided in this embodiment includes: Step 31: Determine, according to a name of the distribution dimension input by the user, an allocation dimension of each record in the allocation base, and an allocation dimension of each record in the distribution object; the distribution dimension name includes a name of the target dimension, and a name of the numerical dimension And the name of the associated dimension.
歩骤 32 : 按照关联维度中数据对分摊基数中所有记录进行分组汇总, 按照关联维度中数据和目标维度中数据对分摊基数中所有记录进行分组 汇总。 Step 32: Group all the records in the allocation base according to the data in the associated dimension, and group all the records in the allocation base according to the data in the associated dimension and the data in the target dimension.
歩骤 33 :将按照关联维度中数据对分摊基数中所有记录进行分组汇总 后得到的每条记录中的数据维度中数据, 与按照关联维度中数据和目标维 度中数据对分摊基数中所有记录进行分组汇总后得到的每条记录中的数 据维度中数据的总和的比值, 并分别将所述分摊基数中所有记录的数值维 度中的数据的总和在所述分摊基数中每条记录中的分摊比例值作为所述 分摊基数中每条记录中的分摊比例维度中的数据。 Step 33: The data in the data dimension in each record obtained by grouping all the records in the allocation base according to the data in the associated dimension, and all the records in the allocation base according to the data in the associated dimension and the data in the target dimension. The ratio of the sum of the data in the data dimension in each record obtained after the grouping is summarized, and respectively the sum of the data in the numerical dimension of all records in the allocation base in each record of the allocation base The value is used as the data in the scale of the scale in each record in the allocation base.
在具有关联维度的情况下, 在本实施例中, 歩骤 12获得所述分摊基 数中每条记录的分摊比例维度具体为歩骤 32和歩骤 33。 In the case of having an associated dimension, in this embodiment, the step of obtaining the scale of the proportion of each record in the allocation base is specifically step 32 and step 33.
可选地, 为减少分摊过程中的数据运算量, 在设置分摊维度后, 在获 得所述分摊基数中每条记录的分摊比例维度之前, 可以根据所述分摊对象 中目标维度中的数据和关联维度中的数据, 对所述分摊对象中所有记录进 行分组汇总。 在获得所述分摊基数中每条记录的分摊比例维度之前, 还可 以根据所述分摊基数中目标维度中的数据和关联维度中的数据, 对所述分 摊基数中所有记录进行分组汇总。 Optionally, in order to reduce the amount of data calculation in the allocation process, after setting the allocation dimension, before obtaining the distribution ratio dimension of each record in the allocation base, according to the data and association in the target dimension in the allocation object The data in the dimension, grouping all the records in the distribution object. Before obtaining the distribution ratio dimension of each record in the allocation base, all the records in the allocation base may be grouped and summarized according to the data in the target dimension and the data in the associated dimension in the allocation base.
以表 2B所示的分摊基数 Y1为例, 在表 2B所示的分摊基数 Y2中增加 分摊比例维度生成如表 13所示的分摊基数 Y5。 具体地, 按照产品维度和 部门维度对表 2Β的当前发生额维度进行分组汇总后得到表 13中汇总 1维 度, 按照部门维度对表 2Β的当前发生额维度进行分组汇总后得到表 13中 汇总 2维度, 将表 13中各记录的汇总 1中数据除以表 13中各记录的汇总 2中数据, 得到表 13中分摊比例维度中数据。 Taking the allocation base Y1 shown in Table 2B as an example, the allocation ratio dimension is increased in the allocation base Y2 shown in Table 2B to generate the allocation base Y5 as shown in Table 13. Specifically, the current balance dimension of Table 2Β is grouped and summarized according to the product dimension and the department dimension, and the summary 1 dimension in Table 13 is obtained, and the current balance dimension of Table 2Β is grouped and summarized according to the department dimension, and the summary in Table 13 is obtained. Dimensions, the data in summary 1 of each record in Table 13 is divided by the data in summary 2 of each record in Table 13, and the data in the scale of proportions in Table 13 is obtained.
表 13分摊基数 Υ5 Table 13 Allocation base Υ5
打印机 A C实施部 30 30 100 30/100 打印机 A B实施部 68 68 100 68/100 Printer AC Implementation Department 30 30 100 30/100 Printer AB Implementation Department 68 68 100 68/100
打印机 c B实施部 10 10 10 10/10 Printer c B Implementation 10 10 10 10/10
以表 8B所示分摊基数 D2为例, 在表 8B所示的分摊基数 D1中增加分 摊比例维度得到如表 14所示的分摊基数 D5。 具体地, 根据分摊基数 D2 中公司维度、 产品维度、 部门维度、 用户维度、 对分摊基数 D2的使用时 长维度进行分组汇总得到表 14中所示的汇总 1维度, 根据分摊基数 D2中 产品维度和公司维度对分摊基数 D2的使用时长维度进行分组汇总得到表 14中所示的汇总 2维度, 将汇总 1维度除以汇总 2维度生成如表 14所示 的分摊比例维度。 Taking the allocation base D2 shown in Table 8B as an example, the allocation ratio dimension is increased in the allocation base D1 shown in Table 8B to obtain the allocation base D5 as shown in Table 14. Specifically, according to the company dimension, the product dimension, the department dimension, the user dimension, and the usage duration dimension of the allocation base D2 in the allocation base D2, the summary 1 dimension shown in Table 14 is obtained, according to the product dimension and the product dimension in the allocation base D2 The company dimension groupes the usage time dimension of the allocation base D2 into a summary 2 dimension shown in Table 14, and divides the summary 1 dimension by the summary 2 dimension to generate the distribution ratio dimension as shown in Table 14.
表 14为分摊基数 D5 Table 14 is the allocation base D5
歩骤 34: 在分摊对象中去除与分摊基数不相关的记录, 在分摊基数中 去除与分摊对象不相关的记录; 分摊对象中与分摊基数不相关的记录为, 分摊对象中的关联维度中数据与分摊基数中每个记录中关联维度中数据 都不相同的记录; 分摊基数中与分摊对象不相关的记录为, 分摊基数中的 关联维度中数据与分摊对象中每个记录中关联维度中数据都不相同的记 录。 Step 34: Remove the record that is not related to the allocation base in the allocation object, and remove the record that is not related to the allocation object in the allocation base; the record in the allocation object that is not related to the allocation base is the data in the associated dimension in the allocation object A record that is different from the data in the associated dimension in each record in the allocation base; the record in the allocation base that is not related to the allocation object is the data in the associated dimension in the data in the associated dimension in the allocation base and the data in the associated dimension in each record in the allocation object Different records.
以表 13和表 1为例,根据部门维度将表 13所示的分摊基数 Y5与表 1 所示的分摊对象 XI进行关联, 在表 1去除了关于打印机 B的记录同样得 到如表 3所示的分摊对象 X2, 在表 13中去除了关于打印机 C的记录, 同 样得到如表 5所示的分摊基数 Y4。 Taking Table 13 and Table 1 as an example, the allocation base Y5 shown in Table 13 is associated with the distribution object XI shown in Table 1 according to the department dimension, and the record about the printer B is removed in Table 1. The distribution object X2, the record on the printer C is removed in Table 13, and the allocation base Y4 as shown in Table 5 is also obtained.
以表 14和表 7为例, 根据产品维度和公司维度将表 14所示的第四分 摊基数 D4与如表 7所示的第一分摊对象 C 1进行关联, 得到如表 9所示的 第二分摊对象 C2和如表 1 1所示的分摊基数 D4。 在表 11中去除了表 14 中公司为慧通公司且产品为复印机的所有记录, 因为在表 7中没有公司为 慧通公司且产品为复印机的记录。 Taking Table 14 and Table 7 as an example, the fourth allocation base D4 shown in Table 14 is associated with the first allocation object C 1 shown in Table 7 according to the product dimension and the company dimension, and the first table shown in Table 9 is obtained. The two objects C2 and the allocation base D4 as shown in Table 11. In Table 11, all the records in Table 14 in which the company is Huitong and the products are copiers are removed, because there is no record in Table 7 that the company is Huitong and the products are copiers.
歩骤 35 :将分摊对象中的每条记录按照处理分摊对象中的第一记录的 方式进行处理, 处理分摊对象中的第一记录的方式包括: 根据分难基数中 与第一记录相关联的各个记录, 将第一记录分摊成多条记录。 Step 35: processing each record in the distribution object according to the first record in the processing object, and processing the first record in the object to be distributed includes: associating with the first record according to the difficulty base For each record, the first record is divided into multiple records.
歩骤 35与歩骤 25相同。 Step 35 is the same as step 25.
图 2和图 3对应的实施例中, 分摊维度包括目标维度、 数据维度和关 联维度。以下以表 15所示的分摊对象 E 1和表 16所示的分摊基数 F1为例, 说明对象和分摊基数中均没有设置关联维度时, 如何根据分摊基数对分摊 对象进行分摊。 In the embodiment corresponding to Figures 2 and 3, the allocation dimension includes a target dimension, a data dimension, and an associated dimension. The following is an example of the allocation base F1 shown in Table 15 and the allocation base F1 shown in Table 16. If the association dimension is not set in the object and the allocation base, how to allocate the distribution object according to the allocation base.
分摊场景可以是根据分摊基数中部门维度和使用时长维度, 对分摊对 象中部门维度和金额 RMB维度以及金额 USD维度进行分摊。 因此, 用户输 入的分摊对象 E1中的目标维度的名称为部门, 分摊对象 E 1中的数值维度 的名称为金额 RMB和金额 USD , 其余维度设置为携带维度, 分摊基数 F1 的目标维度的名称为部门, 分摊基数 F1的数值维度的名称为使用时长。 The allocation scenario may be based on the department dimension and the usage duration dimension in the allocation base, and the department dimension and the amount RMB dimension and the amount USD dimension in the distribution object are allocated. Therefore, the name of the target dimension in the distribution object E1 input by the user is the department, the name of the numerical dimension in the distribution object E 1 is the amount RMB and the amount USD, and the remaining dimensions are set to carry the dimension, and the name of the target dimension of the allocation base F1 is Department, the name of the numerical dimension of the allocation base F1 is the length of use.
表 15为分摊对象 E1
会计期 公司 广口口 部门 区域 金额 RMB 金额 USDTable 15 is the allocation object E1 Accounting period company Guangkoukou department area amount RMB amount USD
201201 海思公司 公共产品 IT实施部 中国 100 15. 4 201201 Haisi Company Public Products IT Implementation Department China 100 15. 4
201201 慧通公司 公共产品 IT实施部 中国 200 15. 4 201201 Huitong Company Public Products IT Implementation Department China 200 15. 4
201201 天天公司 公共产品 IT实施部 中国 150 25 201201 Tiantian Company Public Products IT Implementation Department China 150 25
在如表 16所示的分摊基数 F1中, 部门维度为目标维度, 将当前发生 额为数据维度。提取出分摊基数 F1的目标维度和数值维度得到如表 17所 In the allocation base F1 shown in Table 16, the department dimension is the target dimension, and the current amount is the data dimension. The target dimension and numerical dimension of the extracted base number F1 are obtained as shown in Table 17.
/」、的分摊基数 F2。 /", the base of the distribution F2.
表 16为分摊基数 F1 Table 16 is the allocation base F1
表 17为分摊基数 F2 Table 17 is the allocation base F2
对表 π中所有记录的使用时长维度中数据进行汇总, 得到所有记录 的数据维度中数据的总和为 30, 表 17中每条记录的数据维度中数据在所 有记录的数据维度中数据的总和中占用的分摊比例如表 18所示。表 18所 示的分摊基数 F3在表 17所示的分摊基数 F2中增加了分摊比例维度。 The data in the usage duration dimension of all the records in the table π is summarized, and the sum of the data in the data dimension of all the records is 30, and the data in the data dimension of each record in Table 17 is in the sum of the data in the data dimensions of all the records. The occupied ratio is shown in Table 18. The allocation base F3 shown in Table 18 adds the scale of proportions to the allocation base F2 shown in Table 17.
表 18为分摊基数 F3 Table 18 is the allocation base F3
根据分摊基数 F3中部门维度对分摊对象 E1中部门维度进行分摊, 根
据分摊基数 F3中分摊比例维度对第一分摊对象 E 1中金额 RMB维度和金额 USD维度进行分摊, 得到如表 19所示的分摊结果表。 如表 19所示, 分摊 对象 E1中部门维度 " IT实施部"被分摊成了三个部门 " A实施部、 B实施 部和 C实施部" , 将分摊基数 F3中每条记录的分摊比例维度中数据与分 摊对象 E 1中数据维度中数据分别相乘获得 " A实施部、 B实施部和 C实施 部" 中每个部门对应的数据维度中数据。 The department dimension of the allocation object E1 is allocated according to the department dimension of the allocation base F3, and the root The amount of the RMB dimension and the amount of USD in the first allocation object E 1 are distributed according to the distribution ratio dimension in the allocation base F3, and the distribution result table as shown in Table 19 is obtained. As shown in Table 19, the department dimension "IT implementation department" in the allocation object E1 is divided into three departments "A implementation department, B implementation department, and C implementation department", and the allocation ratio of each record in the allocation base F3 is divided. The middle data is multiplied by the data in the data dimension in the distribution object E 1 to obtain data in the data dimension corresponding to each department in the "A implementation unit, the B implementation unit, and the C implementation unit".
表 19为分摊基数 F2对分摊对象 E1后的分摊结果表 Table 19 shows the distribution result table after the distribution object F1
如表 19所示, 分摊对象 E1中每条记录均被分摊成 3条记录, 这 3条 记录中部门维度中数据分别为分摊基数 F3中每条记录的部门维度中数据, 这 3条记录的数据维度中数据, 分别为分摊基数 F3中每条记录的分摊比
例维度中数据与分摊对象 El中数据维度中数据的乘积。 分摊后, 分摊对 象 E1中的携带维度为: 会计期、 公司、 产品和区域没有发生变化。 As shown in Table 19, each record in the distribution object E1 is divided into three records. The data in the department dimension of the three records are the data in the department dimension of each record in the allocation base F3, and the three records are The data in the data dimension, which is the allocation ratio of each record in the allocation base F3 The product of the data in the case dimension and the data in the data dimension in the allocation object El. After the allocation, the carrying dimensions in the allocation object E1 are: The accounting period, company, product, and region have not changed.
在没有关联维度的情况下, 分摊基数和分摊对象通过笛卡尔乘积进行 关联, 使分摊对象的每一条记录被分摊基数分摊成多条记录。 例如, 分摊 对象有 n条记录,分摊基数有 m条记录,分摊后分摊对象中包括 n X m条记 录。 In the absence of an associated dimension, the allocation base and the distribution object are related by Cartesian product, so that each record of the distribution object is divided into multiple records by the base of the distribution. For example, the allocation object has n records, the allocation base has m records, and the apportioned object includes n X m records.
图 4为本发明实施例提供的一种数据分摊装置结构示意图。 如图 4所 示, 本实施列提供的装置包括: 设置模块 41、计算模块 42和分摊模块 43。 FIG. 4 is a schematic structural diagram of a data sharing device according to an embodiment of the present invention. As shown in FIG. 4, the apparatus provided in this embodiment includes: a setting module 41, a calculating module 42 and an apportioning module 43.
设置模块 41, 用于根据用户输入的分摊维度的名称, 确定分摊基数中 每条记录的分摊维度, 以及分摊对象中每条记录的分摊维度; 所述分摊维 度名称包括目标维度的名称和数值维度的名称。 a setting module 41, configured to determine, according to a name of the distribution dimension input by the user, an allocation dimension of each record in the allocation base, and an allocation dimension of each record in the distribution object; the distribution dimension name includes a name and a numerical dimension of the target dimension The name.
用户输入的目标维度的名称可以包括一个维度的名称, 也可以包括多 个维度的名称。 分摊对象的目标维度的名称和分摊基数的目标维度的名称 相同, 分摊对象的数值维度的名称可以与分摊基数的数值维度的名称相 同, 也可以与分摊基数的数值维度的名称不相同。 根据用户输入从分摊对 象的所有非数值维度中提取出一个或多个需要被分摊的非数值维度作为 目标维度, 从分摊对象的所有数值维度中提取出一个或多个需要被分摊的 数值维度。 根据用户输入从分摊基数的所有非数值维度中提取出一个或多 个非数值维度作为目标维度, 用于对分摊对象中目标维度进行分摊, 并从 摊基数的所有数值维度中提取出一个数值维度, 用于对分摊对象中的数值 维度进行分摊。 The name of the target dimension entered by the user can include the name of one dimension or the name of multiple dimensions. The name of the target dimension of the distribution object is the same as the name of the target dimension of the allocation base. The name of the numerical dimension of the distribution object may be the same as the name of the numerical dimension of the allocation base, or may be different from the name of the numerical dimension of the allocation base. According to the user input, one or more non-numeric dimensions that need to be apportioned are extracted from all non-numeric dimensions of the apportioned object as the target dimension, and one or more numerical dimensions that need to be apportioned are extracted from all numerical dimensions of the apportioned object. Extracting one or more non-numeric dimensions from the non-numeric dimension of the allocation base as the target dimension according to the user input, for apportioning the target dimension in the distribution object, and extracting a numerical dimension from all numerical dimensions of the base number , used to apportion the numeric dimension in the allocation object.
在分摊场景中, 将分摊对象中被分摊基数分摊的非数值维度称为分摊 对象的目标维度, 将分摊基数中对分摊对象进行分摊的非数值维度称为分 摊基数的目标维度。 以根据分摊基数中部门维度和当前发生额维度, 对分 摊对象的部门维度和借方金额进行分摊的分摊场景为例, 可以将分摊对象 中部门维度作为目标维度, 将分摊对象中当前发生额度维度作为数值维 度,可以将分摊基数中产品维度作为关联维度,将部门维度作为目标维度, 将借方金额维度作为数值维度。 In the allocation scenario, the non-numeric dimension of the apportioned base in the apportionment object is called the target dimension of the apportionment object, and the non-numeric dimension in the apportionment base that apportions the apportionment object is called the target dimension of the apportionment base. For example, the departmental dimension of the allocation object and the debit amount are used as the target dimension according to the department dimension and the current balance dimension in the allocation base. The department dimension in the allocation object can be used as the target dimension, and the current quota dimension in the allocation object is taken as For the numeric dimension, you can use the product dimension in the allocation base as the associated dimension, the department dimension as the target dimension, and the debit amount dimension as the numeric dimension.
计算模块 42, 用于获得所述分摊基数中每条记录的分摊比例维度, 所 述分摊基数中每条记录的分摊比例维度中的数据为, 所述分摊基数中所有
记录的数值维度中的数据的总和在所述分摊基数中每条记录中的分摊比 例值。 a calculation module 42, configured to obtain a distribution ratio dimension of each record in the allocation base, where data in a distribution ratio dimension of each record in the allocation base is all in the allocation base The sum of the values of the data in the recorded numerical dimension in each record in the allocation base.
进一歩, 计算模块, 具体用于分别将所述分摊基数中每条记录的数值 维度中数据, 与所述分摊基数中所有记录的数值维度中数据的总和的比 值, 确定为所述分摊基数中所有记录的数值维度中的数据的总和在所述分 摊基数中每条记录中的分摊比例值, 并分别将所述分摊基数中所有记录的 数值维度中的数据的总和在所述分摊基数中每条记录中的分摊比例值作 为所述分摊基数中每条记录中的分摊比例维度中的数据。 Further, the calculating module is configured to respectively determine, as the allocation base, a ratio of data in a numerical dimension of each record in the allocation base to a sum of data in a numerical dimension of all records in the allocation base The sum of the data in all recorded numerical dimensions in each of the allocation bases, and the sum of the data in the numerical dimensions of all records in the allocation base, respectively, in the allocation base The distribution ratio value in the record is used as the data in the distribution ratio dimension in each record in the distribution base.
由于确定分摊比例时只能参照一个标准, 因此, 分摊基数中数值维度 只能有一个。 可以分别将所述分摊基数中每条记录的数值维度中数据, 与 所述分摊基数中所有记录的数值维度中数据的总和的比值, 确定为所述分 摊基数中所有记录的数值维度中的数据的总和在所述分摊基数中每条记 录中的分摊比例值, 并分别将所述分摊基数中所有记录的数值维度中的数 据的总和在所述分摊基数中每条记录中的分摊比例值作为所述分摊基数 中每条记录中的分摊比例维度中的数据。 Since only one standard can be referenced when determining the scale, there can only be one numerical dimension in the allocation base. The ratio of the data in the numerical dimension of each record in the allocation base to the sum of the data in the numerical dimension of all the records in the allocation base may be determined as the data in the numerical dimension of all the records in the allocation base. The sum of the scales in each record in the allocation base, and the sum of the data in the numerical dimension of all the records in the allocation base, respectively, in the score of each of the records The data in the scaled proportion dimension in each record in the allocation base.
分摊模块 43, 用于对于所述分摊对象中每条记录, 根据所述分难基数 中各条记录将所述分摊对象中的每条记录分摊成多条记录, 其中, 所述分 摊对象中的每条记录中的目标维度中的数据, 被分摊成所述分摊基数中各 个记录中的目标维度中数据, 所述分摊对象中的每条记录中的数值维度中 数据, 被分摊成与所述分摊基数中各条记录中的分摊比例维度中分摊比例 值分别对应的数据。 The distribution module 43 is configured to allocate, for each record in the distribution object, each record in the distribution object into a plurality of records according to each record in the difficulty base, wherein the distribution object The data in the target dimension in each record is distributed into the data in the target dimension in each record in the allocation base, and the data in the numerical dimension in each record in the distribution object is allocated and described The data corresponding to the distribution ratio value in the distribution ratio dimension in each record in the allocation base.
本实施例先根据用户输入设置分摊对象和分摊基数的目标维度和数 值维度, 再获得所述分摊基数中每条记录的分摊比例维度, 然后, 根据所 述分难基数中各条记录将所述分摊对象中的每条记录分摊成多条记录, 其 中, 所述分摊对象中的每条记录中的目标维度中的数据, 被分摊成所述分 摊基数中各条记录中的目标维度中数据, 所述分摊对象中的每条记录中的 数值维度中数据, 被分摊成与所述分摊基数中各条记录中的分摊比例维度 中分摊比例值分别对应的数据, 从而实现了按照分摊基数中目标维度和数 值维度中的数据对分摊对象中目标维度和数值维度中的数据进行分摊的 目的。 本实施例中根据用户输入的目标维度名称和数值维度名称分别设置
分摊对象和分摊基数的分摊维度, 通过变换分摊对象和分摊基数的分摊维 度, 可以构成不同的分摊场景, 因此, 本实施例提供的方法适应于各种分 摊场景, 不论分摊维度如何变换均可采用本实施例来实现分摊, 因此。 本 实施例提供的分摊方法提高了分摊灵活度, 减小了分摊复杂度, 降低了代 码维护成本, 提高了分摊效率。 In this embodiment, the target dimension and the numerical dimension of the allocation object and the allocation base are set according to the user input, and then the allocation proportion dimension of each record in the allocation base is obtained, and then, according to each record in the difficulty base Each record in the distribution object is distributed into a plurality of records, wherein data in the target dimension in each record in the distribution object is distributed into data in a target dimension in each record in the allocation base. The data in the numerical dimension in each record in the distribution object is allocated into data corresponding to the distribution ratio value in the distribution ratio dimension in each record in the allocation base, thereby realizing the target according to the allocation base The data in the dimension and numeric dimensions is used to apportion the data in the target dimension and the numeric dimension in the object. In this embodiment, the target dimension name and the numerical dimension name respectively input by the user are respectively set. The allocation object and the allocation dimension of the allocation base can be used to form different allocation scenarios by transforming the distribution object and the allocation dimension of the allocation base. Therefore, the method provided in this embodiment is applicable to various allocation scenarios, and can be adopted regardless of how the allocation dimension is changed. This embodiment implements the allocation, and therefore. The allocation method provided in this embodiment improves the allocation flexibility, reduces the allocation complexity, reduces the code maintenance cost, and improves the allocation efficiency.
可选地, 如图 5所示, 为减少运算量, 图 4所示的装置还包括: 第一 汇总模块 44。 所述第一汇总模块 44, 用于在获得所述分摊基数中每条记 录的分摊比例维度之前, 根据所述分摊对象中目标维度中的数据, 对所述 分摊对象中所有记录进行分组汇总。 如图 5所示, 为减少运算量, 图 4所 示的装置还包括: 第二汇总模块 45.所述第二汇总模块 45, 还用于在获得 所述分摊基数中每条记录的分摊比例维度之前, 根据所述分摊基数中目标 维度中的数据, 对所述分摊基数中所有记录进行分组汇总。 Optionally, as shown in FIG. 5, in order to reduce the amount of calculation, the apparatus shown in FIG. 4 further includes: a first summary module 44. The first summary module 44 is configured to group all the records in the distribution object according to data in the target dimension in the distribution object before obtaining the distribution ratio dimension of each record in the distribution base. As shown in FIG. 5, in order to reduce the amount of calculation, the apparatus shown in FIG. 4 further includes: a second summary module 45. The second summary module 45 is further configured to obtain a proportion of each record in the distribution base. Before the dimension, all the records in the allocation base are grouped and summarized according to the data in the target dimension in the allocation base.
可选地, 在图 4提供的实施例基础上, 所述分摊维度名称还包括关联 维度的名称, 所述分摊基数和所述分摊对象中的每条记录均还包括关联维 度。 如图 6所示, 图 4所示的装置还可以包括关联模块 46、 第三汇总模块 47和第四汇总模块 48。 在分摊维度还包括关联维度的情况下: Optionally, on the basis of the embodiment provided in FIG. 4, the distribution dimension name further includes a name of an associated dimension, and each of the allocation base and each of the distribution objects further includes an association dimension. As shown in FIG. 6, the apparatus shown in FIG. 4 may further include an association module 46, a third summary module 47, and a fourth summary module 48. In the case where the allocation dimension also includes the associated dimension:
所述计算模块, 具体用于按照关联维度中数据对分摊基数中所有记录 进行分组汇总, 按照关联维度中数据和目标维度中数据对分摊基数中所有 记录进行分组汇总; 将按照关联维度中数据对分摊基数中所有记录进行分 组汇总后得到的每条记录中的数据维度中数据, 与按照关联维度中数据和 目标维度中数据对分摊基数中所有记录进行分组汇总后得到的每条记录 中的数据维度中数据的总和的比值, 确定为所述分摊基数中所有记录的数 值维度中的数据的总和在所述分摊基数中每条记录中的分摊比例值, 并分 别将所述分摊基数中所有记录的数值维度中的数据的总和在所述分摊基 数中每条记录中的分摊比例值作为所述分摊基数中每条记录中的分摊比 例维度中的数据。 The calculation module is specifically configured to group all the records in the allocation base according to the data in the associated dimension, and group all the records in the allocation base according to the data in the associated dimension and the data in the target dimension; The data in the data dimension in each record obtained by grouping all the records in the allocation base, and the data in each record obtained by grouping all the records in the allocation base according to the data in the associated dimension and the data in the target dimension. a ratio of the sum of the data in the dimension, determined as a scale of the sum of the data in the numerical dimension of all the records in the allocation base in each of the allocation bases, and respectively records all the records in the allocation base The sum of the data in the numerical dimension is the value of the scale in each record in the allocation base as the data in the scale of proportions in each record in the allocation base.
所述关联模块 46, 用于在根据用户输入的分摊维度的名称, 确定分摊 基数中每条记录的分摊维度之后, 在所述分摊对象中去除与所述分摊基数 不相关的记录, 在所述分摊基数中去除与所述分摊对象不相关的记录; 所 述分摊对象中与所述分摊基数不相关的记录为, 其中的关联维度中数据与
所述分摊基数中每个记录中关联维度中数据都不相同的记录; 所述分摊基 数中与所述分摊对象不相关的记录为, 其中的关联维度中数据与所述分摊 对象中每个记录中关联维度中数据都不相同的记录; 所述分摊维度名称还 包括关联维度的名称, 所述分摊基数和所述分摊对象中的每条记录均还包 括关联维度。 The association module 46 is configured to: after determining the allocation dimension of each record in the allocation base according to the name of the distribution dimension input by the user, remove the record that is not related to the allocation base in the allocation object, where A record that is not related to the allocation object is removed from the allocation base; the record in the allocation object that is not related to the allocation base is: the data in the associated dimension a record in which the data in the associated dimension is different in each record in the record base; the record in the share cardinus that is not related to the share object is: the data in the associated dimension and each record in the share object A record in which the data in the associated dimension is different; the assigned dimension name further includes a name of the associated dimension, and each of the allocation base and each of the distribution objects further includes an associated dimension.
所述分摊模块 43, 具体用于将所述分摊对象中的每条记录按照处理所述 分摊对象中的第一记录的方式进行处理,处理所述分摊对象中的第一记录的方 式包括: 根据所述分难基数中与所述第一记录相关联的各个记录, 将所述第一 记录分摊成多条记录, 其中, 所述第一记录中的目标维度中数据, 被分摊成所 述分摊基数中与所述第一记录相关联的各个记录中的目标维度中数据,所述第 一记录中的数值维度中数据,被分摊成所述分摊基数中与所述第一记录相关联 的各个记录中的分摊比例维度中分摊比例值分别对应的数据;所述分摊基数中 与所述第一记录相关联的记录为,其中的关联维度中数据与所述第一记录中关 联维度中的数据相同的记录; 所述分摊维度名称还包括关联维度的名称, 所述 分摊基数和所述分摊对象中的每条记录均还包括关联维度。 The distribution module 43 is configured to process each record in the distribution object according to a manner of processing the first record in the distribution object, and the manner of processing the first record in the distribution object includes: The respective records associated with the first record in the difficulty base are divided into the plurality of records, wherein the data in the target dimension in the first record is allocated into the allocation Data in a target dimension in each record associated with the first record in the cardinality, data in a numerical dimension in the first record, is distributed into each of the amortization bases associated with the first record Data corresponding to the distribution ratio value in the distribution ratio dimension in the record; the record associated with the first record in the allocation base is the data in the associated dimension and the data in the associated dimension in the first record The same record; the distribution dimension name further includes a name of the associated dimension, and the record base and each record in the share object further include an associated dimension .
所述第三汇总模块 47,用于在获得所述分摊基数中每条记录的分摊比 例维度之前, 根据所述分摊对象中目标维度中的数据和关联维度中的数 据, 对所述分摊对象中所有记录进行分组汇总。 The third summary module 47 is configured to: in the data of the target dimension in the distribution object and the data in the associated dimension, obtain the distribution ratio dimension of each record in the distribution base, All records are grouped together.
所述第四汇总模块 48,用于在获得所述分摊基数中每条记录的分摊比 例维度之前, 根据所述分摊基数中目标维度中的数据和关联维度中的数 据, 对所述分摊基数中所有记录进行分组汇总。 The fourth summary module 48 is configured to: in the data of the target dimension in the allocation base and the data in the associated dimension, before the distribution ratio dimension of each record in the allocation base, All records are grouped together.
图 7为本发明实施例提供的一种数据分摊设备结构示意图。 如图 7所 示, 本实施例提供的设备包括: 处理器 72、 存储器 71、 通信接口 74和总 线 73 ; 所述处理器 72、 所述存储器 71和所述通信接口 74通过所述总线 73连接; FIG. 7 is a schematic structural diagram of a data sharing device according to an embodiment of the present invention. As shown in FIG. 7, the apparatus provided in this embodiment includes: a processor 72, a memory 71, a communication interface 74, and a bus 73; the processor 72, the memory 71, and the communication interface 74 are connected through the bus 73. ;
所述存储器, 用于存储程序; 所述处理器, 用于执行所述存储器存储 的程序; 所述程序, 用于: The memory is used to store a program; the processor is configured to execute the program stored in the memory; and the program is configured to:
根据用户输入的分摊维度的名称, 确定分摊基数中每条记录的分摊维 度, 以及分摊对象中每条记录的分摊维度; 所述分摊维度名称包括目标维 度的名称和数值维度的名称;
获得所述分摊基数中每条记录的分摊比例维度, 所述分摊基数中每条 记录的分摊比例维度中的数据为, 所述分摊基数中所有记录的数值维度中 的数据的总和在所述分摊基数中每条记录中的分摊比例值; Determining, according to the name of the allocation dimension input by the user, an allocation dimension of each record in the allocation base, and an allocation dimension of each record in the distribution object; the distribution dimension name includes a name of the target dimension and a name of the numerical dimension; Obtaining a distribution ratio dimension of each record in the allocation base, the data in the distribution ratio dimension of each record in the allocation base is, the sum of the data in the numerical dimension of all records in the allocation base is in the allocation The scale of the scale in each record in the base;
对于所述分摊对象中每条记录, 根据所述分难基数中各条记录将所述 分摊对象中的每条记录分摊成多条记录, 其中, 所述分摊对象中的每条记 录中的目标维度中的数据, 被分摊成所述分摊基数中各个记录中的目标维 度中数据, 所述分摊对象中的每条记录中的数值维度中数据, 被分摊成与 所述分摊基数中各条记录中的分摊比例维度中分摊比例值分别对应的数 据。 For each record in the distribution object, each record in the distribution object is distributed into a plurality of records according to each record in the difficulty base, wherein the target in each record in the distribution object The data in the dimension is distributed into the data in the target dimension in each record in the allocation base, and the data in the numerical dimension in each record in the distribution object is allocated to each record in the allocation base The data corresponding to the scaled value in the distribution ratio dimension in the data.
可选地, 所述程序, 还用于: Optionally, the program is further configured to:
分别将所述分摊基数中每条记录的数值维度中数据, 与所述分摊基数 中所有记录的数值维度中数据的总和的比值, 确定为所述分摊基数中所有 记录的数值维度中的数据的总和在所述分摊基数中每条记录中的分摊比 例值, 并分别将所述分摊基数中所有记录的数值维度中的数据的总和在所 述分摊基数中每条记录中的分摊比例值作为所述分摊基数中每条记录中 的分摊比例维度中的数据。 Determining, respectively, a ratio of data in a numerical dimension of each record in the allocation base to a sum of data in a numerical dimension of all records in the allocation base as data in a numerical dimension of all records in the allocation base Summing the value of the distribution in each record in the allocation base, and respectively taking the sum of the data in the numerical dimension of all the records in the allocation base in each of the allocation bases as the distribution ratio value The data in the scale of the dimension in each record in the allocation base.
可选地, 所述程序, 还用于: Optionally, the program is further configured to:
在根据用户输入的分摊维度的名称, 确定分摊基数中每条记录的分摊 维度之后, 在所述分摊对象中去除与所述分摊基数不相关的记录, 在所述 分摊基数中去除与所述分摊对象不相关的记录; 所述分摊对象中与所述分 摊基数不相关的记录为, 其中的关联维度中数据与所述分摊基数中每个记 录中关联维度中数据都不相同的记录; 所述分摊基数中与所述分摊对象不 相关的记录为, 其中的关联维度中数据与所述分摊对象中每个记录中关联 维度中数据都不相同的记录; 所述分摊维度名称还包括关联维度的名称, 所述分摊基数和所述分摊对象中的每条记录均还包括关联维度; After determining the allocation dimension of each record in the allocation base according to the name of the distribution dimension input by the user, deleting the record that is not related to the allocation base in the allocation object, and removing the allocation in the allocation base a record that is not related to the object; the record that is not related to the allocation base in the allocation object is a record in which the data in the associated dimension is different from the data in the associated dimension in each record in the allocation base; The records in the allocation base that are not related to the allocation object are records in which the data in the associated dimension is different from the data in the associated dimension in each record in the distribution object; the assigned dimension name also includes the associated dimension. a name, the allocation base, and each record in the distribution object further includes an association dimension;
获得所述分摊基数中每条记录的分摊比例维度包括: 按照关联维度中 数据对分摊基数中所有记录进行分组汇总, 按照关联维度中数据和目标维 度中数据对分摊基数中所有记录进行分组汇总; 将按照关联维度中数据对 分摊基数中所有记录进行分组汇总后得到的每条记录中的数据维度中数 据, 与按照关联维度中数据和目标维度中数据对分摊基数中所有记录进行
分组汇总后得到的每条记录中的数据维度中数据的总和的比值, 确定为所 述分摊基数中所有记录的数值维度中的数据的总和在所述分摊基数中每 条记录中的分摊比例值, 并分别将所述分摊基数中所有记录的数值维度中 的数据的总和在所述分摊基数中每条记录中的分摊比例值作为所述分摊 基数中每条记录中的分摊比例维度中的数据。 Obtaining the proportion of the proportion of each record in the allocation base includes: grouping all the records in the allocation base according to the data in the associated dimension, and grouping all the records in the allocation base according to the data in the associated dimension and the data in the target dimension; The data in the data dimension in each record obtained by grouping all the records in the allocation base according to the data in the associated dimension, and all the records in the allocation base according to the data in the associated dimension and the data in the target dimension. The ratio of the sum of the data in the data dimension in each record obtained after the grouping is determined, and the sum of the data in the numerical dimension of all records in the allocation base is determined in each record of the allocation base. And respectively using the sum of the data in the numerical dimension of all records in the allocation base in each of the allocation bases as the data in the distribution ratio dimension in each record in the allocation base .
将所述分摊对象中的每条记录按照处理所述分摊对象中的第一记录 的方式进行处理, 处理所述分摊对象中的第一记录的方式包括: 根据所述 分难基数中与所述第一记录相关联的各个记录, 将所述第一记录分摊成多 条记录, 其中, 所述第一记录中的目标维度中数据, 被分摊成所述分摊基 数中与所述第一记录相关联的各个记录中的目标维度中数据, 所述第一记 录中的数值维度中数据, 被分摊成所述分摊基数中与所述第一记录相关联 的各个记录中的分摊比例维度中分摊比例值分别对应的数据; 所述分摊基 数中与所述第一记录相关联的记录为, 其中的关联维度中数据与所述第一 记录中关联维度中的数据相同的记录。 And processing the first record in the distribution object according to the manner of processing the first record in the distribution object, and processing the first record in the distribution object includes: The first record is associated with each record, and the first record is divided into a plurality of records, wherein data in the target dimension in the first record is allocated into the allocation base and is related to the first record Data in the target dimension in each of the associated records, the data in the numerical dimension in the first record is distributed into the proportion of the proportion of the proportions in the records associated with the first record in the allocation base The data corresponding to the value respectively; the record associated with the first record in the allocation base is a record in which the data in the associated dimension is the same as the data in the associated dimension in the first record.
可选地, 所述程序, 还用于: Optionally, the program is further configured to:
在获得所述分摊基数中每条记录的分摊比例维度之前, 根据所述分摊 对象中目标维度中的数据, 对所述分摊对象中所有记录进行分组汇总。 All the records in the distribution object are grouped and summarized according to the data in the target dimension in the distribution object before the distribution ratio dimension of each record in the distribution base is obtained.
可选地, 所述程序, 还用于: Optionally, the program is further configured to:
在获得所述分摊基数中每条记录的分摊比例维度之前, 根据所述分摊 基数中目标维度中的数据, 对所述分摊基数中所有记录进行分组汇总。 All the records in the allocation base are grouped and summarized according to the data in the target dimension in the allocation base before the distribution ratio dimension of each record in the allocation base is obtained.
可选地, 所述程序, 还用于: Optionally, the program is further configured to:
获得所述分摊基数中每条记录的分摊比例维度之前, 根据所述分摊对 象中目标维度中的数据和关联维度中的数据, 对所述分摊对象中所有记录 进行分组汇总; All the records in the distribution object are grouped and summarized according to the data in the target dimension and the data in the associated dimension in the data of the target dimension in the allocation object before obtaining the distribution ratio dimension of each record in the allocation base;
获得所述分摊基数中每条记录的分摊比例维度之前, 根据所述分摊基 数中目标维度中的数据和关联维度中的数据, 对所述分摊基数中所有记录 进行分组汇总。 Before obtaining the distribution ratio dimension of each record in the allocation base, all the records in the allocation base are grouped and summarized according to the data in the target dimension and the data in the associated dimension in the allocation base.
本实施例先根据用户输入设置分摊对象和分摊基数的目标维度和数 值维度, 再获得所述分摊基数中每条记录的分摊比例维度, 然后, 根据所 述分难基数中各条记录将所述分摊对象中的每条记录分摊成多条记录, 其
中, 所述分摊对象中的每条记录中的目标维度中的数据, 被分摊成所述分 摊基数中各条记录中的目标维度中数据, 所述分摊对象中的每条记录中的 数值维度中数据, 被分摊成与所述分摊基数中各条记录中的分摊比例维度 中分摊比例值分别对应的数据, 从而实现了按照分摊基数中目标维度和数 值维度中的数据对分摊对象中目标维度和数值维度中的数据进行分摊的 目的。 本实施例中根据用户输入的目标维度名称和数值维度名称分别设置 分摊对象和分摊基数的分摊维度, 通过变换分摊对象和分摊基数的分摊维 度, 可以构成不同的分摊场景, 因此, 本实施例提供的方法适应于各种分 摊场景, 不论分摊维度如何变换均可采用本实施例来实现分摊, 因此。 本 实施例提供的分摊方法提高了分摊灵活度, 减小了分摊复杂度, 降低了代 码维护成本, 提高了分摊效率。 In this embodiment, the target dimension and the numerical dimension of the allocation object and the allocation base are set according to the user input, and then the allocation proportion dimension of each record in the allocation base is obtained, and then, according to each record in the difficulty base Each record in the apportionment object is spread into multiple records, The data in the target dimension in each record in the allocation object is allocated into data in a target dimension in each record in the allocation base, and the numerical dimension in each record in the allocation object The data in the data is allocated to the data corresponding to the distribution ratio in the distribution ratio dimension in each record in the allocation base, thereby realizing the target dimension in the object in the target dimension and the numerical dimension in the allocation base. And the purpose of apportioning the data in the numerical dimension. In this embodiment, the allocation dimension and the distribution dimension are respectively set according to the target dimension name and the numerical dimension name input by the user, and different allocation scenarios can be formed by transforming the distribution object and the allocation dimension of the allocation base. Therefore, this embodiment provides The method is adapted to various allocation scenarios, and the embodiment can be used to implement the allocation regardless of how the allocation dimension is changed. The allocation method provided in this embodiment improves the allocation flexibility, reduces the allocation complexity, reduces the code maintenance cost, and improves the allocation efficiency.
本领域普通技术人员可以理解:实现上述各方法实施例的全部或部分歩骤 可以通过程序指令相关的硬件来完成。前述的程序可以存储于一计算机可读取 存储介质中。 该程序在执行时, 执行包括上述各方法实施例的歩骤; 而前述的 存储介质包括: R0M、 RAM, 磁碟或者光盘等各种可以存储程序代码的介质。 One of ordinary skill in the art will appreciate that all or a portion of the steps of implementing the various method embodiments described above can be accomplished by hardware associated with the program instructions. The aforementioned program can be stored in a computer readable storage medium. The program, when executed, performs the steps including the foregoing method embodiments; and the foregoing storage medium includes: a medium that can store program codes, such as ROM, RAM, disk or optical disk.
最后应说明的是: 以上各实施例仅用以说明本发明的技术方案, 而非对 其限制; 尽管参照前述各实施例对本发明进行了详细的说明, 本领域的普通 技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改, 或者对其中部分或者全部技术特征进行等同替换; 而这些修改或者替换, 并 不使相应技术方案的本质脱离本发明各实施例技术方案的范围。
Finally, it should be noted that the above embodiments are only for explaining the technical solutions of the present invention, and are not intended to be limiting thereof; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art will understand that The technical solutions described in the foregoing embodiments may be modified, or some or all of the technical features may be equivalently replaced; and the modifications or substitutions do not deviate from the technical solutions of the embodiments of the present invention. range.
Claims
1、 一种数据分摊方法, 其特征在于, 包括: 1. A data allocation method, characterized by including:
根据用户输入的分摊维度的名称, 确定分摊基数中每条记录的分摊维 度, 以及分摊对象中每条记录的分摊维度; 所述分摊维度名称包括目标维 度的名称和数值维度的名称; According to the name of the apportionment dimension input by the user, the apportionment dimension of each record in the apportionment base and the apportionment dimension of each record in the apportionment object are determined; the apportionment dimension name includes the name of the target dimension and the name of the numerical dimension;
获得所述分摊基数中每条记录的分摊比例维度, 所述分摊基数中每条 记录的分摊比例维度中的数据为, 所述分摊基数中所有记录的数值维度中 的数据的总和在所述分摊基数中每条记录中的分摊比例值; Obtain the apportionment ratio dimension of each record in the apportionment base. The data in the apportionment ratio dimension of each record in the apportionment base is, The sum of the data in the numerical dimension of all records in the apportionment base is in the apportionment base. The apportionment ratio value in each record in the base;
根据所述分难基数中各条记录将所述分摊对象中的每条记录分摊成 多条记录, 其中, 所述分摊对象中的每条记录中的目标维度中的数据, 被 分摊成所述分摊基数中各个记录中的目标维度中数据, 所述分摊对象中的 每条记录中的数值维度中数据, 被分摊成与所述分摊基数中各条记录中的 分摊比例维度中分摊比例值分别对应的数据。 Each record in the apportionment object is apportioned into multiple records according to each record in the apportionment base, where the data in the target dimension of each record in the apportionment object is apportioned into the The data in the target dimension in each record in the allocation base, and the data in the numerical dimension in each record in the allocation object, are allocated to the allocation proportion value in the allocation proportion dimension in each record in the allocation base, respectively. corresponding data.
2、 根据权利要求 1所述的方法, 其特征在于, 获得所述分摊基数中 每条记录的分摊比例维度包括: 2. The method according to claim 1, characterized in that, obtaining the allocation proportion dimension of each record in the allocation base includes:
分别将所述分摊基数中每条记录的数值维度中数据, 与所述分摊基数 中所有记录的数值维度中数据的总和的比值, 确定为所述分摊基数中所有 记录的数值维度中的数据的总和在所述分摊基数中每条记录中的分摊比 例值, 并分别将所述分摊基数中所有记录的数值维度中的数据的总和在所 述分摊基数中每条记录中的分摊比例值作为所述分摊基数中每条记录中 的分摊比例维度中的数据。 The ratio of the data in the numerical dimension of each record in the apportionment base to the sum of the data in the numerical dimension of all records in the apportionment base is determined as the ratio of the data in the numerical dimension of all records in the apportionment base. Sum the apportionment ratio value in each record in the apportionment base, and respectively use the sum of the apportionment ratio values in each record in the apportionment base as the sum of the data in the numerical dimensions of all records in the apportionment base. Describe the data in the allocation proportion dimension of each record in the allocation base.
3、 根据权利要求 1所述的方法, 其特征在于, 所述分摊维度的名称 还包括关联维度的名称, 所述分摊基数和所述分摊对象中的每条记录均还 包括关联维度; 3. The method according to claim 1, wherein the name of the apportionment dimension also includes the name of the associated dimension, and each record in the apportionment base and the apportionment object also includes an associated dimension;
在所述根据用户输入的分摊维度的名称, 确定分摊基数中每条记录的 分摊维度, 以及分摊对象中每条记录的分摊维度之后, 还包括: After determining the apportionment dimension of each record in the apportionment base and the apportionment dimension of each record in the apportionment object based on the name of the apportionment dimension input by the user, it also includes:
在所述分摊对象中去除与所述分摊基数不相关的记录, 在所述分摊基 数中去除与所述分摊对象不相关的记录; 所述分摊对象中与所述分摊基数 不相关的记录为, 其中的关联维度中数据与所述分摊基数中每个记录中关 联维度中数据都不相同的记录; 所述分摊基数中与所述分摊对象不相关的
记录为, 其中的关联维度中数据与所述分摊对象中每个记录中关联维度中 数据都不相同的记录; Remove records from the apportionment object that are not relevant to the apportionment base, remove records from the apportionment base that are not relevant to the apportionment object; records that are not relevant to the apportionment base from the apportionment object are, Records in which the data in the associated dimension are different from the data in the associated dimension in each record in the apportionment base; those in the apportionment base that are not related to the apportionment object The record is a record in which the data in the associated dimension is different from the data in the associated dimension in each record in the allocation object;
获得所述分摊基数中每条记录的分摊比例维度包括: Obtaining the allocation proportion dimension of each record in the allocation base includes:
按照关联维度中数据对分摊基数中所有记录进行分组汇总, 按照关联 维度中数据和目标维度中数据对分摊基数中所有记录进行分组汇总; 将按照关联维度中数据对分摊基数中所有记录进行分组汇总后得到 的每条记录中的数据维度中数据, 与按照关联维度中数据和目标维度中数 据对分摊基数中所有记录进行分组汇总后得到的每条记录中的数据维度 中数据的总和的比值, 确定为所述分摊基数中所有记录的数值维度中的数 据的总和在所述分摊基数中每条记录中的分摊比例值, 并分别将所述分摊 基数中所有记录的数值维度中的数据的总和在所述分摊基数中每条记录 中的分摊比例值作为所述分摊基数中每条记录中的分摊比例维度中的数 据。 All records in the apportionment base are grouped and summarized according to the data in the associated dimension. All records in the apportionment base are grouped and summarized according to the data in the associated dimension and the target dimension. All records in the apportionment base are grouped and summarized according to the data in the associated dimension. The ratio of the data in the data dimension of each record obtained after that, to the sum of the data in the data dimension of each record obtained by grouping and summarizing all the records in the apportionment base according to the data in the associated dimension and the data in the target dimension, Determine the apportionment ratio value in each record in the apportionment base as the sum of the data in the numerical dimension of all records in the apportionment base, and respectively add the sum of the data in the numerical dimension of all records in the apportionment base The apportionment ratio value in each record in the apportionment base is used as the data in the apportionment ratio dimension in each record in the apportionment base.
4、 根据权利要求 1、 2或 3所述的方法, 其特征在于, 所述分摊维度 的名称还包括关联维度的名称, 所述分摊基数和所述分摊对象中的每条记 录均还包括关联维度; 根据所述分难基数中各条记录将所述分摊对象中的 每条记录分摊成多条记录, 包括: 4. The method according to claim 1, 2 or 3, characterized in that, the name of the apportionment dimension also includes the name of the associated dimension, and the apportionment base and each record in the apportionment object also include the association Dimension; allocate each record in the allocation object into multiple records based on each record in the difficulty allocation base, including:
将所述分摊对象中的每条记录按照处理所述分摊对象中的第一记录 的方式进行处理, 处理所述分摊对象中的第一记录的方式包括: 根据所述 分难基数中与所述第一记录相关联的各个记录, 将所述第一记录分摊成多 条记录, 其中, 所述第一记录中的目标维度中数据, 被分摊成所述分摊基 数中与所述第一记录相关联的各个记录中的目标维度中数据, 所述第一记 录中的数值维度中数据, 被分摊成所述分摊基数中与所述第一记录相关联 的各个记录中的分摊比例维度中分摊比例值分别对应的数据; 所述分摊基 数中与所述第一记录相关联的记录为, 其中的关联维度中数据与所述第一 记录中关联维度中的数据相同的记录。 Each record in the allocation object is processed in the same manner as the first record in the allocation object. The method of processing the first record in the allocation object includes: according to the difficulty allocation base and the For each record associated with the first record, the first record is apportioned into multiple records, where the data in the target dimension in the first record is apportioned into the apportionment base related to the first record. The data in the target dimension in each record associated with the first record is allocated to the allocation ratio in the allocation ratio dimension in each record associated with the first record in the allocation base. The data corresponding to the respective values; the record associated with the first record in the apportionment base is a record in which the data in the associated dimension is the same as the data in the associated dimension of the first record.
5、 根据权利要求 1至 4中任意一项所述的方法, 其特征在于, 在获 得所述分摊基数中每条记录的分摊比例维度之前, 还包括: 5. The method according to any one of claims 1 to 4, characterized in that, before obtaining the allocation proportion dimension of each record in the allocation base, it further includes:
根据所述分摊对象中目标维度中的数据, 对所述分摊对象中所有记录 进行分组汇总。
According to the data in the target dimension in the allocation object, all records in the allocation object are grouped and summarized.
6、 根据权利要求 1至 4中任意一项所述的方法, 其特征在于, 在获 得所述分摊基数中每条记录的分摊比例维度之前, 还包括: 6. The method according to any one of claims 1 to 4, characterized in that, before obtaining the allocation proportion dimension of each record in the allocation base, it further includes:
根据所述分摊基数中目标维度中的数据, 对所述分摊基数中所有记录 进行分组汇总。 According to the data in the target dimension in the apportionment base, all records in the apportionment base are grouped and summarized.
7、 根据权利要求 1至 4中任意一项所述的方法, 其特征在于, 在获 得所述分摊基数中每条记录的分摊比例维度之前, 还包括: 7. The method according to any one of claims 1 to 4, characterized in that, before obtaining the allocation proportion dimension of each record in the allocation base, it further includes:
根据所述分摊对象中目标维度中的数据和关联维度中的数据, 对所述 分摊对象中所有记录进行分组汇总。 According to the data in the target dimension and the data in the associated dimension in the allocation object, all records in the allocation object are grouped and summarized.
8、 根据权利要求 1至 4中任意一项所述的方法, 其特征在于, 在获 得所述分摊基数中每条记录的分摊比例维度之前, 还包括: 8. The method according to any one of claims 1 to 4, characterized in that, before obtaining the allocation proportion dimension of each record in the allocation base, it further includes:
根据所述分摊基数中目标维度中的数据和关联维度中的数据, 对所述 分摊基数中所有记录进行分组汇总。 According to the data in the target dimension and the data in the associated dimension in the apportionment base, all records in the apportionment base are grouped and summarized.
9、 一种数据分摊装置, 其特征在于, 包括: 9. A data sharing device, characterized by including:
设置模块, 用于根据用户输入的分摊维度的名称, 确定分摊基数中每 条记录的分摊维度, 以及分摊对象中每条记录的分摊维度; 所述分摊维度 名称包括目标维度的名称和数值维度的名称; The setting module is used to determine the apportionment dimension of each record in the apportionment base and the apportionment dimension of each record in the apportionment object based on the name of the apportionment dimension input by the user; the apportionment dimension name includes the name of the target dimension and the value dimension. name;
计算模块, 用于获得所述分摊基数中每条记录的分摊比例维度, 所述 分摊基数中每条记录的分摊比例维度中的数据为, 所述分摊基数中所有记 录的数值维度中的数据的总和在所述分摊基数中每条记录中的分摊比例 值; Calculation module, used to obtain the apportionment ratio dimension of each record in the apportionment base, the data in the apportionment ratio dimension of each record in the apportionment base is, the data in the numerical dimension of all records in the apportionment base The apportionment ratio value of the sum in each record in the apportionment base;
分摊模块, 用于根据所述分难基数中各条记录将所述分摊对象中的每 条记录分摊成多条记录, 其中, 所述分摊对象中的每条记录中的目标维度 中的数据, 被分摊成所述分摊基数中各个记录中的目标维度中数据, 所述 分摊对象中的每条记录中的数值维度中数据, 被分摊成与所述分摊基数中 各条记录中的分摊比例维度中分摊比例值分别对应的数据。 An apportionment module, configured to apportion each record in the apportionment object into multiple records based on each record in the apportionment base, where the data in the target dimension of each record in the apportionment object, is apportioned into the data in the target dimension in each record in the apportionment base, and the data in the numerical dimension in each record in the apportionment object is apportioned into the apportionment ratio dimension in each record in the apportionment base Data corresponding to the apportionment ratio values.
10、 根据权利要求 9所述的装置, 其特征在于, 所述计算模块, 具体 用于分别将所述分摊基数中每条记录的数值维度中数据, 与所述分摊基数 中所有记录的数值维度中数据的总和的比值, 确定为所述分摊基数中所有 记录的数值维度中的数据的总和在所述分摊基数中每条记录中的分摊比 例值, 并分别将所述分摊基数中所有记录的数值维度中的数据的总和在所
述分摊基数中每条记录中的分摊比例值作为所述分摊基数中每条记录中 的分摊比例维度中的数据。 10. The device according to claim 9, characterized in that, the calculation module is specifically configured to separately compare the data in the numerical dimension of each record in the apportionment base with the numerical dimensions of all records in the apportionment base. The ratio of the sum of data in , is determined as the apportionment ratio value of the sum of data in the numerical dimension of all records in the apportionment base in each record in the apportionment base, and the apportionment base of all records in the apportionment base is The sum of the data in the numeric dimension is The apportionment ratio value in each record in the apportionment base is used as the data in the apportionment ratio dimension in each record in the apportionment base.
11、 根据权利要求 9所述的装置, 其特征在于, 所述装置还包括关联 模块; 11. The device according to claim 9, characterized in that, the device further includes an association module;
所述关联模块, 用于在根据用户输入的分摊维度的名称, 确定分摊基 数中每条记录的分摊维度之后, 在所述分摊对象中去除与所述分摊基数不 相关的记录, 在所述分摊基数中去除与所述分摊对象不相关的记录; 所述 分摊对象中与所述分摊基数不相关的记录为, 其中的关联维度中数据与所 述分摊基数中每个记录中关联维度中数据都不相同的记录; 所述分摊基数 中与所述分摊对象不相关的记录为, 其中的关联维度中数据与所述分摊对 象中每个记录中关联维度中数据都不相同的记录; 所述分摊维度名称还包 括关联维度的名称, 所述分摊基数和所述分摊对象中的每条记录均还包括 关联维度。 The association module is configured to, after determining the apportionment dimension of each record in the apportionment base according to the name of the apportionment dimension input by the user, remove records in the apportionment object that are not related to the apportionment base, and in the apportionment Records that are not relevant to the allocation object are removed from the base; records that are not relevant to the allocation base in the allocation object are: The data in the associated dimension are the same as the data in the associated dimension of each record in the allocation base. Different records; The records in the apportionment base that are not related to the apportionment object are records in which the data in the associated dimension is different from the data in the associated dimension in each record in the apportionment object; the apportionment The dimension name also includes the name of the associated dimension, and each record in the allocation base and the allocation object also includes the associated dimension.
12、 根据权利要求 9、 10或 11所述的装置, 其特征在于, 12. The device according to claim 9, 10 or 11, characterized in that,
所述分摊维度名称还包括关联维度的名称, 所述分摊基数和所述分摊 对象中的每条记录均还包括关联维度; The apportionment dimension name also includes the name of the associated dimension, and the apportionment base and each record in the apportionment object also includes the associated dimension;
所述分摊模块, 具体用于将所述分摊对象中的每条记录按照处理所述 分摊对象中的第一记录的方式进行处理, 处理所述分摊对象中的第一记录 的方式包括: 根据所述分难基数中与所述第一记录相关联的各个记录, 将 所述第一记录分摊成多条记录,其中,所述第一记录中的目标维度中数据, 被分摊成所述分摊基数中与所述第一记录相关联的各个记录中的目标维 度中数据, 所述第一记录中的数值维度中数据, 被分摊成所述分摊基数中 与所述第一记录相关联的各个记录中的分摊比例维度中分摊比例值分别 对应的数据; 所述分摊基数中与所述第一记录相关联的记录为, 其中的关 联维度中数据与所述第一记录中关联维度中的数据相同的记录; The apportionment module is specifically configured to process each record in the apportionment object in a manner that processes the first record in the apportionment object. The method of processing the first record in the apportionment object includes: Each record associated with the first record in the dividing base is divided into multiple records, wherein the data in the target dimension in the first record is divided into the dividing base. The data in the target dimension in each record associated with the first record, and the data in the numerical dimension in the first record are apportioned into each record associated with the first record in the apportionment base The data corresponding to the apportionment ratio values in the apportionment ratio dimension in ; The record associated with the first record in the apportionment base is, where the data in the associated dimension is the same as the data in the associated dimension in the first record record of;
所述计算模块, 具体用于按照关联维度中数据对分摊基数中所有记录 进行分组汇总, 按照关联维度中数据和目标维度中数据对分摊基数中所有 记录进行分组汇总; 将按照关联维度中数据对分摊基数中所有记录进行分 组汇总后得到的每条记录中的数据维度中数据, 与按照关联维度中数据和 目标维度中数据对分摊基数中所有记录进行分组汇总后得到的每条记录
中的数据维度中数据的总和的比值, 确定为所述分摊基数中所有记录的数 值维度中的数据的总和在所述分摊基数中每条记录中的分摊比例值, 并分 别将所述分摊基数中所有记录的数值维度中的数据的总和在所述分摊基 数中每条记录中的分摊比例值作为所述分摊基数中每条记录中的分摊比 例维度中的数据。 The calculation module is specifically used to group and summarize all the records in the apportionment base according to the data in the associated dimension, to group and summarize all the records in the apportionment base according to the data in the associated dimension and the data in the target dimension; to group and summarize all the records in the apportionment base according to the data in the associated dimension. The data in the data dimension of each record obtained by grouping and summarizing all records in the apportionment base, and each record obtained by grouping and summarizing all records in the apportionment base according to the data in the associated dimension and the data in the target dimension The ratio of the sum of the data in the data dimension in is determined as the apportionment proportion value of the sum of the data in the numerical dimension of all records in the apportionment base in each record in the apportionment base, and the apportionment base is respectively The sum of the data in the numerical dimension of all records in the apportionment base and the apportionment ratio value in each record in the apportionment base are used as the data in the apportionment ratio dimension in each record in the apportionment base.
13、 根据权利要求 9至 12中任意一项所述的装置, 其特征在于, 还 包括: 第一汇总模块; 13. The device according to any one of claims 9 to 12, further comprising: a first summary module;
所述第一汇总模块, 用于在获得所述分摊基数中每条记录的分摊比例 维度之前, 根据所述分摊对象中目标维度中的数据, 对所述分摊对象中所 有记录进行分组汇总。 The first summary module is configured to group and summarize all records in the allocation object based on the data in the target dimension in the allocation object before obtaining the allocation ratio dimension of each record in the allocation base.
14、 根据权利要求 9至 12中任意一项所述的装置, 其特征在于, 还 包括: 第一汇总模块; 14. The device according to any one of claims 9 to 12, further comprising: a first summary module;
所述第二汇总模块, 用于在获得所述分摊基数中每条记录的分摊比例 维度之前, 根据所述分摊基数中目标维度中的数据, 对所述分摊基数中所 有记录进行分组汇总。 The second summary module is configured to group and summarize all records in the apportionment base based on the data in the target dimension in the apportionment base before obtaining the apportionment ratio dimension of each record in the apportionment base.
15、 根据权利要求 9至 12中任意一项所述的装置, 其特征在于, 还 包括第三汇总模块; 所述第三汇总模块, 用于在获得所述分摊基数中每条 记录的分摊比例维度之前, 根据所述分摊对象中目标维度中的数据和关联 维度中的数据, 对所述分摊对象中所有记录进行分组汇总。 15. The device according to any one of claims 9 to 12, further comprising a third summary module; the third summary module is used to obtain the allocation ratio of each record in the allocation base Before dimensions, all records in the allocation object are grouped and summarized based on the data in the target dimension and the data in the associated dimension in the allocation object.
16、 根据权利要求 9至 12中任意一项所述的装置, 其特征在于, 还 包括第四汇总模块; 16. The device according to any one of claims 9 to 12, further comprising a fourth summary module;
所述第四汇总模块, 用于在获得所述分摊基数中每条记录的分摊比例 维度之前, 根据所述分摊基数中目标维度中的数据和关联维度中的数据, 对所述分摊基数中所有记录进行分组汇总。 The fourth summary module is configured to, before obtaining the apportionment proportion dimension of each record in the apportionment base, based on the data in the target dimension and the data in the associated dimension in the apportionment base, calculate all the apportionment bases in the apportionment base. Records are grouped and summarized.
17、 一种数据分摊设备, 其特征在于, 包括: 处理器、 存储器、 通信 接口和总线;所述处理器、所述存储器和所述通信接口通过所述总线连接; 所述存储器, 用于存储程序; 所述处理器, 用于执行所述存储器存储 的程序; 所述程序, 用于: 17. A data sharing device, characterized in that it includes: a processor, a memory, a communication interface and a bus; the processor, the memory and the communication interface are connected through the bus; the memory is used to store Program; The processor is used to execute the program stored in the memory; The program is used to:
根据用户输入的分摊维度的名称, 确定分摊基数中每条记录的分摊维 度, 以及分摊对象中每条记录的分摊维度; 所述分摊维度名称包括目标维
度的名称和数值维度的名称; According to the name of the allocation dimension input by the user, determine the allocation dimension of each record in the allocation base and the allocation dimension of each record in the allocation object; the allocation dimension name includes the target dimension The name of the degree and the name of the numerical dimension;
获得所述分摊基数中每条记录的分摊比例维度, 所述分摊基数中每条 记录的分摊比例维度中的数据为, 所述分摊基数中所有记录的数值维度中 的数据的总和在所述分摊基数中每条记录中的分摊比例值; Obtain the apportionment ratio dimension of each record in the apportionment base. The data in the apportionment ratio dimension of each record in the apportionment base is, The sum of the data in the numerical dimension of all records in the apportionment base is in the apportionment base. The apportionment ratio value in each record in the base;
根据所述分难基数中各条记录将所述分摊对象中的每条记录分摊成 多条记录, 其中, 所述分摊对象中的每条记录中的目标维度中的数据, 被 分摊成所述分摊基数中各个记录中的目标维度中数据, 所述分摊对象中的 每条记录中的数值维度中数据, 被分摊成与所述分摊基数中各条记录中的 分摊比例维度中分摊比例值分别对应的数据。 Each record in the apportionment object is apportioned into multiple records according to each record in the apportionment base, where the data in the target dimension of each record in the apportionment object is apportioned into the The data in the target dimension in each record in the allocation base, and the data in the numerical dimension in each record in the allocation object, are allocated to the allocation proportion value in the allocation proportion dimension in each record in the allocation base, respectively. corresponding data.
18、 根据权利要求 17所述的设备, 其特征在于, 所述程序, 还用于: 分别将所述分摊基数中每条记录的数值维度中数据, 与所述分摊基数 中所有记录的数值维度中数据的总和的比值, 确定为所述分摊基数中所有 记录的数值维度中的数据的总和在所述分摊基数中每条记录中的分摊比 例值, 并分别将所述分摊基数中所有记录的数值维度中的数据的总和在所 述分摊基数中每条记录中的分摊比例值作为所述分摊基数中每条记录中 的分摊比例维度中的数据。 18. The device according to claim 17, characterized in that, the program is further used to: respectively compare the data in the numerical dimension of each record in the amortization base with the numerical dimensions of all records in the amortization base. The ratio of the sum of the data in is determined as the apportionment proportion value of the sum of the data in the numerical dimension of all records in the apportionment base in each record in the apportionment base, and the apportionment base is divided into The sum of the data in the numerical dimension and the apportionment ratio value in each record in the apportionment base are used as the data in the apportionment ratio dimension in each record in the apportionment base.
19、 根据权利要求 17所述的设备, 其特征在于, 所述程序, 还用于: 在根据用户输入的分摊维度的名称, 确定分摊基数中每条记录的分摊 维度之后, 在所述分摊对象中去除与所述分摊基数不相关的记录, 在所述 分摊基数中去除与所述分摊对象不相关的记录; 所述分摊对象中与所述分 摊基数不相关的记录为, 其中的关联维度中数据与所述分摊基数中每个记 录中关联维度中数据都不相同的记录; 所述分摊基数中与所述分摊对象不 相关的记录为, 其中的关联维度中数据与所述分摊对象中每个记录中关联 维度中数据都不相同的记录; 所述分摊维度名称还包括关联维度的名称, 所述分摊基数和所述分摊对象中的每条记录均还包括关联维度; 19. The device according to claim 17, wherein the program is further configured to: after determining the apportionment dimension of each record in the apportionment base according to the name of the apportionment dimension input by the user, in the apportionment object Remove the records that are not related to the allocation base, remove the records that are not related to the allocation object from the allocation base; The records that are not related to the allocation base in the allocation object are, where in the associated dimensions The records whose data are different from the data in the associated dimension of each record in the apportionment base; the records in the apportionment base that are not related to the apportionment object are: the data in the association dimension are the same as the data in each record in the apportionment object. Each record has different data in the associated dimensions; the apportionment dimension name also includes the name of the associated dimension, and the apportionment base and each record in the apportionment object also includes the associated dimension;
获得所述分摊基数中每条记录的分摊比例维度包括: 按照关联维度中 数据对分摊基数中所有记录进行分组汇总, 按照关联维度中数据和目标维 度中数据对分摊基数中所有记录进行分组汇总; 将按照关联维度中数据对 分摊基数中所有记录进行分组汇总后得到的每条记录中的数据维度中数 据, 与按照关联维度中数据和目标维度中数据对分摊基数中所有记录进行
分组汇总后得到的每条记录中的数据维度中数据的总和的比值, 确定为所 述分摊基数中所有记录的数值维度中的数据的总和在所述分摊基数中每 条记录中的分摊比例值, 并分别将所述分摊基数中所有记录的数值维度中 的数据的总和在所述分摊基数中每条记录中的分摊比例值作为所述分摊 基数中每条记录中的分摊比例维度中的数据。 Obtaining the apportionment proportion dimension of each record in the apportionment base includes: grouping and summarizing all records in the apportionment base according to the data in the associated dimension, and grouping and summarizing all the records in the apportionment base according to the data in the associated dimension and the data in the target dimension; The data in the data dimension of each record obtained by grouping and summarizing all records in the apportionment base according to the data in the associated dimension will be compared with all the records in the apportionment base according to the data in the associated dimension and the data in the target dimension. The ratio of the sum of the data in the data dimension of each record obtained after grouping and summarizing is determined as the apportionment ratio value of the sum of the data in the numerical dimension of all records in the apportionment base in each record in the apportionment base. , and respectively use the sum of the data in the numerical dimension of all records in the apportionment base and the apportionment ratio value in each record in the apportionment base as the data in the apportionment ratio dimension in each record in the apportionment base .
20、根据权利要求 17、 18或 19所述的设备, 其特征在于, 所述程序, 还用于: 20. The device according to claim 17, 18 or 19, characterized in that the program is also used for:
将所述分摊对象中的每条记录按照处理所述分摊对象中的第一记录 的方式进行处理, 处理所述分摊对象中的第一记录的方式包括: 根据所述 分难基数中与所述第一记录相关联的各个记录, 将所述第一记录分摊成多 条记录, 其中, 所述第一记录中的目标维度中数据, 被分摊成所述分摊基 数中与所述第一记录相关联的各个记录中的目标维度中数据, 所述第一记 录中的数值维度中数据, 被分摊成所述分摊基数中与所述第一记录相关联 的各个记录中的分摊比例维度中分摊比例值分别对应的数据; 所述分摊基 数中与所述第一记录相关联的记录为, 其中的关联维度中数据与所述第一 记录中关联维度中的数据相同的记录; 所述分摊维度名称还包括关联维度 的名称, 所述分摊基数和所述分摊对象中的每条记录均还包括关联维度。 Each record in the allocation object is processed in the same manner as the first record in the allocation object. The method of processing the first record in the allocation object includes: according to the difficulty allocation base and the For each record associated with the first record, the first record is apportioned into multiple records, where the data in the target dimension in the first record is apportioned into the apportionment base related to the first record. The data in the target dimension in each record associated with the first record is allocated to the allocation ratio in the allocation ratio dimension in each record associated with the first record in the allocation base. The data corresponding to the respective values; The record associated with the first record in the apportionment base is a record in which the data in the associated dimension is the same as the data in the associated dimension in the first record; The name of the apportionment dimension It also includes the name of the associated dimension, and each record in the allocation base and the allocation object also includes the associated dimension.
21、 根据权利要求 Π至 20任意一项所述的设备, 其特征在于, 所述 程序, 还用于: 21. The device according to any one of claims 1 to 20, characterized in that the program is also used for:
在获得所述分摊基数中每条记录的分摊比例维度之前, 根据所述分摊 对象中目标维度中的数据, 对所述分摊对象中所有记录进行分组汇总。 Before obtaining the allocation proportion dimension of each record in the allocation base, all records in the allocation object are grouped and summarized based on the data in the target dimension in the allocation object.
22、 根据权利要求 17至 20任意一项所述的设备, 其特征在于, 所述 程序, 还用于: 获得所述分摊基数中每条记录的分摊比例维度之前, 根据 所述分摊基数中目标维度中的数据, 对所述分摊基数中所有记录进行分组 汇总。 22. The device according to any one of claims 17 to 20, characterized in that the program is also used to: before obtaining the allocation proportion dimension of each record in the allocation base, according to the target in the allocation base The data in the dimension is grouped and summarized for all records in the allocation base.
23、 根据权利要求 17至 20任意一项所述的设备, 其特征在于, 所述 程序, 还用于: 23. The device according to any one of claims 17 to 20, characterized in that the program is also used for:
获得所述分摊基数中每条记录的分摊比例维度之前, 根据所述分摊对 象中目标维度中的数据和关联维度中的数据, 对所述分摊对象中所有记录 进行分组汇总。
Before obtaining the allocation ratio dimension of each record in the allocation base, all records in the allocation object are grouped and summarized based on the data in the target dimension and the data in the associated dimension in the allocation object.
24、 根据权利要求 17至 20任意一项所述的设备, 其特征在于, 所述 程序, 还用于: 获得所述分摊基数中每条记录的分摊比例维度之前, 根据 所述分摊基数中目标维度中的数据和关联维度中的数据, 对所述分摊基数 中所有记录进行分组汇总。
24. The device according to any one of claims 17 to 20, characterized in that the program is also used to: before obtaining the allocation proportion dimension of each record in the allocation base, according to the target in the allocation base The data in the dimension and the data in the associated dimension are used to group and summarize all records in the allocation base.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410052619.7A CN103778247B (en) | 2014-02-17 | 2014-02-17 | Data apportion method, device and equipment |
CN201410052619.7 | 2014-02-17 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2015120696A1 true WO2015120696A1 (en) | 2015-08-20 |
Family
ID=50570482
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2014/083041 WO2015120696A1 (en) | 2014-02-17 | 2014-07-25 | Data apportioning method, apparatus and device |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN103778247B (en) |
WO (1) | WO2015120696A1 (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103778247B (en) * | 2014-02-17 | 2017-02-22 | 华为技术有限公司 | Data apportion method, device and equipment |
CN108629050B (en) * | 2018-05-16 | 2023-06-30 | 中国平安人寿保险股份有限公司 | Service data adjustment method, device, computer equipment and storage medium |
CN109002456B (en) * | 2018-05-24 | 2023-04-11 | 中国平安人寿保险股份有限公司 | Electronic device, data apportionment method, and computer-readable storage medium |
CN109034900A (en) * | 2018-07-26 | 2018-12-18 | 阿里巴巴集团控股有限公司 | A kind of processing method, system and the terminal device of the multi-dimensional data of business |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6047297A (en) * | 1997-01-13 | 2000-04-04 | Microsoft Corporation | Method and system for editing actual work records |
CN1420460A (en) * | 2001-11-20 | 2003-05-28 | 威盛电子股份有限公司 | Method for reversing entry |
CN101379501A (en) * | 2005-12-20 | 2009-03-04 | 罗纳德·罗森伯格 | Method, transaction card or identification system for transaction network |
CN102799658A (en) * | 2012-07-05 | 2012-11-28 | 北京智达方通科技有限公司 | Method for sharing multidimensional data |
CN103778247A (en) * | 2014-02-17 | 2014-05-07 | 华为技术有限公司 | Data apportion method, device and equipment |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1790397A (en) * | 2005-12-28 | 2006-06-21 | 浙江工业大学 | Third party logistics data processing method based on online analysis |
CN101706939A (en) * | 2009-11-04 | 2010-05-12 | 浪潮(山东)电子信息有限公司 | Transfer quantity-based expense allocation module suitable for banks |
-
2014
- 2014-02-17 CN CN201410052619.7A patent/CN103778247B/en active Active
- 2014-07-25 WO PCT/CN2014/083041 patent/WO2015120696A1/en active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6047297A (en) * | 1997-01-13 | 2000-04-04 | Microsoft Corporation | Method and system for editing actual work records |
CN1420460A (en) * | 2001-11-20 | 2003-05-28 | 威盛电子股份有限公司 | Method for reversing entry |
CN101379501A (en) * | 2005-12-20 | 2009-03-04 | 罗纳德·罗森伯格 | Method, transaction card or identification system for transaction network |
CN102799658A (en) * | 2012-07-05 | 2012-11-28 | 北京智达方通科技有限公司 | Method for sharing multidimensional data |
CN103778247A (en) * | 2014-02-17 | 2014-05-07 | 华为技术有限公司 | Data apportion method, device and equipment |
Also Published As
Publication number | Publication date |
---|---|
CN103778247B (en) | 2017-02-22 |
CN103778247A (en) | 2014-05-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107993151B (en) | Fund transaction clearing method, device, equipment and computer readable storage medium | |
WO2015120696A1 (en) | Data apportioning method, apparatus and device | |
US10565022B2 (en) | Systems for parallel processing of datasets with dynamic skew compensation | |
CN110233741B (en) | Service charging method, device, equipment and storage medium | |
CN110704519A (en) | Business document conversion method and device, storage medium and computer equipment | |
Taki | Classification of non‐symplectic automorphisms of order 3 on K3 surfaces | |
JP6303231B2 (en) | Resource combination processing method, apparatus, device, and program | |
US11294712B2 (en) | Method, device and computer program product for task management | |
CN105677645B (en) | A kind of tables of data comparison method and device | |
US20100205075A1 (en) | Large-scale item affinity determination using a map reduce platform | |
EP3384403A1 (en) | Spreadsheet with unit parsing | |
CN110048830B (en) | Data encryption and decryption method and encryption and decryption device | |
CN116303482B (en) | Multidimensional data storage and display method, device, equipment and medium | |
CN107330709A (en) | Determine the method and device of destination object | |
JP2013228701A (en) | Map mesh data generation system and mesh data generation method | |
WO2019218497A1 (en) | Cost allocation method and apparatus, electronic device, and medium | |
CN110008415A (en) | A kind of data object variation tendency determines method, apparatus and server | |
US10503560B2 (en) | Distributed processing control device | |
CN114696991A (en) | Homomorphic encryption-based data clustering method and device | |
CN114444114A (en) | Data processing method, device, equipment and storage medium | |
TWI649665B (en) | Privacy management system and method thereof | |
JP6927553B2 (en) | Information processing equipment, control methods, and programs | |
CN108595552A (en) | Data cube dissemination method, device, electronic equipment and storage medium | |
WO2013153620A1 (en) | Data processing system and data processing method | |
Najnudel et al. | On a flow of operators associated to virtual permutations |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 14882262 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 14882262 Country of ref document: EP Kind code of ref document: A1 |