A file processing method, device, computer-readable storage medium and server

By introducing sharded processing of file polling, downloading, verification, warehousing and uploading operation nodes in financial enterprises, the problem of inefficiency of traditional file processing methods is solved, and efficient processing of massive data files is achieved.

CN114398332BActive Publication Date: 2024-10-25PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210072391.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-21
Publication Date
2024-10-25
Estimated Expiration
2042-01-21

AI Technical Summary

Technical Problem

When existing financial enterprises process massive data files, traditional file processing methods are inefficient and difficult to meet the current high requirements.

Method used

Obtain file information through the preset file polling job node, generate file task information and store it, and use file download, verification, warehousing and uploading job nodes for shard processing to achieve parallel processing and improve file processing efficiency.

Benefits of technology

It greatly improves the efficiency of document processing, can effectively process massive documents, and meets the efficient needs of modern financial enterprises.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114398332B_ABST
    Figure CN114398332B_ABST
Patent Text Reader

Abstract

The present invention belongs to the field of artificial intelligence technology, and in particular, relates to a file processing method, device, computer-readable storage medium and server. The method comprises: obtaining file information from a target file source through a file polling operation node, generating corresponding file task information according to the file information, and storing the file task information in a file task table; reading the file task information in the table through a file downloading operation node, and downloading the file from the target file source according to the file task information; scheduling a first number of file verification operation slices to perform verification operations on the files respectively through a file verification operation node; scheduling a second number of file storage operation slices to perform file parsing on the files respectively through a file storage operation node, and inserting the files into a storage table; scheduling a third number of file upload operation slices to generate local files from the file parsing information in the storage table respectively through a file upload operation node, and uploading the local files to a distributed file system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of artificial intelligence technology, and in particular relates to a file processing method, device, computer-readable storage medium and server. Background Art

[0002] With the development of computer technology, more and more technologies are applied in the financial field. The traditional financial industry is gradually transforming to financial technology (Fintech). However, due to the security and real-time requirements of the financial industry, higher requirements are also placed on technology. In modern financial enterprise applications, in complex business scenarios, massive data files will be generated. Compared with traditional financial enterprises, data files have increased rapidly by several times, dozens of times, or even hundreds of times. However, the current financial enterprises still use the traditional file processing method, that is, to process files in an inherent order. After the entire processing process of the previous file is completed, the next file will be processed. These methods are aimed at file processing with small data volumes, and the processing efficiency is low. It is increasingly difficult to meet the current processing needs for massive files. Summary of the invention

[0003] In view of this, embodiments of the present invention provide a file processing method, device, computer-readable storage medium and server to solve the problem of low processing efficiency of existing file processing methods.

[0004] A first aspect of an embodiment of the present invention provides a file processing method, which may include:

[0005] Obtain file information from a specified target file source through a preset file polling job node, generate corresponding file task information according to the acquired file information, and store the generated file task information in a preset file task table;

[0006] Reading the file task information in the file task table through a preset file downloading operation node, and downloading the corresponding file from the target file source according to the read file task information;

[0007] Scheduling a preset first number of file verification job slices through a preset file verification job node to perform verification operations on the downloaded files respectively;

[0008] Scheduling a preset second number of file storage job slices through a preset file storage job node to perform file parsing on the files after the verification operation respectively, and inserting the obtained file parsing information into a preset library table;

[0009] The preset third number of file upload job slices are scheduled by the preset file upload job node to respectively generate local files from the file parsing information in the library table, and the generated local files are uploaded to the preset distributed file system.

[0010] In a specific implementation of the first aspect, generating corresponding file task information according to the acquired file information may include:

[0011] Perform regular matching on the acquired file information and the file configuration data registered in the preset file configuration table;

[0012] If the match fails, the exception information is recorded in the preset exception information table;

[0013] If the match is successful, the polling flag in the matched file configuration data is extracted;

[0014] If the polling flag is a preset first value, the abnormal information is recorded in the abnormal information table;

[0015] If the polling flag is a preset second value, the file task information is generated according to the matched file configuration data.

[0016] In a specific implementation of the first aspect, storing the generated file task information into a preset file task table may include:

[0017] Querying in the file task table whether there is file task information identical to the generated file task information;

[0018] If the same file task information exists in the file task table, the abnormal information is recorded in a preset abnormal information table;

[0019] If the same file task information does not exist in the file task table, the generated file task information is stored in the preset file task table.

[0020] In a specific implementation of the first aspect, reading the file task information in the file task table, and downloading the corresponding file from the target file source according to the read file task information may include:

[0021] Read the file task information in the file task table according to the preset reading conditions;

[0022] Extract the download flag in the read file task information;

[0023] If the download flag is a preset first value, the status of the read file task information is updated to a skip download status;

[0024] If the download flag is a preset second value, performing an integrity check on the corresponding file in the target file source;

[0025] If the integrity check fails, the exception information is recorded in the preset exception information table;

[0026] If the integrity check passes, the corresponding file is downloaded from the target file source, and the downloaded file is uploaded to the specified directory of the distributed file system;

[0027] Send a file transfer instruction to the target file source to transfer the corresponding source file to a preset backup directory.

[0028] In a specific implementation of the first aspect, the scheduling of a preset first number of file verification job slices to respectively perform verification operations on the downloaded files may include:

[0029] According to the slice number of each file verification job slice and the file number of each downloaded file, a preset slice algorithm is used to determine the file task information list corresponding to each file verification job slice;

[0030] Schedule each file verification job slice to traverse its corresponding file task information list respectively, and perform verification operations on each file in the file task information list;

[0031] The verification operation on each file in the file task information list may include:

[0032] Extracting the check mark in the target file task information; the target file task information is any one of the file task information in the file task information list;

[0033] If the check flag is a preset first value, the state of the target file task information is updated to a skip check state;

[0034] If the check flag is a preset second value, a target file is obtained from the distributed file system; the target file is a file corresponding to the target file task information;

[0035] Parsing the first parameter and the second parameter respectively; the first parameter is the parameter in the target file task information, and the second parameter is the parameter in the target file;

[0036] If the first parameter is inconsistent with the second parameter, the abnormal information is recorded in a preset abnormal information table;

[0037] If the first parameter is consistent with the second parameter, the status of the target file task information is updated to a verification completion status.

[0038] In a specific implementation of the first aspect, the scheduling of a preset second number of file storage job slices respectively performs file parsing on the files after the verification operation, and inserts the obtained file parsing information into a preset library table, which may include:

[0039] According to the slice number of each file storage job slice and the file number of each downloaded file, a preset slice algorithm is used to determine the file task information list corresponding to each file storage job slice;

[0040] Schedule each file storage job slice to traverse the corresponding file task information list respectively, and perform storage operations on each file in the file task information list;

[0041] The storage operation of each file in the file task information list may include:

[0042] Extracting the storage flag in the target file task information; the target file task information is any file task information in the file task information list;

[0043] If the storage flag is a preset first value, the status of the target file task information is updated to a skip storage status;

[0044] If the storage flag is the preset second value, the target file is parsed to obtain file parsing information; the target file is a file corresponding to the target file task information;

[0045] The file parsing information is inserted into a target library table; the target library table is a library table corresponding to the table name configured in the target file task information.

[0046] In a specific implementation of the first aspect, the scheduling of the preset third number of file upload job slices respectively generates local files from the file parsing information in the library table, and uploads the generated local files to a preset distributed file system, which may include:

[0047] According to the slice number of each file upload job slice and the file number of each downloaded file, a preset slice algorithm is used to determine the file task information list corresponding to each file upload job slice;

[0048] Schedule each file upload job slice to traverse its corresponding file task information list respectively, and perform upload operations on each file in the file task information list;

[0049] The uploading operation of each file in the file task information list may include:

[0050] Extracting the upload flag in the target file task information; the target file task information is any file task information in the file task information list;

[0051] If the upload flag is a preset first value, the status of the target file task information is updated to a skip upload status;

[0052] If the upload flag is the preset second value, the file parsing information in the target library table is used to generate a local file, and the generated local file is uploaded to the distributed file system; the target library table is a library table corresponding to the table name configured in the target file task information.

[0053] A second aspect of an embodiment of the present invention provides a file processing device, which may include:

[0054] A file polling job module is used to obtain file information from a specified target file source through a preset file polling job node, generate corresponding file task information according to the obtained file information, and store the generated file task information into a preset file task table;

[0055] A file downloading operation module is used to read the file task information in the file task table through a preset file downloading operation node, and download the corresponding file from the target file source according to the read file task information;

[0056] A file verification operation module, used for scheduling a preset first number of file verification operation slices through a preset file verification operation node to respectively perform verification operations on the downloaded files;

[0057] A file storage operation module, used for scheduling a preset second number of file storage operation slices through a preset file storage operation node to perform file parsing on the files after the verification operation respectively, and inserting the obtained file parsing information into a preset library table;

[0058] The file upload job module is used to schedule a preset third number of file upload job slices through a preset file upload job node to generate local files from the file parsing information in the library table, and upload the generated local files to a preset distributed file system.

[0059] In a specific implementation of the second aspect, the file polling operation module may specifically include:

[0060] A regular matching unit, used for performing regular matching between the acquired file information and the file configuration data registered in the preset file configuration table;

[0061] A first abnormal information recording unit, used for recording abnormal information in a preset abnormal information table if the matching is unsuccessful;

[0062] A polling flag bit extraction unit, used for extracting the polling flag bit in the matched file configuration data if the match is successful;

[0063] A second exception information recording unit, configured to record the exception information in the exception information table if the polling flag is a preset first value;

[0064] The file task information generating unit is used to generate the file task information according to the matched file configuration data if the polling flag is a preset second value.

[0065] In a specific implementation of the second aspect, the file polling job module may further include:

[0066] A file task information query unit, used to query in the file task table whether there is file task information identical to the generated file task information;

[0067] a third abnormal information recording unit, configured to record abnormal information in a preset abnormal information table if the same file task information exists in the file task table;

[0068] The file task information storage unit is used to store the generated file task information into a preset file task table if the same file task information does not exist in the file task table.

[0069] In a specific implementation of the second aspect, the file downloading operation module may specifically include:

[0070] A file task information reading unit, used to read the file task information in the file task table according to a preset reading condition;

[0071] A download flag extraction unit, used for extracting the download flag in the read file task information;

[0072] A download status updating unit, configured to update the status of the read file task information to a skip download status if the download flag is a preset first value;

[0073] an integrity checking unit, configured to perform an integrity check on a corresponding file in the target file source if the download flag is a preset second value;

[0074] A fourth abnormal information recording unit, used for recording abnormal information in a preset abnormal information table if the integrity check fails;

[0075] A file downloading unit, configured to download the corresponding file from the target file source if the integrity check passes, and upload the downloaded file to a designated directory of the distributed file system;

[0076] The file transfer instruction sending unit is used to send a file transfer instruction to the target file source to transfer the corresponding source file to a preset backup directory.

[0077] In a specific implementation of the second aspect, the file verification operation module may specifically include:

[0078] The first slicing submodule is used to determine the file task information list corresponding to each file verification job slice according to the slice number of each file verification job slice and the file number of each downloaded file using a preset slicing algorithm;

[0079] The file verification submodule is used to schedule each file verification job slice to traverse the corresponding file task information list respectively, and perform verification operations on each file in the file task information list;

[0080] In a specific implementation of the second aspect, the file verification submodule may specifically include:

[0081] A check mark extraction unit, used to extract the check mark in the target file task information; the target file task information is any file task information in the file task information list;

[0082] A skip check state updating unit, configured to update the state of the target file task information to a skip check state if the check flag is a preset first value;

[0083] A target file acquisition unit, configured to acquire a target file from the distributed file system if the check flag is a preset second value; the target file is a file corresponding to the target file task information;

[0084] A parameter parsing unit, used to parse a first parameter and a second parameter respectively; the first parameter is a parameter in the target file task information, and the second parameter is a parameter in the target file;

[0085] a fifth abnormal information recording unit, configured to record abnormal information in a preset abnormal information table if the first parameter is inconsistent with the second parameter;

[0086] A verification completion status updating unit is used to update the status of the target file task information to a verification completion status if the first parameter is consistent with the second parameter.

[0087] In a specific implementation of the second aspect, the file storage operation module may specifically include:

[0088] The second slicing submodule is used to determine the file task information list corresponding to each file storage operation slice according to the slice number of each file storage operation slice and the file number of each downloaded file using a preset slicing algorithm;

[0089] The file storage submodule is used to schedule each file storage job slice to traverse the corresponding file task information list respectively, and perform storage operations on each file in the file task information list;

[0090] In a specific implementation of the second aspect, the file storage submodule may specifically include:

[0091] The storage flag extraction unit is used to extract the storage flag in the target file task information; the target file task information is any file task information in the file task information list;

[0092] A skip storage state updating unit, configured to update the state of the target file task information to a skip storage state if the storage flag is a preset first value;

[0093] A file parsing unit, configured to parse the target file to obtain file parsing information if the storage flag is a preset second value; the target file is a file corresponding to the target file task information;

[0094] The file storage unit is used to insert the file parsing information into a target library table; the target library table is a library table corresponding to the table name configured in the target file task information.

[0095] In a specific implementation of the second aspect, the file upload operation module may specifically include:

[0096] The third slicing submodule is used to determine the file task information list corresponding to each file upload job slice according to the slice number of each file upload job slice and the file number of each downloaded file using a preset slicing algorithm;

[0097] The file upload submodule is used to schedule each file upload job slice to traverse the corresponding file task information list respectively, and upload each file in the file task information list;

[0098] In a specific implementation of the second aspect, the file upload submodule may specifically include:

[0099] An upload flag extraction unit, used to extract the upload flag in the target file task information; the target file task information is any file task information in the file task information list;

[0100] A skip upload status update unit, configured to update the status of the target file task information to a skip upload status if the upload flag is a preset first value;

[0101] A file upload unit is used to generate a local file from the file parsing information in the target library table and upload the generated local file to the distributed file system if the upload flag is a preset second value; the target library table is a library table corresponding to the table name configured in the target file task information.

[0102] A third aspect of an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any of the above-mentioned file processing methods are implemented.

[0103] A fourth aspect of an embodiment of the present invention provides a server, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any one of the above-mentioned file processing methods when executing the computer program.

[0104] A fifth aspect of an embodiment of the present invention provides a computer program product. When the computer program product runs on a server, the server executes the steps of any one of the above-mentioned file processing methods.

[0105] Compared with the prior art, the embodiments of the present invention have the following beneficial effects: the embodiments of the present invention obtain file information from a specified target file source through a preset file polling job node, generate corresponding file task information according to the obtained file information, and store the generated file task information in a preset file task table; read the file task information in the file task table through a preset file downloading job node, and download the corresponding file from the target file source according to the read file task information; schedule a preset first number of file verification job slices through a preset file verification job node to perform verification operations on the downloaded files respectively; schedule a preset second number of file storage job slices through a preset file storage job node to perform file parsing on the files after the verification operation respectively, and insert the obtained file parsing information into a preset library table; schedule a preset third number of file upload job slices through a preset file upload job node to generate local files from the file parsing information in the library table respectively, and upload the generated local files to a preset distributed file system. In the embodiments of the present invention, the entire file processing flow is connected in series through different job nodes, and parallel processing is achieved through sliced ​​jobs, which greatly improves the file processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0107] Figure 1 A flowchart of a method for processing a file according to an embodiment of the present invention;

[0108] Figure 2 A structural diagram of a file processing device according to an embodiment of the present invention;

[0109] Figure 3 The figure is a schematic block diagram of a server in an embodiment of the present invention. DETAILED DESCRIPTION

[0110] In order to make the purpose, features and advantages of the present invention more obvious and easy to understand, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described below are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0111] The embodiments of the present invention can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0112] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0113] The execution subject of the embodiment of the present invention may be an artificial intelligence-based server for executing the file processing method in the embodiment of the present invention. The server may be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0114] In an embodiment of the present invention, several job nodes (job) can be set in advance to execute the corresponding file processing flow in stages. These job nodes may include but are not limited to file polling job nodes, file download job nodes, file verification job nodes, file storage job nodes and file upload job nodes.

[0115] See also Figure 1 , an embodiment of a file processing method in an embodiment of the present invention may include:

[0116] Step S101: obtain file information from a specified target file source through a preset file polling operation node, generate corresponding file task information according to the obtained file information, and store the generated file task information into a preset file task table.

[0117] In an embodiment of the present invention, the file polling job node may preferably adopt timed polling, that is, obtaining file information from the target file source at predetermined time intervals. The time interval may be set according to actual conditions, for example, it may be set to 1 minute, 5 minutes, 10 minutes, etc. The embodiment of the present invention does not specifically limit this.

[0118] The target file source can be set according to actual conditions, for example, it can be an SFTP (Secure File Transfer Protocol) file source. The address and directory of the target file source are configured in a distributed configuration center such as apollo, and the file polling job node can obtain the currently existing file information from the target file source.

[0119] After obtaining the file information, the file polling job node can generate corresponding file task information based on the obtained file information. Specifically, the obtained file information can be regularly matched with the file configuration data registered in the preset file configuration table (recorded as t_aplus_cap_file_config), wherein the file configuration table is stored in a preset database, which may be an ACAP database or other databases, and the embodiment of the present invention does not specifically limit this. The matching rule is to perform regular matching based on the file name in the file information and the file name template field (recorded as file_template) in the file configuration data, for example: POSTINGN_20210413_31_001.TXT. The file name will match the file configuration data of file_template=^PO STINGN_d{8}_31_001.TXT$.

[0120] If the match is unsuccessful, the exception information is recorded in the preset exception information table. In the embodiment of the present invention, because most of the operation nodes are executed at intervals, and some operation nodes can be executed in slices, if a slice encounters some exceptions during the execution process and causes the program to be interrupted, the subsequent tasks cannot be effectively executed. In order to allow as many tasks as possible to be executed smoothly, an exception information table is designed here. If some non-technical exceptions are encountered during the operation, such as business exceptions, verification exceptions, and status exceptions, etc., the corresponding exception information will be generated and stored in the exception record table. In this way, the exception information table can be monitored with the help of a special exception monitoring platform to promptly trigger an alarm to notify the operation and maintenance personnel to solve the exception, and the operation node itself will continue to run to ensure the smoothness of the operation execution as much as possible.

[0121] If the match is successful, the polling flag (denoted as polling_flag) in the matched file configuration data is extracted, and the flag is used to indicate whether to poll. When it is the preset first value, it indicates that polling is not performed, which means that the file should not be obtained by polling. At this time, the exception information can be recorded in the exception information table. When it is the preset second value, it indicates that polling is performed. At this time, file task information can be generated according to the matched file configuration data. The first value and the second value can both be set according to actual conditions. For example, the first value can be set to 0 and the second value can be set to 1. Of course, other value settings can also be performed, and the embodiment of the present invention does not specifically limit this.

[0122] After the file task information is generated, an anti-duplicate check can also be performed. The anti-duplicate condition is "whether the file task information exists repeatedly". Specifically, it can be checked in the preset file task table (recorded as t_aplus_cap_file_task) whether there is file task information that is identical to the generated file task information. If the same file task information exists in the file task table, the exception information is recorded in the exception information table; if the same file task information does not exist in the file task table, the generated file task information is stored in the file task table, and the status of the file task information is set to the initial status.

[0123] Step S102: Read the file task information in the file task table through a preset file downloading operation node, and download the corresponding file from the target file source according to the read file task information.

[0124] The file download job node can read the file task information in the file task table according to preset reading conditions. The specific reading conditions can be set according to actual conditions. For example, the reading conditions can be: the file generation date is the specified date, and the status of the file task information is the initial status, that is: batch_date = batch date, file_status = initial status.

[0125] If the file task information is read, the following processing logic is performed for each file task information: first, the download flag (recorded as download_flag) in the read file task information is extracted, and the flag is used to indicate whether to download. When it is the first value, it means that no download is performed. At this time, the status of the read file task information can be updated to the skip download status (recorded as FILE_DOWNLOAD_SKIPPED), and the logical processing of the next file task information is continued; when it is the second value, it means that download is performed. In order to prevent the file from being uploaded during the download process, the integrity check of the corresponding file in the target file source can be performed. The file integrity check logic is specifically: 3 consecutive times, each time at an interval of 0.1s, the size of the file is obtained from the target file source. If the file size is found to have changed, it is considered that the file is not complete and the integrity check has not passed. The exception information is recorded in the exception information table, and the logical processing of the next file task information is continued. On the contrary, if it is found that the file size has not changed, it is considered that the file is complete and the integrity check has passed.

[0126] After the integrity check passes, the corresponding file can be downloaded from the target file source to the local computer according to the target file source information configured in the configuration center and the file name, and the downloaded file can be uploaded to the specified directory of the preset distributed file system (such as Ceph). The agreed format of the directory can be set according to the actual situation. For example, it can be set to: 000000000000 / 20210308 / fileName. After the download is completed, the MD5 value of the file can be calculated to perform a pre- and post-file size check. After that, a file transfer instruction can be sent to the target file source to transfer the corresponding source file to a preset backup directory (such as a bak directory), which can be configured in the configuration center. After completing the above process, the status of the file task information can be updated to the download completion status.

[0127] Step S103: Schedule a preset first number of file verification job slices through a preset file verification job node to perform verification operations on the downloaded files respectively.

[0128] In an embodiment of the present invention, the file verification job node can pre-set a first number of file verification job slices, each slice ultimately corresponds to a thread on the execution machine, and each time the job is executed, a preset slice algorithm (such as modulus, etc.) can be used to determine which tasks each slice should execute during this execution, so that multiple tasks can be processed at one time, greatly improving processing efficiency. The first number can be set according to actual conditions, for example, it can be set to 5, 10, 20 or other values.

[0129] Specifically, the file task information lists corresponding to each file verification job slice can be determined based on the slice number of each file verification job slice and the file number of each downloaded file (denoted as file number) using a preset slice algorithm, and each file task information list includes several pieces of file task information.

[0130] Then, each file verification job slice is scheduled to traverse its corresponding file task information list respectively, and verify each file in the file task information list, so as to achieve the purpose of processing multiple files in one run and improve processing efficiency.

[0131] Taking the verification operation process of any file verification job slice on any file task information (recorded as target file task information) in the corresponding file task information list as an example, the verification flag (recorded as check_flag) in the target file task information can be extracted first, and the flag is used to indicate whether to verify. When it is the first value, it means no verification. At this time, the state of the target file task information can be updated to the skip verification state (recorded as FILE_CHECK_SKIPPED), and the logical processing of the next file task information continues; when it is the second value, it means verification, and at this time, the target file is obtained from the distributed file system and downloaded to the local. The target file is the file corresponding to the target file task information. The first parameter and the second parameter are parsed respectively. The first parameter is the credit amount, debit amount, and total amount of difference in the target file task information. The second parameter is the credit amount, debit amount, and total amount of difference in the target file. If parameter parsing fails, the exception information is recorded in the exception information table; if parameter parsing succeeds, the first parameter and the second parameter are compared, if the first parameter is inconsistent with the second parameter, the verification fails, and the exception information is recorded in the preset exception information table; if the first parameter is consistent with the second parameter, the verification is successful, and the status of the target file task information is updated to the verification completion status.

[0132] Step S104: Scheduling a preset second number of file storage operation slices through a preset file storage operation node to perform file parsing on the files after the verification operation respectively, and inserting the obtained file parsing information into a preset library table.

[0133] In the embodiment of the present invention, the file storage operation node may pre-set a second number of file storage operation slices, and the second number may be set according to actual conditions, for example, it may be set to 5, 10, 20 or other values.

[0134] The file storage operation node can use a preset sharding algorithm to determine the file task information lists corresponding to each file storage operation slice according to the slice number of each file storage operation slice and the file number of each downloaded file, and each file task information list includes several pieces of file task information.

[0135] Then, each file storage job slice is scheduled to traverse its corresponding file task information list respectively, and perform storage operations on each file in the file task information list, so as to achieve the purpose of processing multiple files in one operation and improve processing efficiency.

[0136] Taking the warehousing operation process of any file task information (recorded as target file task information) in the corresponding file task information list of any file warehousing job slice as an example, first, the warehousing flag in the target file task information can be extracted, and the flag is used to indicate whether to enter the warehouse. When it is the first value, it means that the warehousing is not performed. At this time, the state of the target file task information can be updated to the skip warehousing state, and the logical processing of the next file task information can be continued; when it is the second value, it means that the warehousing is performed. At this time, the target file can be parsed to obtain the card number, account number, and customer number of each row record. The target file is the file corresponding to the target file task information. After the file is parsed, the file parsing information can be inserted into the target library table, and the target library table is the library table corresponding to the table name configured in the target file task information.

[0137] If the file fails to be stored in the warehouse, the abnormal information is recorded in the abnormal information table; if the file is successfully stored in the warehouse, the status of the target file task information is updated to the storage success status.

[0138] Step S105 , scheduling a preset third number of file upload job slices through a preset file upload job node to respectively generate local files from the file parsing information in the library table, and uploading the generated local files to a preset distributed file system.

[0139] In the embodiment of the present invention, the file upload job node may pre-set a third number of file upload job slices, and the third number may be set according to actual conditions, for example, it may be set to 5, 10, 20 or other values.

[0140] The file upload job node can use a preset slicing algorithm to determine the file task information lists corresponding to each file upload job slice according to the slice number of each file upload job slice and the file number of each downloaded file, and each file task information list includes several pieces of file task information.

[0141] Then, each file upload job slice is scheduled to traverse its corresponding file task information list respectively, and upload each file in the file task information list, so as to achieve the purpose of processing multiple files in one operation and improve processing efficiency.

[0142] Taking the upload operation process of any file task information (recorded as target file task information) in the corresponding file task information list of any file upload job slice as an example, the upload flag in the target file task information can be extracted first, and the flag is used to indicate whether to upload. When it is the first value, it means that the upload is not performed. At this time, the state of the target file task information can be updated to the skip upload state, and the logical processing of the next file task information can be continued; when it is the second value, it means that the upload is performed. At this time, the file parsing information in the target library table can be used to generate a local file, and the generated local file can be uploaded to the distributed file system. The target library table is the library table corresponding to the table name configured in the target file task information.

[0143] If the file upload fails, the exception information is recorded in the exception information table; if the file upload is successful, the status of the target file task information is updated to the upload success status.

[0144] It should be noted that, in order to achieve the purpose of scheduling jobs to multiple execution machines in a distributed environment for execution, the embodiments of the present invention can be implemented with the help of a distributed scheduling tool. The specific distributed scheduling tool used can be set according to actual conditions, and the embodiments of the present invention do not specifically limit this.

[0145] In summary, the embodiment of the present invention obtains file information from a specified target file source through a preset file polling job node, generates corresponding file task information according to the obtained file information, and stores the generated file task information in a preset file task table; reads the file task information in the file task table through a preset file downloading job node, and downloads the corresponding file from the target file source according to the read file task information; schedules a preset first number of file verification job slices through a preset file verification job node to perform verification operations on the downloaded files respectively; schedules a preset second number of file storage job slices through a preset file storage job node to perform file parsing on the files after the verification operation respectively, and inserts the obtained file parsing information into a preset library table; schedules a preset third number of file upload job slices through a preset file upload job node to generate local files from the file parsing information in the library table respectively, and uploads the generated local files to a preset distributed file system. In the embodiment of the present invention, the entire file processing flow is connected in series through different job nodes, and parallel processing is achieved through sliced ​​jobs, which greatly improves the file processing efficiency.

[0146] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.

[0147] Corresponding to the file processing method described in the above embodiment, Figure 2 A structural diagram of an embodiment of a file processing device provided by an embodiment of the present invention is shown.

[0148] In this embodiment, a file processing device may include:

[0149] The file polling operation module 201 is used to obtain file information from a specified target file source through a preset file polling operation node, generate corresponding file task information according to the obtained file information, and store the generated file task information into a preset file task table;

[0150] A file downloading operation module 202 is used to read the file task information in the file task table through a preset file downloading operation node, and download the corresponding file from the target file source according to the read file task information;

[0151] The file verification operation module 203 is used to schedule a preset first number of file verification operation slices to perform verification operations on the downloaded files respectively through a preset file verification operation node;

[0152] The file storage operation module 204 is used to schedule a preset second number of file storage operation slices to perform file analysis on the files after the verification operation through a preset file storage operation node, and insert the obtained file analysis information into a preset library table;

[0153] The file upload job module 205 is used to schedule a preset third number of file upload job slices through a preset file upload job node to respectively generate local files from the file parsing information in the library table, and upload the generated local files to a preset distributed file system.

[0154] In a specific implementation of the embodiment of the present invention, the file polling operation module may specifically include:

[0155] A regular matching unit, used for performing regular matching between the acquired file information and the file configuration data registered in the preset file configuration table;

[0156] A first abnormal information recording unit, used for recording abnormal information in a preset abnormal information table if the matching is unsuccessful;

[0157] A polling flag bit extraction unit, used for extracting the polling flag bit in the matched file configuration data if the match is successful;

[0158] A second exception information recording unit, configured to record the exception information in the exception information table if the polling flag is a preset first value;

[0159] The file task information generating unit is used to generate the file task information according to the matched file configuration data if the polling flag is a preset second value.

[0160] In a specific implementation of the embodiment of the present invention, the file polling operation module may further include:

[0161] A file task information query unit, used to query in the file task table whether there is file task information identical to the generated file task information;

[0162] a third abnormal information recording unit, configured to record abnormal information in a preset abnormal information table if the same file task information exists in the file task table;

[0163] The file task information storage unit is used to store the generated file task information into a preset file task table if the same file task information does not exist in the file task table.

[0164] In a specific implementation of the embodiment of the present invention, the file download operation module may specifically include:

[0165] A file task information reading unit, used to read the file task information in the file task table according to a preset reading condition;

[0166] A download flag extraction unit, used for extracting the download flag in the read file task information;

[0167] A download status updating unit, configured to update the status of the read file task information to a skip download status if the download flag is a preset first value;

[0168] an integrity checking unit, configured to perform an integrity check on a corresponding file in the target file source if the download flag is a preset second value;

[0169] A fourth abnormal information recording unit, used for recording abnormal information in a preset abnormal information table if the integrity check fails;

[0170] A file downloading unit, configured to download the corresponding file from the target file source if the integrity check passes, and upload the downloaded file to a designated directory of the distributed file system;

[0171] The file transfer instruction sending unit is used to send a file transfer instruction to the target file source to transfer the corresponding source file to a preset backup directory.

[0172] In a specific implementation of the embodiment of the present invention, the file verification operation module may specifically include:

[0173] The first slicing submodule is used to determine the file task information list corresponding to each file verification job slice according to the slice number of each file verification job slice and the file number of each downloaded file using a preset slicing algorithm;

[0174] The file verification submodule is used to schedule each file verification job slice to traverse the corresponding file task information list respectively, and perform verification operations on each file in the file task information list;

[0175] In a specific implementation of the embodiment of the present invention, the file check submodule may specifically include:

[0176] A check mark extraction unit, used to extract the check mark in the target file task information; the target file task information is any file task information in the file task information list;

[0177] A skip check state updating unit, configured to update the state of the target file task information to a skip check state if the check flag is a preset first value;

[0178] A target file acquisition unit, configured to acquire a target file from the distributed file system if the check flag is a preset second value; the target file is a file corresponding to the target file task information;

[0179] A parameter parsing unit, used to parse a first parameter and a second parameter respectively; the first parameter is a parameter in the target file task information, and the second parameter is a parameter in the target file;

[0180] a fifth abnormal information recording unit, configured to record abnormal information in a preset abnormal information table if the first parameter is inconsistent with the second parameter;

[0181] A verification completion status updating unit is used to update the status of the target file task information to a verification completion status if the first parameter is consistent with the second parameter.

[0182] In a specific implementation of the embodiment of the present invention, the file storage operation module may specifically include:

[0183] The second slicing submodule is used to determine the file task information list corresponding to each file storage operation slice according to the slice number of each file storage operation slice and the file number of each downloaded file using a preset slicing algorithm;

[0184] The file storage submodule is used to schedule each file storage job slice to traverse the corresponding file task information list respectively, and perform storage operations on each file in the file task information list;

[0185] In a specific implementation of the embodiment of the present invention, the file storage submodule may specifically include:

[0186] The storage flag extraction unit is used to extract the storage flag in the target file task information; the target file task information is any file task information in the file task information list;

[0187] A skip storage state updating unit, configured to update the state of the target file task information to a skip storage state if the storage flag is a preset first value;

[0188] A file parsing unit, configured to parse the target file to obtain file parsing information if the storage flag is a preset second value; the target file is a file corresponding to the target file task information;

[0189] The file storage unit is used to insert the file parsing information into a target library table; the target library table is a library table corresponding to the table name configured in the target file task information.

[0190] In a specific implementation of the embodiment of the present invention, the file upload operation module may specifically include:

[0191] The third slicing submodule is used to determine the file task information list corresponding to each file upload job slice according to the slice number of each file upload job slice and the file number of each downloaded file using a preset slicing algorithm;

[0192] The file upload submodule is used to schedule each file upload job slice to traverse the corresponding file task information list respectively, and upload each file in the file task information list;

[0193] In a specific implementation of the embodiment of the present invention, the file upload submodule may specifically include:

[0194] An upload flag extraction unit, used to extract the upload flag in the target file task information; the target file task information is any file task information in the file task information list;

[0195] A skip upload status update unit, configured to update the status of the target file task information to a skip upload status if the upload flag is a preset first value;

[0196] A file upload unit is used to generate a local file from the file parsing information in the target library table and upload the generated local file to the distributed file system if the upload flag is a preset second value; the target library table is a library table corresponding to the table name configured in the target file task information.

[0197] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices, modules and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0198] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0199] Figure 3 A schematic block diagram of a server provided by an embodiment of the present invention is shown. For ease of description, only the parts related to the embodiment of the present invention are shown.

[0200] In this embodiment, the server 3 may include: a processor 30, a memory 31, and a computer-readable instruction 32 stored in the memory 31 and executable on the processor 30, such as a computer-readable instruction for executing the above-mentioned file processing method. When the processor 30 executes the computer-readable instruction 32, the steps in the above-mentioned file processing method embodiments are implemented, such as Figure 1 Alternatively, when the processor 30 executes the computer-readable instructions 32, the functions of each module / unit in the above-mentioned device embodiments are realized, for example, Figure 2 The functions of modules 201 to 205 are shown.

[0201] Exemplarily, the computer readable instructions 32 may be divided into one or more modules / units, which are stored in the memory 31 and executed by the processor 30 to implement the present invention. The one or more modules / units may be a series of computer readable instruction segments capable of implementing specific functions, which are used to describe the execution process of the computer readable instructions 32 in the server 3.

[0202] The processor 30 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0203] The memory 31 may be an internal storage unit of the server 3, such as a hard disk or memory of the server 3. The memory 31 may also be an external storage device of the server 3, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the server 3. Further, the memory 31 may also include both an internal storage unit of the server 3 and an external storage device. The memory 31 is used to store the computer-readable instructions and other instructions and data required by the server 3. The memory 31 may also be used to temporarily store data that has been output or is to be output.

[0204] Each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0205] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of computer-readable instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store computer-readable instructions.

[0206] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A file processing method, characterized in that: include: Obtain file information from a specified target file source through a preset file polling job node, generate corresponding file task information according to the acquired file information, and store the generated file task information in a preset file task table; Read the file task information in the file task table according to the preset reading conditions through the preset file download operation node; Extracting the download flag in the read file task information; if the download flag is a preset first value, updating the state of the read file task information to a skip download state; if the download flag is a preset second value, performing an integrity check on the corresponding file in the target file source; if the integrity check fails, recording the exception information in a preset exception information table; If the integrity check passes, the corresponding file is downloaded from the target file source, and the downloaded file is uploaded to a specified directory of the preset distributed file system; Sending a file transfer instruction to the target file source to transfer the corresponding source file to a preset backup directory; Scheduling a preset first number of file verification job slices through a preset file verification job node to perform verification operations on the downloaded files respectively; Scheduling a preset second number of file storage job slices through a preset file storage job node to perform file parsing on the files after the verification operation respectively, and inserting the obtained file parsing information into a preset library table; The preset third number of file upload job slices are scheduled by the preset file upload job node to respectively generate local files from the file parsing information in the library table, and the generated local files are uploaded to the distributed file system.

2. The file processing method according to claim 1, characterized in that: The generating corresponding file task information according to the acquired file information includes: Perform regular matching on the acquired file information and the file configuration data registered in the preset file configuration table; If the match fails, the exception information is recorded in the preset exception information table; If the match is successful, the polling flag in the matched file configuration data is extracted; If the polling flag is a preset first value, the abnormal information is recorded in the abnormal information table; If the polling flag is a preset second value, the file task information is generated according to the matched file configuration data.

3. The file processing method according to claim 1, characterized in that: The step of storing the generated file task information into a preset file task table includes: Querying in the file task table whether there is file task information identical to the generated file task information; If the same file task information exists in the file task table, the abnormal information is recorded in a preset abnormal information table; If the same file task information does not exist in the file task table, the generated file task information is stored in the preset file task table.

4. The file processing method according to claim 1, characterized in that: The scheduling of a preset first number of file verification job slices to respectively perform verification operations on the downloaded files includes: According to the slice number of each file verification job slice and the file number of each downloaded file, a preset slice algorithm is used to determine the file task information list corresponding to each file verification job slice; Schedule each file verification job slice to traverse its corresponding file task information list respectively, and perform verification operations on each file in the file task information list; The verifying operation on each file in the file task information list includes: Extracting the check mark in the target file task information; the target file task information is any one of the file task information in the file task information list; If the check flag is a preset first value, the state of the target file task information is updated to a skip check state; If the check flag is a preset second value, a target file is obtained from the distributed file system; the target file is a file corresponding to the target file task information; Parsing the first parameter and the second parameter respectively; the first parameter is the parameter in the target file task information, and the second parameter is the parameter in the target file; If the first parameter is inconsistent with the second parameter, the abnormal information is recorded in a preset abnormal information table; If the first parameter is consistent with the second parameter, the status of the target file task information is updated to a verification completion status.

5. The file processing method according to claim 1, characterized in that: The scheduling preset second number of file storage job slices respectively performs file parsing on the files after the verification operation, and inserts the obtained file parsing information into the preset library table, including: According to the slice number of each file storage job slice and the file number of each downloaded file, a preset slice algorithm is used to determine the file task information list corresponding to each file storage job slice; Schedule each file storage job slice to traverse the corresponding file task information list respectively, and perform storage operations on each file in the file task information list; The storage operation for each file in the file task information list includes: Extracting the storage flag in the target file task information; the target file task information is any file task information in the file task information list; If the storage flag is a preset first value, the status of the target file task information is updated to a skip storage status; If the storage flag is the preset second value, the target file is parsed to obtain file parsing information; the target file is a file corresponding to the target file task information; The file parsing information is inserted into a target library table; the target library table is a library table corresponding to the table name configured in the target file task information.

6. The file processing method according to claim 1, characterized in that: The scheduling preset third number of file upload job slices respectively generates local files from the file parsing information in the library table, and uploads the generated local files to the distributed file system, including: According to the slice number of each file upload job slice and the file number of each downloaded file, a preset slice algorithm is used to determine the file task information list corresponding to each file upload job slice; Schedule each file upload job slice to traverse its corresponding file task information list respectively, and perform upload operations on each file in the file task information list; The uploading operation of each file in the file task information list includes: Extracting the upload flag in the target file task information; the target file task information is any file task information in the file task information list; If the upload flag is a preset first value, the status of the target file task information is updated to a skip upload status; If the upload flag is the preset second value, the file parsing information in the target library table is used to generate a local file, and the generated local file is uploaded to the distributed file system; the target library table is a library table corresponding to the table name configured in the target file task information.

7. A file processing device, characterized in that: include: A file polling job module is used to obtain file information from a specified target file source through a preset file polling job node, generate corresponding file task information according to the obtained file information, and store the generated file task information into a preset file task table; A file downloading operation module, used to read the file task information in the file task table according to a preset reading condition through a preset file downloading operation node; Extracting the download flag in the read file task information; if the download flag is a preset first value, updating the state of the read file task information to a skip download state; if the download flag is a preset second value, performing an integrity check on the corresponding file in the target file source; if the integrity check fails, recording the exception information in a preset exception information table; If the integrity check passes, the corresponding file is downloaded from the target file source, and the downloaded file is uploaded to a specified directory of the preset distributed file system; Sending a file transfer instruction to the target file source to transfer the corresponding source file to a preset backup directory; A file verification operation module, used for scheduling a preset first number of file verification operation slices through a preset file verification operation node to respectively perform verification operations on the downloaded files; A file storage operation module, used for scheduling a preset second number of file storage operation slices through a preset file storage operation node to perform file parsing on the files after the verification operation respectively, and inserting the obtained file parsing information into a preset library table; The file upload job module is used to schedule a preset third number of file upload job slices through a preset file upload job node to respectively generate local files from the file parsing information in the library table, and upload the generated local files to the distributed file system.

8. A computer-readable storage medium storing computer-readable instructions, characterized in that: When the computer-readable instructions are executed by a processor, the steps of the file processing method according to any one of claims 1 to 6 are implemented.

9. A server comprising a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, characterized in that: When the processor executes the computer-readable instructions, the steps of the file processing method according to any one of claims 1 to 6 are implemented.