[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN112637341B - File uploading method and device, electronic equipment and storage medium - Google Patents

File uploading method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112637341B
CN112637341B CN202011532693.0A CN202011532693A CN112637341B CN 112637341 B CN112637341 B CN 112637341B CN 202011532693 A CN202011532693 A CN 202011532693A CN 112637341 B CN112637341 B CN 112637341B
Authority
CN
China
Prior art keywords
file
idle
time
task
uploading
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011532693.0A
Other languages
Chinese (zh)
Other versions
CN112637341A (en
Inventor
李春江
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Bank Co Ltd
Original Assignee
Ping An Bank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202011532693.0A priority Critical patent/CN112637341B/en
Publication of CN112637341A publication Critical patent/CN112637341A/en
Application granted granted Critical
Publication of CN112637341B publication Critical patent/CN112637341B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/143Termination or inactivation of sessions, e.g. event-controlled end of session
    • H04L67/145Termination or inactivation of sessions, e.g. event-controlled end of session avoiding end of session, e.g. keep-alive, heartbeats, resumption message or wake-up for inactive or interrupted session
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/146Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Cardiology (AREA)
  • General Health & Medical Sciences (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to a data processing technology, and discloses a file uploading method, which comprises the following steps: the method comprises the steps of utilizing a preset monitoring task to enable a file uploading task to maintain a keep-alive state, utilizing a preset idle formula to calculate idle time, carrying out idle judgment on the file uploading task according to the monitoring task and the idle time, if the file uploading task is not idle, prohibiting file uploading, if the file uploading task is idle, judging the state of a file to be uploaded, if the state of the file to be uploaded is a normal state, slicing the file to be uploaded and starting uploading, and if the state of the file to be uploaded is an interruption state, continuing to upload the file to be uploaded. In addition, the invention also relates to a block chain technology, and the file to be uploaded can be stored in the node of the block chain. The invention also provides a file uploading device, electronic equipment and a computer readable storage medium. The invention can solve the problem of low identification accuracy of the electronic seal.

Description

File uploading method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a file uploading method and apparatus, an electronic device, and a computer-readable storage medium.
Background
Under the background of big data, the data scale is sharply enlarged, the data forms are various, and the requirements on data application are increasingly improved, which brings huge challenges to the traditional data uploading technology. The following methods exist for uploading sound files: 1. and the recorded sound is uploaded immediately, but if a new service is transacted, due to the large uploaded file, the waiting time is long, and the new service is transacted. 2. The uploading is carried out in a unified time (for example, the uploading is carried out in a unified mode after work), if the middle equipment is used, the uploading is interrupted, otherwise, the bandwidth is occupied to influence the network, a service worker easily forgets to resume the uploading after the operation is interrupted, and meanwhile, the data loss is easily caused when the uploading of large files is interrupted. 3. The method has the advantages that after recording, the thread is opened to be uploaded secretly in the background, the defects are that power consumption is high, equipment is heated seriously in the using process, the occupied bandwidth is large, meanwhile, the computing resource of a file uploading task can be seized, and the transmission efficiency is low.
Disclosure of Invention
The invention provides a file uploading method, a file uploading device and a computer readable storage medium, and mainly aims to solve the problem of low file uploading efficiency.
In order to achieve the above object, the present invention provides a file uploading method, including:
establishing a file uploading task, and performing keep-alive processing on the file uploading task by using a preset monitoring task to ensure that the file uploading task maintains a keep-alive state;
utilizing a preset idle formula to calculate idle time of the file uploading task to obtain idle time;
carrying out idle judgment on the file uploading task according to the monitoring task and the idle time;
if the file uploading task is not idle, file uploading is prohibited, and a prohibition identifier is printed;
if the file uploading task is idle, judging the state of the file to be uploaded;
if the file to be uploaded is in a normal state, slicing the file to be uploaded, starting uploading, and simultaneously recording slice information;
and if the state of the file to be uploaded is an interruption state, continuously transmitting the file to be uploaded according to the slice information.
Optionally, the establishing a file uploading task, and performing keep-alive processing on the file uploading task by using a preset monitoring task, so that the file uploading task maintains a keep-alive state includes:
judging whether the file uploading task enters a background or not;
if the file uploading task does not enter the background, no processing is performed;
and if the file uploading task enters the background, applying for the background to execute the task by using the monitoring task, and executing the background to execute the task to enable the file uploading task to maintain a keep-alive state.
Optionally, the calculating the idle time of the file uploading task by using a preset idle formula to obtain the idle time includes:
acquiring the current time and the latest moving time of the terminal equipment;
according to the current time and the latest moving time of the equipment, calculating the idle time by using the following formula:
FTime=CurrentTime–LastMoveTime
wherein, FTime is the idle time, currentTime is the current time, and LastMoveTime is the latest moving time of the terminal device.
Optionally, the idle judgment on the file uploading task according to the monitoring task and the idle time includes:
judging whether the current time is the working time or not;
if the working time is the idle time, judging whether the idle time is greater than a preset first time threshold value;
if the first time threshold value is larger than the first time threshold value, marking the mobile terminal to be idle; if the time is less than or equal to the first time threshold, marking the mobile terminal as not idle;
if the current time is not the working time, judging whether the idle time is greater than a preset second time threshold value or not;
if the time is larger than the second time threshold, marking the mobile terminal as idle; and if the time is less than or equal to the second time threshold, marking the mobile terminal as not idle.
Optionally, the determining the state of the file to be uploaded includes:
judging whether the file to be uploaded is a file which is not uploaded last time;
if the file is not the file which is not transmitted last time, judging that the state is a normal state;
and if the file is not transmitted last time, judging that the state is an interruption state.
Optionally, the slicing the file to be uploaded and starting uploading, and recording slice information at the same time includes:
slicing the file to be uploaded according to a preset file size to obtain a plurality of slice files, and numbering the slice files;
recording the serial number and the position information of the slice file in the file to be uploaded to obtain the slice information;
and uploading the slice file, and synchronizing the slice file and the slice information in a background server of the terminal equipment.
Optionally, the resuming the file to be uploaded according to the slice information includes:
acquiring the serial number of the last slice file, and taking the serial number as an index to inquire slice information of a background;
and reading corresponding position information according to the slice information, determining the slice file which needs to be uploaded currently according to the position information, and continuously transmitting the slice file.
In order to solve the above problem, the present invention further provides a file uploading apparatus, including:
the uploading task keep-alive module is used for establishing a file uploading task and carrying out keep-alive processing on the file uploading task by utilizing a preset monitoring task so as to enable the file uploading task to maintain a keep-alive state;
the idle time calculation module is used for calculating the idle time of the file uploading task by using a preset idle formula to obtain the idle time;
the idle judgment module is used for carrying out idle judgment on the file uploading task according to the monitoring task and the idle time; if the file uploading task is not idle, file uploading is prohibited, and a prohibition identifier is marked; if the file uploading task is idle, judging the state of the file to be uploaded;
the file slicing module is used for slicing the file to be uploaded and starting uploading if the state of the file to be uploaded is a normal state, and simultaneously recording slicing information;
and the file continuous transmission module is used for continuously transmitting the file to be uploaded according to the slice information if the state of the file to be uploaded is an interrupt state.
In order to solve the above problem, the present invention also provides an electronic device, including:
a memory storing at least one instruction; and
and the processor executes the instructions stored in the memory to realize the file uploading method.
In order to solve the above problem, the present invention further provides a computer-readable storage medium, which stores at least one instruction, where the at least one instruction is executed by a processor in an electronic device to implement the file uploading method.
According to the method and the device, the file uploading task is established, and the preset monitoring task is utilized to enable the file uploading task to maintain the keep-alive state, so that the file uploading task can be effectively prevented from being killed by the system process in the background. And the idle time is calculated through a preset idle formula, the file uploading task is subjected to idle judgment according to the monitoring task and the idle time, and whether the file uploading task is idle or not can be accurately judged through the monitoring task and the idle time, so that the file uploading efficiency at the idle time is improved. Meanwhile, the file to be uploaded is sliced, so that the file uploading efficiency is further improved. Therefore, the file uploading method, the file uploading device, the electronic equipment and the computer readable storage medium provided by the invention can solve the problem of low file uploading efficiency.
Drawings
Fig. 1 is a schematic flowchart of a file uploading method according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart showing a detailed implementation of one of the steps in FIG. 1;
FIG. 3 is a schematic flow chart showing another step of FIG. 1;
FIG. 4 is a schematic flow chart showing another step of FIG. 1;
FIG. 5 is a schematic flow chart showing another step in FIG. 1;
FIG. 6 is a schematic flow chart illustrating another step of FIG. 1;
fig. 7 is a functional block diagram of a file uploading apparatus according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of an electronic device for implementing the file uploading method according to an embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The embodiment of the application provides a file uploading method. The execution subject of the file uploading method includes, but is not limited to, at least one of electronic devices such as a server and a terminal, which can be configured to execute the method provided by the embodiments of the present application. In other words, the file uploading method may be performed by software or hardware installed in the terminal device or the server device, and the software may be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like.
Fig. 1 is a schematic flow chart of a file uploading method according to an embodiment of the present invention. In this embodiment, the file uploading method includes:
s1, establishing a file uploading task, and performing keep-alive processing on the file uploading task by using a preset monitoring task to enable the file uploading task to maintain a keep-alive state.
In the embodiment of the invention, the file uploading task can be a task for uploading files by recording application in terminal equipment in various fields, for example, the field of banks, and the terminal equipment can be a mobile phone, a Pad and other terminals for recording the face signing process in the business handling process of bank face signing business personnel.
Preferably, referring to fig. 2, the performing keep-alive processing on the file uploading task by using a preset monitoring task to maintain the file uploading task in a keep-alive state includes:
s10, judging whether the file uploading task enters a background or not;
if the file uploading task does not enter the background, executing S11 and not processing;
and if the file uploading task enters the background, executing S12, applying for the background execution task by using the monitoring task, and executing the background execution task to enable the file uploading task to maintain a keep-alive state.
In the embodiment of the present invention, the monitoring task may be configured to perform an inspection task every 15 seconds, where the inspection task may include: keep-alive (namely preventing the file uploading task in the recording application from being killed by the system process in the background), idle state detection of the file uploading task, file uploading state detection and the like are carried out on the file uploading task. The background execution task is used for keeping the file uploading task running in the background when the file uploading task enters the background.
Furthermore, the file uploading task is subjected to keep-alive processing through the monitoring task, so that the file uploading task can be effectively prevented from being killed by the system process in the background.
And S2, carrying out idle time calculation on the file uploading task by using a preset idle formula to obtain idle time.
Preferably, the calculating the idle time of the file uploading task by using a preset idle formula to obtain the idle time includes:
acquiring the current time and the latest moving time of the terminal equipment;
according to the current time and the latest moving time of the equipment, calculating the idle time by using the following formula:
FTime=CurrentTime–LastMoveTime
wherein, FTime is the idle time, currentTime is the current time, and LastMoveTime is the latest moving time of the terminal device.
In the embodiment of the invention, the latest moving time of the terminal equipment can be obtained by means of a gyroscope hardware device on the terminal equipment, the direction change of the terminal equipment is read by the gyroscope hardware device to sense whether the terminal equipment moves, and the latest moving time is determined by reading a system API in the terminal equipment.
Furthermore, in the embodiment of the invention, the preset idle formula can be used for accurately calculating the idle time of the file uploading task, so that the file uploading in the idle time is efficiently realized.
And S3, carrying out idle judgment on the file uploading task according to the monitoring task and the idle time.
In detail, referring to fig. 3, the S3 includes:
s30, judging whether the current time is the working time or not;
if the idle time is the working time, executing S31 and judging whether the idle time is greater than a preset first time threshold value;
if the time is greater than the first time threshold, executing S32 and marking as idle; if the time is less than or equal to the first time threshold, executing S33 and marking the time as non-idle;
if the current time is not the working time, executing S34 and judging whether the idle time is greater than a preset second time threshold value;
if the time is greater than the second time threshold, executing S35 and marking as idle; and if the time is less than or equal to the second time threshold, executing S36 and marking the time as non-idle.
Wherein the first time threshold may be ten minutes and the second time threshold may be five minutes.
In the embodiment of the invention, whether the working time is judged by using the following formula:
Figure BDA0002852365470000061
wherein, the isWorkTime indicates whether the working time is working time, the non-working time is when the working time is equal to 0, the working time is when the working time is equal to 1, and the WorkTime indicates standard working time, which may be: working day 9.
In the embodiment of the invention, whether the device is idle is judged by the following formula:
Figure BDA0002852365470000062
the IsRun represents whether the mobile terminal is idle or not, and is idle when the IsRun is equal to 0 and is not idle when the IsRun is equal to 1.
Furthermore, the invention can accurately judge whether the file uploading task is idle or not through the monitoring task and the idle time, thereby improving the file uploading efficiency in the idle time.
And if the file uploading task is not idle, executing S4, prohibiting file uploading, and printing a prohibition identifier.
In the embodiment of the invention, when the file uploading task is judged to be non-idle, the terminal equipment is possibly in use, and the phenomenon that the file uploading and the terminal equipment occupy computing resources due to the superposition of the file uploading time and the terminal equipment use time can be avoided by setting the file uploading prohibition and marking the prohibition identification, so that the bandwidth pressure is relieved. The inhibition flag may be a character string, a number, or the like.
And if the file uploading task is idle, executing S5 and judging the state of the file to be uploaded.
Preferably, referring to fig. 4, the S5 includes:
s50, judging whether the file to be uploaded is a file which is not uploaded last time;
if the file is not the file which is not transmitted last time, executing S51 and judging that the state is a normal state;
if the file is not transferred last time, S52 is executed to determine that the state is the interrupt state.
In the embodiment of the invention, the file to be uploaded can be a recording file for recording the face-to-face signing process by bank face-to-face signing service personnel. And meanwhile, synchronizing the file uploading state with the background server, if the file is not completely uploaded due to the last interruption, synchronously continuously transmitting the position information and returning to the interruption state, and otherwise, returning to the normal state.
And if the file to be uploaded is in a normal state, executing S6, carrying out slicing processing on the file to be uploaded, starting uploading, and simultaneously recording slicing information.
Preferably, referring to fig. 5, the S6 includes:
s60, slicing the file to be uploaded according to a preset file size to obtain a plurality of sliced files, and numbering the sliced files;
s61, recording the serial number and the position information of the slice file in the file to be uploaded to obtain the slice information;
s62, uploading the slice file, and synchronizing the slice file and the slice information in a background server of the terminal equipment.
In the embodiment of the invention, the preset file size can be 300Kb (about 30s is needed for uploading), and the file uploading efficiency is greatly improved by segmenting a larger file and uploading the segmented file in idle time. Meanwhile, as the uploading time of each slice file is short (30 s), once the fact that the terminal device moves (the monitoring task is patrolled once every 15 s) is found, the uploading is stopped when the uploading of the current slice file is finished (30 s at most), and the operation of the terminal device cannot be greatly influenced. Meanwhile, the files to be uploaded are sliced, large files are uploaded to be converted into small files to be uploaded in free time, and file uploading efficiency is greatly improved. The uploading starts in the embodiment of the invention, namely the uploading task thread is created, the uploading task thread is specially used for processing the uploading task, and if the uploading task is done by the thread, the thread is not repeatedly created for uploading.
And if the file to be uploaded is in an interruption state, executing S7 and continuously transmitting the file to be uploaded according to the slice information.
Preferably, referring to fig. 6, the S7 includes:
s70, acquiring the serial number of the last slice file, and taking the serial number as an index to inquire slice information of a background;
and S71, reading corresponding position information according to the slice information, determining the slice file which needs to be uploaded currently according to the position information, and continuously transmitting.
Further, in the embodiment of the present invention, after the uploading and resuming of S6 to S7, the method further includes:
judging whether a forbidden identifier exists;
if the forbidden identifier exists, forbidding uploading;
if the forbidden identifier does not exist, reading the slice data in the slice file and uploading the slice data;
checking whether the uploaded slice data is uploaded completely, and if so, judging that the uploading is completed;
if not, returning and judging whether the forbidden identification exists.
In the embodiment of the invention, the monitoring task is utilized to carry out the file uploading task keep-alive and file uploading task idle detection, so that whether the file is idle or not can be accurately judged, the file to be uploaded can be uploaded in idle time, and the file to be uploaded is sliced to obtain the sliced file, thereby reducing the problems of long time consumption and low efficiency in uploading large files.
According to the method and the device, the file uploading task is established, and the preset monitoring task is utilized to enable the file uploading task to maintain the keep-alive state, so that the file uploading task can be effectively prevented from being killed by the system process in the background. And the idle time is calculated through a preset idle formula, the file uploading task is subjected to idle judgment according to the monitoring task and the idle time, and whether the file uploading task is idle or not can be accurately judged through the monitoring task and the idle time, so that the file uploading efficiency of the idle time is improved. Meanwhile, the file to be uploaded is sliced, so that the file uploading efficiency is further improved. Therefore, the method and the device can solve the problem of low file uploading efficiency.
Fig. 7 is a functional block diagram of a file uploading apparatus according to an embodiment of the present invention.
The file uploading device 100 of the present invention may be installed in an electronic device. According to the implemented functions, the file uploading device 100 may include an uploading task keep-alive module 101, an idle time calculation module 102, an idle judgment module 103, a file slicing module 104, and a file resuming module 105. The module of the present invention, which may also be referred to as a unit, refers to a series of computer program segments that can be executed by a processor of an electronic device and that can perform a fixed function, and that are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
the upload task keep-alive module 101 is configured to establish a file upload task, and perform keep-alive processing on the file upload task by using a preset monitoring task, so that the file upload task maintains a keep-alive state.
In the embodiment of the invention, the file uploading task can be a task for uploading files by recording application in terminal equipment in various fields, for example, the field of banks, and the terminal equipment can be a mobile phone, a Pad and other terminals for recording the face signing process in the business handling process of bank face signing business personnel.
Preferably, the upload task keep-alive module 101 maintains the file upload task in a keep-alive state by:
judging whether the file uploading task enters a background or not;
if the file uploading task does not enter the background, no processing is performed;
and if the file uploading task enters a background, applying for a background execution task by using the monitoring task, and executing the background execution task to enable the file uploading task to maintain a keep-alive state.
In the embodiment of the present invention, the monitoring task may be configured to perform an inspection task every 15 seconds, where the inspection task may include: keep-alive (namely preventing the file uploading task in the recording application from being killed by the system process in the background), idle state detection of the file uploading task, file uploading state detection and the like are carried out on the file uploading task. The background execution task is used for keeping the file uploading task running in the background when the file uploading task enters the background.
Furthermore, the file uploading task is kept alive by the monitoring task, so that the file uploading task can be effectively prevented from being killed by the system process in the background.
The idle time calculation module 102 is configured to perform idle time calculation on the file uploading task by using a preset idle formula to obtain idle time.
Preferably, the idle time calculation module 102 obtains the idle time by:
acquiring the current time and the latest moving time of the terminal equipment;
according to the current time and the latest moving time of the equipment, calculating the idle time by using the following formula:
FTime=CurrentTime–LastMoveTime
wherein, FTime is the idle time, currentTime is the current time, and LastMoveTime is the latest moving time of the terminal device.
In the embodiment of the invention, the latest moving time of the terminal equipment can be obtained by means of a gyroscope hardware device on the terminal equipment, the direction change of the terminal equipment is read by the gyroscope hardware device to sense whether the terminal equipment moves, and the latest moving time is determined by reading a system API in the terminal equipment.
Furthermore, in the embodiment of the invention, the preset idle formula can be used for accurately calculating the idle time of the file uploading task, so that the file uploading in the idle time is efficiently realized.
The idle judgment module 103 is configured to perform idle judgment on the file uploading task according to the monitoring task and the idle time; if the file uploading task is not idle, file uploading is prohibited, and a prohibition identifier is marked; and if the file uploading task is idle, judging the state of the file to be uploaded.
In detail, the idle determination module 103 performs idle determination on the file uploading task by:
judging whether the current time is the working time or not;
if the working time is the working time, judging whether the idle time is greater than a preset first time threshold value or not;
if the time is greater than the first time threshold, marking as idle; if the time is less than or equal to the first time threshold, marking the mobile terminal as not idle;
if the current time is not the working time, judging whether the idle time is greater than a preset second time threshold value or not;
if the time is larger than the second time threshold, marking as idle; if the time is less than or equal to the second time threshold, marking the mobile terminal as not idle.
Wherein the first time threshold may be ten minutes and the second time threshold may be five minutes.
In the embodiment of the invention, whether the working time is judged by using the following formula:
Figure BDA0002852365470000101
wherein, the isWorkTime indicates whether the working time is working time, the non-working time is when the working time is equal to 0, the working time is when the working time is equal to 1, and the WorkTime indicates standard working time, which may be: working day 9.
In the embodiment of the invention, whether the device is idle is judged by the following formula:
Figure BDA0002852365470000102
the IsRun represents whether the mobile terminal is idle or not, and is idle when the IsRun is equal to 0 and is not idle when the IsRun is equal to 1.
Furthermore, the invention can accurately judge whether the file uploading task is idle or not through the monitoring task and the idle time, thereby improving the file uploading efficiency at the idle time.
And if the file uploading task is not idle, forbidding the file uploading, and marking a forbidding identifier.
In the embodiment of the invention, when the file uploading task is judged to be non-idle, the terminal equipment is possibly in use, and the phenomenon that the file uploading and the terminal equipment occupy computing resources due to the superposition of the file uploading time and the terminal equipment use time can be avoided by setting the file uploading prohibition and marking the prohibition identification, so that the bandwidth pressure is relieved. The prohibition identification may be a character string, a number, or the like.
And if the file uploading task is idle, judging the state of the file to be uploaded.
Preferably, the idle determining module 103 determines the state of the file to be uploaded by:
judging whether the file to be uploaded is a file which is not uploaded last time;
if the file is not the file which is not transmitted last time, judging that the state is a normal state;
and if the file is not transmitted last time, judging that the state is an interruption state.
In the embodiment of the invention, the file to be uploaded can be a recording file for recording the face-to-face signing process by bank face-to-face signing service personnel. And meanwhile, synchronizing the file uploading state with the background server, if the file is not completely uploaded due to the last interruption, synchronously continuously transmitting the position information and returning to the interruption state, and otherwise, returning to the normal state.
The file slicing module 104 is configured to, if the state of the file to be uploaded is a normal state, slice the file to be uploaded and start uploading, and record slice information.
Preferably, the file slicing module 104 slices the file to be uploaded and starts uploading the file to be uploaded by the following operations, and records slice information at the same time:
slicing the file to be uploaded according to a preset file size to obtain a plurality of sliced files, and numbering the sliced files;
recording the serial number and the position information of the slice file in the file to be uploaded to obtain slice information;
and uploading the slice file, and synchronizing the slice file and the slice information in a background server of the terminal equipment.
In the embodiment of the invention, the preset file size can be 300Kb (about 30s is needed for uploading), and the file uploading efficiency is greatly improved by segmenting a larger file and uploading the segmented file in idle time. Meanwhile, as the uploading time of each slice file is short (30 s), once the terminal equipment is found to move (the monitoring task is patrolled once every 15 s), the uploading is stopped when the uploading of the current slice file is finished (30 s at most), and the operation of the terminal equipment is not greatly influenced. Meanwhile, the files to be uploaded are sliced, large files are uploaded to be converted into small files to be uploaded in free time, and file uploading efficiency is greatly improved. The uploading starts in the embodiment of the invention, namely the uploading task thread is created, the uploading task thread is specially used for processing the uploading task, and if the uploading task is done by the thread, the thread is not repeatedly created for uploading.
The file continuous transmission module 105 is configured to continuously transmit the file to be uploaded according to the slice information if the state of the file to be uploaded is an interruption state.
Preferably, the file resuming module 105 resumes the file to be uploaded by:
acquiring the serial number of the last slice file, and taking the serial number as an index to inquire slice information of a background;
and reading corresponding position information according to the slice information, determining the slice file which needs to be uploaded currently according to the position information, and continuously transmitting the slice file.
Further, the file resuming module 105 further includes:
judging whether a forbidden identifier exists;
if the forbidden identifier exists, forbidding uploading;
if the forbidden identification does not exist, reading slice data in the slice file and uploading the slice data;
checking whether the uploaded slice data is uploaded completely, and if so, judging that the uploading is completed;
if not, returning and judging whether the forbidden identification exists.
In the embodiment of the invention, the monitoring task is utilized to carry out the file uploading task keep-alive and file uploading task idle detection, so that whether the file is idle or not can be accurately judged, the file to be uploaded can be uploaded in idle time, and the file to be uploaded is sliced to obtain the sliced file, thereby reducing the problems of long time consumption and low efficiency in uploading large files.
Fig. 8 is a schematic structural diagram of an electronic device for implementing a file uploading method according to an embodiment of the present invention.
The electronic device 1 may comprise a processor 10, a memory 11 and a bus, and may further comprise a computer program, such as a file upload program 12, stored in the memory 11 and operable on the processor 10.
The memory 11 includes at least one type of readable storage medium, which includes flash memory, removable hard disk, multimedia card, card type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device 1, e.g. a removable hard disk of the electronic device 1. The memory 11 may also be an external storage device of the electronic device 1 in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic device 1. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device 1. The memory 11 may be used not only to store application software installed in the electronic device 1 and various types of data, such as a code of the file uploading program 12, but also to temporarily store data that has been output or will be output.
The processor 10 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same or different functions, including one or more Central Processing Units (CPUs), microprocessors, digital Processing chips, graphics processors, and combinations of various control chips. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the electronic device by using various interfaces and lines, and executes various functions and processes data of the electronic device 1 by running or executing programs or modules (e.g., a file upload program, etc.) stored in the memory 11 and calling data stored in the memory 11.
The bus may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is arranged to enable connection communication between the memory 11 and at least one processor 10 or the like.
Fig. 8 only shows an electronic device with components, and it will be understood by those skilled in the art that the structure shown in fig. 8 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than those shown, or some components may be combined, or a different arrangement of components.
For example, although not shown, the electronic device 1 may further include a power supply (such as a battery) for supplying power to each component, and preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so as to implement functions of charge management, discharge management, power consumption management, and the like through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The electronic device 1 may further include various sensors, a bluetooth module, a Wi-Fi module, and the like, which are not described herein again.
Further, the electronic device 1 may further include a network interface, and optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a bluetooth interface, etc.), which are generally used to establish a communication connection between the electronic device 1 and another electronic device.
Optionally, the electronic device 1 may further comprise a user interface, which may be a Display (Display), an input unit (such as a Keyboard), and optionally a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable, among other things, for displaying information processed in the electronic device 1 and for displaying a visualized user interface.
It is to be understood that the embodiments described are illustrative only and are not to be construed as limiting the scope of the claims.
The file upload program 12 stored in the memory 11 of the electronic device 1 is a combination of instructions, which when executed in the processor 10, can implement:
establishing a file uploading task, and performing keep-alive processing on the file uploading task by using a preset monitoring task to enable the file uploading task to maintain a keep-alive state;
utilizing a preset idle formula to calculate idle time of the file uploading task to obtain idle time;
carrying out idle judgment on the file uploading task according to the monitoring task and the idle time;
if the file uploading task is not idle, file uploading is prohibited, and a prohibition identifier is printed;
if the file uploading task is idle, judging the state of the file to be uploaded;
if the file to be uploaded is in a normal state, slicing the file to be uploaded, starting uploading, and recording slice information;
and if the file to be uploaded is in an interruption state, continuously transmitting the file to be uploaded according to the slice information.
Specifically, the specific implementation method of the processor 10 for the instruction may refer to the description of the relevant steps in the embodiments corresponding to fig. 1 to fig. 6, which is not repeated herein.
Further, the integrated modules/units of the electronic device 1, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. The computer readable storage medium may be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying said computer program code, a recording medium, a usb-disk, a removable hard disk, a magnetic diskette, an optical disk, a computer Memory, a Read-Only Memory (ROM).
The present invention also provides a computer-readable storage medium storing a computer program which, when executed by a processor of an electronic device, implements:
establishing a file uploading task, and performing keep-alive processing on the file uploading task by using a preset monitoring task to ensure that the file uploading task maintains a keep-alive state;
calculating the idle time of the file uploading task by using a preset idle formula to obtain the idle time;
carrying out idle judgment on the file uploading task according to the monitoring task and the idle time;
if the file uploading task is not idle, file uploading is prohibited, and a prohibition identifier is printed;
if the file uploading task is idle, judging the state of the file to be uploaded;
if the file to be uploaded is in a normal state, slicing the file to be uploaded, starting uploading, and simultaneously recording slice information;
and if the file to be uploaded is in an interruption state, continuously transmitting the file to be uploaded according to the slice information.
In the several embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a string of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, which is used for verifying the validity (anti-counterfeiting) of the information and generating a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims (9)

1. A file uploading method, the method comprising:
establishing a file uploading task, and performing keep-alive processing on the file uploading task by using a preset monitoring task to ensure that the file uploading task maintains a keep-alive state;
utilizing a preset idle formula to calculate idle time of the file uploading task to obtain idle time;
and carrying out idle judgment on the file uploading task according to the monitoring task and the idle time, wherein the idle judgment comprises the following steps: judging whether the idle time is greater than a preset time threshold, if so, marking the idle time as idle, and if not, marking the idle time as non-idle;
if the file uploading task is not idle, file uploading is prohibited, and a prohibition identifier is marked;
if the file uploading task is idle, judging the state of the file to be uploaded;
if the file to be uploaded is in a normal state, slicing the file to be uploaded, starting uploading, and simultaneously recording slice information;
if the file to be uploaded is in an interruption state, continuously transmitting the file to be uploaded according to the slice information;
the method for calculating the idle time of the file uploading task by using the preset idle formula to obtain the idle time comprises the following steps:
acquiring the current time and the latest moving time of the terminal equipment;
according to the current time and the latest moving time of the terminal equipment, calculating the idle time by using the following formula:
FTime=CurrentTime–LastMoveTime
wherein, FTime is the idle time, currentTime is the current time, and LastMoveTime is the latest moving time of the terminal equipment.
2. The file uploading method according to claim 1, wherein the establishing of the file uploading task and the keep-alive processing of the file uploading task by using a preset monitoring task to maintain the keep-alive state of the file uploading task comprise:
judging whether the file uploading task enters a background or not;
if the file uploading task does not enter the background, no processing is performed;
and if the file uploading task enters the background, applying for the background to execute the task by using the monitoring task, and executing the background to execute the task to enable the file uploading task to maintain a keep-alive state.
3. The method for uploading files according to claim 1, wherein the determining whether the idle time is greater than a preset time threshold, if so, marking the file as idle, and if not, marking the file as not idle, includes:
judging whether the current time is the working time or not;
if the working time is the working time, judging whether the idle time is greater than a preset first time threshold value or not;
if the first time threshold value is larger than the first time threshold value, marking the mobile terminal to be idle; if the time is less than or equal to the first time threshold, marking the mobile terminal as not idle;
if the current time is not the working time, judging whether the idle time is greater than a preset second time threshold value or not;
if the time is larger than the second time threshold, marking the mobile terminal as idle; and if the time is less than or equal to the second time threshold, marking the mobile terminal as not idle.
4. The file uploading method according to claim 1, wherein the determining the status of the file to be uploaded comprises:
judging whether the file to be uploaded is a file which is not uploaded last time;
if the file is not the file which is not transmitted last time, judging that the state is a normal state;
and if the file is not transmitted last time, judging that the state is an interruption state.
5. The file uploading method according to any one of claims 1 to 4, wherein the slicing processing and uploading of the file to be uploaded are started, and simultaneously recording slicing information includes:
slicing the file to be uploaded according to a preset file size to obtain a plurality of sliced files, and numbering the sliced files;
recording the serial number and the position information of the slice file in the file to be uploaded to obtain the slice information;
and uploading the slice file, and synchronizing the slice file and the slice information in a background server of the terminal equipment.
6. The file uploading method according to claim 5, wherein the resuming the file to be uploaded according to the slice information comprises:
acquiring the serial number of the last slice file, and taking the serial number as an index to inquire slice information of a background;
and reading corresponding position information according to the slice information, determining the slice file which needs to be uploaded currently according to the position information, and continuously transmitting the slice file.
7. An apparatus for uploading a document, the apparatus comprising:
the uploading task keep-alive module is used for establishing a file uploading task and carrying out keep-alive processing on the file uploading task by utilizing a preset monitoring task so as to enable the file uploading task to maintain a keep-alive state;
the idle time calculation module is used for calculating the idle time of the file uploading task by using a preset idle formula to obtain the idle time;
the idle judgment module is used for carrying out idle judgment on the file uploading task according to the monitoring task and the idle time, and comprises: judging whether the idle time is greater than a preset time threshold, if so, marking the idle time as idle, and if not, marking the idle time as non-idle; if the file uploading task is not idle, file uploading is prohibited, and a prohibition identifier is printed; if the file uploading task is idle, judging the state of the file to be uploaded;
the file slicing module is used for slicing the file to be uploaded and starting uploading if the state of the file to be uploaded is a normal state, and simultaneously recording slicing information;
the file continuous transmission module is used for continuously transmitting the file to be uploaded according to the slice information if the state of the file to be uploaded is an interruption state;
the method for calculating the idle time of the file uploading task by using the preset idle formula to obtain the idle time comprises the following steps:
acquiring the current time and the latest moving time of the terminal equipment;
and according to the current time and the latest moving time of the terminal equipment, calculating the idle time by using the following formula:
FTime=CurrentTime–LastMoveTime
wherein, FTime is the idle time, currentTime is the current time, and LastMoveTime is the latest moving time of the terminal device.
8. An electronic device, characterized in that the electronic device comprises:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the file upload method of any of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, wherein the computer program is executed by a processor to implement the file uploading method according to any one of claims 1 to 6.
CN202011532693.0A 2020-12-22 2020-12-22 File uploading method and device, electronic equipment and storage medium Active CN112637341B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011532693.0A CN112637341B (en) 2020-12-22 2020-12-22 File uploading method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011532693.0A CN112637341B (en) 2020-12-22 2020-12-22 File uploading method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112637341A CN112637341A (en) 2021-04-09
CN112637341B true CN112637341B (en) 2022-12-13

Family

ID=75321247

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011532693.0A Active CN112637341B (en) 2020-12-22 2020-12-22 File uploading method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112637341B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115225917B (en) * 2021-04-15 2024-08-27 北京字节跳动网络技术有限公司 Recording plug-flow method, device, equipment and medium
CN113094193A (en) * 2021-04-27 2021-07-09 上海商汤临港智能科技有限公司 Data processing method and device
CN113949591B (en) * 2021-12-21 2022-07-05 北京中科金财科技股份有限公司 Data encryption protection method and system based on block chain

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107360233A (en) * 2017-07-14 2017-11-17 世纪龙信息网络有限责任公司 Method, apparatus, equipment and the readable storage medium storing program for executing that file uploads
CN108933805A (en) * 2017-05-26 2018-12-04 武汉斗鱼网络科技有限公司 A kind of document transmission method and system
WO2020147403A1 (en) * 2019-01-16 2020-07-23 平安科技(深圳)有限公司 Cloud storage based file processing method, system and computer device
CN111586094A (en) * 2020-03-26 2020-08-25 平安养老保险股份有限公司 File uploading method and device and computer equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070035764A1 (en) * 2005-08-12 2007-02-15 Yahoo! Inc. System and method for uploading files

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108933805A (en) * 2017-05-26 2018-12-04 武汉斗鱼网络科技有限公司 A kind of document transmission method and system
CN107360233A (en) * 2017-07-14 2017-11-17 世纪龙信息网络有限责任公司 Method, apparatus, equipment and the readable storage medium storing program for executing that file uploads
WO2020147403A1 (en) * 2019-01-16 2020-07-23 平安科技(深圳)有限公司 Cloud storage based file processing method, system and computer device
CN111586094A (en) * 2020-03-26 2020-08-25 平安养老保险股份有限公司 File uploading method and device and computer equipment

Also Published As

Publication number Publication date
CN112637341A (en) 2021-04-09

Similar Documents

Publication Publication Date Title
CN112637341B (en) File uploading method and device, electronic equipment and storage medium
WO2021189899A1 (en) Link state tracking method and apparatus, and electronic device and computer storage medium
CN112653760B (en) Cross-server file transmission method and device, electronic equipment and storage medium
CN112115145A (en) Data acquisition method and device, electronic equipment and storage medium
CN113239106A (en) Excel file export method and device, electronic equipment and storage medium
CN111625252A (en) Cluster upgrading maintenance method and device, electronic equipment and storage medium
CN113468049A (en) Test method, device, equipment and medium based on configurable interface
CN111694844A (en) Enterprise operation data analysis method and device based on configuration algorithm and electronic equipment
CN113890712A (en) Data transmission method and device, electronic equipment and readable storage medium
CN115002062B (en) Message processing method, device, equipment and readable storage medium
CN112486957A (en) Database migration detection method, device, equipment and storage medium
CN111985194A (en) Data storage method and device, electronic equipment and storage medium
CN111694843A (en) Missing number detection method and device, electronic equipment and storage medium
CN115145870A (en) Method and device for positioning reason of failed task, electronic equipment and storage medium
CN111858604B (en) Data storage method and device, electronic equipment and storage medium
CN113766312A (en) Method, device, equipment and storage medium for calculating response delay between equipment
CN112685384A (en) Data migration method and device, electronic equipment and storage medium
CN113434542A (en) Data relation identification method and device, electronic equipment and storage medium
CN113918296B (en) Model training task scheduling execution method and device, electronic equipment and storage medium
CN113434397B (en) Task system testing method and device, electronic equipment and storage medium
CN112905470A (en) Interface calling method and device, computer equipment and medium
CN114942855A (en) Interface calling method and device, electronic equipment and storage medium
CN114662095A (en) Safety monitoring method, device and equipment based on operation data and storage medium
CN113360398A (en) Hybrid application program testing method, device, equipment and medium
CN114185589A (en) Spring boot-based file transmission method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant