CN111221787A - File processing method and device - Google Patents

File processing method and device Download PDF

Info

Publication number
CN111221787A
CN111221787A CN202010005146.0A CN202010005146A CN111221787A CN 111221787 A CN111221787 A CN 111221787A CN 202010005146 A CN202010005146 A CN 202010005146A CN 111221787 A CN111221787 A CN 111221787A
Authority
CN
China
Prior art keywords
file
code module
module
application system
analyzed
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010005146.0A
Other languages
Chinese (zh)
Inventor
沈亮亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
WeBank Co Ltd
Original Assignee
WeBank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by WeBank Co Ltd filed Critical WeBank Co Ltd
Priority to CN202010005146.0A priority Critical patent/CN111221787A/en
Publication of CN111221787A publication Critical patent/CN111221787A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/178Techniques for file synchronisation in file systems
    • G06F16/1794Details of file format conversion

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a file processing method and a file processing device, wherein the method comprises the following steps: an application system end acquires service data, a file structure type of a file to be generated and a file format type of the file to be generated; the application system side acquires a public code module corresponding to the file structure type from a preset code module of the application system side according to the file structure type; the application system end updates the public code module into a specific code module adapted to the file format type according to the file format type; and the application system end takes the service data as an execution object of the specific code module, executes the specific code module and generates the file to be generated. When the method is applied to financial technology (Fintech), the public code module is temporarily updated into the specific code module according to the file format type of the file to be generated, so that the flexibility in processing the file is improved.

Description

File processing method and device
Technical Field
The invention relates to the field of financial technology (Fintech) and the field of computer software, in particular to a file processing method and device.
Background
With the development of computer technology, more and more technologies are applied in the financial field, and the traditional financial industry is gradually changing to financial technology (Fintech), but due to the requirements of the financial industry on safety and real-time performance, higher requirements are also put forward on the technologies. Data interaction is needed among application systems in the financial industry, a common data mode at present is to transmit text files, and the text files need to be processed before and after transmission. For example, before the application system a needs to transmit the service data, it needs to generate a text file, and then transmit the text file to the application system B, and the application system B needs to parse the text file after receiving the text file.
In the current method, the file format type of each file needs to be collected at the application system. Whenever a new file format type occurs, the corresponding file format type needs to be added in the application system. Obviously, in the past, the method of "patching" may cause the code of the application system to be too bulky and the flexibility of processing the file is poor, which is a problem to be solved urgently.
Disclosure of Invention
The embodiment of the application provides a file processing method and device, and solves the problem that in the prior art, the flexibility is poor when a file is processed.
In a first aspect, an embodiment of the present application provides a file processing method, including: an application system end acquires 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 for indicating each file module of the file to be generated; the file format type is used for indicating 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 side acquires a public code module corresponding to the file structure type from a preset code module of the application system side according to the file structure type; the application system end updates the public code module into a specific code module adapted to the file format type according to the file format type; and the application system end takes the service data as an execution object of the specific code module, executes the specific code module and generates the file to be generated.
In the method, a specific code module of a specific file format type is not required to be defined in an application system end, only the code module needs to be preset in the application system end, when the application system end generates a file to be generated of a file format type, the application system end acquires service data serving as a data source, a file structure type indicating each file module of the file to be generated and each field and field format indicating each file module of the file to be generated, then a common code module corresponding to the file structure type is acquired from the preset code module of the application system end according to the file structure type, and the common code module is updated to a specific code module adapted to the file format type according to the file format type, so that the application system end takes the service data as an execution object of the specific code module, the method can generate the file to be generated by executing the specific code module, does not need to define various specific code modules in an application system, and can temporarily update the common code module into the specific code module according to the file format type of the file to be generated, thereby improving the flexibility in processing the file.
In an alternative embodiment, the common code module includes common variables; the value of each public variable represents a processing mode when a field or a field format is processed; the application system side updates the public code module into a specific code module adapted to the file format type according to the file format type, and the method comprises the following steps: the application system end assigns values to the public variables according to the file format type, so that the code modules assigned by the public code modules are adaptive to the file format type; and the application system end takes the code module after the public code module is assigned as the specific code module.
In the above method, the common code module includes common variables; the values of the public variables represent processing modes when fields or field formats are processed, so that the multiple public variables at the application system end represent different processing modes when different values are assigned, and can correspond to the file format types according to corresponding assignments, thereby providing a method for obtaining the specific code module adapted to the file format types through assignment.
In an optional implementation manner, the executing, by the application system end, the specific code module by taking the service data as an input of the specific code module, to generate the file to be generated includes: the application system end processes the corresponding data of each line code in the service data according to the processing mode defined by each line code in the specific code module to obtain the data after the service data is processed; and the application system end generates the file to be generated according to the processed data.
In the method, the processing mode defined by each line of codes in the specific code module can be adapted to the corresponding file format type, so that the application system end can obtain the data processed by the business data according to the corresponding data of each line of codes in the business data, thereby realizing the individual processing under the specific code module and generating the file to be generated in a finer granularity.
In a second aspect, an embodiment of the present application provides a file processing method, including: an application system end obtains a file to be analyzed, a file structure type of the file to be analyzed and a file format type of the file to be analyzed; the file to be analyzed is generated according to the service data, the file structure type and the file structure type; the service data is a data source for generating the file to be analyzed; the file structure type is used for indicating each file module of the file to be analyzed; the file format type is used for indicating each field and field format in each file module of the file to be analyzed; the file format type is adapted to the file structure type; the application system side acquires a public code module corresponding to the file structure type from a preset code module of the application system side according to the file structure type; the application system end updates the public code module into a specific code module adapted to the file format type according to the file format type; and the application system terminal takes the file to be analyzed as an execution object of the specific code module, and executes the specific code module, so that the file to be analyzed is analyzed, and the service data is restored.
In the above manner, a specific code module of a specific file format type is not required to be defined in an application system end, and only the code module needs to be preset in the application system end, when the application system end parses a file to be parsed of a file format type, the application system end obtains service data serving as a data source, a file structure type indicating each file module of the file to be parsed, and each field and field format indicating each file module of the file to be parsed, then according to the file structure type, a common code module corresponding to the file structure type is obtained from the preset code module of the application system end, and according to the file format type, the common code module is updated to a specific code module adapted to the file format type, so that the application system end takes the service data as an execution object of the specific code module, the file to be analyzed can be analyzed by executing the specific code module, and the method can temporarily update the common code module into the specific code module according to the file format type of the file to be analyzed without defining various specific code modules in an application system, thereby improving the flexibility in processing the file.
In an optional implementation manner, the executing, by the application system side, the specific code module includes: 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 terminal takes the file to be analyzed as an execution object of the specific code module, executes the specific code module, so as to analyze the file to be analyzed, and after the business data is restored, the method further comprises the following steps: and the application system end processes the data in the cache queue through a second thread.
In the above manner, the application system end decouples the parsing process and the processing process of the file to be parsed through the first thread and the second thread, the first thread is used for executing the specific code module and putting the service data into the cache queue, and the second thread is used for processing the data in the cache queue, so that the parsing time of the file to be parsed is reduced.
In a third aspect, the present application provides a document processing apparatus comprising: the acquisition module is used for acquiring the 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 a data source for generating the file to be generated; the file structure type is used for indicating each file module of the file to be generated; the file format type is used for indicating 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 file generation module is used for acquiring a public code module corresponding to the file structure type from a preset code module according to the file structure type; updating the public code module into a specific code module which is adapted to the file format type according to the file format type; and taking the service data as an execution object of the specific code module, executing the specific code module, and generating the file to be generated.
In an alternative embodiment, the common code module includes common variables; the value of each public variable represents a processing mode when a field or a field format is processed; the file generation module is specifically configured to: assigning values to the public variables according to the file format type, so that the code modules assigned by the public code modules are adaptive to the file format type; and assigning the code module of the public code module as the specific code module.
In an optional embodiment, the file generating module is specifically configured to: processing corresponding data of each line code in the service data according to a processing mode defined by each line code in the specific code module to obtain data after the service data is processed; and generating the file to be generated according to the processed data.
For the advantages of the third aspect and the embodiments of the third aspect, reference may be made to the advantages of the first aspect and the embodiments of the first aspect, which are not described herein again.
In a fourth aspect, the present application provides a document processing apparatus comprising: the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring a file to be analyzed, a file structure type of the file to be analyzed and a file format type of the file to be analyzed; the file to be analyzed is generated according to the service data, the file structure type and the file structure type; the service data is a data source for generating the file to be analyzed; the file structure type is used for indicating each file module of the file to be analyzed; the file format type is used for indicating each field and field format in each file module of the file to be analyzed; the file format type is adapted to the file structure type; the file analysis module is used for acquiring a public code module corresponding to the file structure type from a preset code module of the application system side according to the file structure type; updating the public code module into a specific code module which is adapted to the file format type according to the file format type; and taking the file to be analyzed as an execution object of the specific code module, and executing the specific code module, so as to analyze the file to be analyzed and restore the service data.
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 is further configured to: and processing the data in the buffer queue through a second thread.
The advantageous effects of the embodiments of the fourth aspect and the fourth aspect may refer to the advantageous effects of the embodiments of the second aspect and the second aspect, and are not described herein again.
In a fifth aspect, the present application provides a computer device comprising a program or instructions for performing the method of the first or second aspect and embodiments described above when the program or instructions are executed.
In a sixth aspect, the present application provides a storage medium comprising a program or instructions which, when executed, is configured to perform the method of the first or second aspect and the various embodiments.
Drawings
Fig. 1 is a schematic flowchart illustrating steps of a document processing method according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating steps of a document processing method according to an embodiment of the present application;
FIG. 3 is a schematic diagram illustrating an architecture of a file processing method according to an embodiment of the present disclosure;
FIG. 4 is a schematic structural diagram of a document processing apparatus according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of a document processing apparatus according to an embodiment of the present application.
Detailed Description
In order to better understand the technical solutions, the technical solutions will be described in detail below with reference to the drawings and the specific embodiments of the specification, and it should be understood that the specific features in the embodiments and examples of the present application are detailed descriptions of the technical solutions of the present application, but not limitations of the technical solutions of the present application, and the technical features in the embodiments and examples of the present application may be combined with each other without conflict.
In the operation process of financial institutions (banking institutions, insurance institutions or security institutions) in carrying out services (such as loan services and deposit services of banks), data interaction is required among application systems in the financial industry, a text file is transmitted in a commonly used data mode at present, and the text file needs to be processed before and after transmission. However, in the current method, the file format type of each file needs to be collected in the application system. Whenever a new file format type occurs, the corresponding file format type needs to be added in the application system. Obviously, in the past, the 'patching' mode can lead to that the codes of the application system are too bloated, the flexibility of processing files is poor, the condition does not meet the requirements of financial institutions such as banks and the like, and the efficient operation of various services of the financial institutions cannot be ensured.
To this end, as shown in fig. 1, the present application provides a file processing method:
step 101: the application system end obtains the service data, the file structure type of the file to be generated and the file format type of the file to be generated.
Step 102: and the application system end acquires a public code module corresponding to the file structure type from a preset code module of the application system end according to the file structure type.
Step 103: the application system end updates the public code module into a specific code module adapted to the file format type according to the file format type; and the application system end takes the service data as an execution object of the specific code module, executes the specific code module and generates the file to be generated.
In step 101, the service data is a data source for generating the file to be generated; the file structure type of the file to be generated is used for indicating each file module of the file to be generated; the file format type of the file to be generated is used for indicating each field and field format in each file module of the file to be generated; and the file format type of the file to be generated is adapted to the file structure type of the file to be generated.
The file structure type of the file to be generated may exist in the form of a configuration file, as shown in table 1, and is a description of each configuration item of the file structure type of the file to be generated.
Figure BDA0002354986790000071
TABLE 1
It should be noted that protocol may be regarded as an identifier of a file structure type of the file to be generated, and the file structure type of the file to be generated is in a one-to-one correspondence relationship. head, body and tail are used to define the header, body and end of file in the file structure, respectively. The file header, the file body and the file tail are all composed of one to a plurality of rows and can be defined according to the rows. The rows are composed of one to more columns, which may be defined by columns, each column may contain one to more attributes. The specific file structure type may be defined according to requirements, such as defining a file structure type including a file header, a file body and a file trailer, or defining a file structure type including a file header and a file body.
The file format type of the file to be generated may exist in the form of a configuration file, as shown in table 2, which is a description of each configuration item of the file format type of the file to be generated.
Figure BDA0002354986790000081
TABLE 2
It should be noted that the protocol is an identifier of a file structure type of the file to be generated, which is shown in table 1. head, body and tail are used to define the file head variable, file body variable and file tail variable in the file format, respectively. For example, the file structure 1 defines a file header, a file body, and a file trailer; file format 1 defines a file header variable a, a file body variable b and a file end variable c, so that the file structure 1 is adapted to the file format 1. The same holds for the row, column and column attributes. Obviously, the file structure types are configurable, the file format is based on configuration management, different file structure types correspond to different text protocols, and a developer only needs to preset a common code module mapped with each file structure type during encoding. If the file structure type I corresponds to the public code module I, the file structure type II corresponds to the public code module II. When in use, only the used file protocol needs to be specified, the specific file format does not need to be additionally coded, namely, the step 102 is only executed according to the file structure type.
In step 103, specifically, executing the specific code module, and generating the file to be generated includes: and the specific code execution module automatically generates file data of the file to be generated based on the text protocol in a serialized mode, and then writes the file data into the file to be generated.
In an optional implementation manner of step 103, the common code module includes common variables; the value of each public variable represents a processing mode when a field or a field format is processed; the mode that the application system end updates the public code module into a specific code module which is adapted to the file format type according to the file format type is as follows:
the application system end assigns values to the public variables according to the file format type, so that the code modules assigned by the public code modules are adaptive to the file format type; and the application system end takes the code module after the public code module is assigned as the specific code module.
For example, a common variable I (which may be an integer type, a character type, a floating point type, or the like) is defined in the file structure type of the file to be generated, and different processing modes for the common variable I being the integer type, the character type, and the floating point type are defined in the common code module. Specific variables I _1 corresponding to the common variables I are defined in the file format type of the file to be generated, wherein I _1 is an integer type, the specific code module is the corresponding code module when I is the integer type, and corresponding processing can be carried out only by assigning values to I _1 during processing, namely assigning values to variables with variable names of 'I _ 1'.
In an optional implementation manner of step 103, the executing, by the application system end, the specific code module by taking the service data as an input of the specific code module, to generate the file to be generated includes: the application system end processes the corresponding data of each line code in the service data according to the processing mode defined by each line code in the specific code module to obtain the data after the service data is processed; and the application system end generates the file to be generated according to the processed data.
For example, the traffic data includes assignments of three fields d1, d2, and d3, such as d1 ═ 1, d2 ═ 2, and d3 ═ 3. Since the specific code module processes d1, d2, and d3, the code in the corresponding line may be substituted with d1 ═ 1, d2 ═ 2, and d3 ═ 3.
Correspondingly, there is a similar method for file parsing, and as shown in fig. 2, an embodiment of the present application provides a file processing method, including:
step 201: the method comprises the steps that an application system side obtains a file to be analyzed, the file structure type of the file to be analyzed and the file format type of the file to be analyzed.
The file to be analyzed is generated according to the service data, the file structure type of the file to be analyzed and the file structure type of the file to be analyzed; the service data is a data source for generating the file to be analyzed; the file structure type is used for indicating each file module of the file to be analyzed; the file format type is used for indicating each field and field format in each file module of the file to be analyzed; and the file format type of the file to be analyzed is adapted to the file structure type of the file to be analyzed.
In step 201, the file structure type of the file to be parsed and the file format type of the file to be parsed may also be configured according to the configuration items shown in table 1 and table 2, respectively.
Step 202: and the application system end acquires a public code module corresponding to the file structure type from a preset code module of the application system end according to the file structure type.
Step 203: the application system end updates the public code module into a specific code module adapted to the file format type according to the file format type; and the application system terminal takes the file to be analyzed as an execution object of the specific code module, and executes the specific code module, so that the file to be analyzed is analyzed, and the service data is restored.
In step 203, specifically, the specific code module is executed to parse the file to be parsed, and the process of restoring the service data is as follows: and reading the data of the file, executing a specific code module to analyze the file data of the file to be generated, and automatically deserializing the file data into service data based on a text protocol.
In an alternative embodiment of step 203, as shown in fig. 3, the application system executes the specific code module according to the following manner:
and the application system end executes the specific code module through a first thread and places the service data into a cache queue.
And after step 203 the following steps may also be performed:
and the application system end processes the data in the cache queue through a second thread.
In the above manner, the application system end decouples the parsing process and the processing process of the file to be parsed through the first thread and the second thread, the first thread is used for executing the specific code module and putting the service data into the cache queue, and the second thread is used for processing the data in the cache queue, so that the parsing time of the file to be parsed is reduced.
The file processing method shown in fig. 1 and 2 can be applied to the component architecture of the application system side shown in fig. 3. The architecture shown in FIG. 3 employs the concept of a microkernel and a Service Provider Interface (SPI) mechanism. Micro-kernel architecture, also known as plug-in architecture pattern (plug-in-architecture pattern), is commonly used to implement product-based applications such as JAVA editor (Eclipse) and Firefox (Firefox) browsers. The microkernel architecture includes two part components: core modules (core modules) and plug-in modules (plugin modules). Application logic is partitioned into independent plug-in modules and core systems, providing scalability, flexibility, functional isolation, and custom processing logic characteristics. SPI is a service discovery mechanism, and in java programming language, files are usually searched through a META-INF/services folder under a ClassPath path, so that classes defined in the files are automatically loaded. This mechanism provides the possibility for many framework extensions, such as the use of the SPI mechanism in both Dubbo and JDBC.
An application program interface module: and the application program interface is used for providing the user with the file format type of the file to be generated or the file format type of the file to be analyzed.
A configuration module: for configuring the relevant resource information.
A tool module: for implementing specific file operations. The device mainly comprises four parts: a resolver: the file analysis method comprises the steps of analyzing a file to be analyzed; a generator: the method comprises the steps of generating a file to be generated; a splitter: the device is used for splitting file data and dividing fields; a combiner: for merging each field data into file data.
An expansion module: the method is used for expanding the self-defining function of the program. With the development of services, in addition to the file processing methods shown in fig. 1 and 2, not only simple reading and writing but also a series of additional service logic increases may be performed in the process of reading and writing files. Such as: the reasonability of the file is verified, whether the file is encrypted or not is verified, a statistical function is added, and the like, so that a callback mechanism is added in the file reading and writing process, the additional functions are stripped from the reading and writing main flow, meanwhile, the callback mechanism is also realized by a plug-in mechanism, and a user can freely expand corresponding service functions. For example, in the parsing process of the file to be parsed, logic for counting "file line number" is added; for another example, after the file to be analyzed is analyzed, after the "file line data" is deserialized into the "service data", the validity check of the "service data" is required, a point is buried after the file to be analyzed is analyzed, and a point is also buried after the logic that pushes the "service data" to the queue is also analyzed.
A source data caching module: the method is used for initializing configuration and loading of data items (or metadata items) in the components.
The message caching module: a message queue for temporarily storing data, and a thread schedule to complete consumption of the data.
A serialization module: serializing and deserializing row data, field data, or the like
An SPI module: plug-in extension entries open to the user.
As shown in fig. 4, the present application provides a document processing apparatus including: an obtaining module 401, configured to obtain 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 for indicating each file module of the file to be generated; the file format type is used for indicating 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 file generation module 402 is configured to obtain a public code module corresponding to the file structure type from a preset code module according to the file structure type; updating the public code module into a specific code module which is adapted to the file format type according to the file format type; and taking the service data as an execution object of the specific code module, executing the specific code module, and generating the file to be generated.
In an alternative embodiment, the common code module includes common variables; the value of each public variable represents a processing mode when a field or a field format is processed; the file generating module 402 is specifically configured to: assigning values to the public variables according to the file format type, so that the code modules assigned by the public code modules are adaptive to the file format type; and assigning the code module of the public code module as the specific code module.
In an optional implementation manner, the file generating module 402 is specifically configured to: processing corresponding data of each line code in the service data according to a processing mode defined by each line code in the specific code module to obtain data after the service data is processed; and generating the file to be generated according to the processed data.
As shown in fig. 5, the present application provides a document processing apparatus including: an obtaining module 501, configured to obtain 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 analyzed is generated according to the service data, the file structure type and the file structure type; the service data is a data source for generating the file to be analyzed; the file structure type is used for indicating each file module of the file to be analyzed; the file format type is used for indicating each field and field format in each file module of the file to be analyzed; 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 public code module corresponding to the file structure type from a preset code module of the application system side; updating the public code module into a specific code module which is adapted to the file format type according to the file format type; and taking the file to be analyzed as an execution object of the specific code module, and executing the specific code module, so as to analyze the file to be analyzed and restore the service data.
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: and processing the data in the buffer queue through a second thread.
The embodiment of the present application provides a computer device, which includes a program or an instruction, and when the program or the instruction is executed, the program or the instruction is used to execute the file processing method shown in fig. 1 or the file processing method shown in fig. 2 in the embodiment of the present application, and any optional method.
The embodiment of the present application provides a storage medium, which includes a program or an instruction, and when the program or the instruction is executed, the program or the instruction is used to execute the file processing method shown in fig. 1 or the file processing method shown in fig. 2 and any optional method in the embodiment of the present application.
Finally, it should be noted that: as will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

Claims (12)

1. A file processing method, comprising:
an application system end acquires 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 for indicating each file module of the file to be generated; the file format type is used for indicating 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 side acquires a public code module corresponding to the file structure type from a preset code module of the application system side according to the file structure type;
the application system end updates the public code module into a specific code module adapted to the file format type according to the file format type;
and the application system end takes the service data as an execution object of the specific code module, executes the specific code module and generates the file to be generated.
2. The method of claim 1, wherein the common code module includes common variables; the value of each public variable represents a processing mode when a field or a field format is processed; the application system side updates the public code module into a specific code module adapted to the file format type according to the file format type, and the method comprises the following steps:
the application system end assigns values to the public variables according to the file format type, so that the code modules assigned by the public code modules are adaptive to the file format type;
and the application system end takes the code module after the public code module is assigned as the specific code module.
3. The method according to claim 1 or 2, wherein the step of the application system side taking the service data as the input of the specific code module, executing the specific code module, and generating the file to be generated comprises:
the application system end processes the corresponding data of each line code in the service data according to the processing mode defined by each line code in the specific code module to obtain the data after the service data is processed;
and the application system end generates the file to be generated according to the processed data.
4. A file processing method, comprising:
an application system end obtains a file to be analyzed, a file structure type of the file to be analyzed and a file format type of the file to be analyzed; the file to be analyzed is generated according to the service data, the file structure type and the file structure type; the service data is a data source for generating the file to be analyzed; the file structure type is used for indicating each file module of the file to be analyzed; the file format type is used for indicating each field and field format in each file module of the file to be analyzed; the file format type is adapted to the file structure type;
the application system side acquires a public code module corresponding to the file structure type from a preset code module of the application system side according to the file structure type;
the application system end updates the public code module into a specific code module adapted to the file format type according to the file format type;
and the application system terminal takes the file to be analyzed as an execution object of the specific code module, and executes the specific code module, so that the file to be analyzed is analyzed, and the service data is restored.
5. The method of claim 4, wherein the application system executing the specific code module comprises:
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 terminal takes the file to be analyzed as an execution object of the specific code module, executes the specific code module, so as to analyze the file to be analyzed, and after the business data is restored, the method further comprises the following steps:
and the application system end processes the data in the cache queue through a second thread.
6. A document processing apparatus, characterized by comprising:
the acquisition module is used for acquiring the 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 a data source for generating the file to be generated; the file structure type is used for indicating each file module of the file to be generated; the file format type is used for indicating 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 file generation module is used for acquiring a public code module corresponding to the file structure type from a preset code module according to the file structure type; updating the public code module into a specific code module which is adapted to the file format type according to the file format type; and taking the service data as an execution object of the specific code module, executing the specific code module, and generating the file to be generated.
7. The apparatus of claim 6, wherein the common code module includes common variables; the value of each public variable represents a processing mode when a field or a field format is processed; the file generation module is specifically configured to:
assigning values to the public variables according to the file format type, so that the code modules assigned by the public code modules are adaptive to the file format type;
and assigning the code module of the public code module as the specific code module.
8. The apparatus of claim 6 or 7, wherein the file generation module is specifically configured to:
processing corresponding data of each line code in the service data according to a processing mode defined by each line code in the specific code module to obtain data after the service data is processed;
and generating the file to be generated according to the processed data.
9. A document processing apparatus, characterized by comprising:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring a file to be analyzed, a file structure type of the file to be analyzed and a file format type of the file to be analyzed; the file to be analyzed is generated according to the service data, the file structure type and the file structure type; the service data is a data source for generating the file to be analyzed; the file structure type is used for indicating each file module of the file to be analyzed; the file format type is used for indicating each field and field format in each file module of the file to be analyzed; the file format type is adapted to the file structure type;
the file analysis module is used for acquiring a public code module corresponding to the file structure type from a preset code module of the application system side according to the file structure type; updating the public code module into a specific code module which is adapted to the file format type according to the file format type; and taking the file to be analyzed as an execution object of the specific code module, and executing the specific code module, so as to analyze the file to be analyzed and restore the service data.
10. The apparatus of claim 9, wherein the file parsing module is specifically configured to:
executing the specific code module through a first thread, and putting the service data into a cache queue;
the file parsing module is further configured to:
and processing the data in the buffer queue through a second thread.
11. A computer device comprising a program or instructions that, when executed, perform the method of any of claims 1 to 5.
12. A storage medium comprising a program or instructions which, when executed, perform the method of any one of claims 1 to 5.
CN202010005146.0A 2020-01-03 2020-01-03 File processing method and device Pending CN111221787A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010005146.0A CN111221787A (en) 2020-01-03 2020-01-03 File processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010005146.0A CN111221787A (en) 2020-01-03 2020-01-03 File processing method and device

Publications (1)

Publication Number Publication Date
CN111221787A true CN111221787A (en) 2020-06-02

Family

ID=70810745

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010005146.0A Pending CN111221787A (en) 2020-01-03 2020-01-03 File processing method and device

Country Status (1)

Country Link
CN (1) CN111221787A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112068895A (en) * 2020-08-10 2020-12-11 深圳市鼎盛光电有限公司 Code configuration method and device, video playing equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112068895A (en) * 2020-08-10 2020-12-11 深圳市鼎盛光电有限公司 Code configuration method and device, video playing equipment and storage medium
CN112068895B (en) * 2020-08-10 2023-12-19 深圳市鼎盛光电有限公司 Code configuration method, device, video playing equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109597661B (en) Service function configuration method and device
CN112988153B (en) Data processing method and frame based on micro front end
CN100418056C (en) System and method for generating methods
CN108829884B (en) Data mapping method and device
CN103019874A (en) Method and device for realizing exception handling based on data synchronization
CN106557307B (en) Service data processing method and system
CN110188135A (en) Document generating method and equipment
EP3441883B1 (en) Function serialization for inter-thread messaging
CN114090671A (en) Data import method and device, electronic equipment and storage medium
US10659567B2 (en) Dynamic discovery and management of page fragments
CN109828759B (en) Code compiling method, device, computer device and storage medium
CN111221787A (en) File processing method and device
CN103646015B (en) Transmission, the method and system for receiving and transmitting XML message
CN110941655A (en) Data format conversion method and device
CN117008920A (en) Engine system, request processing method and device, computer equipment and storage medium
CN116226921A (en) Desensitization processing method and device
CN114637531A (en) Method and device for dynamically generating application program interface
CN109992293B (en) Method and device for assembling Android system component version information
CN114546670A (en) Coroutine-based functional asynchronous data distribution system and method
CN109725932B (en) Method and device for generating description document of application component
CN112835901A (en) File storage method and device, computer equipment and computer readable storage medium
US11341054B2 (en) Method for data processing
CN117519691B (en) Application processing method, device, computer equipment and storage medium
CN114006703B (en) Intersystem data transmission method and device
CN113778392A (en) Method and device for realizing streaming development based on configuration

Legal Events

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