CN109740129B - Report generation method, device and equipment based on blockchain and readable storage medium - Google Patents

Report generation method, device and equipment based on blockchain and readable storage medium Download PDF

Info

Publication number
CN109740129B
CN109740129B CN201811360953.3A CN201811360953A CN109740129B CN 109740129 B CN109740129 B CN 109740129B CN 201811360953 A CN201811360953 A CN 201811360953A CN 109740129 B CN109740129 B CN 109740129B
Authority
CN
China
Prior art keywords
data
attribute
target
statistical view
report
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811360953.3A
Other languages
Chinese (zh)
Other versions
CN109740129A (en
Inventor
李洪
江琳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201811360953.3A priority Critical patent/CN109740129B/en
Publication of CN109740129A publication Critical patent/CN109740129A/en
Application granted granted Critical
Publication of CN109740129B publication Critical patent/CN109740129B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses a report generation method, device and equipment based on a blockchain and a readable storage medium, which relate to the technical field of blockchains, can generate a statistical view of target data attributes, directly extract data of the target data attributes based on the statistical view, directly generate a data statistical report, reduce the difficulty of data statistics and analysis, and simplify the process of generating the data statistical report. The method comprises the following steps: receiving a report generation request of a user; according to the target attribute type of the target data attribute, sorting the state database to generate a statistical view of the target attribute type; extracting target data from the statistical view based on the target data attribute, wherein the target data is a data group of which the data attribute in the statistical view meets the requirement of the target data attribute; and acquiring a preset template, and sorting target data according to the preset template to generate a data statistics report.

Description

Report generation method, device and equipment based on blockchain and readable storage medium
Technical Field
The present invention relates to the field of blockchain technologies, and in particular, to a blockchain-based report generating method, device, equipment, and readable storage medium.
Background
In recent years, with rapid development of data processing technology, blockchain technology is rapidly rising worldwide. Blockchains are an important concept of bitcoin, first proposed by Zhong Bencong in 2008, and in the following years, blockchains become a core component of electronic money bitcoin. It is simply understood that a "block" in a blockchain refers to blocks of information that are interconnected with one another, and that the resulting chain of blocks of information is referred to as a blockchain. The blockchain is a distributed account book, and the technical scheme of collectively maintaining a reliable database in a mode of decentralizing and removing information is widely applied to data storage of various enterprises because the blockchain has the characteristic of non-falsification, and the enterprises generate data statistics based on the blockchain.
In the related art, when an enterprise generates a data statistics report, it is generally required to store data in a blockchain in relation data correspondingly, extract data to be counted in the relation data, and complete statistics of the data report based on the data to be counted.
In carrying out the present invention, the inventors have found that the related art has at least the following problems:
Because both the blockchain and the relational data store data in the form of blocks, when the statistics of the data report is carried out, the data is basically checked according to blocks or transactions, and if the statistics of the data with specific attributes is carried out, the difficulty of data statistics and analysis is high, so that the process of generating the data statistics report is complicated.
Disclosure of Invention
In view of the above, the present invention provides a report generating method, device, equipment and readable storage medium based on blockchain, which mainly aims to solve the problem that the current process of generating a data statistics report is complicated due to the difficulty of larger data statistics and analysis.
According to a first aspect of the present invention, there is provided a blockchain-based report generation method, the method comprising:
receiving a report generation request of a user, wherein the report generation request carries target data attributes and is used for requesting a report generated aiming at service data indicated by data identification in a block chain;
according to the target attribute type of the target data attribute, a state database is arranged to generate a statistical view of the target attribute type, and the state database is used for storing service data indicated by a data identifier in the blockchain;
Extracting target data in the statistical view based on the target data attribute, wherein the target data is a data group of which the data attribute in the statistical view meets the requirement of the target data attribute;
and acquiring a preset template, and sorting the target data according to the preset template to generate a data statistics report.
In another embodiment, the sorting the state database according to the target attribute type of the target data attribute, and generating the statistical view of the target attribute type includes:
determining a target attribute type of the target data attribute;
respectively determining data attributes of each data in the state database, which are matched with the target attribute types, and sorting at least one data with consistent data attributes in the state database into a data group to obtain a plurality of data groups;
and taking the plurality of data sets as a statistical view of the target attribute type.
In another embodiment, the extracting the target data in the statistical view based on the target data attribute includes:
determining at least one data attribute of at least one data group in the statistical view respectively, wherein the statistical view is generated according to the at least one data attribute, and the attribute types of the at least one data attribute are consistent;
And acquiring a target data set corresponding to the data attribute consistent with the target data attribute in the at least one data attribute, and taking the target data set as the target data.
In another embodiment, the method further comprises:
when a data modification request is received, extracting modification data from the data modification request, and determining modification data attributes of the modification data;
and storing the modification data and the modification data attribute into the state database correspondingly.
In another embodiment, the method further comprises:
detecting whether a statistical view to be modified corresponding to the modification data attribute exists or not;
if the statistical view to be modified corresponding to the modification data attribute exists, acquiring the statistical view to be modified, and writing the modification data and the modification data attribute into the statistical view to be modified;
and if the statistical view to be modified corresponding to the modified data attribute does not exist, ending the current flow.
In another embodiment, the method further comprises:
when a data query request is received, extracting data attributes to be queried from the data query request;
Determining the attribute type to be queried of the data attribute to be queried, and determining a statistical view to be queried indicated by the data type to be queried;
and extracting query data indicated by the attribute of the data to be queried from the statistical view to be queried, and returning the query data.
According to a second aspect of the present invention, there is provided a blockchain-based report generating apparatus, the apparatus comprising:
the system comprises a receiving module, a processing module and a processing module, wherein the receiving module is used for receiving a report generation request of a user, the report generation request carries target data attributes, and the report generation request is used for requesting a report generated aiming at service data indicated by data identification in a blockchain;
the sorting module is used for sorting a state database according to the target attribute type of the target data attribute to generate a statistical view of the target attribute type, and the state database is used for storing service data indicated by the data identification in the blockchain;
the first extraction module is used for extracting target data in the statistical view based on the target data attribute, wherein the target data is a data group of which the data attribute in the statistical view meets the requirement of the target data attribute;
The generation module is used for acquiring a preset template, sorting the target data according to the preset template and generating a data statistics report.
In another embodiment, the collation module comprises:
a determining submodule, configured to determine a target attribute type of the target data attribute;
the sorting sub-module is used for respectively determining the data attribute of each data in the state database matched with the target attribute type, and sorting at least one data with consistent data attribute in the state database into a data group to obtain a plurality of data groups;
and the storage sub-module is used for taking the plurality of data sets as a statistical view of the target attribute type.
In another embodiment, the first extraction module includes:
a determining submodule, configured to determine at least one data attribute of at least one data group in the statistical view, where the statistical view is generated according to the at least one data attribute, and attribute types of the at least one data attribute are consistent;
and the storage sub-module is used for acquiring a target data set corresponding to the data attribute consistent with the target data attribute in the at least one data attribute, and taking the target data set as the target data.
In another embodiment, the apparatus further comprises:
the determining module is used for extracting modification data from the data modification request when the data modification request is received, and determining modification data attributes of the modification data;
and the storage module is used for storing the modification data and the modification data attribute into the state database correspondingly.
In another embodiment, the apparatus further comprises:
the detection module is used for detecting whether a statistical view to be modified corresponding to the modification data attribute exists or not;
the writing module is used for acquiring the statistical view to be modified if the statistical view to be modified corresponding to the modification data attribute exists, and writing the modification data and the modification data attribute into the statistical view to be modified;
and the ending module is used for ending the current flow if the statistical view to be modified corresponding to the modification data attribute does not exist.
In another embodiment, the apparatus further comprises:
the second extraction module is used for extracting the attribute of the data to be queried from the data query request when the data query request is received;
the acquisition module is used for acquiring the attribute type to be queried of the data attribute to be queried and determining a statistical view to be queried indicated by the data type to be queried;
And the query module is used for extracting query data indicated by the attribute of the data to be queried from the statistical view to be queried and returning the query data.
According to a third aspect of the present invention there is provided an apparatus comprising a memory storing a computer program and a processor implementing the steps of the method of the first aspect described above when the computer program is executed by the processor.
According to a fourth aspect of the present invention there is provided a readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the method of the first aspect described above.
By means of the technical scheme, compared with the mode of checking and counting data according to blocks or transactions at present, the report generating method, device and equipment based on the block chain and the readable storage medium provided by the invention are used for counting data in the state database according to the target data attribute carried in the report request, and generating the statistical view of the target data attribute, so that the extraction of data of the target data attribute can be directly realized based on the statistical view, and a data statistical report can be directly generated, the difficulty of data statistics and analysis is reduced, and the process of generating the data statistical report is simplified.
The foregoing description is only an overview of the present invention, and is intended to be implemented in accordance with the teachings of the present invention in order that the same may be more clearly understood and to make the same and other objects, features and advantages of the present invention more readily apparent.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to designate like parts throughout the figures. In the drawings:
FIG. 1 shows a schematic flow diagram of a report generation method based on a blockchain according to an embodiment of the present invention;
FIG. 2 illustrates a block chain based report generating system architecture diagram provided by an embodiment of the present invention;
FIG. 3A is a schematic flow diagram of a report generation method based on a blockchain according to an embodiment of the present invention;
FIG. 3B is a schematic flow diagram of a report generation method based on a blockchain according to an embodiment of the present invention;
FIG. 3C is a schematic flow diagram of a report generation method based on a blockchain according to an embodiment of the present invention;
FIG. 4A is a schematic diagram illustrating a report generating device based on a blockchain according to an embodiment of the present invention;
FIG. 4B is a schematic diagram illustrating a report generating device based on a blockchain according to an embodiment of the present invention;
FIG. 4C is a schematic diagram illustrating a report generating device based on a blockchain according to an embodiment of the present invention;
FIG. 4D is a schematic diagram illustrating a report generating device based on a blockchain according to an embodiment of the present invention;
FIG. 4E is a schematic diagram illustrating a report generating device based on a blockchain according to an embodiment of the present invention;
FIG. 4F is a schematic diagram illustrating a report generating device based on a blockchain according to an embodiment of the present invention;
fig. 5 shows a schematic structural diagram of an apparatus according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present invention are shown in the drawings, it should be understood that the present invention may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
The embodiment of the invention provides a report generating method based on a blockchain, which can directly count data in a state database according to target data attributes carried in a report request, generate a statistical view of the target data attributes, realize data extraction directly based on the statistical view, and directly generate a data statistical report, thereby achieving the purposes of reducing the difficulty of data statistics and analysis and simplifying the process of generating the data statistical report, and the method comprises the following steps as shown in figure 1:
101. and receiving a report generation request of a user, wherein the report generation request carries target data attributes, and the report generation request is used for requesting a report generated aiming at service data indicated by data identification in a blockchain.
In the embodiment of the invention, because the requirements of different users on the data statistics report are different, in order to generate the data statistics report according to the requirements of the users, the report generation request of the users needs to carry the target data attribute, so that the report generation system can receive the report generation request carrying the target data attribute.
102. And according to the target attribute type of the target data attribute, sorting a state database to generate a statistical view of the target attribute type, wherein the state database is used for storing service data indicated by the data identification in the block chain.
In the embodiment of the invention, since the target data attribute is only one group of data in the attribute types described by the target data attribute, the state database can be sorted according to the target attribute type of the target data attribute, so that a statistical view of the target attribute type is generated, and the group of data indicated by the target data attribute can be directly extracted from the statistical view of the target attribute type. The method for determining the target attribute type of the target data attribute is not particularly limited.
103. And extracting target data from the statistical view based on the target data attribute, wherein the target data is a data group of which the data attribute in the statistical view meets the requirement of the target data attribute.
In the embodiment of the invention, after the statistical view of the target attribute type is generated, the data included in the statistical view is obtained by adopting the standard statistics of the target attribute type, so that after the statistical view is generated, a data group with the data attribute meeting the requirement of the target data attribute can be extracted from the statistical view based on the target data attribute, and the data group is taken as target data.
104. And acquiring a preset template, and sorting target data according to the preset template to generate a data statistics report.
In the embodiment of the invention, in order to ensure that the generated data statistics report meets the requirement of the data statistics report, the generated data statistics report is prevented from being unable to be normally used, a preset template can be set in the report generation system, so that target data is sorted according to the preset template, and further the data statistics report is generated. The preset templates can be one or more, and provide template selection service for users, and the users can select the preset templates which are expected to be used, so that the report generation system can generate a data statistical report according to the preset templates selected by the users, and the generated data statistical report is ensured to meet the requirements of the users.
According to the method provided by the embodiment of the invention, the data in the state database is counted according to the target data attribute carried in the report request, and the statistical view of the target data attribute is generated, so that the extraction of the data of the target data attribute can be directly realized based on the statistical view, the data statistical report is directly generated, the difficulty of data statistics and analysis is reduced, and the process of generating the data statistical report is simplified.
Before explaining the present invention in detail, a brief description of the blockchain system to which the present invention relates will be provided.
Referring to fig. 2, a blockchain system refers to a system for data sharing between nodes, which may be a blockchain system of Hyper Ledger Fabric (super ledger construction) structure, in which a plurality of nodes are included, and the nodes may be in the form of orgs (organizations). In order to ensure the information intercommunication in the blockchain system, information connection can exist between every two nodes in the blockchain system, and the nodes can transmit information through the information connection. For example, when any node in the blockchain system receives data, all nodes in the blockchain system store the data as data in the blockchain system, so that the data stored on all nodes in the blockchain system are consistent. Each node can be provided with a report generating system, and a user can realize statistics on data based on the report generating system in the node so as to generate a data statistical report.
The embodiment of the invention provides a report generating method based on a blockchain, which can directly count data in a state database according to target data attributes carried in a report request, generate a statistical view of the target data attributes, realize data extraction directly based on the statistical view, and directly generate a data statistical report, thereby achieving the purposes of reducing the difficulty of data statistics and analysis and simplifying the process of generating the data statistical report, and the method comprises the following steps:
301. And receiving a report generation request of the user.
In the embodiment of the invention, the report generating system supports the generation of various reports of different types, so that in order to clearly define the willingness of a user to generate the report, the user is ensured to generate a desired data statistics report, and a report generating request needs to carry target data attributes so as to generate the data statistics report related to the target data attributes according to the target data attributes.
Wherein the user can use the services provided by the report generating system by downloading the client of the report generating system. The client can provide a report generation portal, when the user is detected to trigger the report generation portal, a report generation page comprising a target data attribute input box is displayed, when the user is detected to confirm the report generation page, the report generation request of the user is confirmed to be received, and the target data attribute input by the user in the target data attribute input box is acquired. Specifically, the target data attribute may be person a, time B, place C, or the like.
302. And according to the target attribute type of the target data attribute, sorting the state database to generate a statistical view of the target attribute type.
In the embodiment of the invention, according to the data statistics report expected to be generated by a user according to the target data attribute carried in the report generation request, in order to facilitate the extraction of the data conforming to the target data attribute, thereby generating the data statistics report, the target attribute type of the target data attribute can be determined, and the state database of the block chain can be sorted by adopting the target attribute type, thereby generating the statistics view taking the target attribute type as the standard.
Wherein, the state database stores business data indicated by the data identification included in the blockchain. The status database may be a Couch DB (Cluster Of Unreliable Commodity Hardware Data Base, open-source document-oriented database management system), in the blockchain of the Hyper Ledger Fabric structure, data identifiers for indicating data, that is, keys (identifiers) of data, are stored in the blocks of the blockchain, and data related to the service is stored in the status database. Because only the data identification is stored in the blocks of the block chain and the specific data is stored in the state database, the data statistics in each block is not needed, the data arrangement is directly carried out on the state database, and a statistical view is created for the state database. Specifically, the statistical view may be a view, and the function of the statistical view is to perform statistics on data with the same attribute, so as to facilitate subsequent data extraction. The method can be realized through the following steps one to three when the state database is arranged to generate the statistical view of the target attribute type.
Step one, determining the target attribute type of the target data attribute.
Wherein, for the data matching the target data attribute can be directly extracted based on the created statistical view, the statistical view needs to be generated according to the target attribute type of the target data attribute when being generated, and therefore, the target attribute type of the target data attribute needs to be determined. When determining the target attribute type of the target data attribute, a keyword in the target data attribute can be extracted, and the keyword is used as the target attribute type of the target data attribute. For example, if the target data attribute is person a, a keyword "person" of the target data attribute may be extracted as a target attribute type; if the target data attribute is time B, extracting a keyword time of the target data attribute as a target attribute type; if the target data attribute is place C, the keyword "place" of the target data attribute may be extracted as the target attribute type.
And step two, respectively determining the data attribute of each data in the state database, which is matched with the target attribute type, and sorting at least one data with consistent data attribute in the state database into a data group to obtain a plurality of data groups.
And after determining the target attribute type of the target data attribute, counting the data in the state database by adopting the target attribute type. When the data statistics is carried out on the state database, the data attribute of each data in the state database, which is matched with the target attribute type, is respectively determined, and at least one data with the consistent data attribute in the state database is organized into a data group, so that a plurality of data groups are obtained. For example, if the target attribute type is a task, all data of the character a, the character B and the character C in the state database may be counted according to the character, so as to obtain data sets of the character a, the character B and the character C respectively; if the target attribute type is time, respectively counting all data of the time D, the time E and the time F in a state database according to the time to respectively obtain data sets of the time D, the time E and the time F; if the target attribute type is location, all data of the location G, the location H and the location I in the state database can be counted according to time to obtain data sets of the location G, the location H and the location I respectively.
And thirdly, taking the plurality of data sets as a statistical view of the target attribute type.
After obtaining the plurality of data sets, the plurality of data sets can be used as a statistical view of the target attribute type so as to extract target data matching the target data attribute based on the statistical view.
It should be noted that, in the process of actual application, the statistical view generating process shown in the above steps one to three may be generated immediately when the state database is created, and it is not necessary to wait for the report generating request to be received. Because no user provides the target data attribute when the statistical view is generated during the creation of the state database, the preset attribute type can be set, and the statistical view is generated based on the preset attribute type, so that the statistical view can be directly obtained for data statistics when the data statistics is performed later, and the time for generating the data statistics report is shortened if the target attribute type is consistent with the preset attribute type. If the preset attribute types are multiple, a statistical view can be generated for each preset attribute type, so that a plurality of statistical views are generated, and the preset attribute types and the statistical views are stored in a one-to-one correspondence. The embodiment of the invention does not specifically limit the time for generating the statistical view.
In addition, the target data attribute may not be one data attribute, but may be composed of two or more data attributes, for example, the target data attribute may be a person a and a time period J, so that when determining the target attribute type, any data attribute may be selected, the attribute type of the data attribute is taken as the target attribute type, and when generating the statistical view, only the statistical view of the selected target attribute type is generated, and no statistical view is generated for other data attributes. The number of the data attributes included in the target data attributes is not particularly limited in the embodiment of the invention.
303. And respectively determining at least one data attribute of at least one data group in the statistical view, acquiring a target data group corresponding to the data attribute consistent with the target data attribute in the at least one data attribute, and taking the target data group as target data.
In the embodiment of the invention, the target data is a data group with data attributes meeting the requirements of the target data attributes in the statistical view. Since the at least one data set is generated according to the target attribute type and only the data attributes are different, after the statistical view is generated, at least one data attribute of the at least one data set in the statistical view is respectively determined, a target data set corresponding to the data attribute consistent with the target data attribute is acquired from the at least one data attribute, and the target data set is used as target data.
For example, if the target data attribute is person a, a data group concerning person a is extracted as target data in at least one data group concerning person a. In the practical application process, since there may be more than one target data attribute, that is, there may be two or more than two target data attributes, for example, person a and time J, it is necessary to acquire a target data set indicated by the target data attribute, and extract the specified data of the target data attribute indication range from the target data set, and take the specified data as target data. For example, assuming that the target data attribute is a person a and a period J, a statistical view is generated from the target attribute type "person", it is possible to determine a target data group concerning the person a in the statistical view, and extract the specified data of the period J as target data in the target data group concerning the person a.
304. And acquiring a preset template, and sorting target data according to the preset template to generate a data statistics report.
In the embodiment of the invention, when the target data is acquired, the data statistics report can be generated based on the target data. The method includes the steps that when a data statistics report is generated, a preset template is set, when the data statistics report is generated, the preset template is obtained, target data are sorted according to the preset template, and therefore the data statistics report with the format meeting the requirements is generated.
In addition, considering that the format requirements of the data statistics of different types are different, a preset template corresponding to each attribute type can be set for each attribute type, when the data statistics are generated, a specified preset template corresponding to the attribute type is obtained, and the data statistics are generated based on the specified preset template. The number of the preset templates is not particularly limited in the embodiment of the invention.
It should be noted that, because the number of the generated data statistics forms is large, in order to distinguish the data statistics forms, the data statistics forms may be named by using the target data attribute, and then the data statistics forms may be queried by using the target data attribute in the following.
In the practical application process, the user may request to modify the data in the state database, where the state database belongs to the database for storing data attached to the blockchain system, and also uses the blockchain to store data according to the manner of storing data by the blockchain, and it is intended to determine that the block where the modified data is located is a complex event, so, in order to simplify the modification process of the data, the present invention rewrites the modified data into the state database of the blockchain without modifying the data already stored before, and referring to fig. 3B, the method includes:
305. When a data modification request is received, modification data is extracted from the data modification request, modification data attributes of the modification data are determined, and the modification data attributes are stored in a state database correspondingly.
In the embodiment of the invention, the data modification request carries modification data, and the state database is used for storing the data, so that when the data modification request is received, the modification data is extracted from the data modification request, the modification data attribute of the modification data is determined, and the modification data attribute are correspondingly stored in the state database.
306. Detecting whether there is a statistical view to be modified corresponding to the modified data attribute, and if there is a statistical view to be modified corresponding to the modified data attribute, executing the following step 307; if there is no statistical view to be modified corresponding to the modified data attribute, then the following step 308 is performed.
In the embodiment of the present invention, considering that some data attributes already correspond to the generated statistical views, if the data corresponding to the data attributes in the state database needs to be modified at this time, the statistical views corresponding to the data attributes also need to be modified, so after determining the modified data attributes of the modified data, whether there is a statistical view to be modified corresponding to the modified data attributes is detected, and if there is a statistical view to be modified corresponding to the modified data attributes, the statistical view to be modified also needs to be modified, that is, the following step 307 is executed; if there is no statistical view to be modified corresponding to the modified data attribute, it indicates that no statistical view corresponding to the modified data attribute is currently generated, and the statistical view is not required to be modified, that is, the following step 308 is performed.
307. And if the statistical view to be modified corresponding to the modification data attribute exists, acquiring the statistical view to be modified, and writing the modification data and the modification data attribute into the statistical view to be modified.
In the embodiment of the invention, because the statistical views are generated according to the attribute types, if the statistical views to be modified corresponding to the modified data attributes exist, the statistical views indicated by the modified data attributes are obtained according to the modified data attributes to serve as the statistical views to be modified, and the modified data attributes are correspondingly written into the statistical views to be modified, so that the data update of the statistical views to be modified is realized, and the consistency of the data included in the statistical views to be modified and the data in the state database is ensured.
308. And if the statistical view to be modified corresponding to the modified data attribute does not exist, ending the current flow.
In the embodiment of the invention, if the statistical view to be modified corresponding to the modified data attribute does not exist, the statistical view to be modified corresponding to the modified data attribute is not generated at present, and the current flow is finished without modifying the statistical view.
In the practical application process, since the data in the blockchain is changed in real time, the state database can monitor the data change in real time, when receiving the newly written data, the method described in the steps 305 to 308 can be extracted, the newly written data is stored according to the flow of receiving the modified data, and the statistical view corresponding to the data attribute of the newly written data is changed. In addition, in order to reduce the burden of real-time data monitoring of the state database, a monitoring period can be set for the state database, the data change in the state database is monitored every monitoring period, and the monitored change data is updated into the statistical view.
In the practical application process, the report generating system can also provide data query service for the user, and when the data query is performed, the data query can be performed based on the statistical view, and referring to fig. 3C, the method comprises the following steps:
309. when a data query request is received, the data attribute to be queried is extracted from the data query request.
In the embodiment of the invention, because the statistical views are generated according to the attribute types, when the data query request is received, the attribute of the data to be queried is extracted from the data query request, so that the query data meeting the requirements is extracted according to the attribute of the data to be queried.
The client side carried by the report generating system can set a data query entry, when the user is detected to trigger the data query entry, the data query request of the user is determined to be received, the data attribute to be queried provided by the user is obtained, so that a statistical view is determined according to the type of the attribute to be queried of the data attribute to be queried, and query data indicated by the data attribute to be queried is extracted from the statistical view. Specifically, the attribute of the data to be queried may be an attribute name, for example, person a, time B, place C, and the like. In addition, in order to support the Query on the statistical view, the Fabric source code needs to be modified, and the Execute Query method needs to be extended so as to Query the statistical view.
It should be noted that, in order to meet more query requirements of the user, the data query request may further carry a data range to be queried, where the data range to be queried may specifically be a time range, a location range, etc., so that the user may more accurately acquire data in a specific range. For example, the data query request may carry "person a" and "2018.01 to 2018.02", so that the data of person a between 2018.01 and 2018.02 can be queried subsequently.
310. Acquiring the attribute type to be queried of the attribute of the data to be queried, determining a statistical view to be queried indicated by the data type to be queried, extracting query data indicated by the attribute of the data to be queried from the statistical view to be queried, and returning the query data.
In the embodiment of the invention, after the statistical view to be queried is determined, query data indicated by the attribute of the data to be queried can be extracted from the statistical view to be queried, and the query data is returned to the user. For example, if the attribute of the data to be queried is character a, and all data of character a, character B and character C are included in the statistical view to be queried obtained according to the attribute type of the data to be queried, all data of character a in the statistical view to be queried are used as query data. In addition, if the data query request also carries the data range to be queried, after determining the data indicated by the attribute of the data to be queried in the statistical view to be queried, determining the data indicated by the data range to be queried in the data as query data and returning. For example, if the range of the data to be queried is from 2017, 8, to 2018, 1, and the data obtained according to the attribute of the data to be queried is all the data of the person a, the data of the person a from 2017, 8, to 2018, 1 is taken as the query data.
It should be noted that, the report generating system may also support the query of the data statistics report, when receiving the report query request, obtain the report name to be queried carried in the report query request, obtain the target data statistics report indicated by the report name to be queried, and return the data statistics report to the user.
According to the method provided by the embodiment of the invention, the data in the state database is counted according to the target data attribute carried in the report request, and the statistical view of the target data attribute is generated, so that the extraction of the data of the target data attribute can be directly realized based on the statistical view, the data statistical report is directly generated, the difficulty of data statistics and analysis is reduced, and the process of generating the data statistical report is simplified.
Further, as a specific implementation of the method shown in fig. 1, an embodiment of the present invention provides a report generating device based on a blockchain, as shown in fig. 4A, where the device includes: a receiving module 401, a sorting module 402, a first extracting module 403 and a generating module 404.
The receiving module 401 is configured to receive a report generation request of a user, where the report generation request carries a target data attribute, and the report generation request is used to request a report generated for service data indicated by a data identifier in a blockchain;
The arrangement module 402 is configured to arrange a state database according to a target attribute type of a target data attribute, to generate a statistical view of the target attribute type, where the state database is used to store service data indicated by a data identifier in a blockchain;
the first extraction module 403 is configured to extract, based on the target data attribute, target data in the statistical view, where the target data is a data set in which the data attribute in the statistical view meets a requirement of the target data attribute;
the generating module 404 is configured to obtain a preset template, sort the target data according to the preset template, and generate a data statistics report.
In a specific application scenario, as shown in fig. 4B, the sorting module 402 includes a determining submodule 4021, a sorting submodule 4022 and a storing submodule 4023.
The determining submodule 4021 is configured to determine a target attribute type of the target data attribute;
the sorting sub-module 4022 is configured to determine data attributes of each data in the state database that matches the target attribute type, sort at least one data with consistent data attributes in the state database into one data set, and obtain multiple data sets;
the storage submodule 4023 is configured to take a plurality of data groups as a statistical view of the target attribute type.
In a specific application scenario, as shown in fig. 4C, the first extraction module 403 includes a determination submodule 4031 and a storage submodule 4032.
The determining submodule 4031 is configured to determine at least one data attribute of at least one data group in the statistical view, where the statistical view is generated according to the at least one data attribute, and attribute types of the at least one data attribute are consistent;
the storage submodule 4032 is configured to obtain a target data set corresponding to a data attribute consistent with the target data attribute in the at least one data attribute, and take the target data set as target data.
In a specific application scenario, as shown in fig. 4D, the apparatus further includes a determining module 405 and a storage module 406.
The determining module 405 is configured to extract modification data from the data modification request when the data modification request is received, and determine a modification data attribute of the modification data;
the storage module 406 is configured to store the modification data and the modification data attribute in the state database.
In a specific application scenario, as shown in fig. 4E, the apparatus further includes a detection module 407, a writing module 408, and an ending module 409.
The detecting module 407 is configured to detect whether there is a statistical view to be modified corresponding to the modified data attribute;
The writing module 408 is configured to acquire the statistical view to be modified if there is a statistical view to be modified corresponding to the modified data attribute, and write the modified data and the modified data attribute into the statistical view to be modified;
the ending module 409 is configured to end the current flow if there is no statistical view to be modified corresponding to the modified data attribute.
In a specific application scenario, as shown in fig. 4F, the apparatus further includes a second extraction module 410, an acquisition module 411, and a query module 412.
The second extracting module 410 is configured to extract, when receiving a data query request, a data attribute to be queried in the data query request;
the acquiring module 411 is configured to acquire a type of attribute to be queried of an attribute of the data to be queried, and determine a statistical view to be queried indicated by the type of the data to be queried;
the query module 412 is configured to extract query data indicated by the attribute of the data to be queried from the statistical view to be queried, and return the query data.
The device provided by the embodiment of the invention can count the data in the state database according to the target data attribute carried in the report request, and generate the statistical view of the target data attribute, so that the extraction of the data of the target data attribute can be directly realized based on the statistical view, the data statistical report can be directly generated, the difficulty of data statistics and analysis is reduced, and the process of generating the data statistical report is simplified.
It should be noted that, other corresponding descriptions of each functional unit related to the report generating device based on the blockchain provided by the embodiment of the present invention may refer to corresponding descriptions in fig. 1 and fig. 3A, and are not repeated herein.
In an exemplary embodiment, referring to fig. 5, there is further provided a device 500 including a communication bus, a processor, a memory, and a communication interface, and may further include an input-output interface, and a display device, where the functional units may communicate with each other via the bus. The memory stores a computer program, and the processor is configured to execute the program stored in the memory, and execute the blockchain-based report generating method in the above embodiment.
A readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the blockchain-based report generation method.
From the above description of the embodiments, it will be apparent to those skilled in the art that the present application may be implemented in hardware, or may be implemented by means of software plus necessary general hardware platforms. Based on such understanding, the technical solution of the present application may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.), and includes several instructions for causing a computer device (may be a personal computer, a server, or a network device, etc.) to perform the methods described in various implementation scenarios of the present application.
Those skilled in the art will appreciate that the drawings are merely schematic illustrations of one preferred implementation scenario, and that the modules or flows in the drawings are not necessarily required to practice the present application.
Those skilled in the art will appreciate that modules in an apparatus in an implementation scenario may be distributed in an apparatus in an implementation scenario according to an implementation scenario description, or that corresponding changes may be located in one or more apparatuses different from the implementation scenario. The modules of the implementation scenario may be combined into one module, or may be further split into a plurality of sub-modules.
The foregoing application serial numbers are merely for description, and do not represent advantages or disadvantages of the implementation scenario.
The foregoing disclosure is merely a few specific implementations of the present application, but the present application is not limited thereto and any variations that can be considered by a person skilled in the art shall fall within the protection scope of the present application.

Claims (7)

1. A report generation method based on a block chain is characterized by comprising the following steps:
receiving a report generation request of a user, wherein the report generation request carries target data attributes and is used for requesting a report generated aiming at service data indicated by data identification in a block chain;
Determining a target attribute type of the target data attribute, sorting a state database, respectively determining data attributes of each data in the state database matched with the target attribute type, sorting at least one data with consistent data attributes into a data group to obtain a plurality of data groups, taking the plurality of data groups as a statistical view of the target attribute type, wherein the state database is used for storing service data indicated by data identification in the blockchain;
respectively determining at least one data attribute of at least one data group in the statistical view, extracting a target data group corresponding to a data attribute consistent with the target data attribute in the at least one data attribute from the statistical view based on the target data attribute, and taking the target data group as target data, wherein the target data is a data group of which the data attribute in the statistical view meets the requirement of the target data attribute;
and acquiring a preset template, and sorting the target data according to the preset template to generate a data statistics report.
2. The method according to claim 1, wherein the method further comprises:
When a data modification request is received, extracting modification data from the data modification request, and determining modification data attributes of the modification data;
and storing the modification data and the modification data attribute into the state database correspondingly.
3. The method according to claim 2, wherein the method further comprises:
detecting whether a statistical view to be modified corresponding to the modification data attribute exists or not;
if the statistical view to be modified corresponding to the modification data attribute exists, acquiring the statistical view to be modified, and writing the modification data and the modification data attribute into the statistical view to be modified;
and if the statistical view to be modified corresponding to the modified data attribute does not exist, ending the current flow.
4. The method according to claim 1, wherein the method further comprises:
when a data query request is received, extracting data attributes to be queried from the data query request;
acquiring the attribute type to be queried of the data attribute to be queried, and determining a statistical view to be queried indicated by the attribute type to be queried;
and extracting query data indicated by the attribute of the data to be queried from the statistical view to be queried, and returning the query data.
5. A blockchain-based report generation device, comprising:
the system comprises a receiving module, a processing module and a processing module, wherein the receiving module is used for receiving a report generation request of a user, the report generation request carries target data attributes, and the report generation request is used for requesting a report generated aiming at service data indicated by data identification in a blockchain;
the arrangement module is used for determining a target attribute type of the target data attribute, arranging a state database, respectively determining a data attribute of each data in the state database matched with the target attribute type, arranging at least one data with consistent data attribute into a data group to obtain a plurality of data groups, taking the plurality of data groups as a statistical view of the target attribute type, and storing service data indicated by a data identifier in the block chain by the state database;
the first extraction module is used for respectively determining at least one data attribute of at least one data set in the statistical view, extracting a target data set corresponding to a data attribute consistent with the target data attribute in the at least one data attribute in the statistical view based on the target data attribute, and taking the target data set as target data, wherein the target data is a data set of which the data attribute in the statistical view meets the requirement of the target data attribute;
The generation module is used for acquiring a preset template, sorting the target data according to the preset template and generating a data statistics report.
6. An electronic device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 4 when the computer program is executed.
7. A readable storage medium having stored thereon a computer program, which when executed by a processor realizes the steps of the method according to any of claims 1 to 4.
CN201811360953.3A 2018-11-15 2018-11-15 Report generation method, device and equipment based on blockchain and readable storage medium Active CN109740129B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811360953.3A CN109740129B (en) 2018-11-15 2018-11-15 Report generation method, device and equipment based on blockchain and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811360953.3A CN109740129B (en) 2018-11-15 2018-11-15 Report generation method, device and equipment based on blockchain and readable storage medium

