Data downloading method and apparatus, storage medium, and electronic device

By receiving and saving the download task queue and executing the download tasks in a preset order, the problem of system lag during peak business periods was solved. This decoupled the download tasks from the business system and enabled asynchronous execution, thereby improving system performance and user experience.

CN115695413BActive Publication Date: 2026-07-24HAIER YOUJIA INTELLIGENT TECH (BEIJING) CO LTD +2
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HAIER YOUJIA INTELLIGENT TECH (BEIJING) CO LTD
Filing Date
2022-09-29
Publication Date
2026-07-24

AI Technical Summary

Technical Problem

During peak business operation periods, the system experiences lag due to multiple download tasks being executed in parallel, a problem that cannot be effectively solved by existing technologies.

Method used

By receiving download tasks from target applications, determining their permissions, storing them in a task queue, and executing the download tasks in a preset order, the separation and asynchronous execution of download tasks from business systems are achieved.

Benefits of technology

The system lag issue was resolved, the download task was decoupled from the business system, resource waste was avoided, poor user experience was reduced, and business costs were saved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115695413B_ABST
    Figure CN115695413B_ABST
Patent Text Reader

Abstract

The application discloses a data downloading method and device, a storage medium and an electronic device, relates to the technical field of smart home, and the data downloading method comprises the following steps: receiving a downloading task sent by a target application, and determining whether the target application has downloading authority at the time of sending the downloading task according to request information carried by the downloading task; in the case that it is determined that the target application has the downloading authority at the time of sending the downloading task, saving the downloading task in a task queue; and executing a plurality of downloading tasks in the task queue in a preset order to download data corresponding to the plurality of downloading tasks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of smart home technology, and more specifically, to a data download method and apparatus, storage medium and electronic device. Background Technology

[0002] With the rapid development of internet technology, various industries are beginning to shift their daily operations online: live shopping, online office work, and so on. As people use things, data is generated, which needs to be analyzed from multiple perspectives, and relevant analysis and maintenance reports need to be downloaded.

[0003] Traditional downloading requires the backend to query the database based on conditions, organize and integrate the data, and then convert it into an IO stream response to be sent back to the frontend for users to download. However, as system functions become more complex, the number of locations requiring download functionality also increases; the more users there are, the greater the daily download volume becomes. The data conversion process in memory during downloads is extremely resource-intensive, and during peak business periods, it can even lead to OutOfMemoryError (OOM) errors, causing backend service crashes. Therefore, existing technologies either limit the frequency of downloads or increase server resources to avoid such situations. However, the former affects the user experience and does not completely solve the problem; the latter increases costs, and the resources added for peak periods are mostly idle, which is not conducive to cost maintenance.

[0004] In existing technologies, when multiple download tasks are executed in parallel during peak business operation periods, the system may experience lag or other issues, and no effective solution has yet been proposed. Summary of the Invention

[0005] This invention provides a data download method and apparatus, storage medium and electronic device to at least solve the problem in the prior art where system lag occurs when multiple download tasks are executed in parallel during peak business operation periods.

[0006] According to one embodiment of the present invention, a data download method is provided, comprising: receiving a download task sent by a target application, and determining whether the target application has download permission at the time of sending the download task based on request information carried by the download task; if it is determined that the target application has the download permission at the time of sending the download task, storing the download task in a task queue; and executing multiple download tasks in the task queue in a preset order to download data corresponding to the multiple download tasks.

[0007] In an exemplary embodiment, before receiving a download task sent by a target application, the method further includes: receiving an authentication request sent by the target application, wherein the authentication request carries public key information of the target application; in response to the authentication request, matching the public key information in a first database; and, if the public key information is matched in the first database, determining that the target application has the download permission.

[0008] In an exemplary embodiment, the authentication request also carries the private key information of the target application. After determining that the target application has the download permission, the method further includes: generating a temporary token based on the private key information carried in the authentication request, wherein the temporary token is used to identify that the target application has the download permission; sending the temporary token to the target application; and storing the temporary token in a second database.

[0009] In one exemplary embodiment, receiving a download task sent by a target application and determining whether the target application has download permission at the time the download task is sent based on the request information carried by the download task includes: if the request information carried by the download task does not include a temporary token, determining that the target application does not have the download permission at the time the download task is sent, wherein the temporary token is used to identify that the target application has download permission; if the request information carried by the download task includes the temporary token, determining whether the temporary token is invalid, and if the temporary token is not invalid, determining that the target application has the download permission at the time the download task is sent.

[0010] In an exemplary embodiment, when it is determined that the target application has the download permission at the time of sending the download task, storing the download task in a task queue includes: when it is determined that the target application has the download permission at the time of sending the download task, obtaining a task identifier and download parameters from the request information carried by the download task, and storing the task identifier and the download parameters in the task queue, wherein the task identifier is used to identify the category of the download task, and the download parameters are used to indicate the condition parameters of the download task.

[0011] In an exemplary embodiment, after executing multiple download tasks in the task queue in a preset order to download data corresponding to the multiple download tasks, the method further includes: obtaining the task identifier and the download parameters stored in the task queue; determining storage rules based on the task identifier and the download parameters, and generating a data file based on target data and the storage rules, wherein the target data is the data corresponding to the download task; storing the data file in a first database, and sending the obtained storage information to the target application, wherein the storage information is used to indicate the location information of the data file in the first database.

[0012] In one exemplary embodiment, executing multiple download tasks in the task queue in a preset order includes: sequentially executing multiple download tasks in the task queue according to the time order in which the multiple download tasks were received, or executing multiple download tasks in the task queue respectively according to preset time information in the request information carried by the multiple download tasks, wherein the preset time information is used to indicate the time for executing the download task.

[0013] According to another embodiment of the present invention, a data download apparatus is also provided, comprising: a receiving module, configured to receive a download task sent by a target application, and determine whether the target application has download permission at the time the download task is sent based on request information carried by the download task; a saving module, configured to save the download task in a task queue if it is determined that the target application has the download permission at the time the download task is sent; and an execution module, configured to execute multiple download tasks in the task queue in a preset order to download data corresponding to the multiple download tasks.

[0014] According to another aspect of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer program, which is configured to execute the above-described data download method when running.

[0015] According to another aspect of the present invention, an electronic device is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the above-described data download method through the computer program.

[0016] In this embodiment, a download task sent by a target application is received, and the request information carried by the download task is used to determine whether the target application has download permission at the time the download task is sent. If it is determined that the target application has the download permission at the time the download task is sent, the download task is stored in a task queue. Multiple download tasks in the task queue are executed in a preset order to download the data corresponding to the multiple download tasks. By adopting the above technical solution, the problem of system lag caused by the parallel execution of multiple download tasks during peak business operation periods in the prior art is solved. The technical effect of separating download tasks from business systems and executing download tasks asynchronously is achieved. Attached Figure Description

[0017] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0018] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a schematic diagram of the hardware environment for an optional data download method according to an embodiment of the present invention;

[0020] Figure 2 This is a flowchart of an optional data download method according to an embodiment of the present invention;

[0021] Figure 3 This is a flowchart (a) of an optional data download method according to an embodiment of the present invention;

[0022] Figure 4 This is a flowchart (II) of an optional data download method according to an embodiment of the present invention;

[0023] Figure 5 This is a schematic diagram of an optional download platform system architecture according to an embodiment of the present invention;

[0024] Figure 6 This is an interactive flow topology diagram of an optional download platform according to an embodiment of the present invention;

[0025] Figure 7 This is a flowchart (III) of an optional data download method according to an embodiment of the present invention;

[0026] Figure 8This is a structural block diagram of an optional data download device according to an embodiment of the present invention. Detailed Implementation

[0027] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0028] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0029] According to one aspect of the embodiments of this application, a data download method is provided. This data download method is widely applicable to whole-house intelligent digital control application scenarios such as smart homes, smart home ecosystems, and intelligencehouse ecosystems. Optionally, in this embodiment, the above-mentioned data download method can be applied to, for example... Figure 1 The hardware environment shown consists of terminal device 102 and server 104. For example... Figure 1 As shown, server 104 is connected to terminal device 102 via a network and can be used to provide services (such as application services) to the terminal or clients installed on the terminal. A database can be set up on the server or independently of the server to provide data storage services for server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data processing services for server 104.

[0030] The aforementioned network may include, but is not limited to, at least one of the following: wired network, wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network, metropolitan area network, local area network. The aforementioned wireless network may include, but is not limited to, at least one of the following: Wi-Fi (Wireless Fidelity), Bluetooth. Terminal device 102 may not be limited to PC, mobile phone, tablet computer, smart air conditioner, smart range hood, refrigerator, smart oven, smart stove, smart washing machine, smart water heater, smart washing equipment, smart dishwasher, smart projector, smart TV, smart clothes rack, smart curtains, smart audio-visual equipment, smart socket, smart speaker, smart speaker box, smart fresh air equipment, smart kitchen and bathroom equipment, smart bathroom equipment, smart robot vacuum cleaner, smart window cleaning robot, smart mopping robot, smart air purifier, smart steam oven, smart microwave oven, smart water heater, smart air purifier, smart water dispenser, smart door lock, etc.

[0031] This embodiment provides a data download method, applied to the aforementioned download platform. Figure 2 This is a flowchart of an optional data download method according to an embodiment of the present invention, the process including the following steps:

[0032] Step S202: Receive the download task sent by the target application, and determine whether the target application has download permission at the time the download task is sent based on the request information carried by the download task.

[0033] It should be noted that the above request information refers to the information contained in the download request initiated by the user through the APP. The request includes the request header, request body, etc., and the request information includes, but is not limited to, the task identifier and download parameters mentioned above.

[0034] Step S204: If it is determined that the target application has the download permission at the time of sending the download task, the download task is saved in the task queue;

[0035] It should be noted that the temporary token used to identify that the target application has download permission can be understood as the token information carried in the download request. Since the token has an expiration time, the download platform needs to determine whether the token information of the target application has expired when the download task is received.

[0036] Step S206: Execute multiple download tasks in the task queue in a preset order to download the data corresponding to the multiple download tasks.

[0037] It should be noted that the above preset order can be sorted according to the data size corresponding to the download task, or according to the time of submission of the download task, or it can be the execution time order predetermined by the user when submitting the download task. This application does not limit this.

[0038] In this embodiment, a download task sent by a target application is received, and the request information carried by the download task is used to determine whether the target application has download permission at the time the download task is sent. If it is determined that the target application has the download permission at the time the download task is sent, the download task is stored in a task queue. Multiple download tasks in the task queue are executed in a preset order to download the data corresponding to the multiple download tasks. By adopting the above technical solution, the problem of system lag caused by the parallel execution of multiple download tasks during peak business operation periods in the prior art is solved. The technical effect of separating download tasks from business systems and executing download tasks asynchronously is achieved.

[0039] Optionally, before performing step S202 above: receiving the download task sent by the target application, the method further includes: receiving an authentication request sent by the target application, wherein the authentication request carries the public key information of the target application; in response to the authentication request, matching the public key information in a first database; and if the public key information is matched in the first database, determining that the target application has the download permission.

[0040] Not all third-party systems (equivalent to the target applications mentioned above) can be downloaded through the download platform. The database (equivalent to the first database mentioned above) will pre-store the public key information of the third-party systems with download permissions. Therefore, before the download platform receives the authentication request sent by the target application, it also needs to receive the authentication request sent by the target application first, and query the database according to the public key information of the target application carried in the authentication request to see if the target application has download permissions.

[0041] Optionally, the authentication request also carries the private key information of the target application. After determining that the target application has the download permission, the method further includes: generating a temporary token based on the private key information carried in the authentication request, wherein the temporary token is used to identify that the target application has the download permission; sending the temporary token to the target application; and storing the temporary token in a second database.

[0042] The authentication request also carries the target application's private key information. The private key information is used to determine that the target application has download permission, generate a temporary token, send the temporary token to the target application, and simultaneously save it in the second database; that is, a temporary token is generated for the target application, and the target application needs to carry this temporary token when sending download requests in the future.

[0043] It should be noted that the aforementioned temporary token can be understood as token information. When the APP (equivalent to the target application mentioned above) initiates a request, it will carry token information in the header. Therefore, after receiving the download request, the download platform will parse the request information to determine whether the target application has download permission.

[0044] It should be noted that the second database mentioned above can be a Redis database, which has excellent read and write performance. The second database can also be other databases with good read and write performance, and this application does not impose any restrictions on this.

[0045] Optionally, step S202 above: receiving a download task sent by the target application, and determining whether the target application has download permission at the time of sending the download task based on the request information carried by the download task, includes: if the request information carried by the download task does not include a temporary token, determining that the target application does not have the download permission at the time of sending the download task, wherein the temporary token is used to identify that the target application has download permission; if the request information carried by the download task includes the temporary token, determining whether the temporary token is invalid, and if it is determined that the temporary token is not invalid, determining that the target application has the download permission at the time of sending the download task.

[0046] If the download platform does not find the temporary token after parsing the request information carried in the download task, it is determined that the target application did not have download permissions when sending the download task. If the download platform finds the temporary token after parsing the request information carried in the download task, it further confirms whether the temporary token has expired. Specifically, it can determine the validity period of the temporary token by obtaining the relevant information of the temporary token stored in the second database, thereby determining whether the temporary token has expired. Alternatively, it can set a validity period when saving the temporary token to the second database, and determine whether the temporary token has expired based on whether it can be found in the second database. If it is determined that the temporary token has not expired, it is determined that the target application had the download permissions at the time of sending the download task.

[0047] It should be noted that the above "the request information carried by the download task does not include a temporary token" can be interpreted as the temporary token included in the request information not being found in the second database, or as the request information not carrying a temporary token; this application does not impose any restrictions on this.

[0048] Optionally, step S204 above: if it is determined that the target application has the download permission at the time of sending the download task, the download task is saved in the task queue. This can be achieved by the following scheme: if it is determined that the target application has the download permission at the time of sending the download task, the task identifier and download parameters are obtained from the request information carried by the download task, and the task identifier and download parameters are saved in the task queue. The task identifier is used to identify the category of the download task, and the download parameters are used to indicate the condition parameters of the download task.

[0049] If it is determined that the target application has download permissions at the time the download task is sent, the download platform first saves the download task. Therefore, it is necessary to obtain the task identifier used to identify the category of the download task and the download parameters used to indicate the condition parameters of the download task from the request information of the download task, and save the task identifier and download parameters in the task queue.

[0050] Optionally, after performing step S206 above: executing multiple download tasks in the task queue in a preset order to download the data corresponding to the multiple download tasks, the method further includes: obtaining the task identifier and the download parameters stored in the task queue; determining storage rules based on the task identifier and the download parameters, and generating a data file based on the target data and the storage rules, wherein the target data is the data corresponding to the download task; storing the data file in a first database, and sending the obtained storage information to the target application, wherein the storage information is used to indicate the location information of the data file in the first database.

[0051] When executing a download task, the task identifier and download parameters are obtained. Based on the task identifier and download parameters, the storage rules for the target data are determined, and the download task is executed. The target data is obtained from the target application, and then a data file is generated based on the target data and the storage rules. Finally, the data file is stored in the first database, and the storage information returned by the database to indicate the storage location is sent to the target application.

[0052] It should be noted that the above download parameters can be understood as the restrictions on the data to be obtained by the user-initiated download task, that is, to obtain the target data from the target application according to the restrictions corresponding to the download parameters.

[0053] It should be noted that the R&D personnel will first pre-create various task identifiers based on the data types contained in the third-party systems matched by the download platform, and configure various storage rules according to the task identifiers. The storage rules will be automatically adjusted in combination with the download parameters. When responding to a download task, the target data is first obtained according to the download parameters, and then the data file, such as an Excel file, is automatically generated according to the storage rules corresponding to the task identifier after obtaining the target data from the third-party system.

[0054] In one exemplary embodiment, executing multiple download tasks in the task queue in a preset order includes: sequentially executing multiple download tasks in the task queue according to the time order in which the multiple download tasks were received, or executing multiple download tasks in the task queue respectively according to preset time information in the request information carried by the multiple download tasks, wherein the preset time information is used to indicate the time for executing the download task.

[0055] Multiple download tasks in the task queue can be executed in several orders: the order in which the download tasks are submitted, or the order in which the user sets the preset time information when submitting the download task. The preset time information is used to indicate the time when the download task will be executed. For example, if the user wants to start downloading a large data file at 12:00 midnight, the download task can be set to start at 0:00:00 when it is submitted.

[0056] It should be noted that, in addition to the two orders mentioned above, download tasks can also be executed in other orders, such as sorting the tasks from smallest to largest according to the data size corresponding to the download task; the specific method can be specified by the user, and this application does not impose any restrictions on it.

[0057] This embodiment provides a data download method. Figure 3 This is a flowchart (I) of an optional data download method according to an embodiment of the present invention, as shown below. Figure 3 As shown, it includes the following steps:

[0058] Step 1: User A creates an export task (equivalent to the download task mentioned above);

[0059] Step 2: The backend management system executes the export task;

[0060] Step 3: The backend returns the downloaded data to the backend management system;

[0061] Step 4: The backend management system notifies user A that the download is complete;

[0062] Step 5: User b creates an export task;

[0063] Step 6: The backend management system executes the export task;

[0064] Step 7: The backend returns the downloaded data to the backend management system;

[0065] Step 8: The backend management system notifies user b that the download is complete.

[0066] Through the above steps, the user logs into the backend management system and creates an export task. The backend executes a query based on the conditions and converts the query results into an IO file stream, which is then fed back to the backend management system. The frontend then generates the corresponding document based on the IO file stream and notifies the user that the download is complete. It can be seen that the backend management system can only start executing a download task when it receives a download task initiated by the user, and execute the next download task after the previous one is completed. That is, the backend management system can only perform synchronous downloads. However, the download function consumes a lot of system resources when converting data in memory. Therefore, during peak business operation periods, an OutOfMemoryError (OOM) may occur, causing the backend service to crash.

[0067] To address the aforementioned problems, this application proposes another embodiment, which combines... Figure 4 To explain, such as Figure 4 As shown, Figure 4 This is a sequence diagram (II) of an alternative data download method, which specifically includes the following steps:

[0068] Step 1: User A creates an export;

[0069] Step 2: The backend management system executes the export task;

[0070] Step 3: The backend returns the export status;

[0071] Step 4: The backend management system informs user A of the exported results;

[0072] Step 5: User A downloads and exports the document;

[0073] Step 6: The background management system executes the download task;

[0074] Step 7: The backend returns the downloaded data to the backend management system;

[0075] Step 8: The backend management system notifies user A that the download is complete.

[0076] Through the above steps, the user logs into the management system, creates an export task, and the backend first responds to the frontend that the task has been successfully submitted. Then, the backend asynchronously executes the download process. The backend converts the query results into an IO file stream and uploads it to the cloud server for storage. After the upload to the cloud server is successful, the user is notified of the download address. The user then downloads the file according to the download address, and the download is complete. By adopting the above scheme, the creation of the download task and the execution of the download task are separated and executed separately by the system, thereby realizing asynchronous download and avoiding the problem of system lag caused by download consuming system resources.

[0077] To achieve the above solution, this application proposes a download middleware platform. Figure 5 This is a schematic diagram of an optional download middleware system architecture, specifically including:

[0078] Front-end technology stack: Vue;

[0079] Operations and maintenance technology stack: Nginx, Docker deployment, Redis cluster and cloud storage;

[0080] Distributed technology stack: Spring Cloud, Spring Boot;

[0081] Persistence technology stack: MyBatis Plus, Spring DataRedis;

[0082] Database technology stack: MySQL read-write separation.

[0083] This application uses the aforementioned technology to build the download platform, which decouples business operations and download tasks during the download process; regardless of the number of download tasks, business operations are not affected; and by centrally processing download tasks, resource waste in the business system is avoided; and a poor user experience is reduced.

[0084] Based on the aforementioned download platform, this application also provides an optional interactive flow topology diagram of the download platform, such as... Figure 6 As shown, it includes:

[0085] In this application, the front-end OA office system, management platform, and other systems are all operated and managed through the back-end server. Download tasks, however, are handled separately through a download middleware platform. The switches within the download middleware platform interact with the back-end server. Download requests are received from the back-end server via a download request receiving service and stored in a database. Download batch processing services then process the download tasks in batches and upload the downloaded data to a cloud storage service for storage. This download middleware platform separates the download process from the business system, avoiding performance bottlenecks such as memory consumption leading to lag and OutOfMemoryError (OOM) errors. Furthermore, by integrating and sharing server resources, it saves on business costs.

[0086] Furthermore, based on the aforementioned download platform, this application also provides an optional data download method, such as... Figure 7 As shown, Figure 7 This is a flowchart (III) of an optional data download method according to an embodiment of the present invention, which specifically includes the following steps:

[0087] Step 702: The user initiates a download request through a third-party system (equivalent to the target application mentioned above);

[0088] Step 704: The third-party system initiates an API authorization (equivalent to the authentication request mentioned above) to the download platform, carrying the appkey (equivalent to the public key information mentioned above) and appSecret (equivalent to the private key information mentioned above);

[0089] Step 706: Download the middleware and query the appkey in the MySQL database (equivalent to the first database mentioned above);

[0090] Step 708: The MySQL database returns the query results;

[0091] Step 710: Determine whether the third-party system has download permissions based on the query results;

[0092] Step 712: The download platform generates a token (equivalent to the temporary token mentioned above) based on the appSecret and caches the token in the Redis database (equivalent to the second database mentioned above);

[0093] Step 714: Download the token and related information returned by the middle platform and send them to the third-party system;

[0094] Step 716: The third-party system submits the download task, which carries the taskCode (equivalent to the task identifier mentioned above) and taskParams (equivalent to the condition parameters mentioned above);

[0095] Step 718: Download the middle platform to verify whether the token in the header is valid;

[0096] Step 720: If valid, save the task in the task queue of the MySQL database;

[0097] Step 722: The download platform retrieves task information to be executed from the task queue;

[0098] Step 724: The download platform queries business data in the third-party system based on the acquired task information;

[0099] Step 726: The third-party system sends the retrieved business data back to the download platform in the form of a JSON file;

[0100] It should be noted that the above feedback in JSON file format is only for example, and other formats are also possible. This application does not limit the format of data feedback.

[0101] Step 728: Download the data file generated by the middle platform according to preset rules;

[0102] Step 730: The download platform stores the generated data files in a MySQL database;

[0103] Step 732: The MySQL database returns storage information to the download platform, including the storage ID and storage address information (equivalent to the storage information mentioned above).

[0104] It should be noted that after the download platform completes the download, it can display the downloaded file to the user according to the preset plugins. At the same time, the preset plugins can also allow users to manage download tasks and realize functions such as viewing and canceling.

[0105] It should be noted that after the download task is completed, the download platform can notify the user via email, SMS, app notification, etc.; the above notification methods are only used as examples, and other methods can be used in actual applications; this application does not impose any restrictions on this.

[0106] Through the above steps, users submit download requests through an authenticated third-party business system. Upon receiving the download request, the download platform stores the request and related information in the database and notifies the download platform. Upon receiving the notification, the download platform executes the download task according to the user's configuration. After the download task is completed, the user is notified, and the user retrieves the downloaded file from the storage address. By providing a unified download platform, this solution solves the problem of duplicate download functions between and within different systems. At the same time, separating the download process from the business system avoids performance bottlenecks caused by the download function consuming memory, resulting in lag and OutOfMemoryError, and saves business costs.

[0107] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of the present invention.

[0108] This embodiment also provides a data download device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0109] Figure 8 This is a structural block diagram of an optional data download device according to an embodiment of the present invention; as shown below. Figure 8 As shown, it includes:

[0110] The receiving module 82 is used to receive the download task sent by the target application, and determine whether the target application has download permission at the time of sending the download task based on the request information carried by the download task.

[0111] The storage module 84 is used to store the download task in the task queue when it is determined that the target application has the download permission at the time of sending the download task;

[0112] The execution module 86 is used to execute multiple download tasks in the task queue in a preset order to download the data corresponding to the multiple download tasks.

[0113] The above-described device receives download tasks sent by a target application and determines whether the target application has download permissions at the time the download task is sent based on the request information carried by the download task. If it is determined that the target application has the download permissions at the time the download task is sent, the download task is stored in a task queue. Multiple download tasks in the task queue are executed in a preset order to download the data corresponding to the multiple download tasks. By adopting the above technical solution, the problem of system lag caused by the parallel execution of multiple download tasks during peak business operation periods in the prior art is solved. The technical effect of separating download tasks from business systems and executing download tasks asynchronously is achieved.

[0114] Optionally, the receiving module 82 is further configured to receive an authentication request sent by the target application before receiving the download task sent by the target application, wherein the authentication request carries the public key information of the target application; in response to the authentication request, match the public key information in a first database; and if the public key information is matched in the first database, determine that the target application has the download permission.

[0115] Not all third-party systems (equivalent to the target applications mentioned above) can be downloaded through the download platform. The database (equivalent to the first database mentioned above) will pre-store the public key information of the third-party systems with download permissions. Therefore, before the download platform receives the authentication request sent by the target application, it also needs to receive the authentication request sent by the target application first, and query the database according to the public key information of the target application carried in the authentication request to see if the target application has download permissions.

[0116] Optionally, the authentication request also carries the private key information of the target application. The storage module 84 is further configured to, after determining that the target application has the download permission, generate a temporary token based on the private key information carried in the authentication request, wherein the temporary token is used to identify that the target application has the download permission; send the temporary token to the target application; and store the temporary token in a second database.

[0117] The authentication request also carries the target application's private key information. The private key information is used to determine that the target application has download permission, generate a temporary token, send the temporary token to the target application, and simultaneously save it in the second database; that is, a temporary token is generated for the target application, and the target application needs to carry this temporary token when sending download requests in the future.

[0118] It should be noted that the aforementioned temporary token can be understood as token information. When the APP (equivalent to the target application mentioned above) initiates a request, it will carry token information in the header. Therefore, after receiving the download request, the download platform will parse the request information to determine whether the target application has download permission.

[0119] It should be noted that the second database mentioned above can be a Redis database, which has excellent read and write performance. The second database can also be other databases with good read and write performance, and this application does not impose any restrictions on this.

[0120] Optionally, the receiving module 82 is further configured to: determine if the target application does not have the download permission at the time of sending the download task when the request information carried by the download task does not include a temporary token, wherein the temporary token is used to identify that the target application has the download permission; and determine whether the temporary token is invalid when the request information carried by the download task includes the temporary token, and determine that the target application has the download permission at the time of sending the download task if the temporary token is not invalid.

[0121] If the download platform does not find the temporary token after parsing the request information carried in the download task, it is determined that the target application did not have download permissions when sending the download task. If the download platform finds the temporary token after parsing the request information carried in the download task, it further confirms whether the temporary token has expired. Specifically, it can determine the validity period of the temporary token by obtaining the relevant information of the temporary token stored in the second database, thereby determining whether the temporary token has expired. Alternatively, it can set a validity period when saving the temporary token to the second database, and determine whether the temporary token has expired based on whether it can be found in the second database. If it is determined that the temporary token has not expired, it is determined that the target application had the download permissions at the time of sending the download task.

[0122] It should be noted that the above "the request information carried by the download task does not include a temporary token" can be interpreted as the temporary token included in the request information not being found in the second database, or as the request information not carrying a temporary token; this application does not impose any restrictions on this.

[0123] Optionally, the storage module 84 is further configured to, when determining that the target application has the download permission at the time of sending the download task, obtain a task identifier and download parameters from the request information carried by the download task, and store the task identifier and the download parameters in the task queue, wherein the task identifier is used to identify the category of the download task, and the download parameters are used to indicate the condition parameters of the download task.

[0124] If it is determined that the target application has download permissions at the time the download task is sent, the download platform first saves the download task. Therefore, it is necessary to obtain the task identifier used to identify the category of the download task and the download parameters used to indicate the condition parameters of the download task from the request information of the download task, and save the task identifier and download parameters in the task queue.

[0125] Optionally, the execution module 86 is further configured to execute multiple download tasks in the task queue in a preset order to download the data corresponding to the multiple download tasks, and then obtain the task identifier and the download parameters stored in the task queue; determine storage rules based on the task identifier and the download parameters, and generate a data file based on the target data and the storage rules, wherein the target data is the data corresponding to the download task; store the data file in a first database, and send the obtained storage information to the target application, wherein the storage information is used to indicate the location information of the data file in the first database.

[0126] When executing a download task, the task identifier and download parameters are obtained. Based on the task identifier and download parameters, the storage rules for the target data are determined, and the download task is executed. The target data is obtained from the target application, and then a data file is generated based on the target data and the storage rules. Finally, the data file is stored in the first database, and the storage information returned by the database to indicate the storage location is sent to the target application.

[0127] It should be noted that the above download parameters can be understood as the restrictions on the data to be obtained by the user-initiated download task, that is, to obtain the target data from the target application according to the restrictions corresponding to the download parameters.

[0128] It should be noted that the R&D personnel will first pre-create various task identifiers based on the data types contained in the third-party systems matched by the download platform, and configure various storage rules according to the task identifiers. The storage rules will be automatically adjusted in combination with the download parameters. When responding to a download task, the target data is first obtained according to the download parameters, and then the data file, such as an Excel file, is automatically generated according to the storage rules corresponding to the task identifier after obtaining the target data from the third-party system.

[0129] In an exemplary embodiment, the execution module 86 is further configured to execute multiple download tasks in the task queue sequentially according to the time order in which the multiple download tasks are received, or to execute multiple download tasks in the task queue respectively according to preset time information in the request information carried by the multiple download tasks, wherein the preset time information is used to indicate the time for executing the download task.

[0130] Multiple download tasks in the task queue can be executed in several orders: the order in which the download tasks are submitted, or the order in which the user sets the preset time information when submitting the download task. The preset time information is used to indicate the time when the download task will be executed. For example, if the user wants to start downloading a large data file at 12:00 midnight, the download task can be set to start at 0:00:00 when it is submitted.

[0131] It should be noted that, in addition to the two orders mentioned above, download tasks can also be executed in other orders, such as sorting the tasks from smallest to largest according to the data size corresponding to the download task; the specific method can be specified by the user, and this application does not impose any restrictions on it.

[0132] Embodiments of the present invention also provide a storage medium comprising a stored program, wherein the program, when executed, performs any of the methods described above.

[0133] Optionally, in this embodiment, the storage medium may be configured to store program code for performing the following steps:

[0134] S1, Receive a download task sent by the target application, and determine whether the target application has download permission at the time the download task is sent based on the request information carried by the download task;

[0135] S2, if it is determined that the target application has the download permission at the time of sending the download task, the download task is saved in the task queue;

[0136] S3, execute multiple download tasks in the task queue in a preset order to download the data corresponding to the multiple download tasks.

[0137] Embodiments of the present invention also provide an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.

[0138] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0139] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:

[0140] S1, Receive a download task sent by the target application, and determine whether the target application has download permission at the time the download task is sent based on the request information carried by the download task;

[0141] S2, if it is determined that the target application has the download permission at the time of sending the download task, the download task is saved in the task queue;

[0142] S3, execute multiple download tasks in the task queue in a preset order to download the data corresponding to the multiple download tasks.

[0143] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0144] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.

[0145] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.

[0146] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A data download method, characterized in that, include: Receive a download task sent by the target application, and determine whether the target application has download permission at the time the download task is sent based on the request information carried by the download task; If it is determined that the target application has the download permission at the time the download task is sent, the download task is saved in the task queue; Multiple download tasks in the task queue are executed in a preset order to download the data corresponding to the multiple download tasks; This includes receiving a download task sent by a target application and determining whether the target application has download permissions at the time the download task is sent, based on the request information carried in the download task. If the request information carried by the download task does not include a temporary token, it is determined that the target application does not have the download permission at the time the download task is sent, wherein the temporary token is used to identify that the target application has the download permission; If the temporary token is included in the request information carried by the download task, determine whether the temporary token has expired, and if the temporary token has not expired, determine that the target application has the download permission at the time the download task is sent; Before receiving the download task sent by the target application, the method further includes: Receive an authentication request sent by the target application, wherein the authentication request carries the public key information of the target application; In response to the authentication request, the public key information is matched in the first database; If the public key information is matched in the first database, it is determined that the target application has the download permission; The authentication request also carries the private key information of the target application. After determining that the target application has the download permission, the method further includes: A temporary token is generated based on the private key information carried in the authentication request, wherein the temporary token is used to identify that the target application has download permission; The temporary token is sent to the target application and stored in a second database.

2. The data download method according to claim 1, characterized in that, If it is determined that the target application has the download permission at the time the download task is sent, the download task is saved in the task queue, including: If it is determined that the target application has the download permission at the time of sending the download task, the task identifier and download parameters are obtained from the request information carried by the download task, and the task identifier and download parameters are stored in the task queue. The task identifier is used to identify the category of the download task, and the download parameters are used to indicate the condition parameters of the download task.

3. The data download method according to claim 2, characterized in that, After executing multiple download tasks in the task queue in a preset order to download the data corresponding to the multiple download tasks, the method further includes: Obtain the task identifier and download parameters stored in the task queue; Storage rules are determined based on the task identifier and the download parameters, and a data file is generated based on the target data and the storage rules, wherein the target data is the data corresponding to the download task; The data file is stored in a first database, and the obtained storage information is sent to the target application, wherein the storage information is used to indicate the location information of the data file in the first database.

4. The data download method according to claim 1, characterized in that, Multiple download tasks in the task queue are executed in a preset order, including: The multiple download tasks in the task queue are executed sequentially according to the time order in which they are received, or the multiple download tasks in the task queue are executed respectively according to the preset time information in the request information carried by the multiple download tasks, wherein the preset time information is used to indicate the time for executing the download task.

5. A data download device, characterized in that, include: The receiving module is used to receive the download task sent by the target application and determine whether the target application has download permission at the time of sending the download task based on the request information carried by the download task. A storage module is used to store the download task in a task queue when it is determined that the target application has the download permission at the time of sending the download task; An execution module is used to execute multiple download tasks in the task queue in a preset order to download the data corresponding to the multiple download tasks; The receiving module is further configured to: determine if the target application does not have the download permission at the time of sending the download task when the request information carried by the download task does not include a temporary token, wherein the temporary token is used to identify that the target application has download permission; and determine whether the temporary token is invalid when the request information carried by the download task includes the temporary token, and determine that the target application has the download permission at the time of sending the download task if the temporary token is not invalid. The receiving module is further configured to receive an authentication request sent by the target application, wherein the authentication request carries the public key information of the target application; in response to the authentication request, match the public key information in a first database; and if the public key information is matched in the first database, determine that the target application has the download permission. The authentication request also carries the private key information of the target application. The receiving module is further configured to generate a temporary token based on the private key information carried in the authentication request, wherein the temporary token is used to identify that the target application has download permission; send the temporary token to the target application; and store the temporary token in a second database.

6. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed, performs the method described in any one of claims 1 to 4.

7. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 4 through the computer program.

Citation Information

Patent Citations

  • CN101030873A

  • CN107104956A

  • CN112751930A

  • CN113630412A

  • CN1926540A