File conversion method and device, computer device and computer readable storage medium
By receiving the disk path, decompressing the file, and automatically querying plugin information, the system solves the error problem caused by manual operation in file conversion, thus improving efficiency and accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- PINGAN YIQIANBAO E COMMERCE CO LTD
- Filing Date
- 2022-11-08
- Publication Date
- 2026-05-15
AI Technical Summary
In existing technologies, file conversion requires a lot of manual processing, which is prone to query and input errors, resulting in low efficiency and poor accuracy.
By receiving the disk path, decompressing the file to be converted, extracting version data as identification information, automatically querying and pulling plugin information from the repository, and generating the target file, manual operation is avoided.
It improves the efficiency and accuracy of file conversion and reduces human error.
Smart Images

Figure CN115687247B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet technology, and in particular to a file conversion method, apparatus, computer device, and computer-readable storage medium. Background Technology
[0002] With the continuous advancement of internet technology, most enterprise projects now utilize microservices and employ project management tools like Maven or open-source tools like Gradle for automated project builds. However, some older projects still use the traditional method of referencing specific JAR files within the project itself.
[0003] In related technologies, developers need to check the version of the JAR file in various code snippets, then query the corresponding Maven version from the public Maven repository to complete the file conversion.
[0004] In the process of developing this application, the applicant discovered that the relevant technology has at least the following problems:
[0005] File conversion requires a lot of manual processing. A project often contains hundreds of JAR files, which increases the workload. A lot of manual processing is prone to human errors such as query errors and input errors, which leads to low efficiency and poor accuracy in file conversion. Summary of the Invention
[0006] In view of this, this application provides a file conversion method, apparatus, computer device, and computer-readable storage medium, the main purpose of which is to solve the problem that current manual processing is prone to human errors such as query errors and input errors, which leads to low efficiency and poor accuracy in file conversion.
[0007] According to a first aspect of this application, a file conversion method is provided, the method comprising:
[0008] Receive the disk path, and read the list of files to be converted based on the disk path. The list of files to be converted contains multiple files to be converted.
[0009] Decompress each of the files to be converted, extract the display file from the decompressed files to be converted, and read the version data stored in the display file as the identification information of the file to be converted. The version data includes the package name and version number.
[0010] Based on the identification information, determine the corresponding plugin list in the repository, and pull the plugin information indicated by the plugin list to obtain the target plugin information that matches the identification information;
[0011] Record the target plugin information to obtain the target file corresponding to the file to be converted.
[0012] According to a second aspect of this application, a document conversion apparatus is provided, the apparatus comprising:
[0013] A receiving module is used to receive a disk path and read a list of files to be converted based on the disk path, wherein the list of files to be converted contains multiple files to be converted.
[0014] The decompression module is used to decompress each of the files to be converted, extract the display file from the decompressed files to be converted, and read the version data stored in the display file as the identification information of the files to be converted. The version data includes the package name and version number.
[0015] The pull module is used to determine the corresponding plugin list in the repository according to the identification information, and pull the plugin information indicated by the plugin list to obtain the target plugin information that matches the identification information;
[0016] The recording module is used to record the target plugin information and obtain the target file corresponding to the file to be converted.
[0017] According to a third aspect of this application, a computer device is provided, including a storage device, a processor, and a computer program stored on the storage device and executable on the processor, wherein the processor executes the program to implement the steps of any of the methods described in the first aspect above.
[0018] According to a fourth aspect of this application, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described in any of the first aspects above.
[0019] By employing the above technical solution, this application provides a file conversion method, apparatus, computer device, and computer-readable storage medium. This application first receives a disk path and reads multiple files to be converted from a list of files to be converted based on the disk path. Then, each file to be converted is decompressed, and a display file is extracted from the decompressed file. The version data stored in the display file, i.e., the package name and version number, is read as the identification information of the file to be converted. Next, according to the identification information, the corresponding plugin list is determined in the repository, and the plugin information indicated by the plugin list is retrieved to obtain the target plugin information matching the identification information. Finally, the target plugin information is recorded to obtain the target file corresponding to the file to be converted. By automatically querying the repository for the corresponding plugin information using the identification information of the file to be converted, the target file corresponding to the file to be converted is obtained, avoiding human error caused by manual file conversion and improving the efficiency and accuracy of file conversion.
[0020] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0021] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0022] Figure 1 This illustration shows a schematic flowchart of a file conversion method provided in an embodiment of this application;
[0023] Figure 2A This illustration shows a schematic flowchart of a file conversion method provided in an embodiment of this application;
[0024] Figure 2B This illustration shows a schematic flowchart of a file conversion method provided in an embodiment of this application;
[0025] Figure 2C This illustration shows a schematic flowchart of a file conversion method provided in an embodiment of this application;
[0026] Figure 2D This illustration shows a schematic flowchart of a file conversion method provided in an embodiment of this application;
[0027] Figure 3A This paper shows a schematic diagram of the structure of a file conversion device provided in an embodiment of this application;
[0028] Figure 3B This paper shows a schematic diagram of the structure of a file conversion device provided in an embodiment of this application;
[0029] Figure 4 A schematic diagram of the device structure of a computer device provided in an embodiment of this application is shown. Detailed Implementation
[0030] Exemplary embodiments of the present application will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this application will be thorough and complete, and will fully convey the scope of the present application to those skilled in the art.
[0031] This application provides a file conversion method, such as... Figure 1As shown, the method includes:
[0032] 101. Receive the disk path, and read the list of files to be converted based on the disk path. The list of files to be converted contains multiple files to be converted.
[0033] It's important to note that this method applies to file conversion plugins. Taking a Go-language file conversion plugin as an example, the plugin's source code file can be `jar-to-pom.go`. The source code file is then compiled to generate an executable file. On Windows systems, you can directly double-click the executable file `jar-to-pom.exe` to launch the plugin. This method uses a plugin to perform batch conversion of JAR files, transforming multiple JAR files from an old project into POM files for a new project. Here, POM (Project Object Model) is Maven's description of a single project; that is, POM is the core of Maven, implementing and driving this model-based build approach.
[0034] In this embodiment, considering that the JAR files referenced by the old project are all located in the libs directory of the project, the file conversion plugin can read all the JAR files contained in the project after the storage path of the libs folder, i.e., the disk path, is input to the file conversion plugin. Specifically, the file conversion plugin receives the disk path and reads the list of files to be converted according to the disk path. The list of files to be converted contains multiple files to be converted, and this application does not specifically limit the number of files to be converted stored in the list of files to be converted.
[0035] 102. Unzip each file to be converted, extract the display file from the unzipped file, and read the version data stored in the display file as the identification information of the file to be converted. The version data includes the package name and version number.
[0036] Furthermore, for each file to be converted, the file conversion plugin calls an existing decompression tool to decompress the file, resulting in multiple sub-files storing different data contents. Then, it identifies the display file, manifest.mt, among these sub-files, iterates through the data stored in manifest.mt, and reads the corresponding identification information of the file to be converted from the data stored in manifest.mt.
[0037] 103. Based on the identification information, determine the corresponding plugin list in the repository, and pull the plugin information indicated by the plugin list to obtain the target plugin information that matches the identification information.
[0038] In this embodiment, the file conversion plugin uses the read identification information as keywords to automatically traverse and query the repository, and then stores the information identifiers of the plugin information to be retrieved in the plugin list. Further, it retrieves the plugin information indicated by the information identifiers from the plugin list in the repository. To avoid web page searches potentially loading other plugin information, after the plugin information is retrieved locally, it needs to be filtered to ultimately obtain the target plugin information that matches the identification information.
[0039] 104. Record the target plugin information to obtain the target file corresponding to the file to be converted.
[0040] In this embodiment, the file conversion plugin ultimately identifies the target plugin information, extracts the required information from the target plugin information and records it, thereby obtaining the required target pom file.
[0041] The method provided in this application first receives a disk path and reads multiple files to be converted from the list of files to be converted based on the disk path. Then, each file to be converted is decompressed, and a display file is extracted from the decompressed file. The version data stored in the display file, i.e., the package name and version number, is read as the identification information of the file to be converted. Next, according to the identification information, the corresponding plugin list is determined in the repository, and the plugin information indicated by the plugin list is retrieved to obtain the target plugin information matching the identification information. Finally, the target plugin information is recorded to obtain the target file corresponding to the file to be converted. By automatically querying the repository for the plugin information corresponding to the identification information of the file to be converted, and thus obtaining the target file corresponding to the file to be converted, the method avoids human error caused by manual file conversion and improves the efficiency and accuracy of file conversion.
[0042] This application provides a file conversion method, such as... Figure 2A As shown, the method includes:
[0043] 201. Receive the disk path and read the list of files to be converted based on the disk path. The list of files to be converted contains multiple files.
[0044] With the continuous advancement of internet technology, most enterprise projects now utilize microservices and employ project management tools like Maven or automated build tools like Gradle for compilation and packaging. However, some older projects still use the traditional method of referencing specific JAR files within the project. Currently, developers need to check the corresponding versions of the JAR files in various code snippets, then search for the corresponding Maven version in a public Maven repository to complete the file conversion. However, the applicant recognizes that file conversion requires a significant amount of manual processing. A single project often contains hundreds of JAR files, increasing the workload. Extensive manual processing is prone to errors such as query mistakes and input errors, leading to low efficiency and poor accuracy in file conversion.
[0045] Therefore, this application provides a file conversion method, apparatus, computer device, and computer-readable storage medium. This application first receives a disk path and reads multiple files to be converted from a list of files to be converted based on the disk path. Then, for each file to be converted, it decompresses it and determines the corresponding identification information in the file's display file. Next, according to the identification information, it determines the corresponding plugin list in a repository and retrieves the plugin information indicated by the plugin list to obtain the target plugin information matching the identification information. Finally, it records the target plugin information to obtain the target file corresponding to the file to be converted. By automatically querying the repository for the corresponding plugin information using the identification information of the file to be converted, the target file corresponding to the file to be converted is obtained, avoiding human error caused by manual file conversion and improving the efficiency and accuracy of file conversion.
[0046] In this embodiment, it should be noted that the method is applicable to file conversion plugins, which enable batch conversion of JAR files, transforming JAR files from old projects into POM files for new projects. It should be noted that the file conversion plugin can be written in Go or Java; this application does not specifically limit the scripting language used. In actual operation, considering the ability to compile Go source code files into cross-platform executables, this embodiment uses a Go-written file conversion plugin as an example. The source code file for the file conversion plugin can be jar-to-pom.go. Subsequently, the source code file of the file conversion plugin is compiled to generate an executable file. This executable file can be an .exe file for Windows systems or an .sh file for Linux systems.
[0047] The file conversion method provided in this application is applicable to file conversion plugins, such as... Figure 2BAs shown, considering that the JAR files referenced in the old project are all located in the libs directory of the project, the storage path of the libs folder is sent as the disk path to the file conversion plugin. The file conversion plugin receives the disk path and reads the list of files to be converted according to the location indicated by the disk path. The list of files to be converted contains all the JAR files required by the project. This application does not specifically limit the number of files to be converted stored in the list of files to be converted. Further, each JAR file in the list of files to be converted is processed in a loop. Specifically, the file conversion plugin inputs each JAR folder into the valid file detection module for validity checks. After the JAR file passes the validity check, it is input into the JAR file processing module for file conversion to obtain the corresponding target file. After all the JAR files stored in the list of files to be converted have been converted, the loop processing ends, and all the target files corresponding to the project are obtained.
[0048] 202. Perform a validity check on each file to be converted.
[0049] In this embodiment of the application, in order to ensure the system operation security of the business execution system, the file conversion plugin needs to call the legal file detection module to perform legality detection on each file to be converted before converting the file to be converted.
[0050] First, for each file to be converted, the file conversion plugin calls the legitimate file detection module to perform content detection, format detection, and virus detection on the file, determining the content detection sub-result, format detection sub-result, and virus detection sub-result for the file to be converted. Specifically, as follows... Figure 2CAs shown, after the file conversion plugin inputs the JAR file into the validity detection module, when the validity detection module performs content detection, it reads the file to be converted and determines the coordinates of the plugin organization information G: groupid, plugin project name A: artifactid, plugin version number V: version, and the storage status of the specified file. It should be noted that the storage status is "existent" only if the coordinates of the plugin organization information, plugin project name, plugin version number, and the specified file's class file all exist; otherwise, the storage status is "non-existent." When the storage status meets the preset storage status (existence status), a content detection sub-result indicating normal performance is generated; otherwise, a content detection sub-result indicating anomaly is generated. In other words, a content detection sub-result indicating normal performance is only generated when the coordinates of the plugin organization information, plugin project name, plugin version number, and the specified file all exist. When performing format detection, the file conversion plugin reads the file extension of the file to be converted. If the extension meets the preset .jar extension, a format detection sub-result indicating normal performance is generated; otherwise, a format detection sub-result indicating anomaly is generated. Format detection checks whether the file to be converted has a .jar extension; only .jar files can be converted. During virus detection, the file virus scanning module scans the file to be converted. If the virus scanning module outputs a result indicating no viruses, a sub-result indicating a normal virus detection is generated; otherwise, a sub-result indicating an abnormal virus detection is generated.
[0051] Furthermore, when all the content detection sub-results, format detection sub-results, and virus detection sub-results indicate that the file to be converted is normal, a detection result is generated to indicate that the file to be converted is normal; otherwise, a detection result is generated to indicate that the file to be converted is abnormal.
[0052] Finally, the detection results of the file to be converted are identified. If the detection result indicates that the file to be converted is normal, it is input into the jar file processing module for file conversion to obtain the target file corresponding to the file to be converted, which is to execute step 203 below. If the detection result indicates that the file to be converted is abnormal, an alarm message is generated and sent to the backend terminal for display. The alarm message is used to trigger the backend terminal to upload modification instructions for the file to be converted.
[0053] 203. After the test results indicate that the file to be converted is normal, decompress each file to be converted, extract the display file from the decompressed file to be converted, and read the version data stored in the display file as the identification information of the file to be converted.
[0054] Furthermore, after the detection results indicate that the file to be converted is normal, it is input into the JAR file processing module for file conversion. For each file to be converted, the file conversion plugin calls an existing decompression tool to decompress the file, resulting in multiple sub-files. Next, the file conversion plugin needs to find the display file, namely the manifest.mt file, among these sub-files. This manifest file defines data related to extensions and packages. Further, the plugin reads the stored package name and version number from the manifest.mt file as the identification information corresponding to the file to be converted.
[0055] 204. Based on the identification information, determine the corresponding plugin list in the repository, retrieve the plugin information indicated by the plugin list, obtain the target plugin information that matches the identification information, record the target plugin information, and obtain the target file corresponding to the file to be converted.
[0056] The file conversion plugin uses the read identifier information as keywords to automatically traverse and search the repository, then stores the identifiers of the plugin information to be retrieved in the plugin list. Further, it retrieves the plugin information indicated by the identifiers in the plugin list from the repository. To avoid web searches potentially loading other plugin information, the plugin information is filtered after being retrieved locally, ultimately resulting in the target plugin information that matches the identifier information.
[0057] Specifically, the plugin information is retrieved from the repository by package name and version number to generate a plugin list. Then, the plugin information indicated in the plugin list is retrieved from the repository. It should be noted that the repository includes the company's intranet private repository, the public network repository, and the public network central repository. Furthermore, considering that network searches may load information for other plugins, the file conversion plugin parses the plugin information in the returned plugin list, deletes plugin information that does not match the identifier information, and uses the remaining plugin information as the target plugin information.
[0058] 205. Record the target plugin information to obtain the target file corresponding to the file to be converted.
[0059] In this embodiment, the file conversion plugin will eventually identify the target plugin information, extract the required plugin organization information, plugin project name and plugin version number from the target plugin information and record them, thereby obtaining the required target pom file.
[0060] It should be noted that this method also includes a reverse verification step to validate the plugin list. Specifically, it checks whether the plugin list contains any data. If the plugin list does not contain any data, it means that the file conversion plugin did not retrieve the corresponding plugin information from the repository. In this case, the reason for the failure to retrieve the plugin information needs to be recorded. After the conversion of this group of JAR files is completed, the reason for the failure is returned to the backend terminal for display. In addition, relevant personnel can view which JAR files failed to convert and the corresponding reasons for failure in the backend terminal, and then troubleshoot the errors and re-convert the files based on the reasons for failure. If the plugin list contains data, it means that the plugin information corresponding to the file to be converted has been retrieved. At this time, the corresponding plugin information can be read and the file can be converted.
[0061] In summary, the conversion process for a single JAR file is as follows: Figure 2D As shown, the process first uses an existing decompression tool to decompress the file to be converted. Among the decompressed files, the manifest.mt file is located, and its package name and version number are read as identification information. Next, the corresponding plugin information is queried from the repository using the package name and version number to generate a plugin list. Then, the plugin information indicated by the plugin list is pulled from the repository. Subsequently, the plugin information in the returned plugin list is parsed, and plugins that do not match the identification information are deleted. The remaining plugin information is used as the target plugin information. Finally, the target plugin information is identified, and the required plugin organization information, plugin project name, and plugin version number are extracted and recorded to obtain the required target pom file. Simultaneously, a reverse verification step is set up to perform a reverse verification of the plugin list to determine whether the plugin information was pulled from the repository.
[0062] The method provided in this application first receives a disk path and reads multiple files to be converted from the list of files to be converted based on the disk path. Then, each file to be converted is decompressed, and a display file is extracted from the decompressed file. The version data stored in the display file, i.e., the package name and version number, is read as the identification information of the file to be converted. Next, according to the identification information, the corresponding plugin list is determined in the repository, and the plugin information indicated by the plugin list is retrieved to obtain the target plugin information matching the identification information. Finally, the target plugin information is recorded to obtain the target file corresponding to the file to be converted. By automatically querying the repository for the plugin information corresponding to the identification information of the file to be converted, and thus obtaining the target file corresponding to the file to be converted, the method avoids human error caused by manual file conversion and improves the efficiency and accuracy of file conversion.
[0063] Furthermore, as Figure 1To specifically implement the method, this application provides a file conversion device, such as... Figure 3A As shown, the device includes: a receiving module 301, a decompression module 302, a pulling module 303, and a recording module 304.
[0064] The receiving module 301 is used to receive a disk path and read a list of files to be converted according to the disk path, wherein the list of files to be converted contains multiple files to be converted.
[0065] The decompression module 302 is used to decompress each of the files to be converted, extract the display file from the decompressed files to be converted, and read the version data stored in the display file as the identification information of the files to be converted. The version data includes the package name and version number.
[0066] The pull module 303 is used to determine the corresponding plugin list in the repository according to the identification information, and pull the plugin information indicated by the plugin list to obtain the target plugin information that matches the identification information;
[0067] The recording module 304 is used to record the target plugin information and obtain the target file corresponding to the file to be converted.
[0068] In specific application scenarios, such as Figure 3B As shown, the device also includes a detection module 305 and a generation module 306.
[0069] The detection module 305 is used to perform legality detection on each of the files to be converted and generate detection results for each file to be converted. The legality detection includes content detection, format detection and virus detection.
[0070] The decompression module 302 is used to convert the file to be converted into the target file if the detection result indicates that the file to be converted is normal.
[0071] The generation module 306 is used to generate alarm information if the detection result indicates that the file to be converted is abnormal, and send the alarm information to the backend terminal for display. The alarm information is used to trigger the backend terminal to upload modification instructions for the file to be converted.
[0072] In a specific application scenario, the detection module 305 is used to call the legitimate file detection module to perform content detection, format detection, and virus detection on the file to be converted, and determine the content detection sub-result, format detection sub-result, and virus detection sub-result of the file to be converted; when all the content detection sub-result, format detection sub-result, and virus detection sub-result indicate that they are normal, a detection result indicating that the file to be converted is normal is generated; otherwise, a detection result indicating that the file to be converted is abnormal is generated.
[0073] In specific application scenarios, the detection module 305 is used to, when performing the content detection, read the file to be converted, determine the coordinate information of the plugin organization, plugin project name, plugin version number, and the storage state of the specified file in the file to be converted. If the storage state meets the preset storage state, a content detection sub-result indicating normal content is generated; otherwise, a content detection sub-result indicating abnormal content is generated. When performing the format detection, the module reads the file extension of the file to be converted. If the file extension meets the preset file extension, a format detection sub-result indicating normal format is generated; otherwise, a format detection sub-result indicating abnormal format is generated. When performing the virus detection, the module calls the file virus scanning module to scan the file to be converted. If the result output by the file virus scanning module indicates no virus, a virus detection sub-result indicating normal virus is generated; otherwise, a virus detection sub-result indicating abnormal virus is generated.
[0074] In a specific application scenario, the retrieval module 303 is used to query the plugin information corresponding to the identification information in the repository, generate the plugin list, and retrieve the plugin information indicated by the plugin list from the repository according to the plugin list. The repository includes a company intranet private server repository, a public network repository, and a public network central repository. The module parses the plugin information, deletes plugin information that does not match the identification information, and uses the remaining plugin information after deletion as the target plugin information.
[0075] In specific application scenarios, the retrieval module 303 is used to reverse verify the plugin list. If there is no data content in the plugin list, the reason for the failure to retrieve plugin information is recorded and the reason for the failure is returned to the backend terminal for display.
[0076] In a specific application scenario, the recording module 304 is used to identify the target plugin information, record the plugin organization information, plugin project name and plugin version number in the target plugin information, and store the plugin organization information, plugin project name and plugin version number as the target file.
[0077] The apparatus provided in this application first receives a disk path and reads multiple files to be converted from a list of files to be converted based on the disk path. Then, it decompresses each file to be converted, extracts a display file from the decompressed file, and reads the version data (package name and version number) stored in the display file as the identification information of the file to be converted. Next, according to the identification information, it determines the corresponding plugin list in the repository and retrieves the plugin information indicated by the plugin list to obtain the target plugin information matching the identification information. Finally, it records the target plugin information to obtain the target file corresponding to the file to be converted. By automatically querying the repository for the corresponding plugin information using the identification information of the file to be converted, and thus obtaining the target file corresponding to the file to be converted, it avoids human error caused by manual file conversion and improves the efficiency and accuracy of file conversion.
[0078] It should be noted that other corresponding descriptions of the functional units involved in the file conversion apparatus provided in this application embodiment can be found by referring to... Figure 1 and Figures 2A to 2D The corresponding description in [the document] will not be repeated here.
[0079] In an exemplary embodiment, see Figure 4 The invention also provides a device comprising a communication bus, a processor, a memory, and a communication interface, and may further include an input / output interface and a display device, wherein the various functional units can communicate with each other via the bus. The memory stores a computer program, and the processor executes the program stored in the memory to perform the file conversion method described in the above embodiments.
[0080] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the file conversion method described above.
[0081] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented in hardware or by using software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) and includes several instructions to cause a computer device (such as a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0082] Those skilled in the art will understand that the accompanying drawings are merely schematic diagrams of a preferred embodiment, and the modules or processes shown in the drawings are not necessarily essential for implementing this application.
[0083] Those skilled in the art will understand that the modules in the apparatus of the implementation scenario can be distributed within the apparatus of the implementation scenario as described, or they can be located in one or more apparatuses different from this implementation scenario, with corresponding changes. The modules of the above-described implementation scenario can be combined into one module, or they can be further divided into multiple sub-modules.
[0084] The serial numbers in this application are for descriptive purposes only and do not represent the superiority or inferiority of the implementation scenario.
[0085] The above disclosures are only a few specific implementation scenarios of this application. However, this application is not limited to these. Any variations that can be conceived by those skilled in the art should fall within the protection scope of this application.
Claims
1. A file conversion method, characterized in that, include: Receive disk path, read a list of files to be converted based on the disk path, the list of files to be converted contains multiple files to be converted, the files to be converted include jar files; Decompress each of the files to be converted, extract the display file from the decompressed files to be converted, and read the version data stored in the display file as the identification information of the file to be converted. The version data includes the package name and version number. Based on the identification information, determine the corresponding plugin list in the repository, and pull the plugin information indicated by the plugin list to obtain the target plugin information that matches the identification information; Record the target plugin information to obtain the target file corresponding to the file to be converted. The target file includes a pom file and includes at least plugin organization information, plugin project name, and plugin version number.
2. The method according to claim 1, characterized in that, After receiving the disk path and reading the list of files to be converted based on the disk path, the method further includes: Each of the files to be converted is subjected to a legality check, and a check result is generated for each file. The legality check includes content check, format check, and virus check. If the detection result indicates that the file to be converted is normal, then the file to be converted is converted into the target file; If the detection result indicates that the file to be converted is abnormal, an alarm message is generated and sent to the backend terminal for display. The alarm message is used to trigger the backend terminal to upload modification instructions for the file to be converted.
3. The method according to claim 2, characterized in that, The step of performing a validity check on each of the files to be converted and generating a check result for each file to be converted includes: The legitimate file detection module is invoked to perform content detection, format detection, and virus detection on the file to be converted, and to determine the content detection sub-result, format detection sub-result, and virus detection sub-result of the file to be converted. When the content detection sub-result, the format detection sub-result, and the virus detection sub-result all indicate that they are normal, a detection result is generated to indicate that the file to be converted is normal; otherwise, a detection result is generated to indicate that the file to be converted is abnormal.
4. The method according to claim 3, characterized in that, The process of performing content detection, format detection, and virus detection on the file to be converted, and determining the content detection sub-result, format detection sub-result, and virus detection sub-result for the file to be converted, includes: When performing the content detection, the file to be converted is read, and the coordinate information of the plugin organization information, plugin project name, plugin version number and the storage status of the specified file in the file to be converted are determined. When the storage status meets the preset storage status, a content detection sub-result to indicate normal is generated; otherwise, a content detection sub-result to indicate abnormality is generated. When performing the format detection, the file extension of the file to be converted is read. If the file extension meets the preset file extension, a format detection sub-result is generated to indicate that the format is normal; otherwise, a format detection sub-result is generated to indicate that the format is abnormal. When performing the virus detection, the file virus scanning module is invoked to scan the file to be converted. If the result output by the file virus scanning module indicates no virus, a virus detection sub-result indicating normal results is generated; otherwise, a virus detection sub-result indicating abnormal results is generated.
5. The method according to claim 1, characterized in that, The step of determining the corresponding plugin list in the repository according to the identification information, and retrieving the plugin information indicated by the plugin list to obtain the target plugin information matching the identification information includes: The plugin information matching the package name and version number is queried in the repository, the plugin list is generated, and the plugin information indicated by the plugin list is pulled from the repository according to the plugin list. The repository includes the company's intranet private server repository, public network repository, and public network central repository. The plugin information is parsed, plugin information that does not match the identification information is deleted, and the remaining plugin information after deletion is used as the target plugin information.
6. The method according to claim 5, characterized in that, Before parsing the plugin information, the method further includes: reverse-validating the plugin list; if there is no data content in the plugin list, recording the reason for the failure to retrieve the plugin information, and returning the reason for the failure to the backend terminal for display.
7. The method according to claim 1, characterized in that, The step of recording the target plugin information to obtain the target file corresponding to the file to be converted includes: identifying the target plugin information, recording the plugin organization information, plugin project name and plugin version number in the target plugin information, and storing the plugin organization information, plugin project name and plugin version number as the target file.
8. A file conversion device, characterized in that, include: A receiving module is used to receive a disk path and read a list of files to be converted based on the disk path. The list of files to be converted contains multiple files to be converted, including jar files. The decompression module is used to decompress each of the files to be converted, extract the display file from the decompressed files to be converted, and read the version data stored in the display file as the identification information of the files to be converted. The version data includes the package name and version number. The pull module is used to determine the corresponding plugin list in the repository according to the identification information, and pull the plugin information indicated by the plugin list to obtain the target plugin information that matches the identification information; The recording module is used to record the target plugin information and obtain the target file corresponding to the file to be converted. The target file includes a pom file and includes at least plugin organization information, plugin project name and plugin version number.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.