Invention content
In view of the defects existing in the prior art, the present invention provides a kind of statistics list rapid generation based on metadata
And system, to solve the above problems.
The technical solution adopted by the present invention is as follows:
The present invention provides a kind of statistics list rapid generation based on metadata, includes the following steps:
S1 is created and is safeguarded multiple metadatabases;Each category of the metadatabase for storing report in the form of metadata
Property information, including attribute metadata library, measurement unit metadatabase, classification metadata library and shared index metadatabase;Its
In, attribute metadata library is for storing Criterion Attribute information;Measurement unit metadatabase is used to store the measurement unit letter of index
Breath;Classification metadata library is used to store multiple index name ID by index category classification, also, index classification is in inclusion relation,
Including the 1st grade of index, it is under the jurisdiction of the 2nd grade of index ... of the 1st grade of index according to analogize;Shared index metadatabase is for storing needle
To the mapping relations for the index name ID and index name of authorized user shared for multiple reports;
S2 creates the report form template of blank;
Define total Table Header information of report;Total Table Header information includes table number, report name, formulates organ, code, approval
One or more of code, report classification, report form type and report term of validity;Total Table Header information is defined in report mould simultaneously
Position on plate;
S3, after total Table Header information definition of report is completed, verification of correctness unit believes total gauge outfit of the report
Breath is verified, if be proved to be successful, continues S4;Otherwise, report generation fails;
S4, the main field for defining report form template are set and are set with guest's field, main field set it is upper generate main column, set in guest's field
Generate guest column;Main column and guest column are made of multiple main unit lattice;The intersection region on main column and guest column is data cells;
S5, will be in position relationship of the main unit lattice on each main column in the statistical form generated and each metadatabase
Specific metadata establish binding relationship;Based on the binding relationship, default correspondence is pressed to each main unit lattice on main column
It is directed respectively into " index name " field, " measurement unit " field, " guideline code " field and at least one specific index category
Property field;
By the tool in position relationship of each guest column main unit lattice in the statistical form generated and classification metadata library
Voxel data establishes binding relationship;Based on the binding relationship, classification metadata library is read, is inquired and " index name " field pair
The index name ID answered, then based on the index name ID found, inquiry request is sent to shared index metadatabase, shared
After index metadatabase is to transmitting terminal authentication success, search whether there is specific index name corresponding with index name ID
Claim, if so, then returning to specific index name to transmitting terminal;If it is not, returning to the notification message of inquiry failure;It sends
End customizes the specific index name of privately owned index property;Then, it is set to guest's field corresponding with " index name " field by finger
Mark classification is directed respectively into specific index name;To with " measurement unit " field and specific index name corresponding guest simultaneously
Field, which is set, imports specific measurement unit information;To with " code " field and specific index name corresponding guest's field simultaneously
It sets and imports specific code information, generate initial statistical list;
S6 defines data auditing rule corresponding with initial statistical list, access rights management information, report and shows pattern
And with the single-phase associated task scheduling interface of other statistical forms, generate final statistics list.
Preferably, in S6, the data auditing rule includes auditing rule between auditing rule and table in table;Wherein, described
Auditing rule is that the membership between the specific index name imported based on " index name " field is generated in table
Mathematic(al) representation;
Auditing rule is for dispatching relationship between the table between level relation and table and table between check list and table.
Preferably, the access rights management information is:With filling in the initial statistical list in data cells
Hold the user name and cipher list of permission;Registered user name can access and fill in the initial system only in the list
Count the data in data cells in list.
The present invention also provides a kind of statistics list quick-speed generation system based on metadata, including metadatabase management module
With Report Customization module;
The metadatabase management module, for defining and safeguard each metadatabase, including:
Attribute metadata library definition unit, measurement unit metadatabase definition unit, classification metadata library definition unit and
Shared index metadatabase definition unit;
Attribute metadata library definition unit is based on the general type mechanism of java, for customizing and management business report generation
Required Criterion Attribute in journey, including define data item type and data type;
The measurement unit metadatabase definition unit is based on the general type mechanism of java, for customizing and the life of management business report
At the measurement unit of required index in the process, including define data item type and data type;
Classification metadata library definition unit is based on industry class and divides basic library, is standard according to every profession and trade classification, point
Each index name of the class storage with inclusion relation;
The shared index metadatabase definition unit is used for for Business Entity type in bordereau, define index with
Derived relation between classification metadata library and expansion relation;
The Report Customization module includes report attribute definition unit, template definition unit, index definition unit, report sample
Formula definition unit, administration authority definition unit, access definition unit, preview definition unit;
The template definition unit is used to create the report form template of blank, then fixed in advance on the report form template of the blank
Total Table Header information of adopted report, including table number, report name, formulation organ, code, authentication code, report classification, report form type
And one or more of report term of validity;It is then based on java mapping mechanisms and generates an initial report in the database automatically
Table;
The report attribute definition unit is used on the basis of the initial report, further defines report show line base
This information is then based on java mapping relations and generates a set of contingency table;It is additionally operable to define report displaying row essential information, then base
A set of contingency table is generated in java mapping relations;
The report that the report style definition unit is used to obtain after defining the report attribute definition unit carries out cloth
Then office, typesetting and format editing use java mappings to generate pattern relation table;
The index definition unit is used to be based on current business report essential information, defines between index and pattern relation table
Relationship, and generate contingency table;
Administration authority definition unit, access definition unit, preview definition unit;
Criterion Attribute and index of the administration authority definition unit for defining generated report check the management of permission;
Rights management library is automatically generated by java reflex mechanisms;
The access definition unit is used to provide logical algorithm grammer for the report generated, maps machine with Hibernate
It is made as basis, then calls java interfaces to realize expression parsing function, expression parsing process, which calls radiation, has buffering
Effect;
The preview definition unit is used to be based on defined report messages, and complete report is shown by calling logic relationship
Table.
Beneficial effects of the present invention are as follows:
(1) management model level of control title and Criterion Attribute are used, Criterion Attribute and index name needed for report
Title can facilitate by searching for metadatabase and obtain, when index name and Criterion Attribute variation, it is only necessary to change metadata
Metadata in library need not change former report, that is, simplify investigation index and customize mode, user flexibility management is also facilitated to refer to
Library information is marked, solves the problems, such as that index adjustment difficulty is larger;
(2) by configuring structure of report rule, when structure of report changes, Report Engine is voluntarily adjusted according to variation
Structure of report generates new report, improves Report Customization flexibility;
(3) when report customization, since logic budget verifies and audits work(, it can be achieved that report is real-time between having the function of index
Can, greatly reduce report error rate, improves Report Customization accuracy;
(4) report timeliness can be improved with the self-defined report period, improves report investigation supervision simultaneously, also ensures
It makes a report on data age and makes a report on the authenticity of data.
Specific implementation mode
Below in conjunction with attached drawing, the present invention is described in detail:
The present invention provides a kind of statistics list rapid generation based on metadata, can rely on existing " Beijing's statistics
Acquisition platform in data set ", according to the pattern of " overall arrangement, hierarchical responsibility, gradually ripe, iterative method ", to mitigate base
The principle of statistical work burden, to innovate the Internet model as support, promotes data acquisition based on information-based means
Diversity, improve resident family participate in enthusiasm, improve collecting efficiency.
As shown in Figure 1, specifically including following steps:
S1 is created and is safeguarded multiple metadatabases;Each category of the metadatabase for storing report in the form of metadata
Property information, including attribute metadata library, measurement unit metadatabase, classification metadata library and shared index metadatabase;Its
In, attribute metadata library is for storing Criterion Attribute information;Measurement unit metadatabase is used to store the measurement unit letter of index
Breath;Classification metadata library is used to store multiple index name ID by index category classification, also, index classification is in inclusion relation,
Including the 1st grade of index, it is under the jurisdiction of the 2nd grade of index ... of the 1st grade of index according to analogize;Shared index metadatabase is for storing needle
To the mapping relations for the index name ID and index name of authorized user shared for multiple reports;
As shown in Fig. 2, the statistics list that the statistics list rapid generation to provide through the invention is generated
Specific example, Fig. 3 be Fig. 2 continued;With reference to Fig. 2 and Fig. 3, it is conveniently even further appreciated that some concepts of the present invention:
The Criterion Attribute information that attribute metadata library is stored refers to relevant with index name and is needed for this statistics list
Some to be counted parameters are in Fig. 2:Practical sown area, crops occupy cultivated land area, the per mu yield of broadcasting area, reality (in advance
Production) yield etc..It is said for storage attribute coding, Property Name, attribute in addition, the Criterion Attribute information that is stored of metadatabase is practical
Bright and attribute data type mapping relations;As shown in table 1, it is a kind of specific storage example in attribute metadata library:
Table 1
Attribute coding |
Property Name |
Attribute specification |
Attribute data type |
T120 |
Practical sown area |
Nothing |
Text |
T121 |
Crops occupy cultivated land area |
Nothing |
Text |
T122 |
Quantity |
Nothing |
Number |
In addition, minimum unit, that is, metadata of the Criterion Attribute as report, entire platform realizes metadata pipe end to end
Reason pattern, all Criterion Attribute customizations are operated by administrator, and index customization foundation Criterion Attribute is as basic unit, then
It being defined by being associated between Criterion Attribute and index, index customization is audited after completing, after audit passes through,
Index side can be put into shared index metadatabase and be used, just can only be to specific report form template if it is privately owned index
It is associated.
The index computation unit information that measurement unit metadatabase is stored is:Need the metering of each Criterion Attribute counted
Unit, such as:Mu, kilogram, ton etc..
It classification metadata library can be by each index name of tree structure classification storage, as shown in figure 4, being classification metadata library
A kind of specific example.
Metadata is the descriptive data information about data, illustrate data content, quality, situation and other in relation to feature
Background information.Metadata can promote the efficient utilization of data set, help the effective maintenance and management number of data production unit
According to;Metadata can improve the autgmentability of data, facilitate extended counter information.Data sharing, Neng Goubao are convenient for using metadata
It demonstrate,proves the accuracys of data, consistency and manages end to end.Therefore, in the present invention, each metadatabase is with the side of metadata
Formula stores particular content.
In addition, it is necessary to explanation, in of the invention, the metadata quantity and classification that each metadatabase is stored can roots
According to statistics the case where office's investigation business, real-time update is carried out, to ensure to count the generation of list.
S2 creates the report form template of blank;
Define total Table Header information of report;Total Table Header information includes table number, report name, formulates organ, code, approval
One or more of code, report classification, report form type and report term of validity;Total Table Header information is defined in report mould simultaneously
Position on plate;
With reference to figure 2, table number is A202-2 tables, and report name is:Staple crops occupy cultivated land area and it is expected that, practical production
Amount;Formulation organ is Beijing Statistics Bureau, Beijing investigation army unit of State Statistics Bureau;Code:Capital system hair【2012】No. 68;Approval text
Number:State's controlling【2012】No. 117;Report valid until:In January, 2014.
During generating Fig. 2, need to define position of total Table Header information on report form template be:1-7 rows,
1-6 arranges formed region.
S3, after total Table Header information definition of report is completed, verification of correctness unit believes total gauge outfit of the report
Breath is verified, if be proved to be successful, continues S4;Otherwise, report generation fails;
S4, the main field for defining report form template are set and are set with guest's field, main field set it is upper generate main column, set in guest's field
Generate guest column;Main column and guest column are made of multiple main unit lattice;The intersection region on main column and guest column is data cells;
During generating Fig. 2, it is that main field sets the 1st and is classified as guest's field and sets to need to define eighth row.Main unit lattice are
Store the cell of specific field;Data cells are the cell for filling in statistical data.
S5, will be in position relationship of the main unit lattice on each main column in the statistical form generated and each metadatabase
Specific metadata establish binding relationship;Based on the binding relationship, default correspondence is pressed to each main unit lattice on main column
It is directed respectively into " index name " field, " measurement unit " field, " guideline code " field and at least one specific index category
Property field;Wherein, " index name " field refers to during generating statistical form, each specific for what is arrived involved in the statistical form
The unique mark that index name assigns respectively, the mark in rear continued or between table for auditing.With reference to figure 2, " cereal crops "
Guideline code is set as 01, and the guideline code of " cereal " is set as 02, and the guideline code of " paddy " is set as 03 etc..
In addition, due in the present invention, by position relationship of each main unit lattice in the statistical form generated with it is each
Specific metadata in metadatabase establishes binding relationship, such as:Position relationship is:Eighth row the 3rd arranges;With attribute metadata library
In " practical sown area " establish binding relationship;Then after this report generation, if report other content is constant, it is only necessary to
The row of eighth row the 3rd are changed to other Criterion Attributes, then the binding relationship are directly changed, without re-establishing one again
The report of Zhang Xin, to simplify the process of report generation.
By the tool in position relationship of each guest column main unit lattice in the statistical form generated and classification metadata library
Voxel data establishes binding relationship;Based on the binding relationship, classification metadata library is read, is inquired and " index name " field pair
The index name ID answered, then based on the index name ID found, inquiry request is sent to shared index metadatabase, shared
After index metadatabase is to transmitting terminal authentication success, search whether there is specific index name corresponding with index name ID
Claim, if so, then returning to specific index name to transmitting terminal;If it is not, returning to the notification message of inquiry failure;It sends
End customizes the specific index name of privately owned index property;Then, it is set to guest's field corresponding with " index name " field by finger
Mark classification is directed respectively into specific index name;To with " measurement unit " field and specific index name corresponding guest simultaneously
Field, which is set, imports specific measurement unit information;To with " code " field and specific index name corresponding guest's field simultaneously
It sets and imports specific code information, generate initial statistical list;
S6 defines data auditing rule corresponding with initial statistical list, access rights management information, report and shows pattern
And with the single-phase associated task scheduling interface of other statistical forms, generate final statistics list.
Report shows that style definitions refer to:Report layouts and format of the definition with the binding of this report, after the completion of binding, pass through
Java Reflection mechanism automatically generates a set of mapping table.
Task scheduling interface refers to:The current statistical report form formulated, can directly invoke other systems for having formulated completion
The relevant parameters such as survey data, report style or the report form index of report are counted, to simplify report formulation process.
Data auditing rule includes auditing rule between auditing rule and table in table;Wherein, auditing rule is to be based on " referring in table
Entitling claims " mathematic(al) representation that is generated of the membership between the specific index name that is imported of field;For by Fig. 2 and
The sample report that Fig. 3 is formed can define auditing rule in following table:
Row relationship:(1) 01=02+11+15
(2) 02=03+04+07+08+09+10
(3) 04=05+06
(4)11≥12+13+14
(5) 16=17+22+23+24+28
(6) 17=18+19+20+21
(7)24≥25+26+27
(8) 29=30+37+40+41+42+43
(9) 30=31+35
(10)31≥32+33
(11)31≥34
(12)35≥36
(13) 37=38+39
Row relationship:(1)1≥2
(2) 3=4 × (1000) ÷ 1 or ÷ of 4=1 × 3 (1000)
(12)35≥36
(13) 37=38+39
Due to during generating report, defining auditing rule in table, therefore, when generation statistical report form, and receive
After each data cells have filled in the statistical report form of specific data content, can auditing rule in the automatic running table, to each number
Audited according to the data content that cell is filled in, if there is with the incongruent data of auditing rule in table, then directly to
Go out prompt.
Auditing rule is for dispatching relationship between table between level relation and table and table between check list and table.
In addition, in specific implementation, auditing rule includes audit condition, audit target (attribute, unit) and audit mode;It examines
Core condition is a mathematic(al) representation for including arithmetic operator and Boolean calculation, and can generate complexity by dynamic combined mode
Logical operation.Audit mode includes being audited between audit and table in table, can be automatically generated audit target and audit condition multiple
Miscellaneous logical expression.The parsing of expression formula is built upon on the data basis of the report form template met, and is reflected with java
Calling interface realizes that expression parsing process calls radiation and plays cushioning effect, avoids repeated reflection calling, improves solution
The efficiency of analysis.
Access rights management information is:With fill in initial statistical list the user name of data cells content rights and
Cipher list;Registered user name can be accessed and be filled in initial statistical list in data cells only in the list
Data.In addition, also defining checking permission and filling in permission for generated report, by report, index, permission and the power of filling in are checked
Limit is bound, and a set of authority relation table is automatically generated.Therefore, in subsequent process, the use of permission is only checked with this report
Family can just check this report;Only the user with this filling report forms permission can just fill in this report, to ensure report
Issue the safety of process.
In addition, in the present invention, after the raw statement of costs, in such a way that java autotasks are dispatched, can automatically generate down
Grade report.
The present invention also provides a kind of statistics list quick-speed generation system based on metadata, including metadatabase management module
With Report Customization module;
The metadatabase management module, for defining and safeguard each metadatabase, including:
Attribute metadata library definition unit, measurement unit metadatabase definition unit, classification metadata library definition unit and
Shared index metadatabase definition unit;
Attribute metadata library definition unit is based on the general type mechanism of java, for customizing and management business report generation
Required Criterion Attribute in journey, including define data item type and data type;
The measurement unit metadatabase definition unit is based on the general type mechanism of java, for customizing and the life of management business report
At the measurement unit of required index in the process, including define data item type and data type;
Classification metadata library definition unit is based on industry class and divides basic library, is standard according to every profession and trade classification, point
Each index name of the class storage with inclusion relation;
The shared index metadatabase definition unit is used for for Business Entity type in bordereau, define index with
Derived relation between classification metadata library and expansion relation;
The Report Customization module includes report attribute definition unit, template definition unit, index definition unit, report sample
Formula definition unit, administration authority definition unit, access definition unit, preview definition unit;
The template definition unit is used to create the report form template of blank, then fixed in advance on the report form template of the blank
Total Table Header information of adopted report, including table number, report name, formulation organ, code, authentication code, report classification, report form type
And one or more of report term of validity;It is then based on java mapping mechanisms and generates an initial report in the database automatically
Table;
The report attribute definition unit is used on the basis of the initial report, further defines report show line base
This information is then based on java mapping relations and generates a set of contingency table;It is additionally operable to define report displaying row essential information, then base
A set of contingency table is generated in java mapping relations;
The report that the report style definition unit is used to obtain after defining the report attribute definition unit carries out cloth
Then office, typesetting and format editing use java mappings to generate pattern relation table;
The index definition unit is used to be based on current business report essential information, defines between index and pattern relation table
Relationship, and generate contingency table;
Administration authority definition unit, access definition unit, preview definition unit;
Criterion Attribute and index of the administration authority definition unit for defining generated report check the management of permission;
Rights management library is automatically generated by java reflex mechanisms;
The access definition unit is used to provide logical algorithm grammer for the report generated, maps machine with Hibernate
It is made as basis, then calls java interfaces to realize expression parsing function, expression parsing process, which calls radiation, has buffering
Effect;
The preview definition unit is used to be based on defined report messages, and complete report is shown by calling logic relationship
Table.
In conclusion statistics list rapid generation and system provided by the invention based on metadata, have following
Advantage:
(1) management model level of control title and Criterion Attribute are used, Criterion Attribute and index name needed for report
Title can facilitate by searching for metadatabase and obtain, when index name and Criterion Attribute variation, it is only necessary to change metadata
Metadata in library need not change former report, that is, simplify investigation index and customize mode, user flexibility management is also facilitated to refer to
Library information is marked, solves the problems, such as that index adjustment difficulty is larger;
(2) by configuring structure of report rule, when structure of report changes, Report Engine is voluntarily adjusted according to variation
Structure of report generates new report, improves Report Customization flexibility;
(3) Report Customization process can be completed Report Customization by graphical interfaces mode of operation completely, have without coding
The simple advantage of Report Customization process;
(4) when report customization, since logic budget verifies and audits work(, it can be achieved that report is real-time between having the function of index
Can, greatly reduce report error rate, improves Report Customization accuracy;
(5) report timeliness can be improved with the self-defined report period, improves report investigation supervision simultaneously, also ensures
It makes a report on data age and makes a report on the authenticity of data.
(6) have and efficiently send and recycle report mechanism, can quickly send report and recycle the report number that user submits
According to, and provide and summarize data function automatically, ensure " fast, essence, the standard " of statistical data.
The above is only a preferred embodiment of the present invention, it is noted that for the ordinary skill people of the art
For member, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications are also answered
Depending on protection scope of the present invention.