Resource exporting method, device and equipment

By analyzing client requests in the cloud platform and distributing resource export tasks to threads, and dynamically exporting resource lists using custom annotations, the problems of low resource export efficiency and high maintenance cost in the existing technology are solved, and an efficient and applicable resource export method is realized.

CN119691015APending Publication Date: 2025-03-25DAWNING CLOUD COMPUTING TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411731146.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-28
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

In the prior art, resource export efficiency is low and maintenance costs are high, especially in scenarios where there are many resource types, variable content structures and complex combinations in cloud platforms.

Method used

By analyzing the client's resource export request, generating and distributing resource export tasks to different threads, dynamically exporting resource lists with pre-stored custom annotations to improve export efficiency.

Benefits of technology

It realizes efficient export of resource lists in the cloud platform, which is suitable for a variety of scenarios, reduces maintenance costs, and improves resource export efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119691015A_ABST
    Figure CN119691015A_ABST
Patent Text Reader

Abstract

The invention relates to a resource exporting method, device and equipment, and the method comprises the steps: responding to a resource exporting request triggered by a client, analyzing the resource exporting request, obtaining a parameter field set corresponding to a to-be-exported resource and at least one resource type, and the parameter field set comprises at least one target parameter field; for each resource type, generating a resource export task corresponding to the resource type, and distributing the resource export task to a corresponding thread; each thread obtains a target resource corresponding to the resource type of the corresponding resource export task, and determines a self-defined annotation corresponding to a target parameter field based on a pre-stored self-defined annotation corresponding to each reference parameter field; generating a sub-list based on the obtained target resource and the screened custom annotation; the user-defined annotations are used for identifying list format information of the corresponding parameter fields; and generating a target resource list based on each sub-list, and sending the target resource list to the client.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a resource export method, device and equipment. Background Art

[0002] With the rapid development of cloud computing technology, cloud platform has become one of the important infrastructures for enterprise informatization construction. Cloud platform integrates a large number of resources including virtual machines, storage, networks, etc. The management and viewing of these resources are of great significance to users.

[0003] In related technologies, resource export methods usually rely on hard coding. When exporting dynamic fields, a large amount of logical judgment needs to be added to various resources. For scenarios in cloud platforms where there are many resource types, variable content structures, and complex combinations of various types of resources, this method has low export efficiency and high maintenance costs. Summary of the invention

[0004] The present invention provides a resource export method, device and equipment, which are used to solve the problems of low resource export efficiency and high maintenance cost in related technologies.

[0005] In a first aspect, the present application provides a resource export method, which is applied to a server, and the method comprises:

[0006] In response to a resource export request for a target cloud platform triggered by a client, the resource export request is parsed to obtain a parameter field set corresponding to the resource to be exported and at least one resource type, wherein the parameter field set includes at least one target parameter field;

[0007] For each resource type, generate a resource export task corresponding to the resource type, and distribute the resource export task to the corresponding thread;

[0008] Obtaining the target resource corresponding to the resource type of the corresponding resource export task through each thread respectively, and determining the custom annotation corresponding to the target parameter field based on the pre-stored custom annotations corresponding to each reference parameter field; and generating a sublist based on the obtained target resource and the filtered custom annotations; the custom annotation is used to identify the list format information of the corresponding parameter field;

[0009] A target resource list is generated based on each sub-list, and the target resource list is sent to the client.

[0010] The above method only needs to modify the pre-stored reference parameter fields and their custom annotations accordingly when the application scenario changes. It is applicable to various scenarios and distributes the export tasks of each resource type to different threads for parallel execution. The resource list is dynamically exported according to the filtered resource type and resource parameters, thereby improving the resource export efficiency.

[0011] In a possible implementation, the above-mentioned determining the custom annotation corresponding to the target parameter field based on the pre-stored custom annotations corresponding to each reference parameter field includes:

[0012] Generate target entity classes corresponding to each target parameter field based on reflection mechanism;

[0013] Determine a reference entity class corresponding to the resource type of the thread from pre-stored entity classes corresponding to each resource type; the reference entity class includes: reference parameter fields corresponding to the corresponding resource type, and custom annotations corresponding to each reference parameter field;

[0014] The target entity class is compared with the reference entity class, target parameter fields that have been successfully compared are screened, and custom annotations corresponding to the screened target parameter fields are obtained from the reference entity class.

[0015] The above method improves the efficiency of field screening by pre-storing the entity classes corresponding to each resource type, generating the target entity classes corresponding to the target fields based on the reflection mechanism, and filtering the target parameter fields based on the comparison between the entity classes. In addition, since the parameter fields and custom annotations corresponding to each resource type are pre-cached, it is also convenient to generate sublists based on them in the future, thereby improving the overall resource list generation efficiency.

[0016] In a possible implementation, the above-mentioned generating a sublist based on the acquired target resource and the filtered custom annotations includes:

[0017] Determine the target resource corresponding to the filtered target parameter field from the acquired target resources;

[0018] Based on the determined target resource and the custom annotation corresponding to the filtered target parameter field, a sublist corresponding to the resource type of the corresponding resource export task is generated.

[0019] The above method can be applied to various scenarios by further filtering target resources corresponding to the target parameter fields from the target resources and then generating a sublist based on the custom annotation and the target resources, and the sublist generation efficiency is high.

[0020] In a possible implementation manner, the above-mentioned obtaining the target resource corresponding to the resource type of the corresponding resource export task includes:

[0021] Query the target resource corresponding to the resource type of the corresponding resource export task from the database corresponding to each device included in the target cloud platform;

[0022] Among them, for the database of any device, the target resource corresponding to the resource type of the corresponding resource export task is queried based on the following method:

[0023] The corresponding resource export task is added to the task message queue corresponding to the database of any device, and the target resource returned by the task message queue is received.

[0024] The above method sets a task message queue corresponding to the database of the device. When querying the target resource from the database through a thread, the corresponding resource query task is added to the task queue corresponding to the database. The asynchronous export of data is realized through the message queue, which can avoid occupying the thread for a long time and improve the resource query efficiency.

[0025] In a possible implementation manner, the above-mentioned obtaining the target resource corresponding to the resource type of the corresponding resource export task includes:

[0026] Query the target resource corresponding to the resource type of the corresponding resource export task from the data cache area of ​​the target cloud platform;

[0027] The data cache area is obtained by caching the data in each device included in the target cloud platform.

[0028] The above method caches the data of each device to obtain a data cache area, and then queries the target resource corresponding to the resource type from the data cache area. For resources that are frequently queried and have a large amount of data, it can effectively reduce the number of database accesses, reduce data query time, and reduce the impact on device business.

[0029] In a possible implementation, after the sublist is generated based on the acquired target resources and the filtered custom annotations, the method provided in the embodiment of the present application further includes:

[0030] If there is a composite sub-list with different numbers of target resources corresponding to each target parameter field in the sub-list, then an association relationship between the target resources corresponding to each target parameter field in the composite sub-list is established;

[0031] Generate a target resource list based on each sublist, including:

[0032] A target resource list is generated based on the association relationships corresponding to the sub-lists and the composite sub-lists.

[0033] The above method, for the composite sub-type, establishes the association relationship between the target resources corresponding to each target parameter field in the composite sub-list, thereby realizing the establishment of a resource list of a special type.

[0034] In a second aspect, the present application provides a resource export device, which is applied to a server, and the device includes:

[0035] A parsing module, configured to respond to a resource export request for a target cloud platform triggered by a client, parse the resource export request, obtain a parameter field set corresponding to the resource to be exported and at least one resource type, wherein the parameter field set includes at least one target parameter field;

[0036] A generation module, used for generating a resource export task corresponding to each resource type, and distributing the resource export task to a corresponding thread;

[0037] A determination module, used to obtain, through each thread, a target resource corresponding to a resource type of a corresponding resource export task, and determine, based on pre-stored custom annotations corresponding to each reference parameter field, a custom annotation corresponding to the target parameter field; and, based on the obtained target resource and the filtered custom annotation, generate a sublist; the custom annotation is used to identify list format information of the corresponding parameter field;

[0038] The sending module is used to generate a target resource list based on each sub-list and send the target resource list to the client.

[0039] In a possible implementation manner, the above-mentioned determination module is specifically used to:

[0040] Generate target entity classes corresponding to each target parameter field based on the reflection mechanism;

[0041] Determine a reference entity class corresponding to the resource type of the thread from pre-stored entity classes corresponding to each resource type; the reference entity class includes: reference parameter fields corresponding to the corresponding resource type, and custom annotations corresponding to each reference parameter field;

[0042] The target entity class is compared with the reference entity class, target parameter fields that have been successfully compared are screened, and custom annotations corresponding to the screened target parameter fields are obtained from the reference entity class.

[0043] In a possible implementation manner, the above-mentioned determination module is specifically used to:

[0044] Determine the target resource corresponding to the filtered target parameter field from the acquired target resources;

[0045] Based on the determined target resource and the custom annotation corresponding to the filtered target parameter field, a sublist corresponding to the resource type of the corresponding resource export task is generated.

[0046] In a possible implementation manner, the above-mentioned determination module is specifically used to:

[0047] Querying the target resource corresponding to the resource type of the corresponding resource export task from the databases corresponding to the devices included in the target cloud platform;

[0048] Among them, for the database of any device, the target resource corresponding to the resource type of the corresponding resource export task is queried based on the following method:

[0049] The corresponding resource export task is added to the task message queue corresponding to the database of any of the above devices, and the target resource returned by the task message queue is received.

[0050] In a possible implementation manner, the above-mentioned determination module is specifically used to:

[0051] Query the target resource corresponding to the resource type of the corresponding resource export task from the data cache area of ​​the target cloud platform;

[0052] The data cache area is obtained by caching the data in each device included in the target cloud platform.

[0053] In a possible implementation manner, the above-mentioned determination module is further used to:

[0054] If there is a composite sub-list in the sub-list with different numbers of target resources corresponding to each target parameter field, then an association relationship between the target resources corresponding to each target parameter field in the composite sub-list is established;

[0055] Based on the association relationships between the sub-lists and the composite sub-list, a target resource list is generated.

[0056] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the resource export method when executing the computer program.

[0057] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the steps in the resource export method described above in the present application are implemented.

[0058] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which is stored in a computer-readable storage medium; when the processor of a memory access device reads the computer program from the computer-readable storage medium, the processor executes the computer program, so that the memory access device executes the steps in the above-mentioned resource export method of the present application.

[0059] For each of the above-mentioned second to fifth aspects and the technical effects that may be achieved by each of the above-mentioned aspects, please refer to the above-mentioned description of the technical effects that can be achieved by the first aspect or various possible schemes in the first aspect, and no further details will be given here. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0061] Figure 1 A flowchart of a resource export method provided in an embodiment of the present application;

[0062] Figure 2 A schematic diagram of the structure of the resource export process provided in the embodiment of the present application;

[0063] Figure 3 A flowchart of an example of a resource export process provided in an embodiment of the present application;

[0064] Figure 4 A schematic diagram of the structure of a resource export device provided in an embodiment of the present application;

[0065] Figure 5 A schematic diagram of the structure of a resource export device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0066] In order to make the purpose, technical scheme and advantages of the present application clearer, the technical scheme in the embodiment of the present application will be clearly and completely described below in conjunction with the drawings in the embodiment of the present application. Obviously, the described embodiment is only a part of the embodiment of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application. In the absence of conflict, the embodiments in the present application and the features in the embodiments can be arbitrarily combined with each other. In addition, although the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in an order different from that here.

[0067] The terms "first" and "second" in the specification and claims of the present application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the term "comprising" and any of their variations are intended to cover non-exclusive protection. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices. "Multiple" in the present application can mean at least two, for example, two, three or more, and the embodiments of the present application are not limited.

[0068] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description. It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.

[0069] In the technical solution of this application, the acquisition, transmission, storage, and use of data are in compliance with the requirements of relevant national laws and regulations.

[0070] In order to facilitate those skilled in the art to better understand the technical solutions provided by the embodiments of the present application, the following is a brief description of the professional terms involved:

[0071] (1)easypoi: an open source Excel export plug-in.

[0072] (2) Cloud platform resources: IaaS (Infrastructure as a Service) resources and PaaS (Platform as a Service) resources in the cloud platform.

[0073] (3) Reflection: a feature of the Java programming language.

[0074] (4) Redis: An open source, memory-based, key-value storage database that can be used for caching and improving access speed.

[0075] With the rapid development of cloud computing technology, cloud platform has become one of the important infrastructures for enterprise information construction. Cloud platform gathers a large number of resources, including virtual machines, storage, network, etc. The management and viewing of these resources are very important for users. When managing resources, it is necessary not only to specify the resource type, but also to specify the resource parameters.

[0076] However, traditional resource export methods usually rely on hard coding. In this case, implementing dynamic field export requires adding a lot of logical judgment to various resources. In addition, for scenarios in which there are many resource types, variable content structures, and complex combinations of various resources in the cloud platform, this method is not only inefficient but also has high maintenance costs.

[0077] In this regard, an embodiment of the present application provides a resource export method applied to this scenario. After receiving a resource export request from a target cloud platform triggered by a client, the resource export request is parsed to obtain a parameter field set and at least one resource type corresponding to the resource to be exported; for each resource type, a resource export task corresponding to the resource type is generated, and the resource export task is distributed to the corresponding thread; through each thread, the target resource corresponding to the resource type of the corresponding resource export task is obtained respectively, and based on the custom annotations corresponding to each reference parameter field stored in advance, the custom annotation corresponding to the target parameter field is determined; and, a sub-list is generated based on the obtained target resource and the filtered custom annotation; the custom annotation is used to identify the list format information of the corresponding parameter field; a target resource list is generated based on each sub-list, and the target resource list is sent to the client; this method realizes the integration of cloud platform resources, can dynamically export resource lists according to filtered resource types and resource parameters, improves resource export efficiency, and is suitable for a variety of scenarios.

[0078] In some embodiments, the embodiments of the present application are implemented based on the open source easypoi. Specifically, the system for performing resource export can adopt a distributed microservice architecture, which mainly includes: a front end (i.e., a client), an API (Application Programming Interface) gateway, and a server (service layer and data layer). Among them, the front end is used to interact with the user, so that the user can send a resource export request to the server through the front end. The API gateway is used as the entrance for all requests and is used for data interaction between the client and the server. The service layer contains multiple microservices, each of which is responsible for processing specific business logic (such as network virtual cloud, cloud server, cloud database, etc.), and the data layer is used for data storage and retrieval.

[0079] The present application is further described in detail below in conjunction with the accompanying drawings. Figure 1FIG. 1 is a flow chart of a data export method provided in an embodiment of the present application. The method is applied to a server, and the specific implementation process is as follows:

[0080] Step S101, in response to a resource export request for a target cloud platform triggered by a client, the resource export request is parsed to obtain a parameter field set corresponding to the resource to be exported and at least one resource type;

[0081] Wherein, the parameter field set includes at least one target parameter field;

[0082] In some embodiments, the present application is provided with multiple options for resource export on the client, and the user can trigger the resource export request by selecting each option; that is, the client pre-stores the identifier of the cloud platform that supports the above resource export method, the resource type list corresponding to each resource, and the parameter field list; further, in the embodiment of the present application, the server address information corresponding to each cloud platform identifier can also be stored in the client, so as to facilitate the subsequent sending of resource export requests to the corresponding server based on the API; wherein, the resource type list includes the resource types that support export, and the parameter field list includes the parameter fields that support export resources, i.e., the column names of the exported resource list. The table can be set based on demand, and is not limited in the embodiment of the present application.

[0083] In some embodiments, in the client-triggered resource export request, the user's selection of the parameter field is an optional operation, that is, the user may not select it. In this case, the target parameter field in the resource export request is a predefined default parameter field.

[0084] In a specific implementation, the user can trigger a resource export request by selecting a specific cloud platform identifier, resource type of resources to be exported, and parameter fields on the client interface, and send the request to the server corresponding to the corresponding cloud platform (through the API gateway).

[0085] It should be noted that the embodiment of the present application does not limit the number of parameter fields (i.e., target parameter fields) carried in the resource export request. Similarly, the embodiment of the present application does not limit the number of resource types carried in the resource export request.

[0086] In some embodiments, the present application does not limit the format of the resource export request. In some embodiments, the format of the resource export request may be in JSON format.

[0087] In some embodiments, after receiving the resource export request triggered by the client, the server parses the request to obtain a parameter field set and a resource type list (including at least one resource type) therefrom.

[0088] Optionally, the parameter field set included in the resource export request in the embodiment of the present application may be: a parameter field set corresponding to each resource type in the at least one resource type (i.e., each resource type corresponds to a parameter field set), or a parameter field set corresponding to each resource type (i.e., multiple resource types correspond to the same parameter field set). The set may be in the form of a list.

[0089] Step S102, for each resource type, generating a resource export task corresponding to the resource type, and distributing the resource export task to the corresponding thread;

[0090] In some embodiments, the above-mentioned threads are microservices including network virtual clouds, cloud servers, cloud databases, etc.

[0091] In a specific implementation, after obtaining a parameter field set and at least one resource type corresponding to the resource to be exported, a resource export task is generated for each resource type, and based on the correspondence between resource types and threads, the resource export task is distributed to the corresponding thread.

[0092] It should be noted that the correspondence between the above resource types and threads can be set based on demand and is not limited in the embodiments of the present application.

[0093] Step S103, respectively obtaining, through each thread, a target resource corresponding to the resource type of the corresponding resource export task, and determining, based on the pre-stored custom annotations corresponding to each reference parameter field, a custom annotation corresponding to the target parameter field; and generating a sub-list based on the obtained target resource and the filtered custom annotations;

[0094] Among them, the custom annotation is used to identify the list format information of the corresponding parameter field;

[0095] In some embodiments, when acquiring a target resource corresponding to a resource type of a corresponding resource export task, embodiments of the present application provide the following two resource acquisition methods.

[0096] In a possible implementation, obtaining a target resource corresponding to a resource type of a corresponding resource export task includes:

[0097] Query the target resource corresponding to the resource type of the corresponding resource export task from the database corresponding to each device included in the target cloud platform;

[0098] Among them, for the database of any device, the target resource corresponding to the resource type of the corresponding resource export task is queried based on the following method:

[0099] The corresponding resource export task is added to the task message queue corresponding to the database of any device, and the target resource returned by the task message queue is received.

[0100] In some embodiments, the target cloud platform includes multiple devices, and different devices have their corresponding databases, that is, the resources of the target cloud platform are distributed storage. Therefore, when obtaining the target resources through threads, it is necessary to query the resources corresponding to the resource type from the database of each device respectively.

[0101] For any device, since there may be multiple businesses that need to access the database of the device, in order to avoid occupying the thread for a long time, a task message queue corresponding to the database of the device can be set in the embodiment of the present application. When the target resource is queried from the database through the thread, the corresponding resource export task is added to the task queue corresponding to the database, and asynchronous data export is realized through the message queue.

[0102] In another possible implementation, obtaining a target resource corresponding to a resource type of a corresponding resource export task includes:

[0103] Query the target resource corresponding to the resource type of the corresponding resource export task from the data cache area of ​​the target cloud platform;

[0104] The data cache area is obtained by caching the data in each device included in the target cloud platform.

[0105] In some embodiments, since frequent access to the database of the device will affect the normal business execution of the device, and querying from the database of the device takes a long time, for resource scenarios with frequent queries and large data volumes, the data query efficiency is improved by setting up data cache in the embodiments of the present application. In specific implementations, the embodiments of the present application cache the data of each device of the target cloud platform, that is, cache it in a preset data cache area. When querying the target resources, the corresponding target resources are queried directly from the data cache area of ​​the target cloud platform (the data cache area can be set separately for each device, or a data cache area can be set for each device).

[0106] In some embodiments, the above-mentioned caching method can be redis caching.

[0107] In some embodiments, the generation of sublists is implemented based on the Java reflection mechanism in the embodiments of the present application; wherein, the Java reflection mechanism means that in the running state, for any class, all properties and methods of this class can be obtained, and for any object, any method and property (including private methods and properties) of it can be called. This function of dynamically obtaining information and dynamically calling object methods is called the reflection mechanism of the Java language.

[0108] In the specific implementation, the embodiment of the present application pre-sets entity classes (java entity classes) corresponding to each resource type in the server, each entity class includes parameter fields related to the resources of the corresponding resource type (i.e., reference parameter fields), and custom annotations corresponding to each parameter field, i.e., easypoi annotations, which include list format information corresponding to the parameter field. The specific content of the information can be set based on demand, and the embodiment of the present application does not limit it. For example, the cell size (i.e., width and height), column name, font format and other information corresponding to the parameter field can be set in the custom annotation.

[0109] In some embodiments, the above-mentioned determining the custom annotation corresponding to the target parameter field based on the pre-stored custom annotations corresponding to each reference parameter field specifically includes:

[0110] Generate target entity classes corresponding to each target parameter field based on reflection mechanism;

[0111] Determine a reference entity class corresponding to the resource type of the thread from the pre-stored entity classes corresponding to the resource types; the reference entity class includes: reference parameter fields corresponding to the corresponding resource type, and custom annotations corresponding to the reference parameter fields;

[0112] Compare the target entity class with the reference entity class, filter the successfully matched target parameter fields, and obtain the custom annotations corresponding to the filtered target parameter fields from the reference entity class.

[0113] In specific implementation, Figure 2 As shown, for each thread, the Java reflection mechanism is used to assemble the target parameter fields included in the resource export request into a target entity class through a tool class method; then, the reference entity class corresponding to the resource type corresponding to the current thread is obtained from the entity classes corresponding to each resource type; the target entity class is compared with the reference entity class, and no subsequent processing is performed on the target parameter fields that fail to be compared (i.e., the fields included in the target entity class but not included in the reference entity class); for the fields that are successfully compared (i.e., the fields included in both the target entity class and the reference entity class), the corresponding custom annotations are obtained.

[0114] In some embodiments, a sublist is generated based on the acquired target resource and the filtered custom annotations, including:

[0115] Determine the target resource corresponding to the filtered target parameter field from the acquired target resources;

[0116] Based on the determined target resource and the custom annotations corresponding to the filtered target parameter fields, a sublist corresponding to the resource type of the corresponding resource export task is generated.

[0117] In a specific implementation, since the target resources obtained are all resources corresponding to the resource type, the embodiment of the present application also needs to further filter the obtained resource types, that is, filter out the target resources corresponding to the target parameter field.

[0118] Specifically, when storing resources in the database, the resource type and field identifier corresponding to each resource are recorded, and the field identifier is used to characterize the parameter field corresponding to the resource; in an embodiment of the present application, the correspondence between the field identifier in the database and each reference parameter field can be pre-stored. After the target resource is acquired based on the thread, the target resource corresponding to the target parameter field selected in the above step can be screened out based on the field identifier corresponding to each target resource and the correspondence.

[0119] In some embodiments, a resource storage area may also be set up in the embodiments of the present application. After obtaining the target resource corresponding to the resource type through a thread, the target resource may also be stored in the resource storage area, so that when a resource export request of the same resource type is subsequently received, the corresponding target resource can be directly obtained from the resource storage area. When the corresponding target resource is not queried from the resource storage area, the above-mentioned step of obtaining the resource from the database through a thread is executed.

