CN117421365A - Data conversion method, device, computer equipment and storage medium - Google Patents

Data conversion method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN117421365A
CN117421365A CN202311497010.6A CN202311497010A CN117421365A CN 117421365 A CN117421365 A CN 117421365A CN 202311497010 A CN202311497010 A CN 202311497010A CN 117421365 A CN117421365 A CN 117421365A
Authority
CN
China
Prior art keywords
file
data
path
converted
markup language
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
CN202311497010.6A
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.)
CCB Finetech Co Ltd
Original Assignee
CCB Finetech 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 CCB Finetech Co Ltd filed Critical CCB Finetech Co Ltd
Priority to CN202311497010.6A priority Critical patent/CN117421365A/en
Publication of CN117421365A publication Critical patent/CN117421365A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/258Data format conversion from or to a database
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Mathematical Physics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to the technical field of big data, and particularly discloses a data conversion method, a data conversion device, computer equipment and a storage medium. The method comprises the following steps: extracting the structured query sentence data to be converted according to the data identification corresponding to the file data in the extensible markup language file; splicing the to-be-converted structured query statement data to obtain spliced data, and converting the spliced data into temporary file data; converting the temporary file data into target file data in response to the data conversion instruction; and reading the target file data line by line, and replacing the to-be-converted structured query statement data with the target file data according to the data identification to obtain the converted file. By adopting the method, the structured query sentence data to be converted can be accurately extracted based on the data identification, and the structured query sentence data to be converted can be efficiently converted based on the data conversion instruction and the structured query sentence conversion service, so that the beneficial effect of improving the conversion efficiency of the financial service data is achieved.

Description

Data conversion method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of big data technology, and in particular, to a data conversion method, apparatus, computer device, storage medium, and computer program product.
Background
In the financial field, the financial business data is reasonably and effectively mined and analyzed, the utilization efficiency of the financial business data can be improved, high-value information in the financial business data is extracted, and due to the fact that the financial business data possibly has sensitivity, the data security of the financial business data needs to be improved by means of various means, for example, when a database related to the financial business data does not meet the security requirement, the related database needs to be replaced.
The traditional technology aims at the replacement of a database of a financial service system, particularly the conversion efficiency of SQL sentences in an XML file is low, the time cost for conversion is huge when facing a large amount of financial service data to be converted, and meanwhile, the traditional method also has the possibility of data conversion errors, so that the conversion efficiency of the financial service data is not improved.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a data conversion method, apparatus, computer device, computer-readable storage medium, and computer program product that can improve data conversion efficiency for financial business data.
In a first aspect, the present application provides a data conversion method, including:
extracting structured query sentence data to be converted from file data through an extensible markup language file analysis tool according to a data identifier corresponding to the file data in an extensible markup language file for financial services;
splicing the to-be-converted structured query statement data to obtain spliced data, and converting the spliced data into temporary file data in a binary byte stream form;
responding to a data conversion instruction, calling a structured query statement conversion service, and converting the temporary file data into target file data;
and reading the target file data line by line, and replacing the to-be-converted structured query sentence data in the extensible markup language file with the target file data according to the data identification to obtain a converted file aiming at the extensible markup language file.
In one embodiment, the method further comprises:
determining the extensible markup language file aiming at the financial service in a file searching path according to a preset file searching path;
and determining a file output path for the converted file according to the file path of the extensible markup language file.
In one embodiment, the determining the extensible markup language file for the financial service according to a preset file search path includes:
acquiring the file type of a first subdirectory corresponding to a root directory in the file search path;
under the condition that the file type of the first sub-directory is a folder, sequentially and step by step acquiring the file type of a second sub-directory corresponding to the first sub-directory until a target sub-directory with the file type of a markup extension markup language format is found, and taking the file corresponding to the target sub-directory as the extensible markup language file;
and under the condition that the file type of the first sub-directory is in a markup extensible markup language format, taking the file corresponding to the first sub-directory as the extensible markup language file.
In one embodiment, the determining the file output path for the converted file according to the file path of the extensible markup language file includes:
creating a first file path according to the root directory and the target subdirectory under the condition that the file type of the first subdirectory is a folder, and taking the first file path as a file output path for the converted file;
And under the condition that the file type of the first subdirectory is in a markup extensible markup language format, creating a second file path according to the root directory and the first subdirectory, and taking the second file path as a file output path for the converted file.
In one embodiment, the creating a first file path according to the root directory and the target subdirectory includes:
creating corresponding file output root catalogues and file output subdirectories step by step according to the file paths between the root catalogues and the target subdirectories;
and determining the first file path according to the file output root directory and the file output subdirectory.
In one embodiment, the method further comprises:
determining a target storage position corresponding to the converted file according to the file output path;
and storing the converted file in the target storage position.
In a second aspect, the present application further provides a data conversion apparatus, including:
the data extraction module is used for extracting the structured query sentence data to be converted from the file data through the extensible markup language file analysis tool according to the data identification corresponding to the file data in the extensible markup language file for the financial service;
The data splicing module is used for splicing the to-be-converted structured query statement data to obtain spliced data, and converting the spliced data into temporary file data in a binary byte stream form;
the data conversion module is used for responding to the data conversion instruction, calling the structured query statement conversion service and converting the temporary file data into target file data;
and the file conversion module is used for reading the target file data line by line, and replacing the structural query statement data to be converted in the extensible markup language file with the target file data according to the data identification to obtain a converted file aiming at the extensible markup language file.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory and a processor, the memory storing a computer program which, when executed by the processor, implements the steps of the method described above.
In a fourth aspect, the present application also provides a computer-readable storage medium. The computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the method described above.
In a fifth aspect, the present application also provides a computer program product. The computer program product comprising a computer program which, when executed by a processor, implements the steps of the method described above.
According to the data conversion method, the device, the computer equipment, the storage medium and the computer program product, the structural query statement data to be converted is extracted from the file data through the extensible markup language file analysis tool according to the data identification corresponding to the file data in the extensible markup language file for the financial service, so that the structural query statement data to be converted in the file data in the extensible markup language file for the financial service is accurately screened according to the data identification by utilizing the extensible markup language file analysis tool, and the subsequent conversion operation of all the structural query statement data to be converted is ensured; splicing the to-be-converted structured query statement data to obtain spliced data, converting the spliced data into temporary file data in a binary byte stream form, splicing the to-be-converted structured query statement data together, facilitating unified one-time form conversion (for example, conversion into a binary byte stream form) of the to-be-converted structured query statement data, and storing the obtained binary byte stream form data in a temporary file to obtain temporary file data; responding to the data conversion instruction, calling a structured query statement conversion service, and converting the temporary file data into target file data, so that the temporary file data is converted based on the data conversion instruction by combining the structured query statement conversion service to obtain the target file data; the method comprises the steps of reading target file data line by line, replacing to-be-converted structured query sentence data in an extensible markup language file with target file data according to data identification, obtaining a converted file aiming at the extensible markup language file, screening and extracting accurate to-be-converted structured query sentence data from the file data in the extensible markup language file aiming at financial service based on the data identification, splicing and converting the to-be-converted structured query sentence data into a binary byte stream form, and storing the binary byte stream form in a temporary file, obtaining temporary file data convenient for unified processing, further responding to a data conversion instruction, converting the temporary file data into the target file data by utilizing a structured query sentence conversion service, replacing the to-be-converted structured query sentence data with the target file data line by line, obtaining the converted file aiming at the extensible markup language file, realizing accurate extraction of the to-be-converted structured query sentence data based on the data identification, and performing high-efficiency conversion on the to-be-converted structured query sentence data based on the data conversion instruction and the structured query sentence conversion service, and achieving the beneficial effects of improving the conversion efficiency aiming at financial service data.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the related art, the drawings that are required to be used in the embodiments or the related technical descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to the drawings without inventive effort for a person having ordinary skill in the art.
FIG. 1 is a diagram of an application environment for a data conversion method in one embodiment;
FIG. 2 is a flow chart of a data conversion method according to an embodiment;
FIG. 3 is a flowchart of a data conversion method according to another embodiment;
FIG. 4 is a block diagram of a data conversion device according to one embodiment;
FIG. 5 is an internal block diagram of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
The data conversion method provided by the embodiment of the application can be applied to an application environment shown in fig. 1. Wherein the terminal 102 communicates with the server 104 via a network. The data storage system may store data that the server 104 needs to process. The data storage system may be integrated on the server 104 or may be located on a cloud or other network server. The server 104 extracts the structured query sentence data to be converted from the file data through an extensible markup language file analysis tool according to the data identifier corresponding to the file data in the extensible markup language file for the financial service; the server 104 splices the to-be-converted structured query statement data to obtain spliced data, and converts the spliced data into temporary file data in a binary byte stream form; the server 104 calls a structured query statement conversion service to convert the temporary file data into target file data in response to the data conversion instruction; the server 104 reads the target file data row by row, and replaces the to-be-converted structured query sentence data in the extensible markup language file with the target file data according to the data identification, so as to obtain a converted file aiming at the extensible markup language file. The terminal 102 may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, internet of things devices, and portable wearable devices. The portable wearable device may be a smart watch, smart bracelet, headset, or the like. The server 104 may be implemented as a stand-alone server or as a server cluster of multiple servers.
In an exemplary embodiment, as shown in fig. 2, a data conversion method is provided, and is illustrated by taking the application of the method to the server in fig. 1 as an example, it is understood that the method may also be applied to a terminal, and may also be applied to a system including the terminal and the server, and implemented through interaction between the terminal and the server. In this embodiment, the method includes the steps of:
step S202, extracting the structured query sentence data to be converted from the file data through an extensible markup language file analysis tool according to the data identification corresponding to the file data in the extensible markup language file for the financial service.
The financial business may refer to related services transacted in institutions such as banks, and in practical applications, the financial business may include, but is not limited to, deposit, withdrawal, maintenance and management of financial account data, and the like.
The extensible markup language file may refer to a file in an extensible markup language (Extensible Markup Language, XML) format, and the extensible markup language is a subset of a standard general markup language, may be used to mark data and define data types, is a source language allowing a user to define a markup language of the user, and specifically, the extensible markup language file may be represented as an XML file.
The file data may refer to data in an extensible markup language file, and in practical application, the file data in the extensible markup language file may include statement data of multiple types, and specifically, each statement data may be an element.
The data identifier may be a tag preset for each file data in the extensible markup language file, in practical application, the data identifier may be represented as an XML tag, and an attribute of the XML tag may be used to determine a data type of the file data.
The XML file parsing tool may be a tool for processing an XML file or an open source library (for example, dom4 j), and in practical application, the XML file parsing tool may perform operations such as reading and writing on the XML file.
The structured query statement data to be converted may refer to data to be converted in the file data, specifically, the structured query statement data may refer to statement data in a structured query language (Structured Query Language, SQL) format, and the structured query statement data may be represented as an SQL statement, specifically, the XML file may include a plurality of SQL statements to be converted.
As an example, to meet the requirement of financial business on data security, an original database (for example Oracle) needs to be replaced by a target database (for example Tidb), because an object relation mapping (Object Relational Mapping, ORM) framework mostly used by the existing system is Mybatis (a Java-based persistent layer framework), and Mybatis interacts with the database by using an XML file, in order to enable a system of the target database to be put into production and use as soon as possible, transformation and conversion of an SQL statement in the XML file are required, a server acquires a data identifier corresponding to file data in an extensible markup language file for the financial business, and the server determines whether each file data is structured query statement data (SQL statement) according to a data identifier corresponding to file data in the extensible markup language file for the financial business, and extracts the SQL statement from the file data as structured query statement data to be converted through an extensible markup language file parsing tool.
And S204, splicing the to-be-converted structured query statement data to obtain spliced data, and converting the spliced data into temporary file data in a binary byte stream form.
The spliced data may refer to data obtained by splicing together the structured query statement data to be converted.
Where binary byte stream form may refer to a data stream consisting of consecutive bytes, each byte in the data stream may consist of several binary bits.
The temporary file data may refer to data in a temporary file, and in practical application, the temporary file may refer to a file for storing data in a short time, specifically, after converting spliced data into a binary byte stream, the server may store the data obtained after converting into the binary byte stream in the temporary file.
As an example, after the server extracts the SQL statement as the structured query statement data to be converted from the file data, the server splices the SQL statement to obtain spliced data, the server converts the spliced data into a binary byte stream through a file IO (FileIO), to obtain byte stream data, and the server stores the byte stream data into a temporary file, where the byte stream data may refer to temporary file data in the temporary file.
Step S206, in response to the data conversion instruction, the structured query statement conversion service is called to convert the temporary file data into target file data.
The data conversion instruction may be an instruction triggered by a user (such as a staff member that maintains and reforms a database) and used for controlling the structured query statement conversion service to convert temporary file data.
The structured query term conversion service may refer to a tool and/or related service for performing conversion processing on temporary file data, and in practical application, the structured query term conversion service may be represented as an SQLines service.
The target file data may refer to data obtained by converting temporary file data.
As an example, in response to a data conversion instruction, the server invokes the SQLines service by using a SHELL command through a related program, inputs a temporary file to the SQLines service, the SQLines service performs conversion processing on temporary file data in the temporary file, the SQLines service outputs an intermediate file, and data obtained after conversion of the temporary file data may refer to target file data in the intermediate file.
Step S208, reading the target file data row by row, and replacing the to-be-converted structured query sentence data in the extensible markup language file with the target file data according to the data identification to obtain a converted file aiming at the extensible markup language file.
The converted file may be a file obtained by replacing the to-be-converted structured query sentence data in the extensible markup language file with the target file data.
As an example, the server reads the target file data in the target file row by row, the server inputs the target file data into a string buffer (a computer function capable of storing and operating character strings), and replaces the to-be-converted structured query statement data in the extensible markup language file with the target file data through the data identifier corresponding to the to-be-converted structured query statement data by the Dom4j, so as to obtain the converted file for the extensible markup language file.
According to the data conversion method, the structural query sentence data to be converted is extracted from the file data through the extensible markup language file analysis tool according to the data identification corresponding to the file data in the extensible markup language file for the financial service, so that the structural query sentence data to be converted in the file data in the extensible markup language file for the financial service is accurately screened out according to the data identification by utilizing the extensible markup language file analysis tool, and the follow-up conversion operation of all the structural query sentence data to be converted is ensured; splicing the to-be-converted structured query statement data to obtain spliced data, converting the spliced data into temporary file data in a binary byte stream form, splicing the to-be-converted structured query statement data together, facilitating unified one-time form conversion (for example, conversion into a binary byte stream form) of the to-be-converted structured query statement data, and storing the obtained binary byte stream form data in a temporary file to obtain temporary file data; responding to the data conversion instruction, calling a structured query statement conversion service, and converting the temporary file data into target file data, so that the temporary file data is converted based on the data conversion instruction by combining the structured query statement conversion service to obtain the target file data; the method comprises the steps of reading target file data line by line, replacing to-be-converted structured query sentence data in an extensible markup language file with target file data according to data identification, obtaining a converted file aiming at the extensible markup language file, screening and extracting accurate to-be-converted structured query sentence data from the file data in the extensible markup language file aiming at financial service based on the data identification, splicing and converting the to-be-converted structured query sentence data into a binary byte stream form, and storing the binary byte stream form in a temporary file, obtaining temporary file data convenient for unified processing, further responding to a data conversion instruction, converting the temporary file data into the target file data by utilizing a structured query sentence conversion service, replacing the to-be-converted structured query sentence data with the target file data line by line, obtaining the converted file aiming at the extensible markup language file, realizing accurate extraction of the to-be-converted structured query sentence data based on the data identification, and performing high-efficiency conversion on the to-be-converted structured query sentence data based on the data conversion instruction and the structured query sentence conversion service, and achieving the beneficial effects of improving the conversion efficiency aiming at financial service data.
In an exemplary embodiment, the method further comprises: according to a preset file searching path, determining an extensible markup language file aiming at financial service in the file searching path; a file output path for the converted file is determined based on the file path of the extensible markup language file.
The file searching path may be a preset file route and/or a folder route according to which the file searching path is used for searching and searching the extensible markup language file for the financial service.
The file path may refer to data characterizing a file storage location of an extensible markup language file, among other things.
The file output path may refer to data characterizing a file storage location of the converted file, among other things.
As an example, the server screens each file in the file search path layer by layer according to a preset file search path, so as to determine an extensible markup language file for financial services from the file search path, and in order to conveniently determine a storage position of the converted file, the server determines a file output path for the converted file according to the file path of the extensible markup language file.
In the embodiment, an extensible markup language file aiming at financial service in a file search path is determined according to a preset file search path; according to the file path of the extensible markup language file, the file output path aiming at the converted file is determined, all files in the file search path can be screened layer by layer according to the preset file search path, and the extensible markup language file is ensured not to be omitted, so that the file needing data conversion is ensured to be comprehensively and accurately searched, and the beneficial effect of improving the conversion efficiency aiming at financial service data is achieved.
In some embodiments, determining the extensible markup language file for the financial service in the file search path according to a preset file search path includes: acquiring a file type of a first subdirectory corresponding to a root directory in a file search path; under the condition that the file type of the first sub-directory is a folder, sequentially and step by step acquiring the file type of the second sub-directory corresponding to the first sub-directory until a target sub-directory with the file type of a markup extensible markup language format is found, and taking the file corresponding to the target sub-directory as an extensible markup language file; and under the condition that the file type of the first subdirectory is in the extensible markup language format, taking the file corresponding to the first subdirectory as an extensible markup language file.
The root directory may refer to the uppermost level directory of the logical drive, which is opposite to the subdirectory, and in practical application, the root directory may refer to the first level directory in the file search path, for example, the file search path may be denoted as D: file\data\001. Xml, then the root directory may refer to the D disk.
The first subdirectory may refer to a subdirectory corresponding to the root directory, for example, the file search path may be denoted as D: file \data\001.Xml, then the first subdirectory may refer to a file folder.
The file type may refer to information that characterizes an extension of a file corresponding to the root directory and/or a file corresponding to the subdirectory.
Wherein, the file type is a folder may refer to a sub-directory file type is a folder, wherein, a folder may refer to a data structure for organizing and managing disk files.
The second subdirectory may refer to a subdirectory corresponding to the first subdirectory, for example, the file search path may be represented as D: file\data\001. Xml, then the second subdirectory may refer to the data folder.
Wherein the file type is in a markup extensible markup language format may refer to a file in which the file type of the subdirectory is in a markup extensible markup language format.
The target subdirectory may be a subdirectory in which the markup extensible markup language file is located.
The file corresponding to the target sub-directory may refer to a file at a file storage location corresponding to the target sub-directory.
As an example, the server determines a first sub-directory corresponding to the root directory in the file search path, in an actual application, the root directory may correspond to a plurality of first sub-directories, the server acquires the file type of the first sub-directory, in the case that the file type of the first sub-directory is a folder, the server sequentially acquires the file type of a second sub-directory corresponding to the first sub-directory step by step until a target sub-directory with the file type being in a markup language format is found, the file corresponding to the target sub-directory is used as an extensible markup language file, for example, the second sub-directory corresponding to the first sub-directory may be represented as B1, B2 and B3, in the case that the file type of the first sub-directory is a folder, the server acquires the file types of the second sub-directories B1, B2 and B3 respectively, in the case that the file type of the B1 is a folder, the server determines the sub-directories C1 and C2 of the B1 as a third sub-directory, determines the file corresponding to the target sub-directory with the target sub-directory as a markup language file, and in the specific markup language format is marked by step until the file type of the third sub-directory is a specific markup language, and the file corresponding to the C2 is in a specific markup language format is marked as the extension language; and the server takes the file corresponding to the first sub-directory as the extensible markup language file under the condition that the file type of the first sub-directory is in the extensible markup language format.
In this embodiment, the file type of the first subdirectory corresponding to the root directory in the file search path is obtained; under the condition that the file type of the first sub-directory is a folder, sequentially and step by step acquiring the file type of the second sub-directory corresponding to the first sub-directory until a target sub-directory with the file type of a markup extensible markup language format is found, and taking the file corresponding to the target sub-directory as an extensible markup language file; under the condition that the file type of the first subdirectory is in a markup extensible markup language format, the file corresponding to the first subdirectory is used as an extensible markup language file, each subdirectory in a file searching path can be screened step by step, an accurate extensible markup language file is determined according to the file type, data support is provided for subsequent data conversion, and the beneficial effect of improving the conversion efficiency of financial service data is achieved.
In some embodiments, determining a file output path for the converted file from the file path of the extensible markup language file comprises: under the condition that the file type of the first subdirectory is a folder, creating a first file path according to the root directory and the target subdirectory, and taking the first file path as a file output path for the converted file; in the case that the file type of the first subdirectory is in a markup extensible markup language format, a second file path is created according to the root directory and the first subdirectory, and the second file path is used as a file output path for the converted file.
The first file path may refer to a file output path corresponding to the converted file when the file type representing the first subdirectory is a folder.
The second file path may refer to a file output path corresponding to the converted file when the file type representing the first subdirectory is in a markup extensible markup language format.
As an example, in order to facilitate management and maintenance of the converted file, it is required to ensure that the folder structure corresponding to the converted file is the same as the folder structure corresponding to the original file (i.e., the extensible markup language file), and in the process of performing hierarchical search on the file search path, when the file type of the first subdirectory is a folder, the server creates the first file path according to the root directory and the target subdirectory, specifically, the server uses the disk Fu Lujing representing the root directory to the target subdirectory as the first file path, and the server uses the first file path as the file output path for the converted file; when the file type of the first subdirectory is in a markup extensible markup language format, the server creates a second file path according to the root directory and the first subdirectory, and the server takes the second file path as a file output path for the converted file.
In this embodiment, when the file type of the first subdirectory is a folder, creating a first file path according to the root directory and the target subdirectory, and using the first file path as a file output path for the converted file; under the condition that the file type of the first subdirectory is in a markup extension markup language format, a second file path is created according to the root directory and the first subdirectory, and the second file path is used as a file output path for the converted file, so that the file output path of the converted file can be determined according to the root directory and the target subdirectory and/or the first subdirectory, and the converted file with the same structure as the folder of the original file is output, so that the converted file can be conveniently reviewed and searched, and the conversion efficiency for financial service data is improved.
In some embodiments, creating a first file path from the root directory and the target subdirectory includes: creating corresponding file output root catalogues and file output subdirectories step by step according to file paths between the root catalogues and target subdirectories; and determining a first file path according to the file output root directory and the file output subdirectory.
The file output root directory may refer to a root directory corresponding to a file output path of the converted file, for example, a file search path may be represented as D: file\data\001. Xml, the file path of the extensible markup language file can be represented as D: file \data\001.Xml, the file output path of the converted file can be denoted as D: file-x1\data-x1\001-x1. Xml, then the file output root directory may be referred to as a D disk.
The file output sub-directory may refer to a sub-directory corresponding to a file output path of the converted file, for example, a file search path may be represented as D: file\data\001. Xml, the file path of the extensible markup language file can be represented as D: file \data\001.Xml, the file output path of the converted file can be denoted as D: the file-x1\data-x1\001-x1. Xml, the file-output sub-directory may include a file-output first sub-directory, a file-output second sub-directory, and a file-output third sub-directory, wherein the file-output first sub-directory may be denoted as file-X1, the file-output second sub-directory may be denoted as data-X1, and the file-output third sub-directory may be denoted as 001-X1. Xml.
As an example, the server creates a corresponding file output root directory and a corresponding file output subdirectory step by step according to a file path between the root directory and a target subdirectory, specifically, each directory in the file path between the root directory and the target subdirectory needs to create a corresponding file output directory, the server creates the file output root directory according to the root directory corresponding to the file search path, in the case that the file type of the first subdirectory is a folder, the server creates the file output subdirectory according to the target subdirectory, and the directory between the root directory corresponding to the file search path and the target subdirectory also creates a corresponding file output intermediate directory; in the case where the file type of the first subdirectory is in a markup extensible markup language format, the server creates a file output subdirectory from the first subdirectory, and the server takes a disk Fu Lujing characterizing the file output root directory to the file output subdirectory as the first file path.
In the embodiment, corresponding file output root directory and file output subdirectories are created step by step according to the file path between the root directory and the target subdirectory; according to the file output root directory and the file output subdirectory, a first file path is determined, a corresponding file output directory can be created step by step according to the root directory to the target subdirectory, and then an accurate file output path is determined, so that the converted file is output to a corresponding position, the converted file is convenient to review, and the beneficial effect of improving the conversion efficiency of financial service data is achieved.
In some embodiments, the above method further comprises: determining a target storage position corresponding to the converted file according to the file output path; and storing the converted file in a target storage position.
Wherein the target storage location may refer to a path for storing the converted file.
As an example, the server determines, according to the file output path, a target storage location corresponding to the converted file, and specifically, the server may directly use a bottom directory corresponding to the file output path as the target storage location, and the server stores the converted file in the target storage location.
In the embodiment, the target storage position corresponding to the converted file is determined according to the file output path; the converted file is stored in the target storage position, and can be stored in the specific storage position based on the file output path, so that subsequent processing such as review and the like is convenient for the converted file, and the beneficial effect of improving the conversion efficiency of financial service data is achieved.
In some embodiments, as shown in fig. 3, a flow chart of a data conversion method is provided, a server performs hierarchical search on an extensible markup language file according to a file search path, so as to circularly read the extensible markup language file to be converted under the file search path, specifically, the server obtains a file type corresponding to a subdirectory of a current path (such as a root directory) in the file search path, when the file type is a folder, the server determines a part of a file output path according to the current path and the corresponding subdirectory, the server performs file search on the subdirectory corresponding to the subdirectory of the current path, obtains the file type of the subdirectory corresponding to the subdirectory of the current path until the file type is found to be in the extensible markup language format, the server can determine the file output path of the converted file according to the target subdirectory and root directory corresponding to the searched extensible markup language file in the file search path, the server screens and extracts the to-be-converted structured query sentence data from the file data in the extensible markup language file according to the data identification corresponding to each file data in the extensible markup language file through the extensible markup language file analysis tool, the server splices the to-be-converted structured query sentence data to obtain spliced data, the server converts the spliced data into temporary file data in the form of binary byte stream through FileIO and stores the temporary file data in the corresponding temporary file, the server responds to the data conversion instruction to convert the temporary file data into the target file data through blocking and calling the SQLines tool, in particular, the server inputs the temporary file into the SQLines tool, the method comprises the steps that an intermediate file output by an SQLines tool is obtained, the intermediate file comprises converted target file data, a server reads the intermediate file line by line and inputs the intermediate file into a StringBuffer, and data identifiers corresponding to file data in the StringBuffer and the extensible markup language file are spliced through a Dom4j, so that to-be-converted structured query statement data in the extensible markup language file are replaced by the target file data, a converted file for the extensible markup language file is obtained, and the server stores the converted file in a corresponding target storage position according to a file output path.
In this embodiment, by searching the extensible markup language file under the file search path, extracting, splicing and converting the to-be-converted structured query sentence data in the extensible markup language file to obtain a converted file, and storing the converted file in the target storage location, the file under the specified reconstruction path can be conveniently converted, and the converted file with the same folder structure as the original file is output, so that the conversion efficiency of the financial service data is improved.
In some embodiments, when data analysis and mining are performed on financial data, in order to meet the security requirement of the financial data, an original foreign database Oracle can be replaced by a domestic database Tidb, most of the existing (financial business) systems use an ORM framework as Mybatis, and Mybatis interacts with the database in an XML file mode, so that a system replacing a new database (such as the domestic database Tidb) can be put into production and used as soon as possible, SQL sentences in XML files need to be modified, a server acquires a preset file search path, the server performs hierarchical recursive search on a folder path needing to be modified in batches according to the file search path, and judges whether each sub-directory in the file search path is a folder or an XML file step by step, if the file type of a certain sub-directory is a folder, the server creates an output folder corresponding to the certain sub-directory, and sets the certain sub-directory as a writing path, so that the structure of the output folder corresponding to the converted XML file is consistent with the structure of the original folder input, and the secondary directory does not need to be adjusted and the efficiency is improved; if the file type of a subdirectory is an XML file, the server executes an automatic conversion process of the XML file, specifically, the server extracts elements of SQL attributes in the XML file as structured query statement data to be converted according to data identifiers corresponding to file data in the XML file, the server executes splicing operation on the structured query statement data to be converted to obtain spliced data, the server changes the spliced data into a binary byte stream form and temporarily stores the spliced data into the file data in a temporary file, the server calls SQLines service by using a SHELL command, takes the temporary file as input and acquires an output file, the server reads the output file line by line, reads a result and outputs the read result to a StringBuffer, namely, the server replaces the structured query statement data to be converted in the original XML file with the target file data (namely, the target file data obtained after splicing is in the XML file), the converted XML file is converted, the server stores the corresponding to the output file in a corresponding to the XML file in a corresponding way of the XML file, and performs the same as the XML file label, and the label can be obtained by performing the conversion label, for example, the SQL label is carried out in the XML file corresponding to the XML file after the output file is subjected to the label is correspondingly modified; it will be appreciated that the processing of data is performed by mybatis framework, data is written in sql statement without explicit requirement in xml file, data is written in sql by variable mode, data loading can be realized by mybatis framework binding variable, it is feasible to directly write variable in sql and put it into sqlines conversion, because sqlines will treat variable as text and put variable into original position or corresponding method, for example when oracle is used as database, statement in xml is select from tables where name =substr (# { variable },0, 4), then select from tables where name =substr (# -, variable #, 1, 4) after conversion.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a data conversion device for realizing the above related data conversion method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in the embodiments of the data conversion device or devices provided below may refer to the limitation of the data conversion method hereinabove, and will not be repeated herein.
In an exemplary embodiment, as shown in fig. 4, there is provided a data conversion apparatus including: a data extraction module 402, a data stitching module 404, a data conversion module 406, and a file conversion module 408, wherein:
the data extraction module 402 is configured to extract, according to a data identifier corresponding to file data in an extensible markup language file for a financial service, structured query sentence data to be converted from the file data through an extensible markup language file parsing tool.
And the data splicing module 404 is configured to splice the to-be-converted structured query sentence data to obtain spliced data, and convert the spliced data into temporary file data in the form of binary byte stream.
The data conversion module 406 is configured to invoke a structured query statement conversion service in response to a data conversion instruction, and convert the temporary file data into target file data.
The file conversion module 408 is configured to read the target file data line by line, and replace the to-be-converted structured query sentence data in the extensible markup language file with the target file data according to the data identifier, so as to obtain a converted file for the extensible markup language file.
In an exemplary embodiment, the apparatus further includes a path generation module, where the path generation module is specifically configured to determine, according to a preset file search path, the extensible markup language file for the financial service in the file search path; and determining a file output path for the converted file according to the file path of the extensible markup language file.
In an exemplary embodiment, the path generating module is specifically further configured to obtain a file type of a first subdirectory corresponding to a root directory in the file search path; under the condition that the file type of the first sub-directory is a folder, sequentially and step by step acquiring the file type of a second sub-directory corresponding to the first sub-directory until a target sub-directory with the file type of a markup extension markup language format is found, and taking the file corresponding to the target sub-directory as the extensible markup language file; and under the condition that the file type of the first sub-directory is in a markup extensible markup language format, taking the file corresponding to the first sub-directory as the extensible markup language file.
In an exemplary embodiment, the path generating module is specifically further configured to, when the file type of the first subdirectory is a folder, create a first file path according to the root directory and the target subdirectory, and use the first file path as a file output path for the converted file; and under the condition that the file type of the first subdirectory is in a markup extensible markup language format, creating a second file path according to the root directory and the first subdirectory, and taking the second file path as a file output path for the converted file.
In an exemplary embodiment, the path generating module is specifically further configured to create a corresponding file output root directory and a file output subdirectory step by step according to a file path between the root directory and the target subdirectory; and determining the first file path according to the file output root directory and the file output subdirectory.
In an exemplary embodiment, the path generating module is specifically further configured to determine, according to the file output path, a target storage location corresponding to the converted file; and storing the converted file in the target storage position.
The respective modules in the above-described data conversion apparatus may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one exemplary embodiment, a computer device is provided, which may be a terminal, and an internal structure diagram thereof may be as shown in fig. 5. The computer device includes a processor, a memory, an input/output interface, a communication interface, a display unit, and an input means. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a data conversion method. The display unit of the computer device is used for forming a visual picture, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be a key, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in fig. 5 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In an embodiment, there is also provided a computer device comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the method embodiments described above when the computer program is executed.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when executed by a processor, carries out the steps of the method embodiments described above.
In an embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
It should be noted that, the user information (including, but not limited to, user equipment information, user personal information, etc.) and the data (including, but not limited to, data for analysis, stored data, presented data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use, and processing of the related data are required to meet the related regulations.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the various embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the various embodiments provided herein may include at least one of relational databases and non-relational databases. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic units, quantum computing-based data processing logic units, etc., without being limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples only represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the present application. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application shall be subject to the appended claims.

Claims (15)

1. A method of data conversion, the method comprising:
extracting structured query sentence data to be converted from file data through an extensible markup language file analysis tool according to a data identifier corresponding to the file data in an extensible markup language file for financial services;
splicing the to-be-converted structured query statement data to obtain spliced data, and converting the spliced data into temporary file data in a binary byte stream form;
Responding to a data conversion instruction, calling a structured query statement conversion service, and converting the temporary file data into target file data;
and reading the target file data line by line, and replacing the to-be-converted structured query sentence data in the extensible markup language file with the target file data according to the data identification to obtain a converted file aiming at the extensible markup language file.
2. The method according to claim 1, wherein the method further comprises:
determining the extensible markup language file aiming at the financial service in a file searching path according to a preset file searching path;
and determining a file output path for the converted file according to the file path of the extensible markup language file.
3. The method of claim 2, wherein the determining the extensible markup language file for the financial service in the file search path according to a preset file search path comprises:
acquiring the file type of a first subdirectory corresponding to a root directory in the file search path;
under the condition that the file type of the first sub-directory is a folder, sequentially and step by step acquiring the file type of a second sub-directory corresponding to the first sub-directory until a target sub-directory with the file type of a markup extension markup language format is found, and taking the file corresponding to the target sub-directory as the extensible markup language file;
And under the condition that the file type of the first sub-directory is in a markup extensible markup language format, taking the file corresponding to the first sub-directory as the extensible markup language file.
4. A method according to any one of claims 2 to 3, wherein said determining a file output path for said converted file from a file path of said extensible markup language file comprises:
creating a first file path according to the root directory and the target subdirectory under the condition that the file type of the first subdirectory is a folder, and taking the first file path as a file output path for the converted file;
and under the condition that the file type of the first subdirectory is in a markup extensible markup language format, creating a second file path according to the root directory and the first subdirectory, and taking the second file path as a file output path for the converted file.
5. The method of claim 4, wherein creating a first file path from the root directory and the target subdirectory comprises:
creating corresponding file output root catalogues and file output subdirectories step by step according to the file paths between the root catalogues and the target subdirectories;
And determining the first file path according to the file output root directory and the file output subdirectory.
6. The method according to claim 2, wherein the method further comprises:
determining a target storage position corresponding to the converted file according to the file output path;
and storing the converted file in the target storage position.
7. A data conversion device, the device comprising:
the data extraction module is used for extracting the structured query sentence data to be converted from the file data through the extensible markup language file analysis tool according to the data identification corresponding to the file data in the extensible markup language file for the financial service;
the data splicing module is used for splicing the to-be-converted structured query statement data to obtain spliced data, and converting the spliced data into temporary file data in a binary byte stream form;
the data conversion module is used for responding to the data conversion instruction, calling the structured query statement conversion service and converting the temporary file data into target file data;
and the file conversion module is used for reading the target file data line by line, and replacing the structural query statement data to be converted in the extensible markup language file with the target file data according to the data identification to obtain a converted file aiming at the extensible markup language file.
8. The apparatus of claim 7, further comprising a path generation module configured to determine the extensible markup language file for the financial service in a file search path according to a preset file search path; and determining a file output path for the converted file according to the file path of the extensible markup language file.
9. The apparatus of claim 8, wherein the path generation module is configured to obtain a file type of a first subdirectory corresponding to a root directory in the file search path; under the condition that the file type of the first sub-directory is a folder, sequentially and step by step acquiring the file type of a second sub-directory corresponding to the first sub-directory until a target sub-directory with the file type of a markup extension markup language format is found, and taking the file corresponding to the target sub-directory as the extensible markup language file; and under the condition that the file type of the first sub-directory is in a markup extensible markup language format, taking the file corresponding to the first sub-directory as the extensible markup language file.
10. The apparatus according to any one of claims 8 to 9, wherein the path generation module is configured to create a first file path as a file output path for the converted file according to the root directory and the target subdirectory, in a case where a file type of the first subdirectory is a folder; and under the condition that the file type of the first subdirectory is in a markup extensible markup language format, creating a second file path according to the root directory and the first subdirectory, and taking the second file path as a file output path for the converted file.
11. The apparatus of claim 10, wherein the path generation module is configured to create the corresponding file output root directory and file output subdirectory step by step according to a file path between the root directory and the target subdirectory; and determining the first file path according to the file output root directory and the file output subdirectory.
12. The apparatus of claim 8, wherein the path generation module is configured to determine, according to the file output path, a target storage location corresponding to the converted file; and storing the converted file in the target storage position.
13. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 6 when the computer program is executed.
14. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
15. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
CN202311497010.6A 2023-11-10 2023-11-10 Data conversion method, device, computer equipment and storage medium Pending CN117421365A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311497010.6A CN117421365A (en) 2023-11-10 2023-11-10 Data conversion method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311497010.6A CN117421365A (en) 2023-11-10 2023-11-10 Data conversion method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117421365A true CN117421365A (en) 2024-01-19

Family

ID=89522813

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311497010.6A Pending CN117421365A (en) 2023-11-10 2023-11-10 Data conversion method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117421365A (en)

Similar Documents

Publication Publication Date Title
AU2014233672B2 (en) System for metadata management
CN112036736A (en) Workflow creating method and device
CN111061475B (en) Software code generating method, device, computer equipment and storage medium
CN106844682A (en) Method for interchanging data, apparatus and system
US10691556B2 (en) Recovering a specified set of documents from a database backup
US20170010869A1 (en) Multistage customizing of web-based application in a browser independent of platform and operating system
CN106648569B (en) Target serialization realization method and device
CN115544183A (en) Data visualization method and device, computer equipment and storage medium
CN112100182A (en) Data warehousing processing method and device and server
CN113962597A (en) Data analysis method and device, electronic equipment and storage medium
US9710337B1 (en) Systems and methods for restoring web parts in content management systems
CN117171108A (en) Virtual model mapping method and system
CN106547438B (en) Method and device for checking electronic notes
CN114780497B (en) Batch file processing method, apparatus, computer device, medium, and program product
CN117421365A (en) Data conversion method, device, computer equipment and storage medium
US20140379762A1 (en) Content management system
US9471569B1 (en) Integrating information sources to create context-specific documents
JP2018109898A (en) Data migration system
US8818955B2 (en) Reducing storage costs associated with backing up a database
Fang et al. Research on Distributed Storage Method for Big Data of Geological and Mineral Resources Based on Hadoop
US9286372B2 (en) Content management with RDBMS
CN103440289B (en) The incompatible label parallel search of webpage method based on MapReduce
CN116775649A (en) Data classified storage method and device, computer equipment and storage medium
CN117290359A (en) Report processing method, report processing device, report processing equipment, report processing medium and report processing computer program product
CN117951223A (en) Data synchronization method, device, computer equipment and storage medium

Legal Events

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