File uploading method and device and related equipment

By introducing business implementation classes and cached file upload status information, the resource consumption and code redundancy problems of traditional file upload mechanisms are solved, file generation logic is decoupled and modular design is achieved, and file upload efficiency and user experience are improved.

CN119544701BActive Publication Date: 2025-11-25AGRICULTURAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411737064.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-29
Publication Date
2025-11-25
Estimated Expiration
2044-11-29

AI Technical Summary

Technical Problem

Existing file upload mechanisms require significant computational resources and time when processing various file types, and traditional solutions lack versatility, leading to code redundancy and maintenance difficulties.

Method used

By introducing business implementation classes and file upload status information in the cache, it is possible to quickly determine whether a file has been uploaded, avoiding repeated generation and uploading. A one-dimensional structure is used to store the upload status, thereby achieving decoupling of file generation logic and modular design.

Benefits of technology

It improves file upload speed, saves computing resources and time, and enhances user experience, especially for large files or in poor network conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119544701B_ABST
    Figure CN119544701B_ABST
Patent Text Reader

Abstract

The application discloses a file uploading method and device and related equipment. The application first receives a file uploading request containing a file type, and loads each business implementation class. The business implementation class corresponds to the file type one by one. Then, the business implementation class is traversed, and file uploading state information of the corresponding type file in the cache is checked. The file uploading state information records the file uploading state of the business implementation class corresponding type, and is used for avoiding repeated uploading. If the file is not uploaded, a public information part and a personalized information part of the file are assembled, and the personalized information part is assembled by the business implementation class from the personalized data obtained from the cache. Finally, the file is uploaded, and the file uploading state information in the cache is updated. The method combines the cache and the business implementation class, improves the uploading efficiency, and supports personalized file processing.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of information technology, and more particularly, to a file uploading method, device and related equipment. BACKGROUND

[0002] File uploading function is crucial in modern computer applications, especially in Internet business systems. From bank loan business to express logistics system, various scenarios need to upload files to record and process information.

[0003] With the development of business and changes in demand, the types, formats and contents of files that need to be uploaded also change, and users may upload the same file multiple times, causing waste of storage space and increase of processing burden. Traditional solutions, such as checking methods based on file hash values (MD5, SHA, etc.), need to calculate the hash value of the file and compare it with the existing records in the database. Especially when dealing with larger files, this will consume a lot of computing resources and time, and traditional solutions need to write specific generation logic for each type when generating different types of files, i.e. one file generation logic can only generate one type of file. This lack of universality in processing leads to code redundancy, making it difficult to extend and maintain.

[0004] In summary, the existing file uploading mechanism not only needs to call specific generation logic in the file generation phase, but also needs to consume a lot of computing resources in the uploading phase to determine whether to retransmit. SUMMARY

[0005] In view of the above problems, the present application is proposed to provide a file uploading method, device and related equipment to realize efficient generation and uploading of files. The specific scheme is as follows:

[0006] In a first aspect, a file uploading method is provided, comprising:

[0007] Obtaining a file uploading request, the file uploading request containing a file type;

[0008] Loading pre-configured business implementation classes, the business implementation classes corresponding one-to-one to the file types, for assembling individualized information of the corresponding type of file;

[0009] Traversing the business implementation classes one by one, for the currently traversed business implementation class:

[0010] determining whether the file type corresponding to the currently traversed business implementation class is contained in the file upload request; if not, skipping the currently traversed business implementation class; if yes, obtaining file upload state information configured in the cache, and determining whether the file of the type corresponding to the currently traversed business implementation class has been uploaded based on the file upload state information, the file upload state information recording a corresponding relationship between different business implementation classes and upload states, and the upload state corresponding to any business implementation class indicating whether the file of the type corresponding to the business implementation class has been uploaded;

[0011] if the file of the type corresponding to the currently traversed business implementation class has not been uploaded, obtaining public information of the file to assemble a public information part of the file, obtaining personalized data corresponding to the currently traversed business implementation class in the cache by using the currently traversed business implementation class and assembling a personalized information part of the file, and composing the file from the public information part and the personalized information part;

[0012] uploading the file;

[0013] updating the file upload state information according to the uploading result of the file.

[0014] Preferably, the file upload state information is stored in a one-dimensional structure, the one-dimensional structure containing a plurality of data bits, different data bits corresponding to different business implementation classes, and the data bits representing different upload states of the file of the type corresponding to the corresponding business implementation class by storing different numerical values.

[0015] Preferably, the numerical value stored in the data bit is a first numerical value, a second numerical value or a third numerical value, the first numerical value indicating that the file upload is successful, the second numerical value indicating that the file has not been uploaded, and the third numerical value indicating that the file upload fails.

[0016] Preferably, the determining whether the file of the type corresponding to the currently traversed business implementation class has been uploaded based on the file upload state information comprises:

[0017] if the numerical value stored in the data bit corresponding to the currently traversed business implementation class in the file upload state information is the first numerical value, the file of the type corresponding to the currently traversed business implementation class has been uploaded;

[0018] if the numerical value stored in the data bit corresponding to the currently traversed business implementation class in the file upload state information is the second numerical value or the third numerical value, the file of the type corresponding to the currently traversed business implementation class has not been uploaded.

[0019] Preferably, the first numerical value is 0, the second numerical value is 1, and the third numerical value is m, m being a numerical value greater than 1.

[0020] Accordingly, the updating the file uploading state information according to the uploading result of the file comprises:

[0021] If the file uploading succeeds, updating the value stored in the data bit corresponding to the current traversed business implementation class in the file uploading state information to 0;

[0022] If the file uploading fails, adding 1 to the value stored in the data bit corresponding to the current traversed business implementation class in the file uploading state information.

[0023] Preferably, if the value stored in the data bit in the file uploading state information is greater than a preset uploading threshold, generating a log indicating the number of times of failed uploading of the file according to the value stored in the data bit and outputting the log to a user.

[0024] In a second aspect, a file uploading apparatus is provided, comprising:

[0025] a request obtaining unit configured to obtain a file uploading request, the file uploading request containing a file type;

[0026] a business implementation class loading unit configured to load preconfigured business implementation classes, the business implementation classes corresponding one-to-one to the file type and used to assemble individualized information of a file of the corresponding type;

[0027] a business implementation class traversing unit configured to traverse the business implementation classes one by one, for a currently traversed business implementation class:

[0028] judging whether the file type corresponding to the currently traversed business implementation class is contained in the file uploading request, if not, skipping the currently traversed business implementation class, and if yes, obtaining file uploading state information configured in a cache, and judging whether a file of the type corresponding to the currently traversed business implementation class has been uploaded based on the file uploading state information, the file uploading state information recording a corresponding relationship between different business implementation classes and uploading states, and the uploading state corresponding to any business implementation class indicating whether a file of the type corresponding to the business implementation class has been uploaded;

[0029] if the file of the type corresponding to the currently traversed business implementation class has not been uploaded, obtaining common information of the file to assemble a common information part of the file, obtaining individualized data corresponding to the currently traversed business implementation class in the cache by using the currently traversed business implementation class and assembling an individualized information part of the file, and composing the file from the common information part and the individualized information part;

[0030] uploading the file;

[0031] updating the file uploading state information according to the uploading result of the file.

[0032] In a third aspect, an electronic device is provided, comprising a memory and a processor.

[0033] The memory is configured to store a program.

[0034] The processor is configured to execute the program to implement each step of the file uploading method described in any one of the preceding first aspects.

[0035] In a fourth aspect, a storage medium is provided, which stores a computer program. When the computer program is executed by a processor, each step of the file uploading method described in any one of the preceding first aspects is implemented.

[0036] By the above technical solution, in the file generation phase, the file uploading state information configured in the cache is used to quickly determine whether a specific type of file has been uploaded. If it has been uploaded, the subsequent generation and uploading steps are skipped, avoiding the generation of a file in the file generation phase and the determination of whether the file has been uploaded in the file uploading phase, saving computing resources and time. By introducing a business implementation class and public information, the processing logic of the common part and the personalized information part of different types of files is encapsulated, realizing file generation logic decoupling and modular design. Moreover, due to the reduction of unnecessary computing and uploading operations, the file uploading speed is improved, thereby improving the user experience, especially in the case of uploading large files or poor network environment. BRIEF DESCRIPTION OF DRAWINGS

[0037] Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The accompanying drawings are included to provide a description of the preferred embodiments and are not intended to limit the scope of the present application. Moreover, like reference numerals designate like parts throughout the several views. In the drawings:

[0038] Figure 1 A flowchart of a file uploading method provided by an embodiment of the present application;

[0039] Figure 2 A scenario diagram of a file uploading method is illustrated;

[0040] Figure 3 A structural diagram of a file uploading device provided by an embodiment of the present application;

[0041] Figure 4 A structural diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0042] With reference to the drawings, the technical solutions in the embodiments of the present application will be clearly and completely described below. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts are within the scope of the present application.

[0043] The embodiments of the present application provide a file uploading method. The present application can be applied to a terminal with data processing capability, which can be a mobile phone, a computer, a server, etc.

[0044] Next, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings. Figure 1 The file uploading method specifically includes the following steps:

[0045] Step S100, a file uploading request is acquired, and the file uploading request contains a file type.

[0046] Specifically, this step marks the beginning of the file uploading process. A file uploading request can be sent to start the file uploading, using, for example, a web browser, a mobile application, or a dedicated uploading tool. The request can use the HTTP POST method and contain the file type. For a specific scenario, the file uploading request can contain the file types of all files to be uploaded in this scenario.

[0047] Step S110, pre-configured business implementation classes are loaded, and the business implementation classes correspond one-to-one to the file types and are used to assemble personalized information of the corresponding type of files.

[0048] Specifically, after receiving the file uploading request, the pre-configured business implementation classes are loaded. These business implementation classes are specifically designed to handle specific types of files. This type-based architecture provides flexibility and scalability. The business implementation classes correspond one-to-one to the file types, which means that each type of file has a corresponding business implementation class to handle its unique requirements. The purpose of these business implementation classes can be to assemble personalized information of the corresponding type of files. For example, the business implementation class of the identity verification type can add personal information, identification information, etc. of the user. The business implementation class can add programming languages, code versions, and dependency information. Loading these business implementation classes can involve instantiating them and saving them in memory so that they can be quickly accessed.

[0049] Step S120, it is judged whether the business implementation classes are traversed completely.

[0050] Specifically, the loaded set of business implementation classes is iterated through. The number of business implementation classes is the number of loop iterations, and this iteration process aims to find a specific business implementation class that matches the file type contained in the file upload request. Each business implementation class is checked one by one, and its associated file type is compared with the file type in the file upload request. This iterative method ensures that the server can identify the correct processing program, even if multiple file types are supported. The efficiency of the iteration can depend on the specific data structure and search algorithm used. For example, a hash table or dictionary can provide faster lookup times than a linear search.

[0051] Step S130, determine whether the file type corresponding to the currently iterated business implementation class is contained in the file upload request.

[0052] Specifically, the file type corresponding to the currently iterated business implementation class is compared with the file type extracted from the file upload request. If the file types do not match, the current business implementation class is skipped and the next business implementation class is iterated. If a match is found, step S140 is executed.

[0053] Step S140, obtain the file upload status information configured in the cache.

[0054] Specifically, the file upload status information is retrieved from the cache. The cache, which can be Redis or Memcached, is used to store frequently accessed data to improve performance.

[0055] Step S150, based on the file upload status information, determine whether the file of the type corresponding to the currently iterated business implementation class has been uploaded.

[0056] Specifically, the file upload status information records the correspondence between different business implementation classes and upload states, and the upload state corresponding to any business implementation class indicates whether the file of the type corresponding to the business implementation class has been completed uploading. This allows tracking the upload progress of each type of file. The file upload status information can indicate whether the file has been uploaded, and when the result of step S150 is yes, the currently iterated business implementation class is skipped, otherwise, step S160 is executed.

[0057] Step S160, obtain the public information of the file to assemble the public information part of the file, obtain the personalized data corresponding to the currently iterated business implementation class in the cache using the business implementation class, and assemble the personalized information part of the file, and compose the file from the public information part and the personalized information part.

[0058] Specifically, if it is determined that the type of file corresponding to the currently traversed business implementation class has not been uploaded, the file information will continue to be assembled. This involves obtaining the public information of the file, such as the file name, file size, and content type. In addition, personalized data corresponding to the currently traversed business implementation class in the cache is obtained. These personalized data can include data information specific to the file type, and then the public information part and the personalized information part are combined to form the complete file to be uploaded, which can associate all necessary information with the file for correct processing and storage.

[0059] Step S170, uploading the file.

[0060] Specifically, the assembled file is uploaded to a designated storage location. This can be a cloud storage service (such as Amazon S3, Google Cloud Storage), a local file system, or a network shared drive. The uploading process can involve various techniques, such as chunk uploading, resuming upload, and checksum verification, to ensure data integrity and efficiency.

[0061] Step S180, updating the file upload state information according to the upload result of the file.

[0062] Specifically, the file upload state information in the cache is updated according to the upload result of the file. If the upload is successful, the status will be updated to "uploaded". If the upload fails, the status will be updated to "upload failed", and can contain error codes or messages for further investigation. Updating the status information in the cache ensures the maintenance of accurate upload status records, which is crucial for tracking progress and handling potential upload failures. This information can also be used to provide feedback to the client, such as an upload progress bar or an upload completion notification.

[0063] With the file upload state information in the cache, the uploaded file types can be quickly identified, avoiding repeated generation and uploading, saving resources and time. At the same time, through the encapsulation of business implementation classes and public information, the logical decoupling and modularization of file generation are realized, improving the efficiency of file upload, optimizing the user experience, especially when dealing with large files or poor network conditions.

[0064] The following embodiment introduces the file upload state information in the foregoing embodiment: the file upload state information is stored in a one-dimensional structure, the one-dimensional structure contains a plurality of data bits, different data bits correspond to different business implementation classes, and the data bits represent different upload states of the type of file corresponding to the corresponding business implementation class by storing different values.

[0065] Specifically, a one-dimensional structure, such as an array or a bit vector, is a linear data storage method, where each element (data bit) represents a specific business implementation class. This design allows for quick access and updating of the upload status of any specific file type, as each business implementation class has a fixed position or index corresponding to it. In a one-dimensional structure, the data bit can be a Boolean value, an integer, or an enumeration type, indicating the upload status of a file, such as not uploaded, uploaded, or upload failed, etc. The specific value of the data bit can be defined according to actual needs to efficiently represent the status information.

[0066] When a file upload request occurs, the corresponding business implementation class is found according to the file type, and the corresponding data bit in the one-dimensional structure is located. If the file is not uploaded, the upload process is executed, and the data bit is updated after the upload is successful. If the upload fails, the data bit is updated according to the number of failures, such as increasing the number of failures or setting a specific failure code. Before uploading the file, the value of the corresponding data bit in the one-dimensional structure can be checked to determine whether the file needs to be re-uploaded. If the data bit already indicates that the file has been uploaded successfully, the upload process is skipped, thereby avoiding unnecessary calculations and network transmissions and improving efficiency.

[0067] The file upload status information stored in the one-dimensional structure can be cached in memory to enable fast access. This caching mechanism helps reduce the number of accesses to the database or persistent storage, especially in high-concurrency scenarios, which can significantly improve performance.

[0068] The following embodiments introduce the values stored in the data bits of the file upload status information in the preceding embodiments: the first value, the second value, or the third value, where the first value indicates that the file has been uploaded successfully, the second value indicates that the file has not been uploaded, and the third value indicates that the file has failed to upload.

[0069] Correspondingly, based on the file upload status information, determining whether the file of the type corresponding to the currently traversed business implementation class has been uploaded, includes:

[0070] If the value stored in the data bit corresponding to the currently traversed business implementation class in the file upload status information is the first value, it indicates that the file of the type corresponding to the currently traversed business implementation class has been uploaded.

[0071] If the value stored in the data bit corresponding to the currently traversed business implementation class in the file upload status information is the second value or the third value, it indicates that the file of the type corresponding to the currently traversed business implementation class has not been uploaded.

[0072] Specifically, the value stored in the data bit is explicitly defined as three states: a first value, a second value, and a third value. This definition provides a clear and concise state representation method, making the identification and processing of states intuitive. The first value can be set to represent a successful file upload state. The second value represents that the file has not been uploaded, indicating that the upload process for this file type has not started. The third value indicates that the file upload has failed, which also represents that the file has not been uploaded.

[0073] When a file upload request is initiated, the value in the data bit of the corresponding business implementation class is checked. If the value in the data bit is the second value or the third value (the file has not been uploaded or the previous upload has failed), the file generation and upload process is executed. After successful upload, the value in the data bit will be updated to the first value (the file upload is successful). If an error occurs during the upload process, the value in the data bit will be updated to the third value (the file upload has failed), and an error code or failure reason can be attached for error tracking and subsequent processing.

[0074] Through this judgment method based on file upload state information, the file upload states of different business implementation classes can be efficiently managed, enabling fast state query and update, while reducing unnecessary calculations and upload operations, optimizing performance and user experience.

[0075] The following embodiments further limit the file upload state information in the preceding embodiments: the first value is 0, the second value is 1, and the third value is m, where m is a value greater than 1.

[0076] Correspondingly, updating the file upload state information according to the upload result of the file includes:

[0077] If the file upload is successful, the value stored in the data bit corresponding to the currently traversed business implementation class in the file upload state information is updated to 0.

[0078] If the file upload fails, the value stored in the data bit corresponding to the currently traversed business implementation class in the file upload state information is incremented by 1.

[0079] If the value stored in the data bit in the file upload state information is greater than a preset upload threshold, a log indicating the number of failed uploads of the file is generated according to the value stored in the data bit and output to the user.

[0080] Specifically, if the file upload fails, the corresponding data bit value is incremented by 1. This design allows tracking the number of failures and can take different strategies based on the number of failures, such as retrying the upload or notifying the user. By encoding the number of failures in the value of the data bit (i.e., the third value m-1), the history of each file type upload failure can be recorded. This helps identify potential problems in the upload process and provides data support for troubleshooting and optimization. If the m value exceeds the preset upload threshold, a log indicating the number of times the file has failed to upload can be generated and fed back to the user. In addition, for time-consuming upload operations, an asynchronous approach can be used, and the status information is updated asynchronously after the upload is completed.

[0081] With this design, the management of file upload status information becomes more flexible and efficient, while also improving maintainability and user experience. The status information can be dynamically updated based on the upload results of the files, and appropriate actions can be taken, such as feeding back the number of file upload failures to the user.

[0082] The following embodiments introduce the personalized data in the foregoing embodiments, which includes:

[0083] The identifier of the business implementation class and the personalized data information of the file of the type corresponding to the business implementation class.

[0084] Specifically, the personalized data stored in the cache contains the identifier of the business implementation class, each business implementation class has a unique identifier, which can be a class name, ID or enumeration value, used to uniquely determine a business implementation class. Personalized data information refers to file attributes and data content associated with a specific business implementation class, which can be specially processed during file generation and upload. For example, for a business implementation class that handles invoices, personalized data may include invoice numbers, dates, amounts, etc.; while for a business implementation class that handles contracts, personalized data may include contract terms, signer information, contract validity period, etc.

[0085] By introducing the identifier of the business implementation class and the corresponding personalized data information, this method can flexibly provide customized file personalized information generation logic to meet the needs of different business scenarios. Storing personalized data in the cache can improve data processing speed and efficiency, while ensuring fast access and consistency of data.

[0086] Figure 2 An example of a scenario diagram of a file upload method is shown.

[0087] As Figure 2As shown, a scenario of a file upload method is described, which supports multiple file types and provides customized processing logic for each type. First, a file upload request is received, which contains the file type information to be uploaded. Then, pre-configured business implementation classes are loaded, each responsible for handling a specific file type. These business implementation classes are traversed in turn to find the implementation class that matches the file type in the file upload request.

[0088] After finding the matching business implementation class, the file upload status information stored in the cache is checked. This status information is stored in a one-dimensional structure, with each data bit corresponding to a business implementation class. The value of the data bit represents the upload status of the corresponding file type: 0 indicates successful upload, 1 indicates no upload, and a value greater than 1, m, indicates m-1 consecutive upload failures. If the status information shows that the file has not been uploaded or has failed to upload, the upload process will continue.

[0089] The upload process first assembles file information, including common information and personalized information. Common information refers to information common to all file types, such as file name, file size, etc. Personalized information is generated by the current business implementation class based on the personalized data stored in the cache, which includes the identification of the business implementation class and specific data for the corresponding file type.

[0090] After assembling the file information, the file is uploaded to the specified storage location. After the upload is complete, the file upload status information in the cache is updated based on the upload result. If the upload is successful, the value of the corresponding data bit is updated to 0; if the upload fails, the value of the corresponding data bit is incremented by 1. If the value of the data bit exceeds the preset upload threshold, a log is generated and output to the user, informing the number of file upload failures, for example, 3, indicating that the file has failed to upload twice in a row, a log is generated to record the number of file upload failures, and the log is output to the user.

[0091] Through the design of the cache mechanism and business implementation class, efficient file upload management is achieved. The cache mechanism allows quick access and update of file upload status information, avoiding repeated uploads and saving resources and time. The encapsulation of business implementation classes achieves decoupling and modularization of file generation logic, improving flexibility and scalability. In addition, error tracking support is provided through recording the number of upload failures and outputting logs, improving user experience.

[0092] Next, based on the description of the foregoing embodiments, a possible specific scenario is provided to introduce the file upload method of the present application:

[0093] This scenario is a scenario in which a customer manager handles a consumer loan for a customer on site, and the steps and actions of the file upload method are as follows:

[0094] A file upload request containing file types is acquired. This request can be triggered by a customer manager on site by inputting customer identity information and starting a face verification operation, involving two file types of identity information saving and biological image information saving.

[0095] A pre-configured business implementation class is loaded, which corresponds to the file type one by one, and is used for subsequent assembly of personalized information of a specific type of file. Examples of loaded business implementation classes include identity information saving business implementation class, biological image information saving business implementation class, authorization saving business implementation class, customer consumption flow saving business implementation class, credit index saving business implementation class, and business data information saving business implementation class.

[0096] Each business implementation class is traversed, and the file type corresponding to each business implementation class is conditionally judged. For the identity information saving file type, it is confirmed that it is contained in the file upload request, and the identity information saving business implementation class checks the file upload state information of the corresponding type in the cache, and finds that the first bit is 1, indicating that the file has not been uploaded, so the subsequent operation is continued.

[0097] The public information part of the file is assembled, the corresponding personalized data configured in the cache is called through the identity information saving business implementation class, the personalized information part of the file is assembled, which can include name, ID number and nationality, etc., the file is generated and the upload operation is performed. After successful upload, update the file upload state information, update the first bit value to 0, indicating that the upload is successful.

[0098] For the biological image information file type, repeat the above steps, find that the second bit of the file upload state information is also 1, continue to execute the file generation and upload process, but find that the file upload fails in subsequent processing, update the corresponding value of the file upload state information to 2, indicating that the upload has failed once.

[0099] For the authorization saving file type, it is not contained in the file upload request and does not meet the saving condition, so it is skipped. Continue to traverse other business implementation classes until all loaded business implementation classes are traversed.

[0100] Through the automatic and modularized file upload process, the efficiency of business processing is improved, and the user experience is also improved, realizing the optimized use of resources.

[0101] The file upload device provided by the embodiments of the present application is described below. The file upload device described below can be referred to each other corresponding to the file upload method described above.

[0102] Referring to Figure 3 , Figure 3 A file upload device structure diagram disclosed by the embodiments of the present application.

[0103] As Figure 3 shown, the device can include:

[0104] A request acquisition unit 11 is configured to acquire a file upload request, the file upload request containing a file type.

[0105] A service implementation class loading unit 12 is configured to load pre-configured service implementation classes, the service implementation classes corresponding one-to-one to the file types, and used to assemble individualized information of files of corresponding types.

[0106] A service implementation class traversal unit 13 is configured to traverse the service implementation classes one by one, and for a currently-traversed service implementation class:

[0107] determine whether the file type corresponding to the currently-traversed service implementation class is contained in the file upload request, if not, skip the currently-traversed service implementation class, and if yes, acquire file upload state information configured in a cache, and based on the file upload state information, determine whether a file of a type corresponding to the currently-traversed service implementation class has been uploaded, the file upload state information recording a corresponding relationship between different service implementation classes and upload states, an upload state corresponding to any service implementation class indicating whether a file of a type corresponding to the service implementation class has been completed uploading.

[0108] if the file of the type corresponding to the currently-traversed service implementation class has not been uploaded, acquire common information of the file to assemble a common information part of the file, acquire individualized data corresponding to the currently-traversed service implementation class in the cache using the currently-traversed service implementation class and assemble an individualized information part of the file, and compose the file from the common information part and the individualized information part.

[0109] upload the file.

[0110] update the file upload state information according to an upload result of the file.

[0111] Optionally, the file upload state information is stored in a one-dimensional structure, the one-dimensional structure containing a plurality of data bits, different data bits corresponding to different service implementation classes, and the data bits representing different upload states of files of types corresponding to the service implementation classes by storing different numerical values.

[0112] Optionally, the numerical values stored in the data bits are first numerical values, second numerical values or third numerical values, the first numerical values indicating that file uploading is successful, the second numerical values indicating that a file has not been uploaded, and the third numerical values indicating that file uploading has failed.

[0113] Optionally, the process in which the service implementation class traversal unit 13 determines whether a file of a type corresponding to a currently-traversed service implementation class has been uploaded based on the file upload state information includes:

[0114] If the value stored in the data bit corresponding to the currently traversed business implementation class in the file upload status information is the first value, the file of the type corresponding to the currently traversed business implementation class has been uploaded.

[0115] If the value stored in the data bit corresponding to the currently traversed business implementation class in the file upload status information is the second value or the third value, the file of the type corresponding to the currently traversed business implementation class has not been uploaded.

[0116] Optionally, the first value is 0, the second value is 1, and the third value is m, where m is a value greater than 1.

[0117] Correspondingly, the process in which the business implementation class traversal unit 13 updates the file upload status information according to the upload result of the file includes:

[0118] If the file is uploaded successfully, the value stored in the data bit corresponding to the currently traversed business implementation class in the file upload status information is updated to 0.

[0119] If the file fails to be uploaded, the value stored in the data bit corresponding to the currently traversed business implementation class in the file upload status information is increased by 1.

[0120] Optionally, the process in which the business implementation class traversal unit 13 determines whether the file of the type corresponding to the currently traversed business implementation class has been uploaded based on the file upload status information further includes:

[0121] If the value stored in the data bit is greater than a preset upload threshold, a log indicating the number of failed uploads of the file is generated according to the value stored in the data bit and output to the user.

[0122] Optionally, the personalized data includes:

[0123] The identifier of the business implementation class and the personalized data information of the file of the type corresponding to the business implementation class.

[0124] The present application also provides an electronic device. Referring to FIG. 1, which shows a structural schematic diagram of an electronic device suitable for implementing the electronic device in the embodiments of the present application. The electronic device in the embodiments of the present application can include, but is not limited to, fixed terminals such as mobile phones, tablet computers, teaching large screens, wearable devices, and the like. Figure 4 The electronic device shown in FIG. 1 is merely an example and should not impose any limitation on the functions and use range of the embodiments of the present application. Figure 4 The electronic device shown in FIG. 1 is merely an example and should not impose any limitation on the functions and use range of the embodiments of the present application.

[0125] As shown in FIG. 1, the electronic device includes a business implementation class traversal unit 13, a file upload status information storage unit 14, and a file upload unit 15. Figure 4As shown, the electronic device can include a processing device (e.g., a central processor, a graphics processor, etc.) 601 that can perform various appropriate actions and processes according to programs stored in a read only memory (ROM) 602 or loaded from a storage device 608 into a random access memory (RAM) 603 to implement the file uploading method of the foregoing embodiments of the present application. In a state where the electronic device is powered on, various programs and data required for operation of the electronic device are also stored in the RAM 603. The processing device 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0126] Generally, the following devices can be connected to the I / O interface 605: input devices 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 608 including, for example, a memory card, a hard disk, etc.; and communication devices 609. The communication devices 609 can allow the electronic device to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 4 An electronic device having various devices is shown, but it should be understood that all of the shown devices are not required to be implemented or possessed. More or fewer devices can be alternatively implemented or possessed.

[0127] The embodiments of the present application also provide a computer program product including computer readable instructions, which, when executed on an electronic device, cause the electronic device to implement any of the file uploading methods provided by the embodiments of the present application.

[0128] The embodiments of the present application also provide a computer readable storage medium carrying one or more computer programs, which, when executed by an electronic device, can cause the electronic device to implement any of the file uploading methods provided by the embodiments of the present application.

[0129] It should be further noted that the device embodiments described above are only schematic and that in actual implementations some of the units, which are described as separate units, can be combined or integrated into one unit, and some of the units, which are described as separate units, can be physically or logically separate units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the embodiments. In addition, in the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which can be implemented as one or more communication buses or signal lines.

[0130] Those skilled in the art can clearly understand that the application can be implemented by means of software plus necessary universal hardware, and of course can also be implemented by means of dedicated hardware including special-purpose integrated circuits, special-purpose CPUs, special-purpose memories, special-purpose components, etc. Generally, any function completed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure for implementing the same function can also be various, such as analog circuits, digital circuits, or special-purpose circuits, etc. However, for the present application, software program implementation is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a readable storage medium, such as a floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a magnetic disk or an optical disk, etc., and includes a plurality of instructions for causing a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in various embodiments of the present application.

[0131] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments can be implemented in the form of a computer program product.

[0132] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another, for example, the computer instructions can be transmitted from one website, computer, training device or data center to another website, computer, training device or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that can be stored by a computer or a data storage device such as a training device, a data center, etc. integrated with one or more available media. The available media can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (SSD)), etc.

[0133] Finally, it should be noted that the terms "first", "second", and the like, herein do not denote any order, quantity, combination, or importance, but rather are used to distinguish one element from another, and are not intended to denote the presence of any such actual relationship or order. Moreover, the terms "include", "have", or any other variant thereof are intended to encompass non-exclusive inclusions, such that processes, methods, articles, or apparatuses that comprise a list of elements are not required to comprise only those elements in the list, but can include other elements not expressly listed, or also include elements inherent in such processes, methods, articles, or apparatuses. Without additional restrictions, an element preceded by "comprises... a" does not exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the stated elements.

[0134] The various embodiments in the specification are described in progressive order with each embodiment building on the previous one, and each embodiment can be combined with other embodiments in any way technically possible. The same or similar parts and principles can be mutually referred to.

[0135] The above description of disclosed embodiments provides enough information to enable those skilled in the art to make or use the application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein can be applied to other embodiments without departing from the spirit or scope of the application. Therefore, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A file upload method, characterized in that, include: Obtain a file upload request, wherein the file upload request includes the file type; Load the pre-configured business implementation classes, which correspond one-to-one with the file type, and are used to assemble the personalized information of the corresponding file type; Iterate through each business implementation class one by one. For the currently iterated business implementation class: Determine whether the file type corresponding to the currently traversed business implementation class is included in the file upload request. If not, skip the currently traversed business implementation class. If yes, obtain the file upload status information configured in the cache. Based on the file upload status information, determine whether the file of the type corresponding to the currently traversed business implementation class has been uploaded. The file upload status information records the correspondence between different business implementation classes and upload status. The upload status corresponding to any business implementation class indicates whether the file of the type corresponding to the business implementation class has been uploaded. The file upload status information is stored in a one-dimensional structure. The one-dimensional structure contains several data bits. Different data bits correspond to different business implementation classes. The data bits store different values ​​to represent different upload statuses of the file of the type corresponding to the business implementation class. The value stored in the data bits is a first value, a second value, or a third value. The first value indicates that the file was uploaded successfully, the second value indicates that the file was not uploaded, and the third value indicates that the file was uploaded unsuccessfully. The first value is 0, the second value is 1, and the third value is m, where m is a value greater than 1. If the file of the type corresponding to the currently traversed business implementation class has not been uploaded, obtain the common information of the file to assemble the common information part of the file, use the currently traversed business implementation class to obtain the corresponding personalized data in the cache and assemble the personalized information part of the file, and the file is composed of the common information part and the personalized information part. Upload the file; If the file upload is successful, the value stored in the data bit corresponding to the currently traversed business implementation class in the file upload status information will be updated to 0; If the file upload fails, increment the value stored in the data bit corresponding to the currently traversed business implementation class in the file upload status information by 1.

2. The method according to claim 1, characterized in that, The step of determining whether a file of the type corresponding to the currently traversed business implementation class has been uploaded based on the file upload status information includes: If the value stored in the data bit corresponding to the currently traversed business implementation class in the file upload status information is the first value, then the file of the type corresponding to the currently traversed business implementation class has been uploaded. If the data bit stored in the file upload status information corresponding to the currently traversed business implementation class has a second or third value, then the file of the type corresponding to the currently traversed business implementation class has not been uploaded.

3. The method according to claim 1, characterized in that, Also includes: If the value stored in the data bits of the file upload status information is greater than the preset upload threshold, a log representing the number of times the file has failed to be uploaded is generated based on the value stored in the data bits and output to the user.

4. The method according to claim 1, characterized in that, The personalized data includes: The identifier of the business implementation class and the personalized data information of the file of the type corresponding to the business implementation class.

5. A file upload device, characterized in that, include: A request acquisition unit is used to acquire a file upload request, wherein the file upload request includes a file type; The business implementation class loading unit is used to load pre-configured business implementation classes, which correspond one-to-one with the file type and are used to assemble personalized information of the corresponding file type. The business implementation class traversal unit is used to traverse each business implementation class one by one. For the currently traversed business implementation class: Determine whether the file type corresponding to the currently traversed business implementation class is included in the file upload request. If not, skip the currently traversed business implementation class. If yes, obtain the file upload status information configured in the cache. Based on the file upload status information, determine whether the file of the type corresponding to the currently traversed business implementation class has been uploaded. The file upload status information records the correspondence between different business implementation classes and upload status. The upload status corresponding to any business implementation class indicates whether the file of the type corresponding to the business implementation class has been uploaded. The file upload status information is stored in a one-dimensional structure. The one-dimensional structure contains several data bits. Different data bits correspond to different business implementation classes. The data bits store different values ​​to represent different upload statuses of the file of the type corresponding to the business implementation class. The value stored in the data bits is a first value, a second value, or a third value. The first value indicates that the file was uploaded successfully, the second value indicates that the file was not uploaded, and the third value indicates that the file was uploaded unsuccessfully. The first value is 0, the second value is 1, and the third value is m, where m is a value greater than 1. If the file of the type corresponding to the currently traversed business implementation class has not been uploaded, obtain the common information of the file to assemble the common information part of the file, use the currently traversed business implementation class to obtain the corresponding personalized data in the cache and assemble the personalized information part of the file, and the file is composed of the common information part and the personalized information part. Upload the file; If the file upload is successful, the value stored in the data bit corresponding to the currently traversed business implementation class in the file upload status information will be updated to 0; If the file upload fails, increment the value stored in the data bit corresponding to the currently traversed business implementation class in the file upload status information by 1.

6. An electronic device, characterized in that, include: Memory and processor; The memory is used to store programs; The processor is used to execute the program to implement each step of the file upload method as described in any one of claims 1 to 4.

7. A readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements each step of the file upload method as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Data transmission method and equipment

    CN108390741A

  • File acquisition method and device, electronic equipment and readable storage medium

    CN116361242A