File transfer reading and writing method, device, equipment and storage medium
By receiving file transfer instructions and dynamic configuration of protocol rule files, the problem of low scalability of protocol files is solved, and efficient file generation and parsing is achieved.
Patent Information
- Application Number
- CN202210121770.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-09
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2042-02-09
AI Technical Summary
In the prior art, protocol files cannot be dynamically configured and have low scalability, resulting in a large amount of time and manpower being consumed in parsing multiple protocol files.
By receiving file transfer instructions, obtaining preset protocol rule files, accessing the business database, exporting or writing data according to the protocol rule files, and dynamically configuring file generation and parsing processes, the reliance on code is reduced.
It implements dynamic configuration of protocol files, improves the efficiency of file generation and parsing, reduces the need for code modification, and improves the scalability of the system.
Smart Images

Figure CN114547169B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of file transmission, and in particular to a file transmission reading and writing method, device, equipment and storage medium. Background Art
[0002] If different systems interact using TXT files, a file communication protocol must define the file's content and format to ensure correct communication between the parties. This file definition protocol is called a file communication protocol. Once the protocol is defined between different systems, the corresponding TXT files must be generated and parsed according to the protocol. This process is called data file generation and reading.
[0003] Under existing technology, code must be written for each protocol file. Different protocol files require different corresponding codes, making dynamic configuration impossible. Changes to protocol files also require modifying the original code, limiting scalability. Furthermore, when there are too many protocol files to parse, parsing the corresponding files takes a significant amount of time, wasting manpower. Summary of the Invention
[0004] The main purpose of the present invention is to solve the technical problem that the current protocol file cannot be dynamically configured and has low scalability.
[0005] A first aspect of the present invention provides a method for reading and writing files, comprising the steps of:
[0006] Receive file transfer instructions;
[0007] Obtain a preset protocol rule file, access the service database corresponding to the file transfer instruction, and read the TXT file corresponding to the file transfer instruction;
[0008] Determining whether the file transfer instruction is a data export instruction;
[0009] If it is a data export instruction, the business data in the business database is exported according to the format of the preset business data table to obtain exported business data;
[0010] Reorganize the service fields of the exported service data according to the protocol rule file to obtain exported TXT data, and write the exported TXT data into the TXT file;
[0011] If it is not a data export instruction, copy the TXT characters of the TXT file to obtain a TXT string, perform field matching processing on the TXT string according to the protocol rule file to obtain a matching TXT string set, and write the data corresponding to the matching TXT string set in the TXT string into the business database.
[0012] Optionally, in a first implementation of the first aspect of the present invention, the file transfer instruction includes: an extraction address and a transmission address, and determining whether the file transfer instruction is a data export instruction includes:
[0013] Determine whether the transmission address of the file transfer instruction is a local path character string;
[0014] If it is a local path character string, the file transfer instruction is determined to be a data export instruction;
[0015] If it is not a local path character string, the file transfer instruction is determined not to be a data export instruction.
[0016] Optionally, in a second implementation of the first aspect of the present invention, reorganizing the service fields of the exported service data according to the protocol rule file to obtain exported TXT data, and writing the exported TXT data into the TXT file includes:
[0017] Read the protocol field of the protocol rule file;
[0018] Matching the protocol field with the business field of the exported business data to obtain a mapped business field set;
[0019] Based on the format setting of the protocol rule file, the data corresponding to the mapped business field set in the exported business data is formatted to obtain exported TXT data;
[0020] Write the exported TXT data into the TXT file.
[0021] Optionally, in a third implementation of the first aspect of the present invention, performing field matching processing on the TXT string according to the protocol rule file to obtain a matching TXT string set, and writing data corresponding to the matching TXT string set in the TXT string into the business database includes:
[0022] Read the protocol field of the protocol rule file;
[0023] Matching the protocol field with the TXT string to obtain a matching TXT string set;
[0024] Based on the format setting of the protocol rule file, the data corresponding to the matching TXT character string set in the TXT character string is written into the business database.
[0025] Optionally, in a fourth implementation of the first aspect of the present invention, after obtaining the preset protocol rule file, accessing the service database corresponding to the file transfer instruction, and reading the TXT file corresponding to the file transfer instruction, and before determining whether the file transfer instruction is a data export instruction, the method further includes:
[0026] According to the format setting of the protocol rule file, the data format of the TXT file is reorganized and processed to obtain a TXT file that conforms to the format setting.
[0027] Optionally, in a fifth implementation of the first aspect of the present invention, after receiving the file transfer instruction and before obtaining the preset protocol rule file, accessing the service database corresponding to the file transfer instruction, and reading the TXT file corresponding to the file transfer instruction, the method further includes:
[0028] Determine whether the file corresponding to the file transfer instruction is in TXT format;
[0029] If it is not in TXT format, determine whether the file corresponding to the file transfer instruction meets the protocol requirements;
[0030] If there is a protocol provision, the protocol provision is read and the file transfer instruction is processed according to the protocol provision.
[0031] Optionally, in a sixth implementation of the first aspect of the present invention, the protocol rule file includes: a file name rule file, a file header rule file, and a file content rule file.
[0032] A second aspect of the present invention provides a file transfer reading and writing device, the file transfer reading and writing device comprising:
[0033] A receiving module, configured to receive a file transfer instruction;
[0034] An access acquisition module is used to acquire a preset protocol rule file, access a service database corresponding to the file transfer instruction, and read a TXT file corresponding to the file transfer instruction;
[0035] A judgment module, used to judge whether the file transfer instruction is a data export instruction;
[0036] An export module, configured to export the business data in the business database according to a format of a preset business data table to obtain exported business data if the instruction is a data export instruction;
[0037] a reorganization and writing module, configured to reorganize the service fields of the exported service data according to the protocol rule file to obtain exported TXT data, and write the exported TXT data into the TXT file;
[0038] The matching writing module is used to copy the TXT characters of the TXT file to obtain a TXT string if it is not a data export instruction, perform field matching processing on the TXT string according to the protocol rule file, and write the TXT string into the business database.
[0039] A third aspect of the present invention provides a file transfer reading and writing device, comprising: a memory and at least one processor, wherein instructions are stored in the memory, and the memory and the at least one processor are interconnected via a line; the at least one processor calls the instructions in the memory so that the file transfer reading and writing device executes the above-mentioned file transfer reading and writing method.
[0040] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the above-mentioned file transfer reading and writing method.
[0041] The present invention is used in the field of file transmission and parsing. It maps protocol files and database data tables in the form of configuration, so that file generation and parsing can be performed automatically and quickly without writing corresponding parsing and generation codes for specific protocol files, thereby improving the efficiency of parsing and generating files. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 A schematic diagram of an embodiment of a method for reading and writing file transmission in an embodiment of the present invention;
[0043] Figure 2 A schematic diagram of an embodiment of a reading and writing device for file transmission in an embodiment of the present invention;
[0044] Figure 3 Schematic diagram of another embodiment of a reading and writing device for file transmission in an embodiment of the present invention;
[0045] Figure 4 The figure is a schematic diagram of an embodiment of a reading and writing device for file transmission in an embodiment of the present invention. DETAILED DESCRIPTION
[0046] The embodiments of the present invention provide a file transmission reading and writing method, apparatus, device and storage medium.
[0047] The terms "first," "second," "third," "fourth," and the like (if any) in the description and claims of the present invention and in the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to these processes, methods, products, or apparatus.
[0048] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 , an embodiment of the file transmission reading and writing method in an embodiment of the present invention includes:
[0049] 101. Receive a file transfer instruction;
[0050] In this embodiment, the file transfer instruction is {A: XXXX; B: YYY}, where A points to the address to be transferred and B points to the address to be extracted data.
[0051] Furthermore, after step 101 and before step 102, the following steps may be performed:
[0052] 1011. Determine whether the file corresponding to the file transfer instruction is in TXT format;
[0053] 1012. If it is not in TXT format, determine whether the file corresponding to the file transfer instruction has the protocol provisions;
[0054] 1013. If there is a protocol provision, read the protocol provision and process the file transfer instruction according to the protocol provision.
[0055] 1014. If there is no protocol provision, a transmission failure message is sent to the preset management port.
[0056] In steps 1011-1014, the format of the file to be transferred is determined. For protocol rule files that are not in structured TXT format, such as PDF or WORD files, the protocol rule content must be entered, or the protocol rule content must be filled in the protocol rule template and automatically imported into the protocol rule parser. If the parser has parsing protocol regulations for PDF, WORD, and other files, the protocol rule parser will execute according to the regulations. If the parser does not have parsing protocol regulations for PDF, WORD, and other files, a transmission failure message will be sent to the preset management port.
[0057] 102. Obtain a preset protocol rule file, access a business database corresponding to the file transfer instruction, and read a TXT file corresponding to the file transfer instruction;
[0058] In this embodiment, the protocol rule file is read and, depending on the protocol rule file, different methods are selected to enter the protocol rules into the protocol rule parser for parsing the transmission data. The service database corresponding to the file transfer instruction is accessed and the TXT file corresponding to the file transfer instruction is read to read and write data into the TXT file and the service database.
[0059] Among them, the protocol rule file includes: file name rule file, file header rule file, and file content rule file. The file name rule defines the specific generation rules of the TXT file name, and the specific protocol file can be generated or located according to the rule. The file header rule generally refers to the file header inside the TXT file, and the file header is generally a statistic of the file content. The file content rule refers to the truly meaningful business data in the TXT file. It includes the definition of the line break character, the definition of the field separator within the line, the type, length and meaning of the field in the line, the order of the fields in the line, and other information.
[0060] Furthermore, after step 102 and before step 103, the following steps may be performed:
[0061] 1021. According to the format setting of the protocol rule file, the data format of the TXT file is reorganized and processed to obtain a TXT file that complies with the format setting.
[0062] In step 1021, the data format of the TXT file is unified according to the format setting of the protocol rule file, where the arrangement order of each row and column can be that the valid header data is arranged in the front and the content data is arranged in the back.
[0063] 103. Determine whether the file transfer instruction is a data export instruction;
[0064] In this embodiment, it is necessary to check whether the file transfer instruction is reading or writing. The data export instruction exports data from the business database to a TXT file, while the non-data export instruction writes the TXT data of the TXT file into the business database.
[0065] Furthermore, at step 103 , the following steps may be performed:
[0066] 1031. The file transfer instruction includes: extracting an address, transmitting an address, and determining whether the file transfer instruction is a data export instruction includes:
[0067] 1032. Determine whether the transfer address of the file transfer instruction is a local path character string;
[0068] 1033. If it is a local path character string, determine the file transfer instruction as a data export instruction;
[0069] 1034. If it is not a local path character string, the file transfer instruction is determined not to be a data export instruction.
[0070] In steps 1031-1034, the file transfer instruction {A: XXXX; B: YYY}, where A points to XXXX, is the transfer address, and B points to YYY, the extraction address. A check is performed to determine whether XXXX is a path string to a local disk or storage device. If so, the TXT file to be transferred to the local path is a data export instruction. If not, it indicates that the file transfer instruction is a network link, and is not a data export instruction.
[0071] 104. If it is a data export instruction, export the business data in the business database according to the format of the preset business data table to obtain exported business data;
[0072] In this embodiment, the service data table format is not necessarily in the protocol format. The service data to be exported must be exported first and then converted into a TXT file.
[0073] 105. Reorganize the business fields of the exported business data according to the protocol rule file to obtain exported TXT data, and write the exported TXT data into a TXT file;
[0074] In this embodiment, the protocol format protocol rule decoder of the protocol rule file will write the entered protocol rule content into the protocol configuration database for use by the subsequent protocol field mapper. The protocol field mapper reads the configured protocol rule data from the protocol configuration database and dynamically generates a mapping relationship between the protocol rules and the business database table. The protocol field mapper automatically generates or updates the corresponding business data table by comparing the fields of the existing business database through the newly generated mapping relationship, determines the updated business data table as TXT data, and writes the TXT data into the TXT file.
[0075] Furthermore, at step 105 , the following steps may be performed:
[0076] 1051. Read the protocol field of the protocol rule file;
[0077] 1052. Match the protocol field with the business field of the exported business data to obtain a mapped business field set;
[0078] 1053. Based on the format setting of the protocol rule file, the data corresponding to the mapped business field set in the exported business data is formatted to obtain exported TXT data;
[0079] 1054. Write the exported TXT data into a TXT file.
[0080] In steps 1051-1054, the business system writes specific business data into the business database. The protocol field mapper retrieves the corresponding business data from the business database, converts it into the corresponding fields in the TXT file based on the mapping, and passes it to the protocol file reader generator. The protocol file reader generator converts the received data into TXT data and writes the TXT data into the TXT file.
[0081] 106. If it is not a data export instruction, copy the TXT characters of the TXT file to obtain a TXT string, perform field matching processing on the TXT string according to the protocol rule file to obtain a matching TXT string set, and write the data corresponding to the matching TXT string set in the TXT string into the business database.
[0082] In this implementation, you first need to copy the TXT characters in sorted order to get the TXT string of the content of the TXT file, match the protocol fields used for guidance in the protocol rule file with the TXT string one by one, get the matching TXT string in the TXT string, and then write the entity content corresponding to the matching TXT string into the business database according to the guidance mapping relationship.
[0083] 1061. According to the protocol rule file, performing field matching processing on the TXT string to obtain a matching TXT string set, and writing data corresponding to the matching TXT string set in the TXT string into the business database includes:
[0084] 1062. Read the protocol field of the protocol rule file;
[0085] 1063. Match the protocol field with the TXT string to obtain a matching TXT string set.
[0086] 1064. Based on the format setting of the protocol rule file, write the data corresponding to the matching TXT string set in the TXT string into the business database.
[0087] In steps 1061-1064, with the business database corresponding to the protocol data, the specific data is read from the TXT file and written to the business database. The protocol file reader generator reads the corresponding TXT file according to the file name mapping rules stored in the protocol field mapper. The protocol file reader generator passes the read data to the protocol field mapper, which parses the specific business data according to the corresponding mapping rules. The protocol field mapper writes the business data to the business database, where it can be read by the specific business system.
[0088] The present invention is used in the field of file transmission and parsing. It maps protocol files and database data tables in the form of configuration, so that file generation and parsing can be performed automatically and quickly without writing corresponding parsing and generation codes for specific protocol files, thereby improving the efficiency of parsing and generating files.
[0089] The above describes the file transfer reading and writing method in the embodiment of the present invention. The following describes the file transfer reading and writing device in the embodiment of the present invention. Figure 2 In one embodiment of the present invention, a file transmission reading and writing device is provided, wherein the file transmission reading and writing device comprises:
[0090] Receiving module 201, used for receiving a file transfer instruction;
[0091] The access acquisition module 202 is used to acquire a preset protocol rule file, access a service database corresponding to the file transfer instruction, and read a TXT file corresponding to the file transfer instruction;
[0092] A determination module 203 is configured to determine whether the file transfer instruction is a data export instruction;
[0093] The export module 204 is configured to export the business data in the business database according to the format of a preset business data table to obtain exported business data if the instruction is a data export instruction;
[0094] A reorganization and writing module 205 is configured to reorganize the service fields of the exported service data according to the protocol rule file to obtain exported TXT data, and write the exported TXT data into the TXT file;
[0095] The matching writing module 206 is used to copy the TXT characters of the TXT file to obtain a TXT string if it is not a data export instruction, perform field matching processing on the TXT string according to the protocol rule file, and write the TXT string into the business database.
[0096] The present invention is used in the field of file transmission and parsing. It maps protocol files and database data tables in the form of configuration, so that file generation and parsing can be performed automatically and quickly without writing corresponding parsing and generation codes for specific protocol files, thereby improving the efficiency of parsing and generating files.
[0097] See also Figure 3 Another embodiment of the file transmission reading and writing device in the embodiment of the present invention includes:
[0098] Receiving module 201, used for receiving a file transfer instruction;
[0099] The access acquisition module 202 is used to acquire a preset protocol rule file, access a service database corresponding to the file transfer instruction, and read a TXT file corresponding to the file transfer instruction;
[0100] A determination module 203 is configured to determine whether the file transfer instruction is a data export instruction;
[0101] The export module 204 is configured to export the business data in the business database according to the format of a preset business data table to obtain exported business data if the instruction is a data export instruction;
[0102] A reorganization and writing module 205 is configured to reorganize the service fields of the exported service data according to the protocol rule file to obtain exported TXT data, and write the exported TXT data into the TXT file;
[0103] The matching writing module 206 is used to copy the TXT characters of the TXT file to obtain a TXT string if it is not a data export instruction, perform field matching processing on the TXT string according to the protocol rule file, and write the TXT string into the business database.
[0104] The file transfer reading and writing device further includes a formatting module 207, which is specifically configured to:
[0105] According to the format setting of the protocol rule file, the data format of the TXT file is reorganized to obtain a TXT file that conforms to the format setting.
[0106] The file transmission reading and writing device further includes a format determination module 208, which is specifically configured to:
[0107] Determine whether the file corresponding to the file transfer instruction is in TXT format;
[0108] If it is not in TXT format, determine whether the file corresponding to the file transfer instruction meets the protocol requirements;
[0109] If there is a protocol provision, the protocol provision is read and the file transfer instruction is processed according to the protocol provision.
[0110] If there is no protocol provision, a transmission failure message is sent to the preset management port.
[0111] The matching writing module 206 is specifically configured to:
[0112] Read the protocol field of the protocol rule file;
[0113] Matching the protocol field with the TXT string to obtain a matching TXT string set;
[0114] Based on the format setting of the protocol rule file, the data corresponding to the matching TXT character string set in the TXT character string is written into the business database.
[0115] The reorganization writing module 205 is specifically used for:
[0116] Read the protocol field of the protocol rule file;
[0117] Matching the protocol field with the business field of the exported business data to obtain a mapped business field set;
[0118] Based on the format setting of the protocol rule file, the data corresponding to the mapped business field set in the exported business data is formatted to obtain exported TXT data;
[0119] Write the exported TXT data into the TXT file.
[0120] The file transfer instruction includes: extracting address and transmitting address, and the judgment module 203 is used to:
[0121] Determine whether the transmission address of the file transfer instruction is a local path character string;
[0122] If it is a local path character string, the file transfer instruction is determined to be a data export instruction;
[0123] If it is not a local path character string, the file transfer instruction is determined not to be a data export instruction.
[0124] The present invention is used in the field of file transmission and parsing. It maps protocol files and database data tables in the form of configuration, so that file generation and parsing can be performed automatically and quickly without writing corresponding parsing and generation codes for specific protocol files, thereby improving the efficiency of parsing and generating files.
[0125] above Figure 2 and Figure 3 The reading and writing device for file transmission in the embodiment of the present invention is described in detail from the perspective of modular functional entities. The reading and writing device for file transmission in the embodiment of the present invention is described in detail from the perspective of hardware processing.
[0126] Figure 4: This is a structural diagram of a file transfer read-write device provided by an embodiment of the present invention. The file transfer read-write device 400 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 410 (for example, one or more processors) and a memory 420, and one or more storage media 430 (for example, one or more mass storage devices) storing application programs 433 or data 432. Among them, the memory 420 and the storage medium 430 can be temporary storage or permanent storage. The program stored in the storage medium 430 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the file transfer read-write device 400. Furthermore, the processor 410 can be configured to communicate with the storage medium 430 to execute a series of instruction operations in the storage medium 430 on the file transfer read-write device 400.
[0127] The file transfer-based read / write device 400 may further include one or more power supplies 440, one or more wired or wireless network interfaces 450, one or more input / output interfaces 460, and / or one or more operating systems 431, such as Windows Server, Mac OS X, Unix, Linux, Free BSD, etc. It will be understood by those skilled in the art that Figure 4 The structure of the file transfer reading and writing device shown does not constitute a limitation on the file transfer-based reading and writing device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0128] The present invention also provides a computer-readable storage medium, which can be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. The computer-readable storage medium stores instructions, and when the instructions are executed on a computer, the computer executes the steps of the file transfer reading and writing method.
[0129] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems, devices, and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0130] 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 is essentially 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. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or 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), random access memory (RAM), magnetic disk or optical disk, etc., various media that can store program code.
[0131] As described above, the above embodiments 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 above embodiments, those skilled in the art should understand that the technical solutions described in the above embodiments can still be modified, or some of the technical features thereof can 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 transfer reading and writing method, characterized in that: Including steps: Receive file transfer instructions; Obtain a preset protocol rule file, access a service database corresponding to the file transfer instruction, and read a TXT file corresponding to the file transfer instruction, wherein the protocol rule file includes a file name rule file, a file header rule file, and a file content rule file; Determining whether the file transfer instruction is a data export instruction; If it is a data export instruction, the business data in the business database is exported according to the format of the preset business data table to obtain exported business data; The protocol field mapper reads the configured protocol rule data from the protocol configuration database and dynamically generates the mapping relationship between the protocol rules and the business database table; Read the protocol field of the protocol rule file; Matching the protocol field with the business field of the exported business data to obtain a mapped business field set; Based on the format setting of the protocol rule file, the data corresponding to the mapped business field set in the exported business data is formatted to obtain exported TXT data; Writing the exported TXT data into the TXT file; If it is not a data export instruction, copy the TXT characters of the TXT file to obtain a TXT character string; Read the protocol field of the protocol rule file; Match the protocol field with the TXT string to obtain a matching TXT string set; Based on the format setting of the protocol rule file, the data corresponding to the matching TXT string set in the TXT string is written into the business database.
2. The file transfer reading and writing method according to claim 1, characterized in that: The file transfer instruction includes: extracting an address and transmitting an address, and determining whether the file transfer instruction is a data export instruction includes: Determine whether the transmission address of the file transfer instruction is a local path character string; If it is a local path character string, the file transfer instruction is determined to be a data export instruction; If it is not a local path character string, the file transfer instruction is determined not to be a data export instruction.
3. The file transfer reading and writing method according to claim 1, characterized in that: After obtaining the preset protocol rule file, accessing the service database corresponding to the file transfer instruction, and reading the TXT file corresponding to the file transfer instruction, and before determining whether the file transfer instruction is a data export instruction, the method further includes: According to the format setting of the protocol rule file, the data format of the TXT file is reorganized and processed to obtain a TXT file that conforms to the format setting.
4. The file transfer reading and writing method according to claim 1, wherein: After receiving the file transfer instruction, and before obtaining the preset protocol rule file, accessing the service database corresponding to the file transfer instruction, and reading the TXT file corresponding to the file transfer instruction, the method further includes: Determine whether the file corresponding to the file transfer instruction is in TXT format; If it is not in TXT format, determine whether the file corresponding to the file transfer instruction meets the protocol requirements; If there is a protocol provision, reading the protocol provision and processing the file transfer instruction according to the protocol provision; If there is no protocol provision, a transmission failure message is sent to the preset management port.
5. A file transfer reading and writing device, characterized in that: The reading and writing device of the file transmission includes: A receiving module, configured to receive a file transfer instruction; An access acquisition module is used to acquire a preset protocol rule file, access a service database corresponding to the file transfer instruction, and read a TXT file corresponding to the file transfer instruction, wherein the protocol rule file includes a file name rule file, a file header rule file, and a file content rule file; A judgment module, used to judge whether the file transfer instruction is a data export instruction; An export module, configured to export the business data in the business database according to a format of a preset business data table to obtain exported business data if the instruction is a data export instruction; The protocol field mapper is used to read the configured protocol rule data from the protocol configuration database and dynamically generate the mapping relationship between the protocol rules and the business database table; a reorganization and writing module, configured to read the protocol field of the protocol rule file; match the protocol field with the business field of the exported business data to obtain a mapping business field set; based on the format settings of the protocol rule file, perform format conversion on the data corresponding to the mapping business field set in the exported business data to obtain exported TXT data; and write the exported TXT data into the TXT file; A matching writing module is used for copying the TXT characters of the TXT file to obtain a TXT character string if the instruction is not a data export instruction; The matching writing module is further specifically configured to: Read the protocol field of the protocol rule file; Match the protocol field with the TXT string to obtain a matching TXT string set; Based on the format setting of the protocol rule file, the data corresponding to the matching TXT string set in the TXT string is written into the business database.
6. A file transfer reading and writing device, characterized in that: The file transfer reading and writing device includes: a memory and at least one processor, wherein the memory stores instructions, and the memory and the at least one processor are interconnected via a line; The at least one processor calls the instruction in the memory to enable the file transfer reading and writing device to execute the file transfer reading and writing method according to any one of claims 1 to 4.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the file transmission reading and writing method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Ad groups for using advertisements across placements
WO2010111014A2
File analysis system and method
CN102402541A
Data importing method and device
CN106445962A