Publications (2)

Publication Number Publication Date
CN109740129A CN109740129A (en) 2019-05-10
CN109740129B true CN109740129B (en) 2024-03-08

Family

ID=66355627

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811360953.3A Active CN109740129B (en) 2018-11-15 2018-11-15 Report generation method, device and equipment based on blockchain and readable storage medium

Country Status (1)

Country Link
CN (1) CN109740129B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110377633A (en) * 2019-06-21 2019-10-25 深圳壹账通智能科技有限公司 Method for processing report data, device, computer equipment and storage medium
CN111144755A (en) * 2019-12-26 2020-05-12 安徽朋德信息科技有限公司 Scientific research instrument experiment result traceability management system and method
CN111352751A (en) * 2020-03-04 2020-06-30 深圳乐信软件技术有限公司 Data file generation method and device, computer equipment and storage medium
CN112633858A (en) * 2021-01-05 2021-04-09 润联软件系统(深圳)有限公司 Process approval processing method and system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101430710A (en) * 2008-11-14 2009-05-13 中国科学院软件研究所 Data visualization engine system
CN105631745A (en) * 2015-12-31 2016-06-01 北京神州绿盟信息安全科技股份有限公司 Asset view construction method and device
CN105808538A (en) * 2014-12-29 2016-07-27 深圳云之家网络有限公司 Method and device for generating mobile report form
CN108460140A (en) * 2018-03-13 2018-08-28 广州供电局有限公司 Equipment-patrolling report-generating method, device, system and computer equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8601007B2 (en) * 2011-05-17 2013-12-03 Microsoft Corporation Net change notification based cached views with linked attributes

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101430710A (en) * 2008-11-14 2009-05-13 中国科学院软件研究所 Data visualization engine system
CN105808538A (en) * 2014-12-29 2016-07-27 深圳云之家网络有限公司 Method and device for generating mobile report form
CN105631745A (en) * 2015-12-31 2016-06-01 北京神州绿盟信息安全科技股份有限公司 Asset view construction method and device
CN108460140A (en) * 2018-03-13 2018-08-28 广州供电局有限公司 Equipment-patrolling report-generating method, device, system and computer equipment