[0120] Furthermore, in order to ensure the accuracy of resource data in the resource storage area, the embodiment of the present application can also record the storage time (or acquisition time) of the target resource corresponding to each resource type. When the time interval between the storage time and the current time reaches a preset threshold (the value can be set based on demand), the target resource is deleted from the data storage area.

[0121] Step S104: Generate a target resource list based on each sub-list, and send the target resource list to the client.

[0122] In some embodiments, the above-mentioned target resource list can be an Excel file. In this case, each of the above-mentioned sub-lists is a Sheet page corresponding to the Excel file. After obtaining each sub-list, the sub-lists can be combined in a preset order (this order is not limited in the embodiment of the present application and can be set based on needs) to generate the above-mentioned target resource list.

[0123] It should be noted that the embodiment of the present application does not limit the manner in which the target resource list is sent to the client. Optionally, the generated target resource list may be sent to the client in the form of a binary stream.

[0124] In some embodiments, after the sublist is generated based on the acquired target resources and the filtered custom annotations, the following method is further executed in the embodiment of the present application:

[0125] If there is a composite sub-list with different numbers of target resources corresponding to each target parameter field in the sub-list, then an association relationship between the target resources corresponding to each target parameter field in the composite sub-list is established;

[0126] A target resource list is generated based on the association relationships corresponding to the sub-lists and the composite sub-lists.

[0127] In an embodiment of the present application, for each resource type, the number of target resources corresponding to each target parameter field in the target resources queried corresponding to the resource type may be different, that is, the number of resources between different columns in the generated sub-list is different, that is, a nested type sub-list (that is, the above-mentioned sub-list).

[0128] For example, for resource type 1, its corresponding target parameter fields include: field 1, field 2 and field 3, among which field 1 corresponds to 1 target resource, field 2 corresponds to 2 target resources, and field 3 corresponds to 3 target resources. At this time, the generated sublist corresponding to resource type 1 includes three columns corresponding to field 1, field 2 and field 3 respectively. The column data where field 1 and field 3 are located are both 1 row, and the column data where field 2 is located are both 2 rows. This sublist is a composite sublist.

[0129] In some embodiments, for the above-mentioned composite sub-list, in the embodiments of the present application, after generating the sub-list, it is also necessary to record the association relationship between the target resources in different target parameter fields. Taking the above example, it is necessary to record the association relationship between 1 line of data corresponding to field 1, 2 lines of data corresponding to field 2, and 1 line of data corresponding to field 3, so that when generating the target resource list, the association relationship can be stored in the resource list.

[0130] The above method only needs to modify the pre-stored reference parameter fields and their custom annotations accordingly when the application scenario changes. It is applicable to various scenarios and distributes the export tasks of each resource type to different threads for parallel execution. The resource list is dynamically exported according to the filtered resource type and resource parameters, thereby improving the resource export efficiency.

[0131] The following combination Figure 3The above resource export process is described in detail with a specific example. The process specifically includes:

[0132] Step S301, the client obtains the target parameter field and resource type of the resource to be exported configured by the user, generates a resource export request, and sends it to the server corresponding to the target cloud platform;

[0133] Step S302: The server receives a resource export request and parses the request to obtain a parameter field set and at least one resource type; wherein the parameter field set includes at least one target parameter field;

[0134] Step S303: the server generates a resource export task for each resource type and distributes it to the corresponding thread;

[0135] Step S304, the thread queries the target resource corresponding to the resource type from each device database or data cache area of ​​the target cloud platform;

[0136] Step S305, the thread generates a target entity class corresponding to each target parameter field based on a reflection mechanism, and compares the target entity class with a reference entity class pre-stored in the server;

[0137] The reference entity class is an entity class corresponding to the resource type of the thread, and stores reference parameter fields corresponding to the corresponding resource type and user-defined annotations corresponding to the reference parameter fields.

[0138] Step S306, the thread obtains the custom annotation corresponding to the successfully matched target parameter field, and selects the target resource corresponding to the successfully matched target parameter field from the queried target resources;

[0139] Step S307, the thread generates a sub-list corresponding to the resource type based on the obtained custom annotations and the filtered target resources;

[0140] Step S308: The server merges the sub-lists generated by each thread to generate a target resource list, and returns it to the client in the form of a binary stream.

[0141] Based on the same inventive concept, the present application also provides a resource export device, see Figure 4 , the device comprises:

[0142] The parsing module 401 is used to respond to the resource export request for the target cloud platform triggered by the client, parse the resource export request, obtain a parameter field set corresponding to the resource to be exported and at least one resource type, wherein the parameter field set includes at least one target parameter field;

[0143] A generating module 402 is used to generate a resource export task corresponding to each resource type, and distribute the resource export task to a corresponding thread;

[0144] The determination module 403 is used to obtain the target resource corresponding to the resource type of the corresponding resource export task through each thread respectively, and determine the custom annotation corresponding to the target parameter field based on the pre-stored custom annotations corresponding to each reference parameter field; and generate a sub-list based on the obtained target resource and the filtered custom annotations; the custom annotation is used to identify the list format information of the corresponding parameter field;

[0145] The sending module 404 is used to generate a target resource list based on each sub-list, and send the target resource list to the client.

[0146] In a possible implementation manner, the determination module 403 is specifically configured to:

[0147] Generate target entity classes corresponding to each target parameter field based on reflection mechanism;

[0148] Determine a reference entity class corresponding to the resource type of the thread from pre-stored entity classes corresponding to each resource type; the reference entity class includes: reference parameter fields corresponding to the corresponding resource type, and custom annotations corresponding to each reference parameter field;

[0149] The target entity class is compared with the reference entity class, target parameter fields that have been successfully compared are screened, and custom annotations corresponding to the screened target parameter fields are obtained from the reference entity class.

[0150] In a possible implementation manner, the determination module 403 is specifically configured to:

[0151] Determine the target resource corresponding to the filtered target parameter field from the acquired target resources;

[0152] Based on the determined target resource and the custom annotation corresponding to the filtered target parameter field, a sublist corresponding to the resource type of the corresponding resource export task is generated.

[0153] In a possible implementation manner, the determination module 403 is specifically configured to:

[0154] Querying the target resource corresponding to the resource type of the corresponding resource export task from the databases corresponding to the devices included in the target cloud platform;

[0155] Among them, for the database of any device, the target resource corresponding to the resource type of the corresponding resource export task is queried based on the following method:

[0156] The corresponding resource export task is added to the task message queue corresponding to the database of any of the above devices, and the target resource returned by the task message queue is received.

[0157] In a possible implementation manner, the determination module 403 is specifically configured to:

[0158] Query the target resource corresponding to the resource type of the corresponding resource export task from the data cache area of ​​the target cloud platform;

[0159] The data cache area is obtained by caching the data in each device included in the target cloud platform.

[0160] In a possible implementation manner, the determination module 403 is further configured to:

[0161] If there is a composite sub-list in the sub-list with different numbers of target resources corresponding to each target parameter field, then an association relationship between the target resources corresponding to each target parameter field in the composite sub-list is established;

[0162] Based on the association relationships between the sub-lists and the composite sub-list, a target resource list is generated.

[0163] Based on the same inventive concept, an electronic device is also provided in an embodiment of the present application, and the electronic device can realize the function of the aforementioned resource export device, referring to Figure 5 , the electronic device comprises:

[0164] At least one processor 501, and a memory 502 connected to the at least one processor 501. The specific connection medium between the processor 501 and the memory 502 is not limited in the embodiment of the present application. Figure 5 In the example, the processor 501 and the memory 502 are connected via a bus 500. The bus 500 is Figure 5 The connections between other components are shown in bold lines, and are not intended to be limiting. The bus 500 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. Alternatively, the processor 501 can also be called a controller, and there is no limitation on the name.

[0165] In the embodiment of the present application, the memory 502 stores instructions that can be executed by at least one processor 501. The at least one processor 501 can execute the resource export method discussed above by executing the instructions stored in the memory 502. The processor 501 can implement Figure 5The functions of each module in the device shown.

[0166] Among them, the processor 501 is the control center of the device, and can use various interfaces and lines to connect the various parts of the entire control device. By running or executing instructions stored in the memory 502 and calling data stored in the memory 502, the various functions of the device and processing data, the device can be monitored as a whole.

[0167] In one possible design, the processor 501 may include one or more processing units, and the processor 501 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor 501. In some embodiments, the processor 501 and the memory 502 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on separate chips.

[0168] Processor 501 can be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, and can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor can be a microprocessor or any conventional processor, etc. The steps of the resource export method disclosed in the embodiments of the present application can be directly embodied as a hardware processor execution, or a combination of hardware and software modules in the processor.

[0169] The memory 502 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 502 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory 502 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 502 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.

[0170] By designing and programming the processor 501, the code corresponding to the application anomaly detection method described in the above embodiment can be fixed into the chip, so that the chip can execute the code when running. Figure 1 The steps of the resource export method of the embodiment shown are as follows: How to design and program the processor 501 is a technique known to those skilled in the art and will not be described in detail here.

[0171] An embodiment of the present application also provides a computer-readable storage medium that stores computer-executable instructions required to execute the above-mentioned processor, which includes a program required to execute the above-mentioned processor.

