Disclosure of Invention
The embodiment of the application provides a data reporting method, a data reporting device, data reporting equipment and a storage medium, and aims to solve the following technical problems: the development difficulty of the data reporting system is high, so that when the format of the reporting file is adjusted, a large amount of workload needs to be invested to correspondingly upgrade and modify the data reporting system.
The embodiment of the application adopts the following technical scheme:
the embodiment of the application provides a data reporting method. Determining a reporting format of data to be reported; determining a corresponding entity object according to the report format; filling data to be reported into the entity object to obtain an entity object to be analyzed; determining an index type according to the reported data; determining a characteristic annotation in the entity object to be analyzed according to a preset characteristic table, an index type and a reporting format; the preset characteristic table comprises index types and characteristic annotations of all reporting formats corresponding to the index types; and analyzing the entity object with the corresponding characteristic annotation into a file meeting the requirement of a data reporting format by an analyzer so as to report the data.
According to the embodiment of the application, the corresponding analyzer can be selected to analyze the entity object by determining the reporting format of the reported data. In addition, according to different reporting data formats, different entity objects are set in advance, so that the entity objects can be analyzed according to the characteristic annotations in the entity objects only by filling the data to be reported into the entity objects. Research personnel do not need to pay attention to details in the analysis process, and the re-investment of system development when the reported technical details are changed is greatly reduced.
Determining a reporting format of data to be reported, specifically comprising:
receiving a first reporting file format to be reported in a wire-down mode so as to analyze the entity object to be analyzed into a reporting file meeting the requirement of the first reporting file format; and receiving a second reporting file format template to be reported in a line mode, and analyzing the entity object to be analyzed into a reporting file meeting the requirement of the second reporting file format template.
In an implementation manner of the present application, after determining a reporting format of data to be reported, in a case that two reporting formats are required, the method further includes: marking the characteristic annotations with the same index type but different file forms in the same entity object; and respectively filling the data to be reported to the positions corresponding to the characteristic annotations with different file forms, and respectively analyzing the entity object according to different types of analyzers.
According to the embodiment of the application, under the condition that the types of the data needing to be uploaded are multiple types, the same entity object can be used, different types of characteristic annotations are marked in the same entity object, and the same data are filled in multiple positions corresponding to the same entity object. The number of used entity objects is reduced, and meanwhile, data needing to be uploaded does not need to be acquired for multiple times. The workload of developers is reduced.
In an implementation manner of the present application, the analyzing the entity object according to different types of analyzers specifically includes: identifying characteristic annotations in a first reporting file form and characteristic annotations in a second reporting file form respectively corresponding to the entity object to be analyzed according to the first analyzer and the second analyzer; and according to the first parser and the second parser, the entity object with the first reporting file form characteristic annotation and the second reporting file form characteristic annotation is parsed.
According to the embodiment of the application, the same entity object is analyzed through different analyzers, and the problem that research and development staff work load is large due to the fact that only one entity object can be analyzed through one analyzer can be avoided. Meanwhile, the embodiment of the application can be compatible with two reporting forms, different entity objects do not need to be researched and developed for different reporting forms, and the development period of a data reporting system is simplified.
In an implementation manner of the present application, parsing, according to a first parser and a second parser, an entity object with a first reporting file form property annotation and a second reporting file form property annotation specifically includes: the first analyzer is an xml analyzer, identifies the characteristic annotation in the xml form in the entity object according to the xml analyzer, and analyzes the reported data corresponding to the characteristic annotation in the xml form in the entity object into data in the xml file format meeting the reporting requirement so as to obtain an xml file; and the second parser is a db parser, identifies the characteristic annotation in the db form in the entity object according to the db parser, and parses reported data corresponding to the characteristic annotation in the db form in the entity object into data in a db file format meeting the reporting requirement so as to obtain a db file.
In an implementation manner of the present application, after parsing, by the parser, the entity object with the corresponding property annotation into a file meeting a requirement of a data reporting format, the method further includes: compressing and packaging the files in different forms obtained after analysis, and encrypting the files; and calling a supervision interface, and reporting the encrypted file to a supervision system.
In one implementation of the present application, the indicator type includes at least one or more of a root type, a text type, a numeric type, an aggregate type, an attachment type, and an ignore type.
An embodiment of the present application provides a data reporting apparatus, including: a report format determining unit for determining the report format of the data to be reported; the entity object determining unit determines a corresponding entity object according to the report format; the data filling unit is used for filling the data to be reported into the entity object to obtain the entity object to be analyzed; the characteristic annotation determining unit determines the index type according to the reported data; determining a characteristic annotation in the entity object to be analyzed according to a preset characteristic table, the index type and a reporting format; the preset characteristic table comprises index types and characteristic annotations of all reporting formats corresponding to the index types; and the analysis unit is used for analyzing the entity object with the corresponding characteristic annotation into a file meeting the requirement of a data reporting format through an analyzer so as to report the data.
An embodiment of the present application provides a data reporting apparatus, including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to cause the at least one processor to: determining a reporting format of data to be reported; determining a corresponding entity object according to the report format; filling data to be reported into the entity object to obtain an entity object to be analyzed; determining an index type according to the reported data; determining a characteristic annotation in the entity object to be analyzed according to a preset characteristic table, an index type and a reporting format; the preset characteristic table comprises index types and characteristic annotations of all reporting formats corresponding to the index types; and analyzing the entity object with the corresponding characteristic annotation into a file meeting the requirement of a data reporting format by an analyzer so as to report the data.
A non-volatile computer storage medium provided in an embodiment of the present application stores computer-executable instructions, and the computer-executable instructions are configured to: determining a reporting format of data to be reported; determining a corresponding entity object according to the report format; filling data to be reported into the entity object to obtain an entity object to be analyzed; determining an index type according to the reported data; determining a characteristic annotation in the entity object to be analyzed according to a preset characteristic table, an index type and a reporting format; the preset characteristic table comprises index types and characteristic annotations of all reporting formats corresponding to the index types; and analyzing the entity object with the corresponding characteristic annotation into a file meeting the requirement of a data reporting format by an analyzer so as to report the data.
The embodiment of the application adopts at least one technical scheme which can achieve the following beneficial effects: according to the embodiment of the application, the corresponding analyzer can be selected to analyze the entity object by determining the reporting format of the reported data. In addition, according to different reporting data formats, different entity objects are set in advance, so that the entity objects can be analyzed according to the characteristic annotations in the entity objects only by filling the data to be reported into the entity objects. Research personnel do not need to pay attention to details in the analysis process, and the re-investment of system development when the reported technical details are changed is greatly reduced.
Detailed Description
The embodiment of the application provides a data reporting method, a data reporting device, data reporting equipment and a storage medium.
In order to make those skilled in the art better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any inventive step based on the embodiments of the present disclosure, shall fall within the scope of protection of the present application.
In the prior art, when data is reported to a state resource committee system, research and development personnel need to pay attention to a service implementation process and pay attention to technical implementation details of data reporting. Due to the change of technical details, different technicians cannot completely master the situation, which results in a difficult development of a data reporting and storing system.
In addition, since the reported technical implementation process may be dispersed in different service modules, when technical details are changed, different service modules need to be upgraded and modified correspondingly with a certain workload. The workload of re-investment of system development when the reporting technology details are overlapped is increased.
In order to solve the foregoing problems, embodiments of the present application provide a data reporting method, apparatus, device, and storage medium. And establishing different entity objects according to the data reporting requirements issued by the state resource committee. In the process of data reporting, the data to be reported is only needed to be filled into the corresponding entity object, and then the entity object is analyzed by the analyzer corresponding to the reporting type, so that the entity object can be analyzed into a reporting file meeting the requirements. The development difficulty of the data reporting system is reduced, and the workload of re-investment of system development when reporting technical details are overlapped is greatly reduced.
The technical solutions proposed in the embodiments of the present application are described in detail below with reference to the accompanying drawings.
Fig. 1 is a flowchart of a data reporting method according to an embodiment of the present application. As shown in fig. 1, the data reporting includes the following steps:
s101, determining a reporting format of data to be reported.
In an embodiment of the present application, the type of the data that needs to be reported this time is obtained according to the data reporting requirement issued by state resource supervision.
Specifically, the type of the data report issued by the state resource supervision may be an xml-type file, or a db-type file, or may require to upload an xml-type file and a db-type file at the same time.
It should be noted that, in the reported data type requirements issued by state resource supervision, the requirement of the xml format file is transmitted through a offline mode, so that developers who report data obtain the uploading requirement of the xml format file through the offline mode. And analyzing the data to be reported into a reporting file meeting the file format requirement of the xml type. The file requirement of db format is issued by the state resource committee system, so that the developer for data reporting can obtain the uploading requirement of db format file through on-line mode. And analyzing the data to be reported into a reporting file meeting the requirement of the file template of db type.
And S102, determining the corresponding entity object according to the report format.
In an embodiment of the present application, a developer may formulate entity objects in different forms according to different reporting formats. For example, the entity object in the xml format may be formulated according to the xml reporting format, or the entity object in the db format may be formulated according to the db reporting format.
In an embodiment of the present application, a corresponding entity object is determined according to a reporting format of the reported data. For example, if the format of the data to be reported is in the xml format, an entity object in the xml format needs to be selected.
And S103, filling the data to be reported into the entity object to obtain the entity object to be analyzed.
In one embodiment of the present application, different C # characteristics are established for different file forms, different index types.
Table 1 is a table of C # characteristics established herein.
TABLE 1
As shown in table 1, in the embodiment of the present application, index types are reported for different common data, and corresponding C # characteristics in the form of db and xml are established. The index type at least comprises one or more of a root type, a text type, a number type, an aggregation type, an attachment type and an ignore type. The file form at least comprises one or more of db form and xml form. Moreover, any index type and any file form correspond to a C # characteristic.
In an embodiment of the present application, the reporting index refers to a minimum unit of each reported data, such as a conference number and a conference name. The db form is that the sqlite database is used as a data storage means, and data is put into the sqlite data file. The xml format is that an xml file is used as a data storage mode, and data is put into the file x.
FIG. 2 is a composition diagram of base classes in the form of xml according to an embodiment of the present application. As shown in FIG. 2, the xml form base class includes XmlRootAttribute, XmlElementAttribute, XmlArrayttemAttribute, XmlArrayAttribute, XmlIgnoreAttribute. FIG. 3 is a block diagram of a base class composition in db form according to an embodiment of the present application. As shown in FIG. 3, the db form base class includes ReportDBRootAttribute, ReportDBElementAttribute, ReportDBArrayAttribute, and ReportDBAttachAttribute.
The index type, file format, and characteristics in the C # characteristics table may be added or deleted according to actual use requirements or requirements of state commission.
In an embodiment of the application, a file format of the data reporting is determined according to the acquired requirement of the reported data issued by the state resource committee. And under the condition that the reporting type of the service data is determined to be a single type, filling the data to be reported into the entity object corresponding to the single type to obtain the entity object to be analyzed. The following description will take the example that the present request is reported in the xml file format.
In one embodiment of the present application, entity objects in the form of xml are created. Fig. 4 is a diagram of an example of an xml format system entity provided in an embodiment of the present application. As shown in FIG. 4, the graph is labeled with property annotations XmlRootAttribute and XmlElement. Each property annotation corresponds to data that needs to be populated.
In one embodiment of the present application, the data to be reported is filled into an entity object in the form of xml. Fig. 5 is an example data diagram of an xml formal entity object provided in an embodiment of the present application. As shown in fig. 5, it can be seen from the "presentation data" in the RegulationName in the figure that the data that needs to be filled into the entity object in the xml format at this time is the "presentation data", and the presentation data in fig. 5 is filled into the position of the "adjustment _ name" corresponding to the property annotation XmlElement in fig. 4. And obtaining the entity object to be analyzed in the form of xml.
In an embodiment of the present application, the following description will take the request to report data in db file format as an example.
In one embodiment of the present application, an entity object in the form of db is created. Fig. 8 is a diagram of an example of a db-type system entity provided in an embodiment of the present application. As shown in fig. 8, the graph is labeled with property annotations DBRootAttribute and DBElement. Each property annotation corresponds to data that needs to be populated.
In one embodiment of the present application, the data to be reported is filled into the entity object in db form. Fig. 9 is a data diagram of an example of db formal entity object according to an embodiment of the present application. As shown in fig. 9, it can be seen from the "demonstration data" in the RegulationName in the figure that the data that needs to be filled into the entity object in the db format at this time is the "demonstration data", and the demonstration data in fig. 9 is filled into the position of the "system name" corresponding to the characteristic annotation DBElement in fig. 8. And obtaining the entity object in db form to be analyzed.
In an embodiment of the application, after the reporting type of the business data is determined to be reported, the characteristic annotations with the same index type but different file forms are marked in the same entity object under the condition that two reporting types are required. And filling the data to be reported into the positions corresponding to the characteristic annotations with different file forms respectively.
Specifically, in the requirement issued by the national resource supervision, the same data needs to be uploaded with the xml file and the db file. The xml entity object may be combined with the db entity object. Fig. 12 is an entity diagram annotated with different file formats according to an embodiment of the present application. As shown in fig. 12, the figure shows both the property annotation XmlElement in the xml file format and the property annotation DBElement in the db file format. At this time, only the property annotation corresponding to the data to be uploaded needs to be marked in the same entity object, and research and development personnel do not need to develop two sets of entity objects with the same logic according to different uploading formats, so that the workload of the development personnel is reduced.
Specifically, the same filling data "presentation data" is used and filled to the positions corresponding to the property notes in different file forms in fig. 12. Such as the location of "relationship _ name" for the property annotation XmlElement, and the location of "system name" for the property annotation DBElement. Therefore, the entity object can be filled by calling the same filling data, and a plurality of filling data do not need to be established for the characteristic annotations in different file forms. Therefore, the development difficulty is reduced, and the workload of developers is reduced.
And S104, determining an index type according to the reported data, and determining the characteristic annotation in the entity object to be analyzed according to the preset characteristic table, the index type and the reported format.
In an embodiment of the present application, according to the data reported this time, the index type of the data reported this time can be determined. For example, the report is of a text type or an attachment type. And according to the determined index type and the reporting format of the reported data, determining the unique characteristic annotation by presetting a characteristic table.
Specifically, the preset characteristic table represents the format of the report file horizontally and represents the index type vertically, so that the unique characteristic annotation can be determined through any one report format and any one index type.
And S105, analyzing the entity object with the corresponding characteristic annotation into a file meeting the requirement of a data reporting format through an analyzer so as to report the data.
In one embodiment of the application, different resolvers are established to resolve different forms of entity objects. For example, an xml parser reportxmlserialiser is established to parse an entity object in xml form. And establishing a db parser report DBStalizer to parse the entity object in the db form.
In an embodiment of the present application, when it is determined that the reporting type of the service data is a single type, the data to be reported is filled into the entity object corresponding to the single type, so as to obtain the entity object to be analyzed. And determining the characteristic annotation in the entity object to be analyzed according to the analyzer corresponding to the single type, and analyzing the data corresponding to the characteristic annotation to obtain a report file corresponding to the single type.
Specifically, when the data reporting is required to be performed in the xml file format, the data is first filled in the entity object shown in fig. 3, so as to obtain the entity object to be analyzed. And then calling a pre-established xml analyzer to analyze the entity object to be analyzed. The xml parser determines the characteristic annotation in the entity object to be parsed, parses the corresponding data into data in an xml format according to the characteristic annotation, and forms an xml file.
Fig. 6 is a data diagram illustrating an example of an xml formal entity object converted into an xml file according to an embodiment of the present application. As shown in fig. 6, the data "presentation data" to be filled has been converted into data in xml format. Fig. 7 is a diagram of data conversion in xml format according to an embodiment of the present application. As shown in fig. 7, data corresponding to the property annotation in the entity object to be parsed has been converted into a file in xml format, and for example, data "tiol" corresponding to the property annotation xmllottattribute, data "relationship _ name" corresponding to the property annotation xmllelement, and data "presentation data" that needs to be filled are converted into data in xml file format, respectively.
In an embodiment of the present application, when data reporting in a db file format is required this time, data is first filled in the entity object shown in fig. 8, so as to obtain an entity object to be analyzed. And then calling a pre-established db parser to parse the entity object to be parsed. The db parser determines the characteristic annotation in the entity object to be parsed, parses the corresponding data into db format data according to the characteristic annotation, and forms a db file.
Fig. 10 is an exemplary data diagram after a db formal entity object is converted into a db file according to an embodiment of the present application. As shown in fig. 10, the data "presentation data" to be filled has been converted into data in db format. Fig. 11 is a diagram of conversion of db format data according to an embodiment of the present application. As shown in fig. 11, data corresponding to the property annotation in the entity object to be parsed has been converted into a file in DB format, such as data "303127913" corresponding to the property annotation DBRootAttribute, data "4833" and "system name" corresponding to the property annotation DBElement, and data "presentation data" to be filled are converted into data in DB file format, respectively.
In an embodiment of the application, when the two types of reporting types are required, the data to be reported are respectively filled into the positions corresponding to the different characteristic annotations in the file form, and the entity object is parsed according to different types of parsers.
In an embodiment of the application, according to the first parser and the second parser, the property annotation in the form of a first reporting file and the property annotation in the form of a second reporting file corresponding to the entity object to be parsed are identified. And according to the first parser and the second parser, the entity object with the first reporting file form characteristic annotation and the second reporting file form characteristic annotation is parsed.
Specifically, the first parser is set as an xml parser, and the property annotation in the form of xml in the entity object is identified according to the xml parser. And analyzing the reported data corresponding to the xml form characteristic annotation in the entity object into data in an xml file format meeting the reporting requirement so as to obtain an xml file. And setting the second resolver as a db resolver, and identifying the characteristic annotation in the db form in the entity object according to the db resolver. And analyzing the reported data corresponding to the db-form characteristic annotation in the entity object into data in a db file format meeting the reporting requirement to obtain a db file.
Fig. 12 is an entity diagram annotated with different file formats according to an embodiment of the present application. As shown in FIG. 12, an xml parser and a db parser may be invoked, respectively, to parse data corresponding to different property annotations in the entity object. Thus, an xml file and a db file can be obtained.
According to the embodiment of the application, under the condition that the types of the data needing to be uploaded are multiple, the same entity object can be used, different types of characteristic annotations are marked in the same entity object, and the same data are filled in multiple positions corresponding to the same entity object. The number of used entity objects is reduced, and meanwhile, data needing to be uploaded does not need to be acquired for multiple times, so that the workload of developers is reduced.
In one embodiment of the application, files in different forms obtained after parsing are compressed and packaged, and the files are encrypted. And calling a supervision interface, and reporting the encrypted file to a supervision system. Thus, the reporting process of the data is completed. The supervision interface can be a state resource committee interface, and the supervision system can be a state resource committee supervision system.
Fig. 13 is a block diagram of a complete process of data reporting according to an embodiment of the present application. As shown in fig. 13, the data reporting process is as follows:
in one embodiment of the present application, preparation for reporting data is performed first. Namely, the data to be reported is extracted in the database. And secondly, filling the data model object, and filling the extracted data to be reported to the corresponding position of the entity object. And finally, reporting data, analyzing the entity object by using an analyzer to obtain a file meeting the requirements of the state resource committee, and reporting the obtained file to a state resource committee system.
Fig. 14 is a block diagram of a data reporting splitting process according to an embodiment of the present application.
In an embodiment of the application, a request for reporting data issued by the state resource committee is received, and a file form of the reported data is determined so as to call a parser of a corresponding type.
In an embodiment of the present application, in a case that the format of the reported data is required to be in an xml format, the data to be reported is filled into an entity object in the xml format. And under the condition that the format of the reported data is required to be in the db form, acquiring a db template issued by the State administration, and filling the data to be reported into an entity object in the db form.
In an embodiment of the present application, a parser corresponding to the reporting format is called to parse the entity object filled with data, so as to obtain a reporting file meeting the requirements of the reporting format.
In an embodiment of the present application, the obtained report file is compressed and packaged, and the file is encrypted. And calling a national resource committee system interface, and reporting the encrypted file to a national resource committee system.
Fig. 15 is a structural diagram of a data reporting apparatus according to an embodiment of the present application. The device comprises: a report format determining unit S501, an entity object determining unit S502, a data filling unit S503, a characteristic annotation determining unit S504 and an analyzing unit S505.
A report format determining unit S501 determines a report format of data to be reported;
an entity object determining unit S502, which determines the corresponding entity object according to the report format;
a data filling unit S503, filling the data to be reported into the entity object, to obtain an entity object to be analyzed;
a characteristic annotation determination unit S504, which determines the index type according to the reported data; determining the characteristic annotation in the entity object to be analyzed according to a preset characteristic table, the index type and the report format; the preset characteristic table comprises index types and characteristic annotations of all reporting formats corresponding to the index types;
the parsing unit S505 parses the entity object with the corresponding property annotation into a file meeting the requirement of the data reporting format by using a parser, so as to report the data.
Fig. 16 is a schematic structural diagram of a data reporting device according to an embodiment of the present application, where the device includes:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to:
determining a reporting format of data to be reported;
determining a corresponding entity object according to the report format;
filling the data to be reported into the entity object to obtain an entity object to be analyzed;
determining an index type according to the reported data; determining the characteristic annotation in the entity object to be analyzed according to a preset characteristic table, the index type and the report format; the preset characteristic table comprises index types and characteristic annotations of all reporting formats corresponding to the index types;
and analyzing the entity object with the corresponding characteristic annotation into a file meeting the requirement of a data reporting format by an analyzer so as to report the data.
A non-volatile computer storage medium according to an embodiment of the present application stores computer-executable instructions configured to:
determining a reporting format of data to be reported;
determining a corresponding entity object according to the report format;
filling the data to be reported into the entity object to obtain an entity object to be analyzed;
determining an index type according to the reported data; determining the characteristic annotation in the entity object to be analyzed according to a preset characteristic table, the index type and the report format; the preset characteristic table comprises index types and characteristic annotations of all reporting formats corresponding to the index types;
and analyzing the entity object with the corresponding characteristic annotation into a file meeting the requirement of a data reporting format by an analyzer so as to report the data.
The embodiments in the present application are described in a progressive manner, and the same and similar parts among the embodiments can be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the embodiments of the apparatus, the device, and the nonvolatile computer storage medium, since they are substantially similar to the embodiments of the method, the description is simple, and for the relevant points, reference may be made to the partial description of the embodiments of the method.
The foregoing description of specific embodiments of the present application has been presented. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art to which the embodiments of the present application pertain. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the embodiments of the present application should be included in the scope of the claims of the present application.