Also Published As

Publication number Publication date
CN109740129A (en) 2019-05-10

Similar Documents

Publication Publication Date Title
CN109740129B (en) Report generation method, device and equipment based on blockchain and readable storage medium
CN105447046A (en) Distributed system data consistency processing method, device and system
CN110956269A (en) Data model generation method, device, equipment and computer storage medium
CN109614403B (en) Data consistency checking method and device for cluster service node
CN109446208A (en) A kind of date storage method, computer readable storage medium and server
WO2023273218A1 (en) Json packet checking method and json packet checking apparatus
CN112671878B (en) Block chain information subscription method, device, server and storage medium
CN111767481B (en) Access processing method, device, equipment and storage medium
CN111932076A (en) Rule configuration and release method and device and computing equipment
CN111737148A (en) Automatic regression testing method and device, computer equipment and storage medium
CN111553749A (en) Activity push strategy configuration method and device
CN115481026A (en) Test case generation method and device, computer equipment and storage medium
CN113434588B (en) Data mining analysis method and device based on mobile communication ticket
CN114781517A (en) Risk identification method and device and terminal equipment
CN113849520A (en) Intelligent identification method and device of abnormal SQL (structured query language), electronic equipment and storage medium
CN114281549A (en) Data processing method and device
CN114237798A (en) Data processing method, device, server and storage medium
CN115310011A (en) Page display method and system and readable storage medium
CN114547184A (en) Personnel information synchronization method, terminal device and storage medium
CN114818645B (en) Automatic report generation method, device, equipment and medium based on data body
CN110309211A (en) A kind of method and relevant device positioning ETL Process Problems
CN110418020B (en) List state information processing method and device, electronic terminal and storage medium
CN116955494A (en) Data processing method and device, electronic equipment and storage medium
CN105763363A (en) Method and device for realizing user resource data configuration
CN116644065A (en) Database table management method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant