A file processing method and apparatus

By dynamically updating specific code modules in the financial industry application system, the problem of poor file processing flexibility is solved, file generation and parsing efficiency is improved, different file formats are adapted to meet the efficient operation needs of financial institutions.

CN111221787BActive Publication Date: 2025-07-25WEBANK (CHINA)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010005146.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-01-03
Publication Date
2025-07-25
Estimated Expiration
2040-01-03

AI Technical Summary

Technical Problem

In the prior art, the financial industry application system has poor flexibility when processing files, and needs to frequently add specific code modules of file format type, resulting in bloated code and unable to meet the needs of efficient operation.

Method used

By presetting public code modules on the application system side, dynamically updating specific code modules according to file structure and format type, and generating or parsing files, defining various specific code modules in the system is avoided, and the flexibility of processing files is improved.

Benefits of technology

It realizes temporary update of code modules according to file format type, improves file processing flexibility and efficiency, reduces code bloat, and meets the efficient operation needs of financial institutions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111221787B_ABST
    Figure CN111221787B_ABST
Patent Text Reader

Abstract

The present invention discloses a file processing method and apparatus. The method is as follows: The application system end obtains service data, the file structure type of the file to be generated, and the file format type of the file to be generated; The application system end obtains, according to the file structure type, a common code module corresponding to the file structure type from the preset code module of the application system end; The application system end updates the common code module into a specific code module adapted to the file format type according to the file format type; The application system end uses the service data as the execution object of the specific code module, executes the specific code module, and generates the file to be generated. When the above method is applied to financial technology (Fintech), the common code module is temporarily updated into a specific code module according to the file format type of the file to be generated, thereby improving the flexibility in processing files.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of financial technology (Fintech) and the field of computer software, and particularly relates to a file processing method and apparatus. Background Art

[0002] With the development of computer technology, more and more technologies are applied in the financial field, and the traditional financial industry is gradually transforming into financial technology (Fintech). However, due to the security and real-time requirements of the financial industry, higher requirements are also put forward for technologies. Data interaction is required between application systems in the financial industry. Currently, the commonly used data method is to transmit text files, and the text files need to be processed before and after transmission. For example, before application system A transmits business data, it needs to generate a text file and then transmit the text file to application system B. Application system B needs to parse the text file after receiving it.

[0003] In the current method, it is necessary to collect the file format types of each file in the application system. Whenever a new file format type appears, it is necessary to add the corresponding file format type in the application system. Obviously, in the long run, this "patching" method will cause the code of the application system to be very bloated and the flexibility in processing files to be poor, which is an urgent problem to be solved. Summary of the Invention

[0004] Embodiments of the present application provide a file processing method and apparatus, which solve the problem of poor flexibility in processing files in the prior art.

[0005] In a first aspect, embodiments of the present application provide a file processing method, including: an application system end obtains service data, a file structure type of a file to be generated, and a file format type of the file to be generated; the service data is a data source for generating the file to be generated; the file structure type is used to indicate each file module of the file to be generated; the file format type is used to indicate each field and field format in each file module of the file to be generated; the file format type is adapted to the file structure type; the application system end obtains a common code module corresponding to the file structure type from a preset code module of the application system end according to the file structure type; the application system end updates the common code module to a specific code module adapted to the file format type according to the file format type; the application system end uses the service data as an execution object of the specific code module and executes the specific code module to generate the file to be generated.

[0006] In the above method, there is no need to define a specific code module for a specific file format type at the application system end. Only a code module needs to be preset at the application system end. When the application system end generates a file to be generated of a file format type, it obtains business data serving as a data source, indicates the file structure types of each file module of the file to be generated, and indicates each field and field format in each file module of the file to be generated. Then, according to the file structure type, it obtains a common code module corresponding to the file structure type from the preset code module at the application system end, and updates the common code module to a specific code module adapted to the file format type according to the file format type. Thus, the application system end takes the business data as the execution object of the specific code module and executes the specific code module, and then can generate the file to be generated. This method does not need to define various specific code modules in the application system, and can temporarily update the common code module to a specific code module according to the file format type of the file to be generated, thereby improving the flexibility in processing files.

[0007] In an optional implementation manner, each common variable is included in the common code module; the values of each common variable represent the processing manner when processing a field or a field format; the application system end updates the common code module to a specific code module adapted to the file format type according to the file format type, including: the application system end assigns values to the multiple common variables according to the file format type, so that the code module after the common code module is assigned values is adapted to the file format type; the application system end takes the code module after the common code module is assigned values as the specific code module.

[0008] In the above method, each common variable is included in the common code module; the values of each common variable represent the processing manner when processing a field or a field format. Therefore, when the application system end assigns different values to the multiple common variables, it represents different processing manners. Therefore, it can be corresponding to the file format type through corresponding assignment, thereby providing a method for obtaining a specific code module adapted to the file format type through assignment.

[0009] In an optional implementation manner, the application system end takes the business data as the input of the specific code module and executes the specific code module to generate the file to be generated, including: the application system end processes the corresponding data of each line of code in the business data according to the processing manner defined by each line of code in the specific code module to obtain the processed data of the business data; the application system end generates the file to be generated according to the processed data.

[0010] In the above method, the processing methods defined by the codes in each line of the specific code module can be adapted to the corresponding file format type. Therefore, the application system end can process the corresponding data of each line of code in the service data to obtain the processed data of the service data, realizing personalized processing under the specific code module, so that the file to be generated can be generated with a finer granularity.

[0011] In a second aspect, an embodiment of the present application provides a file processing method, including: the application system end obtains a file to be parsed, the file structure type of the file to be parsed, and the file format type of the file to be parsed; the file to be parsed is generated according to service data, the file structure type, and the file structure type; the service data is the data source for generating the file to be parsed; the file structure type is used to indicate each file module of the file to be parsed; the file format type is used to indicate each field and field format in each file module of the file to be parsed; the file format type is adapted to the file structure type; the application system end obtains a common code module corresponding to the file structure type from the preset code modules of the application system end according to the file structure type; the application system end updates the common code module to a specific code module adapted to the file format type according to the file format type; the application system end uses the file to be parsed as the execution object of the specific code module and executes the specific code module, so as to parse the file to be parsed and restore the service data.

[0012] In the above manner, it is not necessary to define specific code modules for specific file format types in the application system end. It is only necessary to preset code modules in the application system end. When the application system end parses a file to be parsed of a file format type, it obtains the service data acting as the data source, the file structure type indicating each file module of the file to be parsed, and the file format type indicating each field and field format in each file module of the file to be parsed. Then, according to the file structure type, it obtains the common code module corresponding to the file structure type from the preset code modules of the application system end, and updates the common code module to a specific code module adapted to the file format type according to the file format type. Therefore, the application system end uses the service data as the execution object of the specific code module and executes the specific code module, and can parse the file to be parsed. This method does not require defining various specific code modules in the application system, and can temporarily update the common code module to a specific code module according to the file format type of the file to be parsed, thereby improving the flexibility in processing files.

[0013] In an alternative implementation, the application system side executes the specific code module, including: the application system side executes the specific code module through a first thread and puts the service data into a cache queue; the application system side uses the file to be parsed as the execution object of the specific code module, executes the specific code module to parse the file to be parsed, and after restoring the service data, further includes: the application system side processes the data in the cache queue through a second thread.

[0014] In the above manner, the application system side decouples the parsing process and the processing process of the file to be parsed through the first thread and the second thread respectively. The first thread is used to execute the specific code module and put the service data into the cache queue, and the second thread is used to process the data in the cache queue, thereby reducing the parsing duration of the file to be parsed.

[0015] In a third aspect, the present application provides a file processing device, including: an acquisition module, configured to acquire service data, the file structure type of the file to be generated, and the file format type of the file to be generated; the service data is the data source for generating the file to be generated; the file structure type is used to indicate each file module of the file to be generated; the file format type is used to indicate each field and field format in each file module of the file to be generated; the file format type is adapted to the file structure type; a file generation module, configured to obtain, according to the file structure type, a common code module corresponding to the file structure type from a preset code module; update the common code module to a specific code module adapted to the file format type according to the file format type; use the service data as the execution object of the specific code module, execute the specific code module, and generate the file to be generated.

[0016] In an alternative implementation, the common code module includes various common variables; the values of the various common variables represent the processing methods when processing fields or field formats; the file generation module is specifically configured to: assign values to the multiple common variables according to the file format type, so that the code module after the common code module is assigned is adapted to the file format type; use the code module after the common code module is assigned as the specific code module.

[0017] In an alternative implementation, the file generation module is specifically configured to: process the corresponding data of each line of code in the service data according to the processing method defined by each line of code in the specific code module to obtain the processed data of the service data; generate the file to be generated according to the processed data.

[0018] For the beneficial effects of the third aspect and each implementation manner of the third aspect, reference may be made to the beneficial effects of the first aspect and each implementation manner of the first aspect, which will not be elaborated here.

[0019] Fourth aspect, the present application provides a file processing device, including: an acquisition module, configured to acquire a file to be parsed, a file structure type of the file to be parsed, and a file format type of the file to be parsed; the file to be parsed is generated according to service data, the file structure type, and the file structure type; the service data is a data source for generating the file to be parsed; the file structure type is used to indicate each file module of the file to be parsed; the file format type is used to indicate each field and field format in each file module of the file to be parsed; the file format type is adapted to the file structure type; a file parsing module, configured to obtain, according to the file structure type, a common code module corresponding to the file structure type from a preset code module at the application system side; update the common code module to a specific code module adapted to the file format type according to the file format type; use the file to be parsed as an execution object of the specific code module, and execute the specific code module, so as to parse the file to be parsed and restore the service data.

[0020] In an optional implementation manner, the specific code module is executed through a first thread, and the service data is placed in a cache queue; the file parsing module is further configured to: process the data in the cache queue through a second thread.

[0021] For the beneficial effects of the fourth aspect and each implementation manner of the fourth aspect, reference may be made to the beneficial effects of the second aspect and each implementation manner of the second aspect, which will not be elaborated here.

[0022] Fifth aspect, the present application provides a computer device, including a program or instruction, which when executed, is used to execute the method according to the first aspect or the second aspect and each implementation manner.

[0023] Sixth aspect, the present application provides a storage medium, including a program or instruction, which when executed, is used to execute the method according to the first aspect or the second aspect and each implementation manner. Description of the Drawings

[0024] Figure 1 It is a schematic flowchart of the steps of a file processing method provided by an embodiment of the present application;

[0025] Figure 2 It is a schematic flowchart of the steps of a file processing method provided by an embodiment of the present application;

[0026] Figure 3Schematic diagram of an architecture to which a file processing method provided by an embodiment of the present application can be applied;

[0027] Figure 4 Schematic diagram of the structure of a file processing device provided by an embodiment of the present application;

[0028] Figure 5 Schematic diagram of the structure of a file processing device provided by an embodiment of the present application. Detailed implementation manners

[0029] To better understand the above technical solution, the above technical solution will be described in detail below in conjunction with the accompanying drawings of the specification and specific implementation manners. It should be understood that the embodiments of the present application and the specific features in the embodiments are detailed descriptions of the technical solution of the present application, rather than limitations on the technical solution of the present application. Without conflict, the technical features in the embodiments of the present application and the embodiments can be combined with each other.

[0030] During the operation of financial institutions (banking institutions, insurance institutions or securities institutions) in their business operations (such as loan business, deposit business, etc. of banks), data interaction is required between application systems in the financial industry. Currently, the commonly used data method is to transmit text files, and the text files need to be processed before and after transmission. However, in the current method, it is necessary to collect the file format types of each file in the application system. Whenever a new file format type appears, it is necessary to add the corresponding file format type in the application system. Obviously, in the long run, this "patching" method will cause the code of the application system to be very bloated and the flexibility in processing files to be poor. This situation does not meet the needs of financial institutions such as banks and cannot ensure the efficient operation of various businesses of financial institutions.

[0031] For this reason, as Figure 1 shown, the present application provides a file processing method:

[0032] Step 101: The application system end obtains business data, the file structure type of the file to be generated, and the file format type of the file to be generated.

[0033] Step 102: The application system end obtains the common code module corresponding to the file structure type from the preset code module at the application system end according to the file structure type.

[0034] Step 103: The application system end updates the common code module to a specific code module adapted to the file format type according to the file format type; the application system end uses the business data as the execution object of the specific code module and executes the specific code module to generate the file to be generated.

[0035] In step 101, the service data is the data source for generating the file to be generated; the file structure type of the file to be generated is used to indicate each file module of the file to be generated; the file format type of the file to be generated is used to indicate each field and field format in each file module of the file to be generated; the file format type of the file to be generated is adapted to the file structure type of the file to be generated.

[0036] The file structure type of the file to be generated may exist in the form of a configuration file. As shown in Table 1, it is the description of each configuration item of the file structure type of the file to be generated.

[0037]

[0038] Table 1

[0039] It should be noted that protocol can be regarded as the identifier of the file structure type of the file to be generated, and it has a one-to-one correspondence with the file structure type of the file to be generated. head, body, and tail are used to define the file header, file body, and file tail in the file structure respectively. The file header, file body, and file tail are each composed of one or more lines and can be defined by line. And each line is composed of one or more columns and can be defined by column. Each column can contain one or more attributes. The specific file structure type can be defined according to requirements. For example, a file structure type including a file header, a file body, and a file tail can be defined, or a file structure type including only a file header and a file body can be defined.

[0040] The file format type of the file to be generated may exist in the form of a configuration file. As shown in Table 2, it is the description of each configuration item of the file format type of the file to be generated.

[0041]

[0042] Table 2

[0043] It should be noted that "protocol" is the identifier of the file structure type of the file to be generated shown in Table 1. "head", "body", and "tail" are respectively used to define the file header variable, file body variable, and file tail variable in the file format. For example, File Structure 1 defines the file header, file body, and file tail; File Format 1 defines the file header variable a, file body variable b, and file tail variable c, then File Structure 1 is adapted to File Format 1. The same applies to rows, columns, and column attributes. Obviously, the file structure type is configurable, and the file format is based on configuration management. Different file structure types correspond to different text protocols. When developers code, they only need to preset the common code modules mapped to each file structure type. For example, File Structure Type 1 corresponds to Common Code Module 1, and File Structure Type 2 corresponds to Common Code Module 2. When using, only the file protocol to be used needs to be specified, and there is no need to code the specific file format additionally, that is, only step 102 is executed according to the file structure type.

[0044] In step 103, specifically, the process of generating the file to be generated by executing the specific code module is as follows: Executing the specific code module will automatically serialize the file data of the file to be generated based on the text protocol, and then write the file data into the file to be generated.

[0045] In an optional implementation manner of step 103, the common code module includes various common variables; the values of the various common variables represent the processing methods when processing fields or field formats; the method for the application system side to update the common code module to a specific code module adapted to the file format type according to the file format type is as follows:

[0046] The application system side assigns values to the multiple common variables according to the file format type, so that the code module after the common code module is assigned is adapted to the file format type; the application system side uses the code module after the common code module is assigned as the specific code module.

[0047] For example, in the file structure type of the file to be generated, a common variable I (which can be integer type, character type, floating point type, etc.) is defined, and different processing methods for the common variable I being integer type, character type, and floating point type are defined in the common code module. In the file format type of the file to be generated, the specific variable i_1 corresponding to the common variable I is defined, and i_1 is of integer type. Then the specific code module is the corresponding code module when I is of integer type, and when processing, the variable named "i_1" needs to be assigned a value to perform corresponding processing, that is, it is required to assign a value to the variable named "i_1".

[0048] In an alternative implementation of step 103, the application system side uses the service data as the input of the specific code module, executes the specific code module, and generates the file to be generated, including: the application system side processes the corresponding data of each line of code in the service data according to the processing method defined by each line of code in the specific code module, and obtains the processed data of the service data; the application system side generates the file to be generated according to the processed data.

[0049] For example, the service data contains the assignments of three fields d1, d2, and d3, such as d1 = 1, d2 = 2, and d3 = 3. There are processes for d1, d2, and d3 in the specific code module, so d1 = 1, d2 = 2, and d3 = 3 can be substituted into the corresponding lines of code for processing.

[0050] Correspondingly, there is a similar method for file parsing, such as Figure 2 As shown, an embodiment of the present application provides a file processing method, including:

[0051] Step 201: The application system side obtains the file to be parsed, the file structure type of the file to be parsed, and the file format type of the file to be parsed.

[0052] The file to be parsed is generated according to the service data, the file structure type of the file to be parsed, and the file structure type of the file to be parsed; the service data is the data source for generating the file to be parsed; the file structure type is used to indicate each file module of the file to be parsed; the file format type is used to indicate each field and field format in each file module of the file to be parsed; the file format type of the file to be parsed is adapted to the file structure type of the file to be parsed.

[0053] In step 201, the file structure type and the file format type of the file to be parsed can also be configured according to the configuration items shown in Table 1 and Table 2 respectively.

[0054] Step 202: The application system side obtains the common code module corresponding to the file structure type from the preset code modules of the application system side according to the file structure type.

[0055] Step 203: The application system side updates the common code module to a specific code module adapted to the file format type according to the file format type; the application system side uses the file to be parsed as the execution object of the specific code module, executes the specific code module, and thus parses the file to be parsed and restores the service data.

[0056] In step 203, specifically, the process of executing the specific code module, parsing the file to be parsed, and restoring the service data is as follows: read the data of the file, then execute the specific code module to parse the file data of the file to be generated, and then automatically deserialize it into service data based on the text protocol.

[0057] In an alternative implementation of step 203, as Figure 3 shown, the application system side executes the specific code module in the following manner:

[0058] The application system side executes the specific code module through the first thread and puts the service data into the cache queue.

[0059] And the following steps can also be executed after step 203:

[0060] The application system side processes the data in the cache queue through the second thread.

[0061] In the above manner, the application system side decouples the parsing process and the processing process of the file to be parsed through the first thread and the second thread respectively. The first thread is used to execute the specific code module and put the service data into the cache queue, and the second thread is used to process the data in the cache queue, thereby reducing the parsing duration of the file to be parsed.

[0062] Figure 1 and Figure 2 The file processing method shown can be applied in the Figure 3 component architecture of the application system side shown. Figure 3 The architecture shown adopts the idea of the microkernel and the Service Provider Interface (SPI) mechanism. The microkernel architecture is also called the plug-in architecture pattern, which is usually used to implement product-based applications, such as the JAVA editor (Eclipse) and the Firefox browser. The microkernel architecture consists of two parts of components: core modules and plugin modules. The application logic is divided into independent plugin modules and the core system, providing features such as scalability, flexibility, function isolation, and custom processing logic. SPI is a service discovery mechanism, which often finds files in the META-INF / services folder under the ClassPath path in the Java programming language and automatically loads the classes defined in the files. This mechanism makes it possible to extend many frameworks, such as the SPI mechanism is used in Dubbo and JDBC.

[0063] Application Programming Interface Module: An application programming interface used to provide users with the ability to configure the file format type of the file to be generated or the file format type of the file to be parsed.

[0064] Configuration Module: Used to configure relevant resource information.

[0065] Tool Module: Used to implement specific file operations. It mainly includes four parts: Parser: Used for parsing the file to be parsed; Generator: Used for generating the file to be generated; Splitter: Used for splitting file data and dividing fields; Merger: Used for merging each field data into file data.

[0066] Extension Module: Used to extend the custom functions of the program. With the development of the business, in addition to Figure 1 and Figure 2 the file processing methods shown, during the file reading and writing process, it is not just simple reading and writing, but a series of additional business logics can also be added. For example: verifying the rationality of the file, whether the file is encrypted, adding statistical functions, etc. Therefore, a callback mechanism is added during the file reading and writing process in the component to separate these additional functions from the main reading and writing process. At the same time, this callback mechanism is also implemented as a plugin mechanism, and users can freely extend the corresponding business functions. For example, during the parsing process of the file to be parsed, add the logic to count the "number of file lines"; another example is that after the "file line data" is deserialized into "business data" after parsing the file to be parsed, it is necessary to perform a legality check on the "business data". The logic of adding points after parsing the file to be parsed and pushing the "business data" to the queue is also added points after parsing the file to be parsed.

[0067] Source Data Cache Module: Used for initializing data item (or metadata item) configuration and loading within the component.

[0068] Message Cache Module: A message queue used for temporarily storing data, and thread scheduling is used to complete data consumption.

[0069] Serialization Module: Performs serialization and deserialization operations on line data, field data, etc.

[0070] SPI Module: An open plugin extension entry for users.

[0071] Such as Figure 4As shown in the figure, the present application provides a document processing device, including: an acquisition module 401, configured to acquire service data, a file structure type of a file to be generated, and a file format type of the file to be generated; the service data is a data source for generating the file to be generated; the file structure type is used to indicate each file module of the file to be generated; the file format type is used to indicate each field and field format in each file module of the file to be generated; the file format type is adapted to the file structure type; a file generation module 402, configured to obtain a common code module corresponding to the file structure type from a preset code module according to the file structure type; update the common code module to a specific code module adapted to the file format type according to the file format type; use the service data as an execution object of the specific code module, and execute the specific code module to generate the file to be generated.

[0072] In an alternative embodiment, the common code module includes various common variables; the values of the various common variables represent the processing methods when processing fields or field formats; specifically, the file generation module 402 is configured to: assign values to the multiple common variables according to the file format type, so that the code module after the common code module is assigned values is adapted to the file format type; use the code module after the common code module is assigned values as the specific code module.

[0073] In an alternative embodiment, the file generation module 402 is specifically configured to: process the corresponding data of each line of code in the service data according to the processing method defined by each line of code in the specific code module to obtain the processed data of the service data; generate the file to be generated according to the processed data.

[0074] As Figure 5As shown in the figure, the present application provides a file processing device, including: an acquisition module 501, configured to acquire a file to be parsed, the file structure type of the file to be parsed, and the file format type of the file to be parsed; the file to be parsed is generated according to service data, the file structure type, and the file structure type; the service data is the data source for generating the file to be parsed; the file structure type is used to indicate each file module of the file to be parsed; the file format type is used to indicate each field and field format in each file module of the file to be parsed; the file format type is adapted to the file structure type; a file parsing module 502, configured to obtain, according to the file structure type, a common code module corresponding to the file structure type from a preset code module at the application system end; update the common code module to a specific code module adapted to the file format type according to the file format type; use the file to be parsed as an execution object of the specific code module, and execute the specific code module, so as to parse the file to be parsed and restore the service data.

[0075] In an optional implementation manner, the specific code module is executed by a first thread, and the service data is placed in a cache queue; the file parsing module 502 is further configured to: process the data in the cache queue by a second thread.

[0076] The embodiment of the present application provides a computer device, including a program or instruction, which when executed, is used to execute the Figure 1 file processing method shown in the Figure 2 file processing method shown in the

[0077] The embodiment of the present application provides a storage medium, including a program or instruction, which when executed, is used to execute the Figure 1 file processing method shown in the Figure 2 file processing method shown in the

[0078] Finally, it should be noted that those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, optical storage, etc.) containing computer-usable program code.

[0079] This application is described with reference to the flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to the application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, as well as the combination of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing device generate means for implementing the functions specified in the flow Figure 1 one flow or multiple flows and / or blocks Figure 1 or means for implementing the functions specified in multiple blocks.

[0080] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including instruction means that implement the functions specified in the flow Figure 1 one flow or multiple flows and / or blocks Figure 1 or means for implementing the functions specified in multiple blocks.

[0081] Obviously, those skilled in the art can make various changes and modifications to this application without departing from the scope of this application. Thus, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalent technologies, this application is also intended to include these changes and modifications.

Claims

1. A file processing method, characterized in that, Including: The application system end obtains service data, the file structure type of the file to be generated, and the file format type of the file to be generated; The service data is the data source for generating the file to be generated; the file structure type is used to indicate each file module of the file to be generated; The file format type is used to indicate each field and field format in each file module of the file to be generated; the file format type is adapted to the file structure type; The application system end obtains, according to the file structure type, a common code module corresponding to the file structure type from the preset code modules of the application system end, and the common code module includes various common variables; the values of the various common variables represent the processing methods when processing fields or field formats; The application system end assigns values to multiple common variables according to the file format type, so that the code module after the common code module is assigned values is adapted to the file format type; The application system end uses the code module after the common code module is assigned values as a specific code module; The application system end uses the service data as the execution object of the specific code module, executes the specific code module, and generates the file to be generated.

2. The method according to claim 1, characterized in that, The application system end uses the service data as the execution object of the specific code module, executes the specific code module, and generates the file to be generated, including: The application system end processes the corresponding data of each line of code in the service data according to the processing methods defined by each line of code in the specific code module, and obtains the data after the service data is processed; The application system end generates the file to be generated according to the processed data.

3. A file processing method, characterized in that, Including: The application system end obtains the file to be parsed, the file structure type of the file to be parsed, and the file format type of the file to be parsed; The file to be parsed is generated according to service data, the file structure type, and the file format type; the service data is the data source for generating the file to be parsed; the file structure type is used to indicate each file module of the file to be parsed; the file format type is used to indicate each field and field format in each file module of the file to be parsed; the file format type is adapted to the file structure type; The application system end obtains, according to the file structure type, a common code module corresponding to the file structure type from the preset code modules of the application system end, and the common code module includes various common variables; the values of the various common variables represent the processing methods when processing fields or field formats; The application system end assigns values to multiple common variables according to the file format type, so that the code module after the common code module is assigned values is adapted to the file format type; The application system end uses the code module after the common code module is assigned values as a specific code module; The application system end uses the file to be parsed as the execution object of the specific code module, executes the specific code module, and thus parses the file to be parsed and restores the service data.

4. The method according to claim 3, characterized in that The application system end executes the specific code module, including: The application system side executes the specific code module through a first thread and places the service data into a cache queue; After the application system side uses the file to be parsed as the execution object of the specific code module, executes the specific code module, parses the file to be parsed, and restores the service data, it further includes: The application system side processes the data in the cache queue through a second thread.

5. A file processing device, characterized in that, It includes: An acquisition module, configured to acquire service data, the file structure type of the file to be generated, and the file format type of the file to be generated; The service data is the data source for generating the file to be generated; the file structure type is used to indicate each file module of the file to be generated; The file format type is used to indicate each field and field format in each file module of the file to be generated; the file format type is adapted to the file structure type; A file generation module, configured to obtain, according to the file structure type, a common code module corresponding to the file structure type from a preset code module, where the common code module includes each common variable; the value of each common variable represents a processing method when processing a field or a field format; according to the file format type, assign values to multiple common variables so that the code module after the common code module is assigned is adapted to the file format type; use the code module after the common code module is assigned as a specific code module; use the service data as the execution object of the specific code module, and execute the specific code module to generate the file to be generated.

6. The device according to claim 5, characterized in that, Specifically, the file generation module is configured to: Process the corresponding data of each line of code in the service data according to the processing method defined by each line of code in the specific code module, and obtain the processed data of the service data; Generate the file to be generated according to the processed data.

7. A file processing device, characterized in that, It includes: An acquisition module, configured to acquire a file to be parsed, the file structure type of the file to be parsed, and the file format type of the file to be parsed; The file to be parsed is generated according to service data, the file structure type, and the file format type; the service data is the data source for generating the file to be parsed; the file structure type is used to indicate each file module of the file to be parsed; the file format type is used to indicate each field and field format in each file module of the file to be parsed; the file format type is adapted to the file structure type; A file parsing module, configured to obtain, according to the file structure type, a common code module corresponding to the file structure type from a preset code module at the application system end, where the common code module includes various common variables; values of the various common variables represent processing methods when processing fields or field formats; assign values to a plurality of common variables according to the file format type, so that the code module after the common code module is assigned values is adapted to the file format type; use the code module after the common code module is assigned values as a specific code module; use the file to be parsed as an execution object of the specific code module, and execute the specific code module, so as to parse the file to be parsed and restore the service data.

8. The device according to claim 7, characterized in that, Specifically, the file parsing module is configured to: Execute the specific code module through a first thread, and put the service data into a cache queue; The file parsing module is further configured to: Process the data in the cache queue through a second thread.

9. A computer device, characterized in that, Includes a program or instruction, which when executed, executes the method according to any one of claims 1 to 4.

10. A storage medium, characterized in that, Includes a program or instruction, which when executed, executes the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • File generation method and device

    CN107704479A

  • Code file generation method and device, computer device, and storage medium

    CN109032662A