A file download method and related apparatus
By receiving download requests, obtaining the target file type and query conditions, generating a dataset, and merging it to generate the download file, the problem of resource waste and code redundancy in the download process of multiple types of work orders is solved, achieving resource saving and efficiency improvement.
Patent Information
- Application Number
- CN202410339415.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-25
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2044-03-25
AI Technical Summary
In existing technologies, the download process for various types of work orders requires the design of multiple sets of dedicated program code, resulting in resource waste and code redundancy, and increasing development and maintenance costs.
By receiving download requests, obtaining target file types and query conditions, generating a data set, and generating download files based on the data set, a unified download process is adopted to handle multiple file types, reducing code redundancy.
It achieves resource conservation and reduces code redundancy in downloading various file types, improves the efficiency and intelligence of the download process, and reduces development and maintenance costs.
Smart Images

Figure CN118200312B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing, and particularly relates to a file downloading method and a related device. BACKGROUND
[0002] With the development of the information age, files, as a carrier for recording, storing and transmitting information, are increasingly widely used in various fields. For example, a work order is a common standardized file in enterprise management, which is used to guide the work flow within an enterprise and ensure that tasks are completed on time, and is used for customer service, such as maintenance and complaint handling, outside the enterprise.
[0003] In the related art, the downloading logic of a work order usually includes the following steps: first, work order data is searched according to a query condition; then, the work order data is exported to a download file, and the download file is stored in a server; and finally, the absolute or relative path of the download file is transmitted to the front end to enable a user to download the download file.
[0004] However, different types of work orders are usually stored in different database tables due to different table styles, and the fields of different types of work orders imported into a download file also differ, so that a dedicated program code needs to be designed for the downloading process of different types of work orders, and a set of program code corresponds to a set of downloading process. Therefore, multiple sets of downloading processes are usually used to process multiple types of work orders. As a result, the use of multiple sets of downloading processes causes resource waste. SUMMARY
[0005] The present application provides a file downloading method and a related device to reduce resource consumption of a file downloading process.
[0006] In a first aspect, an embodiment of the present application provides a file downloading method, which includes the following steps:
[0007] receiving a downloading request and obtaining a target file type and a file query condition based on the downloading request, wherein the target file type is a type corresponding to N target files to be downloaded, N is a positive integer, and the file query condition is a search condition satisfied by the N target files in common;
[0008] obtaining a data set corresponding to the N target files based on the target file type and the file query condition, wherein the data set is composed of fields and attribute values contained in the N target files respectively;
[0009] generating N download files corresponding to the N target files based on the data set.
[0010] In a second aspect, an embodiment of the present application further provides a file downloading device, which includes the following components:
[0011] The receiving module is configured to receive a download request and obtain a target file type and a file query condition based on the download request, wherein the target file type is a type corresponding to N target files to be downloaded, N is a positive integer, and the file query condition is a search condition commonly met by the N target files;
[0012] The query module is configured to obtain a data set corresponding to the N target files based on the target file type and the file query condition, wherein the data set is composed of fields and attribute values included in the N target files respectively;
[0013] The downloading module is configured to generate a download file corresponding to the N target files based on the data set.
[0014] Optionally, when the downloading module generates the download file corresponding to the N target files based on the data set, the downloading module is configured to:
[0015] based on common fields between the file corresponding to the target file type and files corresponding to other file types, import common attribute values corresponding to the common fields in the data set into the download file;
[0016] based on difference fields between the file corresponding to the target file type and files corresponding to other file types, import difference attribute values corresponding to the difference fields in the data set into the download file.
[0017] Optionally, before the query module obtains the data set corresponding to the N target files based on the target file type and the file query condition, the query module is further configured to:
[0018] if N is not greater than a preset threshold, directly complete the download request based on a currently running interactive thread;
[0019] if N is greater than the preset threshold, maintain the interactive thread and complete the download request using a preset download thread.
[0020] Optionally, the threshold is obtained in the following manner:
[0021] within a set time range, use an interactive thread to download files, record the number of files downloaded within the set time range, and set the number of files as the threshold.
[0022] Optionally, when the downloading module completes the download request using the preset download thread, the query module is further configured to:
[0023] add the download request to the end of a preset download task queue, wherein the download task queue contains a plurality of historical download requests;
[0024] when the download thread is in an idle state, sequentially complete each historical download request based on the download thread starting from the head of the download task queue.
[0025] Optionally, the file search criteria may include at least one or any combination of the following:
[0026] File name;
[0027] File creation date;
[0028] File status.
[0029] Thirdly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method as described in any of the first aspects.
[0030] Fourthly, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the methods described in the first aspect.
[0031] Fifthly, embodiments of this application provide a computer program product that, when invoked by a computer, causes the computer to execute the method described in the first aspect.
[0032] In this application embodiment, a file download method and related apparatus are proposed. The server receives a download request and obtains the target file type and file query conditions based on the download request. The target file type is the type corresponding to N target files to be downloaded, where N is a positive integer. The file query conditions are the retrieval conditions that the N target files jointly satisfy. Then, based on the target file type and file query conditions, a data set corresponding to the N target files is obtained. The data set consists of the fields and attribute values contained in each of the N target files. Finally, based on the data set, the download files corresponding to the N target files are generated.
[0033] In this way, in scenarios involving downloading multiple file types, an independent download logic is adopted. A general download task entity class is set up to store the target file type and file query conditions. This prevents the download process from being dominated by download task entities of different file types. As a result, multiple file types can use the same download process, reducing resource waste and code redundancy.
[0034] Other features and advantages of this application will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings. Attached Figure Description
[0035] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used 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 those skilled in the art, other drawings can be obtained based on these drawings without creative effort. In the drawings:
[0036] Figure 1 This is a schematic diagram illustrating possible application scenarios in the embodiments of this application;
[0037] Figure 2 This is a flowchart of a file download method according to an embodiment of this application;
[0038] Figure 3 This is a logical diagram of a general download task entity class in an embodiment of this application;
[0039] Figure 4 This is a method for exporting file data in an embodiment of this application;
[0040] Figure 5 This is a schematic diagram of the logical flow of asynchronous download in the embodiments of this application;
[0041] Figure 6 This is a schematic diagram of an overall file download process in an embodiment of this application;
[0042] Figure 7 This is a schematic diagram of the structure of a file download device according to an embodiment of this application;
[0043] Figure 8 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0044] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments of this application. Obviously, the described embodiments are only some embodiments of the technical solutions of this application, and not all embodiments. Based on the embodiments recorded in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the technical solutions of this application.
[0045] The terms "first," "second," etc., used 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 embodiments of the invention described herein can be implemented in sequences other than those illustrated or described herein.
[0046] The following explanations of some terms used in the embodiments of this application are provided to facilitate understanding by those skilled in the art.
[0047] (1) Consumer protection: Consumer protection services.
[0048] (2) Consumer protection complaint work order: Handling consumer complaints in a workflow manner.
[0049] (3) Synchronous Download: Only one of the user interaction and download processes can be executed at a time. While the download process is in progress, other functions must wait until the download is complete. The overall execution efficiency of synchronous download is relatively low and time-consuming, but it is beneficial for the server to control the process and avoid many uncontrollable unexpected situations.
[0050] (4) Asynchronous Download: Asynchronous download refers to separating user interaction and the download process into two different threads. The download process does not hinder the operation of other functions such as user interaction. Asynchronous download has high overall execution efficiency and saves time, but it consumes more system resources and is not conducive to the server's control over the process.
[0051] The design concept of the embodiments of this application is briefly introduced below:
[0052] Currently, many banks have a need to export consumer protection complaint work order lists. However, different types of work orders are usually stored in different database tables due to the different table styles generated. Furthermore, the fields in the imported and downloaded files also differ for different types of work orders. Therefore, most banks adopt a method of one set of download processes for each type of work order.
[0053] However, most work orders contain the same fields, and the processing of the same fields is reflected in the same code segments. Using multiple download processes will result in resource waste and code redundancy, which in turn increases the development and maintenance costs of the download process.
[0054] In view of this, this application proposes a file download method and related apparatus. In this application embodiment, the server first receives a download request and obtains the target file type and file query conditions based on the download request. The target file type is the type corresponding to N target files to be downloaded, where N is a positive integer. The file query conditions are the retrieval conditions commonly satisfied by the N target files. Then, based on the target file type and file query conditions, a data set corresponding to the N target files is obtained. The data set consists of the fields and attribute values contained in each of the N target files. Finally, based on the data set, the download files corresponding to the N target files are generated.
[0055] The preferred embodiments of this application are described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit this application. Furthermore, the embodiments and features in the embodiments of this application can be combined with each other without conflict.
[0056] See Figure 1 As shown, it is a schematic diagram of possible application scenarios in the embodiments of this application.
[0057] This application scenario includes terminal device 110 (including terminal device 1101, terminal device 1102... terminal device 110n) and server 120. Terminal device 110 and server 120 can communicate with each other through a communication network.
[0058] In one alternative implementation, the communication network can be a wired network or a wireless network. Therefore, the terminal device 110 and the server 120 can be connected directly or indirectly via wired or wireless communication. For example, the terminal device 110 can be indirectly connected to the server 120 via a wireless access point, or the terminal device 110 can be directly connected to the server 120 via the Internet; this application does not impose any limitations on this.
[0059] In this application embodiment, the terminal device 110 includes, but is not limited to, mobile phones, tablets, laptops, desktop computers, e-book readers, smart voice interaction devices, smart home appliances, vehicle terminals, and other devices; various clients can be installed on the terminal device, which can be applications that support video preview, video playback, and other functions (such as browsers, game software, etc.), or web pages, mini programs, etc.
[0060] Server 120 is a backend server corresponding to the client installed in terminal device 110. Server 120 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0061] It should be noted that the file download method in this application embodiment can be executed by an electronic device, which can be a server 120 or a terminal device 110. That is, the method can be executed by the server 120 or the terminal device 110 alone, or by the server 120 and the terminal device 110 together.
[0062] It should be noted that the following text mainly uses the example of the server running alone, and no specific limitations are made here.
[0063] It should be noted that, Figure 1 The examples shown are merely illustrative; in reality, the number of terminal devices 110 and servers 120 is not limited and is not specifically limited in this embodiment.
[0064] In this embodiment of the application, when there are multiple servers 120, the multiple servers 120 can form a blockchain, and the servers 120 are nodes on the blockchain.
[0065] Furthermore, the data collection, dissemination, and use in the technical solution of this application all comply with the requirements of relevant national laws and regulations.
[0066] See Figure 2 As shown, it is a flowchart of a file download method in an embodiment of this application. The following is a description of the method in conjunction with the attached diagram. Figure 2 The specific execution steps are explained in detail below:
[0067] Step S201: Receive the download request and obtain the target file type and file query conditions based on the download request.
[0068] The target file type refers to the type of the N target files to be downloaded, where N is a positive integer, and the file query condition is the retrieval condition that the N target files all satisfy.
[0069] It should be noted that the target file in this application is a collection of named related information, which can be a text document, table, image, program, etc. That is, this application does not limit the specific type of the target file. For ease of understanding and description, the following description takes a bank consumer protection complaint work order as the target file.
[0070] Specifically, in this embodiment of the application, the server has multiple preset operation codes, each referring to a different type of work order.
[0071] For example, the operation code for a type A work order is 01, the operation code for a type B work order is 02, the operation code for a type C work order is 03, and so on. The type of work order corresponds one-to-one with the operation code, and the specific coding order is not restricted.
[0072] When a user requests to download one or more work orders, they need to provide the type of work order to be downloaded and the file search conditions. The server then generates a download task based on the operation code corresponding to that type and the file search conditions.
[0073] The document query conditions in this application embodiment include at least one or any combination of the following:
[0074] (1) File name.
[0075] (2) Date the file was generated.
[0076] (3) File status.
[0077] For details, please refer to Figure 3 As shown, it is a logical diagram of a general download task entity class in an embodiment of this application. It includes a framework of download entity classes corresponding to various types of work orders, such as type A work order download entity class and type B work order download entity class. The parameters corresponding to each type of work order download entity class, such as the parameter CrdEntity corresponding to type A work order download entity class and the parameter DbtEntity corresponding to type B work order download entity class, are used to characterize their respective query conditions.
[0078] When no download request is received, the parameters in the general download task entity class are empty. When a download request for a certain type of work order is received, the corresponding parameter values will be filled in, thereby generating the general download task entity class corresponding to that type of work order.
[0079] For example, when a download request is received for a Class B work order with a complaint date of 2023 / 6 / 1, the server obtains the operation code and query conditions entered by the front end, and assigns the value of MnpltType to 02 and the value of DbtEntity to the query condition—complaint date 2023 / 6 / 1 in the general download task entity class, and generates the corresponding download task.
[0080] It should be noted that in a general download task entity class, only the parameter values corresponding to the download entity class of one type of work order can be assigned. In other words, a download task can only correspond to requesting to download one type of work order.
[0081] Furthermore, after the server generates a download task based on the target file type and file query conditions, it will also perform an adaptive judgment on synchronous and asynchronous download before reading the target file to obtain the data set.
[0082] For example, assuming there are N Class B work orders with a complaint date of June 1, 2023, the server will compare N with a preset threshold to obtain an adaptive judgment result.
[0083] Specifically, if N is not greater than the preset threshold, the download request will be completed directly based on the currently running interactive thread.
[0084] Typically, when the number of files corresponding to a download request is small, the server will automatically adopt a synchronous download method to improve the download speed, that is, to complete the download request directly based on the currently running interactive thread.
[0085] It should be noted that in the synchronous download method, the server can only continue to perform other tasks such as front-end interaction after the current download request is completed.
[0086] If N is greater than the preset threshold, the interaction thread is maintained, and the preset download thread is used to complete the download request.
[0087] In another optional embodiment, when the number of files corresponding to the download request is large, in order to ensure that the batch download of files does not hinder the operation of other functions such as front-end interaction, the server will adopt an asynchronous download method, that is, maintain the interaction thread and use the preset download thread to complete the download request. In this way, while waiting for the download of multiple files, the server can also process other tasks in parallel, improving the user experience.
[0088] The preset threshold is usually related to the performance of the system and machine, and this application does not restrict its value.
[0089] Specifically, in this embodiment of the application, file download is performed using an interactive thread within a set time range, and the number of files downloaded within the set time range is recorded, with the number of files set as a threshold.
[0090] For example, during testing, a time function is used to calculate the time spent downloading different numbers of work orders in synchronous mode. The maximum number of work orders that meets the time requirement can be set as the threshold. The time requirement is the set time range in this application embodiment, which is usually the user's acceptable waiting time.
[0091] In this application, when downloading work orders, the system adaptively selects between synchronous and asynchronous download methods based on the number of work orders to be downloaded. This avoids the problems of wasting resources and hindering process control when downloading asynchronously when the data volume is small, as well as the problem of other functions being blocked when downloading synchronously when the data volume is large, thereby improving the intelligence of the file download system.
[0092] Step S202: Based on the target file type and file query conditions, obtain the data set corresponding to N target files. The data set consists of the fields and attribute values contained in each of the N target files.
[0093] Specifically, in this embodiment of the application, the server queries N files that meet the requirements from the database table based on the target file type and file query conditions, and reads the field and attribute values in each file to obtain a data set.
[0094] Step S203: Based on the dataset, generate download files corresponding to N target files.
[0095] For further details, please refer to [link / reference]. Figure 4 As shown, this is a file data export method according to an embodiment of this application, wherein:
[0096] Step S2031: Based on the common fields between the target file type and other file types, import the common attribute values corresponding to the common fields in the data set into the downloaded file.
[0097] For example, in this embodiment of the application, the common fields between files corresponding to each file type usually include: work order number, complaint reason, complaint details, etc. Therefore, the server first uniformly imports the common attribute values corresponding to the common fields in the data set into the downloaded file.
[0098] Step S2032: Based on the difference fields between the target file type and other file types, import the difference attribute values corresponding to the difference fields in the dataset into the downloaded file.
[0099] Secondly, the server imports the difference attribute values corresponding to the difference fields that are unique to the target file compared to other file types from the dataset into the downloaded file. In this way, the server can use the same process to export and download different types of files. This avoids the problem of code redundancy when exporting common fields by using multiple download processes for different types of files.
[0100] It should be noted that in the above process, if the server uses a synchronous download method, the server directly uses the file query conditions and opcodes contained in WrkOrdrExpVo to retrieve the data and import it into the download file. Since the interactive thread handles the current task during synchronous download and does not need to consider whether it is idle, the user can directly download on the current page.
[0101] If the server uses an asynchronous download method, the server needs to consider whether the download thread is idle.
[0102] For details, please refer to Figure 5 As shown, this is a schematic diagram of the logical flow of asynchronous download in an embodiment of this application. When the system starts, the server opens a download thread as a daemon thread for downloading files and automatically initializes the download task queue. The task of the download thread is to cyclically retrieve download task entity classes WrkOrdrExpVo from the download task queue for processing, and ensure that only one download task is executed at a time.
[0103] In this embodiment, if an asynchronous download method is used, the server adds the download request to the tail of a preset download task queue, which contains multiple historical download requests. When the download thread is idle, it completes each historical download request sequentially, starting from the head of the download task queue.
[0104] Understandably, the number of historical download requests in the download task queue can be greater than 0 or equal to 0 before a download task is added to the tail of the download task queue.
[0105] Furthermore, since users cannot determine which download task is being processed in the download thread, asynchronous downloads require a dedicated page to display the execution status of each download task, where users can also download the final file.
[0106] See Figure 6 The diagram illustrates a general file download process in an embodiment of this application. The server receives an opcode representing the target file type and file query conditions from the front end, generates a download task entity class, and then queries the number of target files that meet the requirements for download. This number is compared to a preset threshold. If the number of downloads is less than the threshold, the server directly obtains the target file dataset based on the interaction thread, generates the download file, and finally sends the download file's address to the front end for the user to download. If the number of downloads exceeds the threshold, the server adds the download task to a download task queue. The download thread then sequentially retrieves download tasks from the queue, obtains the target file dataset, merges them to generate the download file, and then sends the download address to the front end.
[0107] In summary, this application unifies the download process for multiple file types into a single processing flow. By using different input operation codes, different file types are processed, which greatly reduces code redundancy and subsequent maintenance costs. Furthermore, based on the number of downloads and thresholds, it adaptively selects between synchronous and asynchronous download methods, avoiding the problems of asynchronous download being detrimental to process control when the data volume is small, and synchronous download causing other functions to be blocked when the data volume is large, thus improving the intelligence of the download system.
[0108] Furthermore, although the operations of the method of this application are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.
[0109] Based on the same technical concept, see [reference] Figure 7 As shown in the figure, this application embodiment also provides a file download device, which includes:
[0110] The receiving module 701 is used to receive download requests and obtain target file types and file query conditions based on the download requests. The target file types are the types corresponding to the N target files to be downloaded, where N is a positive integer, and the file query conditions are the search conditions that the N target files satisfy together.
[0111] The query module 702 is used to obtain a data set corresponding to N target files based on the target file type and file query conditions. The data set consists of the fields and attribute values contained in each of the N target files.
[0112] Download module 703 is used to generate download files corresponding to N target files based on a dataset.
[0113] Optionally, when generating download files corresponding to N target files based on the dataset, the download module 703 is used for:
[0114] Based on the common fields between the target file type and other file types, import the common attribute values corresponding to the common fields in the data set into the downloaded file;
[0115] Based on the difference fields between the target file type and other file types, the difference attribute values corresponding to the difference fields in the dataset are imported into the downloaded file.
[0116] Optionally, before obtaining the data set corresponding to N target files based on the target file type and file query conditions, the query module 702 is also used for:
[0117] If N is not greater than the preset threshold, the download request will be completed directly based on the currently running interactive thread.
[0118] If N is greater than the preset threshold, the interaction thread is maintained, and the preset download thread is used to complete the download request.
[0119] Optionally, the threshold is obtained in the following way:
[0120] Within a set time range, use interactive thread to download files and record the number of files downloaded within the set time range. Set the number of files downloaded as a threshold.
[0121] Optionally, when using a preset download thread to complete the download request, the query module 702 is further used to:
[0122] Add the download request to the tail of the preset download task queue, which contains multiple historical download requests;
[0123] When the download thread is in an idle state, it completes each historical download request sequentially, starting from the head of the download task queue.
[0124] Optionally, the file search criteria may include at least one or any combination of the following:
[0125] File name;
[0126] File creation date;
[0127] File status.
[0128] Based on the same technical concept, this application also provides an electronic device that can implement the file download method provided in the above embodiments of this application.
[0129] In one embodiment, the electronic device may be a server, a terminal device, or other electronic device.
[0130] See Figure 8 As shown, the electronic device may include:
[0131] At least one processor 801 and a memory 802 connected to at least one processor 801. In this embodiment, the specific connection medium between the processor 801 and the memory 802 is not limited. Figure 8 The example shown is the connection between processor 801 and memory 802 via bus 800. Bus 800 is... Figure 8 The connections between other components are indicated by thick lines and are for illustrative purposes only, not as limiting information. The 800 bus can be divided into address bus, data bus, control bus, etc., for ease of representation. Figure 8 The term is represented by a single thick line, but this does not imply that there is only one bus or one type of bus. Alternatively, the processor 801 can also be called a controller; there is no restriction on the name.
[0132] In this embodiment, the memory 802 stores instructions executable by at least one processor 801. By executing the instructions stored in the memory 802, the at least one processor 801 can perform a file download method as described above. The processor 801 can implement... Figure 7 The functions of each module in the device shown.
[0133] The processor 801 is the control center of the device. It can connect to various parts of the control device through various interfaces and lines. By running or executing instructions stored in memory 802 and calling data stored in memory 802, the processor can perform various functions and process data, thereby monitoring the device as a whole.
[0134] In one possible design, processor 801 may include one or more processing units. Processor 801 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into processor 801. In some embodiments, processor 801 and memory 802 may be implemented on the same chip; in some embodiments, they may also be implemented on separate chips.
[0135] The processor 801 can be a general-purpose processor, such as a CPU, digital signal processor, application-specific integrated circuit, field-programmable gate array or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of a file download method disclosed in the embodiments of this application can be directly manifested as execution by a hardware processor, or execution by a combination of hardware and software modules within the processor.
[0136] Memory 802, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Memory 802 may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic storage, magnetic disk, optical disk, etc. Memory 802 can be any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto. In the embodiments of this application, memory 802 can also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.
[0137] By designing and programming the processor 801, the code corresponding to the file download method described in the foregoing embodiments can be embedded into the chip, enabling the chip to execute it during operation. Figure 2The illustrated embodiment presents the steps of a file download method. How to design and program the processor 801 is a technique well-known to those skilled in the art and will not be described further here.
[0138] Based on the same inventive concept, embodiments of this application also provide a storage medium storing computer instructions that, when executed on a computer, cause the computer to perform a file download method described above.
[0139] In some possible implementations, various aspects of the file download method provided by this application can also be implemented in the form of a program product, which includes program code that, when the program product is run on a device, causes the control device to perform the steps of a file download method according to various exemplary embodiments of this application as described above.
[0140] It should be noted that although several units or sub-units of the device have been mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, according to embodiments of this application, the features and functions of two or more units described above can be embodied in one unit. Conversely, the features and functions of one unit described above can be further divided and embodied by multiple units.
[0141] Furthermore, although the operations of the method of this application are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.
[0142] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0143] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0144] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0145] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0146] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A file download method characterized by, The method comprises the following steps: receiving a download request and obtaining a target file type and a file query condition based on the download request, wherein the target file type is a type corresponding to N target files to be downloaded, N is a positive integer, and the file query condition is a search condition commonly met by the N target files; obtaining a data set corresponding to the N target files based on the target file type and the file query condition, wherein the data set is composed of fields and attribute values contained in the N target files respectively; generating a download file corresponding to the N target files based on the data set.
2. The method of claim 1, wherein, The step of generating the download file corresponding to the N target files based on the data set comprises the following steps: based on common fields between files corresponding to the target file type and files corresponding to other file types, importing common attribute values corresponding to the common fields in the data set into the download file; based on difference fields between files corresponding to the target file type and files corresponding to other file types, importing difference attribute values corresponding to the difference fields in the data set into the download file.
3. The method of claim 1, wherein, Before the step of obtaining the data set corresponding to the N target files based on the target file type and the file query condition, the method further comprises the following steps: if N is not greater than a preset threshold, directly completing the download request based on a currently running interactive thread; if N is greater than the preset threshold, maintaining the interactive thread and completing the download request using a preset download thread.
4. The method of claim 3, wherein, The threshold is obtained in the following manner: within a set time range, using the interactive thread to download files and recording the number of files downloaded within the set time range, and setting the number of files as the threshold.
5. The method of claim 3, wherein, The step of completing the download request using the preset download thread comprises the following steps: adding the download request to the tail of a preset download task queue, wherein the download task queue contains a plurality of historical download requests; when the download thread is in an idle state, sequentially completing each historical download request based on the download thread from the head of the download task queue.
6. The method according to any one of claims 1 to 5, wherein, The file query condition comprises at least one or any combination of the following: a file name; a file generation date; a file status.
7. A file download apparatus characterized by comprising: The method comprises the following steps: a receiving module configured to receive a download request and obtain a target file type and a file query condition based on the download request, wherein the target file type is a type corresponding to N target files to be downloaded, N is a positive integer, and the file query condition is a search condition commonly met by the N target files; a query module configured to obtain a data set corresponding to the N target files based on the target file type and the file query condition, wherein the data set is composed of fields and attribute values contained in the N target files respectively; a download module configured to generate a download file corresponding to the N target files based on the data set.
8. The apparatus of claim 7, wherein, When the download module generates the download file corresponding to the N target files based on the data set, the download module is configured to: Based on the common field between the file corresponding to the target file type and the file corresponding to other file types, the common attribute value corresponding to the common field in the data set is imported into the download file; Based on the difference field between the file corresponding to the target file type and the file corresponding to other file types, the difference attribute value corresponding to the difference field in the data set is imported into the download file.
9. The apparatus of claim 7, wherein, Before the query module obtains the data set corresponding to the N target files based on the target file type and the file query condition, the query module is further configured to: If N is not greater than a preset threshold, the download request is completed based on the currently running interactive thread directly; If N is greater than the preset threshold, the interactive thread is maintained, and the download request is completed using a preset download thread.
10. The apparatus of claim 9, wherein, The threshold is obtained in the following way: Within a set time range, the interactive thread file download is used, and the number of files downloaded within the set time range is recorded, and the number of files is set as the threshold.
11. The apparatus of claim 9, wherein, When the download request is completed using the preset download thread, the query module is further configured to: Add the download request to the tail of a preset download task queue, wherein the download task queue contains a plurality of historical download requests; When the download thread is in an idle state, based on the download thread, each historical download request is completed in turn from the head of the download task queue.
12. The device of any one of claims 7-11, wherein, The file query condition at least includes any one or any combination of the following: File name; File generation date; File status.
13. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to realize the method of any one of claims 1-6.
14. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to realize the steps of the method of any one of claims 1-6.
15. A computer program product, characterised in that, The computer program product, when invoked by a computer, causes the computer to execute the method of any one of claims 1-6.
Citation Information
Patent Citations
Spacecraft heterogeneous test data integrated management system
CN107194007A
Asynchronous downloading method based on kettle commercial intelligent platform
CN112162985A