[0172] In some possible implementations, various aspects of the resource export method provided in the present application may also be implemented in the form of a program product, which includes a program code. When the above-mentioned program product is run on an electronic device, the above-mentioned program code is used to enable the above-mentioned electronic device to execute the steps of the resource export method according to various exemplary implementations of the present application described above in this specification.

[0173] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0174] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (apparatus), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0175] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0176] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0177] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0178] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A resource export method, characterized in that: Applied to a server, the method comprises: In response to a resource export request for a target cloud platform triggered by a client, the resource export request is parsed to obtain a parameter field set corresponding to the resource to be exported and at least one resource type, wherein the parameter field set includes at least one target parameter field; For each resource type, generate a resource export task corresponding to the resource type, and distribute the resource export task to the corresponding thread; Obtaining a target resource corresponding to a resource type of a corresponding resource export task through each thread respectively, and determining a custom annotation corresponding to the target parameter field based on custom annotations corresponding to each reference parameter field stored in advance; and generating a sublist based on the obtained target resource and the filtered custom annotations; the custom annotation is used to identify list format information of the corresponding parameter field; A target resource list is generated based on each sub-list, and the target resource list is sent to the client.

2. The method according to claim 1, characterized in that The step of determining the custom annotation corresponding to the target parameter field based on the pre-stored custom annotations corresponding to the reference parameter fields includes: Generate target entity classes corresponding to each target parameter field based on reflection mechanism; Determine a reference entity class corresponding to the resource type of the thread from pre-stored entity classes corresponding to each resource type; the reference entity class includes: reference parameter fields corresponding to the corresponding resource type, and custom annotations corresponding to each reference parameter field; The target entity class is compared with the reference entity class, target parameter fields that have been successfully compared are screened, and custom annotations corresponding to the screened target parameter fields are obtained from the reference entity class.

3. The method according to claim 2, characterized in that The sublist is generated based on the acquired target resource and the filtered custom annotations, including: Determine the target resource corresponding to the filtered target parameter field from the acquired target resources; Based on the determined target resource and the custom annotation corresponding to the filtered target parameter field, a sublist corresponding to the resource type of the corresponding resource export task is generated.

4. The method according to claim 1, characterized in that: The step of acquiring a target resource corresponding to a resource type of a corresponding resource export task includes: Querying the target resource corresponding to the resource type of the corresponding resource export task from the databases corresponding to the devices included in the target cloud platform; Among them, for the database of any device, the target resource corresponding to the resource type of the corresponding resource export task is queried based on the following method: The corresponding resource export task is added to the task message queue corresponding to the database of any one of the devices, and the target resource returned by the task message queue is received.

5. The method according to any one of claim 1, characterized in that: The step of acquiring a target resource corresponding to a resource type of a corresponding resource export task includes: Querying the target resource corresponding to the resource type of the corresponding resource export task from the data cache area of ​​the target cloud platform; The data cache area is obtained by caching the data in each device included in the target cloud platform.

6. The method according to any one of claims 1 to 5, characterized in that: After generating the sublist based on the acquired target resource and the filtered custom annotation, the method further includes: If there is a composite sub-list in the sub-list with different numbers of target resources corresponding to each target parameter field, establishing an association relationship between the target resources corresponding to each target parameter field in the composite sub-list; The generating of the target resource list based on each sub-list includes: A target resource list is generated based on the association relationships corresponding to the sub-lists and the composite sub-list.

7. A resource export device, characterized in that: Applied to a server, the device comprises: A parsing module, configured to respond to a resource export request for a target cloud platform triggered by a client, parse the resource export request, obtain a parameter field set corresponding to the resource to be exported and at least one resource type, wherein the parameter field set includes at least one target parameter field; A generation module, used for generating, for each resource type, a resource export task corresponding to the resource type, and distributing the resource export task to a corresponding thread; A determination module, used to obtain, through each thread respectively, a target resource corresponding to a resource type of a corresponding resource export task, and determine, based on pre-stored custom annotations corresponding to each reference parameter field, a custom annotation corresponding to the target parameter field; and, based on the obtained target resource and the filtered custom annotation, generate a sublist; the custom annotation is used to identify list format information of the corresponding parameter field; The sending module is used to generate a target resource list based on each sub-list, and send the target resource list to the client.

8. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to implement the method according to any one of claims 1 to 6 when executing a computer program stored in the memory.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

10. A computer program product, characterized in that The computer program product comprises: a computer program code, and when the computer program code is run on a computer, the computer is enabled to execute the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Resource exporting method and device

    CN113326299A

  • Interface access control method and device, electronic equipment and storage medium

    CN114519181A

  • Big data exporting method and device based on platform

    CN115934297A

  • Excel file exporting method and system, computer equipment and readable storage medium

    CN117349244A