CN117472367B - Heterogeneous resource intelligent identification and access method, device, equipment and storage medium - Google Patents

Heterogeneous resource intelligent identification and access method, device, equipment and storage medium Download PDF

Info

Publication number
CN117472367B
CN117472367B CN202311812296.2A CN202311812296A CN117472367B CN 117472367 B CN117472367 B CN 117472367B CN 202311812296 A CN202311812296 A CN 202311812296A CN 117472367 B CN117472367 B CN 117472367B
Authority
CN
China
Prior art keywords
interface
information
call
interface information
access
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.)
Active
Application number
CN202311812296.2A
Other languages
Chinese (zh)
Other versions
CN117472367A (en
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.)
Zhongdian Data Industry Co ltd
Original Assignee
Zhongdian Data Industry 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 Zhongdian Data Industry Co ltd filed Critical Zhongdian Data Industry Co ltd
Priority to CN202311812296.2A priority Critical patent/CN117472367B/en
Publication of CN117472367A publication Critical patent/CN117472367A/en
Application granted granted Critical
Publication of CN117472367B publication Critical patent/CN117472367B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/36Software reuse
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/186Templates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/73Program documentation
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Library & Information Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a heterogeneous resource intelligent identification and access method, device, equipment and storage medium, wherein the method comprises the following steps: scanning class files under the appointed directory, and screening out class files belonging to interface classes to obtain at least one interface class file; then, obtaining interface information contained in each interface class file, and writing each interface information into a preset interface template to obtain an interface document; the interface document is configured based on a preset data structure; the interface document is then imported into the system project to access the plurality of interfaces to the system project. The scheme can access a plurality of interfaces of external engineering in batches, realizes automation of cross-system access, and improves the efficiency of interface access.

Description

Heterogeneous resource intelligent identification and access method, device, equipment and storage medium
Technical Field
The present disclosure relates to the field of data processing technologies, and in particular, to a method, an apparatus, a device, and a storage medium for intelligently identifying and accessing heterogeneous resources.
Background
With the development of big data, various business systems need to be in butt joint with more and more external systems so as to realize sharing and integration of data. For example, the government open service platform needs to interact with other institution department systems, enterprise systems or third party service systems, so as to obtain heterogeneous data from different sources, and further realize cross-system data sharing.
In the prior art, when a system accesses a plurality of application program development interfaces (Application Programming Interface, APIs, which are collectively called interfaces in the present application) of an external system, a technician often manually adds each interface information and sets rules, and the interface access efficiency is low.
Disclosure of Invention
The main purpose of the application is to provide a heterogeneous resource intelligent identification and access method, device, equipment and storage medium, so as to solve the problem of low interface access efficiency in the existing scheme.
In order to achieve the above objective, the present application provides a heterogeneous resource intelligent identification and access method, which includes:
scanning class files under the appointed directory, and screening out class files belonging to interface classes to obtain at least one interface class file;
acquiring interface information contained in each interface type file, and writing each interface information into a preset interface template to obtain an interface document; the interface document is configured based on a preset data structure;
the interface document is imported into a system project.
Optionally, the step of importing the interface document into a system project includes:
Uploading the interface document to a system import interface, analyzing interface information corresponding to each interface in the interface document by the system import interface, and writing each interface information into a database of a system project; the interface information comprises interface calling parameters;
after the step of importing the interface document into the system project, the method further comprises:
acquiring the interface call parameters from the database, and performing interface call test based on the interface call parameters to obtain a call test result of an interface corresponding to the interface call parameters;
if the calling test result is that the calling fails, generating failure prompt information;
and when receiving interface correction data returned by a user based on the failure prompt information, updating the interface information stored in the database based on the interface correction data.
Optionally, the step of performing the interface call test based on the interface call parameter to obtain a call test result of the interface corresponding to the interface call parameter includes:
when the interface is subjected to call testing, the flow of each port in the current environment is obtained;
Selecting a target port from a plurality of ports based on the traffic of each of the ports;
generating an interface call address based on the interface call parameter and the target port;
and calling the interface calling address to obtain a response result, and determining a calling test result of the interface based on the response result.
Optionally, the step of performing a call test on the interface corresponding to the interface call parameter based on the interface call parameter to obtain a call test result of the interface includes:
when the interface is subjected to call testing, the flow of each port in the current environment is obtained;
selecting a target port from a plurality of ports based on the traffic of each of the ports;
generating an interface call address based on the interface call parameter and the target port;
and calling the interface calling address to obtain a response result, and determining a calling test result of the interface based on the response result.
Optionally, before the step of selecting a target port from the plurality of ports based on the traffic of each of the ports, the method further comprises:
when the interface is subjected to call testing, acquiring a current time period;
Inputting the interface calling parameters and the current time period into a trained flow prediction model to obtain a flow prediction result;
the step of selecting a target port from a plurality of ports based on the traffic of each of the ports includes:
and selecting a port with port flow matched with the flow prediction result as a target port.
Optionally, before the step of writing each piece of interface information into a preset interface template to obtain an interface document, the method further includes:
carrying out integrity check on each interface information to obtain a check result;
if the verification result is incomplete, inputting the interface information into an interface information filling model to obtain the filled interface information;
updating the interface information based on the filled interface information.
Optionally, the heterogeneous resource intelligent identification and access method further comprises the following steps:
if the source code of any interface class file under the appointed directory is detected to be updated, acquiring updated content;
updating the interface information stored in the database based on the updating content.
Optionally, the step of writing each of the interface information to a database of system items includes:
When the interface information is written into the database, monitoring the writing execution condition of the interface information;
if any one of the interface information fails to be written, marking the interface information;
and after all other interface information is successfully written into the database, re-executing the writing operation of marked interface information until all the interface information is successfully written into the database.
The embodiment of the application also provides a heterogeneous resource intelligent identification and access device, which comprises:
the interface class acquisition module is used for scanning all class files under the appointed catalogue, screening out class files belonging to interface classes and obtaining all interface class files;
the information acquisition module is used for acquiring interface information contained in each interface type file, and writing each interface information into a preset interface template to obtain an interface document; the interface document is configured based on a preset data structure;
and the writing module is used for importing the interface document into a system project.
The embodiment of the application also provides a terminal device, which comprises a memory, a processor and a heterogeneous resource intelligent identification and access program stored on the memory and capable of running on the processor, wherein the heterogeneous resource intelligent identification and access program realizes the steps of the heterogeneous resource intelligent identification and access method when being executed by the processor.
The embodiment of the application also provides a computer readable storage medium, wherein the computer readable storage medium is stored with a heterogeneous resource intelligent identification and access program, and the heterogeneous resource intelligent identification and access program realizes the steps of the heterogeneous resource intelligent identification and access method when being executed by a processor.
The heterogeneous resource intelligent identification and access method, the heterogeneous resource intelligent identification and access device, the terminal equipment and the storage medium provided by the embodiment of the application are used for obtaining at least one interface class file by scanning class files under a designated directory and screening out class files belonging to the interface class; then, obtaining interface information contained in each interface class file, and writing each interface information into a preset interface template to obtain an interface document; the interface document is configured based on a preset data structure; the interface document is then imported into the system project to access the plurality of interfaces to the system project. The implementation method can access a plurality of interfaces of external engineering in batches, realize automation of cross-system access and improve the efficiency of interface access. Meanwhile, according to the embodiment, the interface information is written into the interface document with the preset data format, so that the rule of writing into system items is not required to be set for different types of interfaces, and the interface access efficiency is improved.
Drawings
Fig. 1 is a schematic diagram of a functional module of a terminal device to which a heterogeneous resource intelligent identification and access device belongs in the present application;
FIG. 2 is a flow chart of an exemplary embodiment of a heterogeneous resource intelligent identification and access method of the present application;
FIG. 3 is a schematic flow chart of another exemplary embodiment of a heterogeneous resource intelligent identification and access method of the present application;
FIG. 4 is a schematic flow chart of another exemplary embodiment of a heterogeneous resource intelligent recognition and access method of the present application;
fig. 5 is a flowchart of another exemplary embodiment of a heterogeneous resource intelligent recognition and access method of the present application.
The realization, functional characteristics and advantages of the present application will be further described with reference to the embodiments, referring to the attached drawings.
Detailed Description
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 main solutions of the embodiments of the present application are: all class files under the appointed directory are scanned, class files belonging to interface classes are screened out, and all interface class files are obtained; then, obtaining interface information contained in each interface class file, and writing each interface information into a preset interface template to obtain an interface document; the interface document is configured based on a preset data structure; the interface document is then imported into the system project to access the plurality of interfaces to the system project. According to the scheme, a plurality of interfaces of external engineering can be accessed in batches, automation of cross-system access is achieved, and the efficiency of interface access is improved.
Technical terms referred to in this application:
an application development interface (Application Programming Interface, API) refers to a number of pre-set functions or methods that allow third party programs to invoke data or provide data-based services over a network. APIs fall into many categories, such as: operating system APIs, web APIs, platform APIs, etc. For the Web API, it is an electronic interface that accesses the backend system via a network, which may contain some well-known Web standards (e.g., HTTP, XML, JSON, etc.). In this application, application development interfaces are collectively referred to as interfaces.
Reflection, a Reflection mechanism, is a feature of the Java language that allows a program to obtain class information, including class methods, properties, constructors, annotations, etc., at runtime without prior knowledge of the specific implementation of the class. By the reflection mechanism, the information of the class can be acquired at the running time of the program, and the method of the class can be called at the running time, the object can be created, and the like. Where the Method class is a reflection mechanism class for representing the Method of the class or interface. It contains metadata about the information of method name, parameter type, return type, access modifier, etc.
Swagger is a tool set for designing, building, documenting and consuming RESTful Web services, supporting multiple programming languages and Web services frameworks. After integrating Swagger, the project can identify information such as interface type, interface use, interface address and the like through notes.
In the related technical scheme, when multiple external interfaces are accessed across systems, because the interface information corresponding to each interface is different (for example, the data protocol adopted by each interface is different, the SOAP protocol is adopted by some interfaces, the HTTP protocol can be adopted by some interfaces, for example, each interface corresponds to different parameter information), the interface access across systems is often carried out by technicians aiming at each interface setting rule, and the interface access efficiency is low.
Based on the above, the embodiment of the application provides a solution, which can access a plurality of interfaces of external engineering in batches, realize the automation of cross-system access and improve the efficiency of interface access.
Specifically, referring to fig. 1, fig. 1 is a schematic functional block diagram of a terminal device to which a heterogeneous resource intelligent identification and access device of the present application belongs. The heterogeneous resource intelligent identification and access device can be a device which is independent of terminal equipment and can perform data processing, and can be borne on the terminal equipment in a form of hardware or software. The terminal device may include an electronic device with data processing capability, such as a mobile phone, a tablet computer, a server, and the like.
In this embodiment, the terminal device to which the heterogeneous resource intelligent recognition and access device belongs at least includes an output module 110, a processor 120, a memory 130 and a communication module 140.
The memory 130 stores an operating system and a heterogeneous resource intelligent recognition and access program, and the heterogeneous resource intelligent recognition and access device can store the acquired information such as interface information contained in each interface type file in the memory 130; the output module 110 may be a display screen, a speaker, etc. The communication module 140 may include a WIFI module, a mobile communication module, a bluetooth module, and the like, and communicates with an external device or a server through the communication module 140.
Wherein, the intelligent identification of heterogeneous resources and the access procedure in the memory 130 are executed by the processor, and the following steps are implemented:
scanning class files under the appointed directory, and screening out class files belonging to interface classes to obtain at least one interface class file;
acquiring interface information contained in each interface type file, and writing each interface information into a preset interface template to obtain an interface document; the interface document is configured based on a preset data structure;
the interface document is imported into the system project.
Further, the intelligent identification of heterogeneous resources and the access procedure in the memory 130 when executed by the processor further implement the following steps:
uploading the interface document to a system import interface, analyzing interface information corresponding to each interface in the interface document by the system import interface, and writing each interface information into a database of a system project; the interface information comprises interface calling parameters;
acquiring interface calling parameters from a database, and performing interface calling test based on the interface calling parameters to obtain a calling test result of an interface corresponding to the interface calling parameters;
if the calling test result is a calling failure, generating failure prompt information;
and when receiving the interface correction data returned by the user based on the failure prompt information, updating the interface information stored in the database based on the interface correction data.
Further, the intelligent identification of heterogeneous resources and the access procedure in the memory 130 when executed by the processor further implement the following steps:
when the ports are subjected to call testing, the flow of each port in the current environment is obtained;
selecting a target port from the plurality of ports based on the traffic of each port;
Generating an interface call address based on the interface call parameter and the target port;
and calling the interface call address to obtain response data, and determining a call test result of the interface based on the response data.
Further, the intelligent identification of heterogeneous resources and the access procedure in the memory 130 when executed by the processor further implement the following steps:
when the interface is subjected to call test, acquiring a current time period;
inputting the interface calling parameters and the current time period into a trained flow prediction model to obtain a flow prediction result;
and selecting a port with port flow matched with the flow prediction result as a target port.
Further, the intelligent identification of heterogeneous resources and the access procedure in the memory 130 when executed by the processor further implement the following steps:
carrying out integrity check on each interface information to obtain a check result;
if the checking result is incomplete, inputting the interface information into an interface information filling model to obtain the filled interface information;
and updating the interface information based on the filled interface information.
Further, the intelligent identification of heterogeneous resources and the access procedure in the memory 130 when executed by the processor further implement the following steps:
If the source code of any interface type file under the appointed directory is detected to be updated, acquiring updated content;
updating the interface information stored in the database based on the updated content.
Further, the intelligent identification of heterogeneous resources and the access procedure in the memory 130 when executed by the processor further implement the following steps:
when writing each interface information into the database, monitoring the writing execution condition of each interface information;
if any interface information fails to be written, marking the interface information;
and re-executing the writing operation of the marked interface information until all the interface information is successfully written into the database.
According to the scheme, the class files under the appointed directory are scanned, the class files belonging to the interface class are screened out, and at least one interface class file is obtained; then, obtaining interface information contained in each interface class file, and writing each interface information into a preset interface template to obtain an interface document; the interface document is configured based on a preset data structure; the interface document is then imported into the system project to access the plurality of interfaces to the system project. The implementation method can access a plurality of interfaces of external engineering in batches, realize automation of cross-system access and improve the efficiency of interface access. Meanwhile, according to the embodiment, the interface information is written into the interface document with the preset data format, so that the rule of writing into system items is not required to be set for different types of interfaces, and the interface access efficiency is improved.
Based on the above terminal device architecture, but not limited to the above architecture, the method embodiments of the present application are presented. The implementation main body of the embodiment of the method can be a heterogeneous resource intelligent identification and access device, and also can be terminal equipment, and the following embodiment takes the terminal equipment as an example.
Referring to fig. 2, fig. 2 is a flow chart illustrating an exemplary embodiment of a heterogeneous resource intelligent recognition and access method according to the present application. The heterogeneous resource intelligent identification and access method comprises the following steps:
step S101, scanning class files under a specified directory, and screening out class files belonging to interface classes to obtain at least one interface class file.
For example, the terminal device may be provided with an operation interface, and the user may input path information of the instruction directory based on the operation interface and click the run button to generate the import instruction. The terminal equipment can respond to the import instruction and operate the heterogeneous resource intelligent identification and access method based on the appointed directory path information contained in the import instruction. The heterogeneous resource intelligent identification and access method can be a script program pre-written by a developer, and the functions executed by the heterogeneous resource intelligent identification and access method can include, but are not limited to, scanning all class files under a specified directory, identifying interface class files, acquiring interface information in the interface class files and generating interface documents based on the interface information.
Further, the terminal device may package the heterogeneous resource intelligent identification and access method into a tool package (for example, jar package), and pre-cache the tool package to a specified directory. The intelligent identification and access method for the heterogeneous resources is managed through the tool kit, so that the whole removal after the interface is accessed is facilitated, the code integrity of a system project is ensured, and meanwhile, the system security guarantee is provided.
The specified directory may be an access side engineering directory, where the access side engineering directory may include class files corresponding to multiple heterogeneous interfaces, and the class files corresponding to the multiple heterogeneous interfaces are not all in the same programming language, interface protocol, and data format. Class files may contain definition information for classes, which may refer to a collection of methods or interfaces that have the same data members and function members. For example, an object defining an interface in java may define the interface by public class+interface name and generate a class file.
Specifically, the terminal device may parse the source code in each class file to obtain class information, and identify a class file belonging to the interface class based on the class information to obtain the interface class file.
As an example, the implementation manner of scanning all class files under the specified directory and screening out class files belonging to the interface class to obtain all interface class files may be: if the heterogeneous resource intelligent identification and access method is written through java language, the interface joining method can scan all kinds of file paths under the instruction directory by using a getresource method in a SpringFramework framework, then call a getModifiers method in java.
Step S102, obtaining interface information contained in each interface class file, and writing each interface information into a preset interface template to obtain an interface document.
In this embodiment, each interface class file corresponds to one interface object. For example, interface class file 1 corresponds to interface 1, and for example, interface class file 2 corresponds to interface 2.
Specifically, an interface class method may be included in the interface class file, and the interface class method may be used to indicate operations that may be performed by members of the class. The interface class methods may include, but are not limited to, method names of interface classes, interface base information, and interface parameter information. The terminal equipment can obtain interface information by analyzing each interface type method.
If the heterogeneous resource intelligent identification and access method adopts a springframe framework, the terminal device can acquire the annotation of the interface class method by executing the getactions method, and acquire the interface basic information and the interface parameter information based on the annotation content such as the Swagger identification Mapping. If the heterogeneous resource intelligent identification and access method adopts a Struct framework, the terminal equipment can acquire interface basic information and interface parameter information by executing Action Mapping.
The interface information may include interface basic information and interface parameter information. The interface base information may include, but is not limited to, interface encoding, interface ID, interface description, interface name, interface protocol type, interface request type, whether an interface is available, interface address, and service ID. The interface parameter information may include, but is not limited to, a parameter ID, an interface call parameter, a parameter description, a parameter default value, a parameter home type, a parameter name, a parameter type, a response representation, and a response preset value.
Further, after the terminal device obtains each interface information, the terminal device can obtain, for each interface information, interface call parameters (such as an in-parameter and an out-parameter return value) included in each interface information, sequence the interface call parameters into a JSON format, package the interface call parameters and other interface information in the JJSON format, and write the interface call parameters and other interface information into an interface document.
The interface document can be configured based on a preset data structure. The data structure may be used to indicate a structure of interface information corresponding to each interface object in the interface template, where the structure of interface information may include a data format corresponding to each information included in each interface information object. For example, if the interface information includes interface basic information and interface parameter information, the structure of the interface information may include a data format of the interface basic information and a data format of the interface parameter information. The structure of the interface information may be determined according to the data storage format of the database of system items. The data structure may be in an excel data format, for example. By designing the data format of the interface template, the data structure of the interface information of each interface is standardized, and the interface information is smoothly imported into the database of the system project.
Further, after obtaining the interface information, the terminal device may clean and rewrite the interface information into the interface template according to a preset cleaning rule.
Step S103, importing the interface document into the system project.
The system item may be an item corresponding to a system to be accessed to a plurality of interfaces. The item may be written in any programming language, for example, the item may be a java item written in the java language.
According to the scheme, the class files under the appointed directory are scanned, the class files belonging to the interface class are screened out, and at least one interface class file is obtained; then, obtaining interface information contained in each interface class file, and writing each interface information into a preset interface template to obtain an interface document; the interface document is configured based on a preset data structure; the interface document is then imported into the system project to access the plurality of interfaces to the system project. The scheme of the embodiment can access a plurality of interfaces of external engineering in batches, realize automation of cross-system access and improve the efficiency of interface access. Meanwhile, according to the scheme of the embodiment, the interface information is written into the interface document with the preset data format, so that the rule of writing into system items is not required to be set for different types of interfaces, and the interface access efficiency is improved.
Based on the above embodiment, the step of importing the interface document into the system item may include:
uploading the interface document to a system import interface, analyzing the interface information corresponding to each interface in the interface document by the system import interface, and writing each interface information into a database of the system project.
The interface information may include an interface call parameter.
Specifically, the system import interface is an interface of the system project for importing the interface document, the interface information in the imported interface document can be analyzed through the system import interface, so that the interface information corresponding to each interface is obtained, and each interface information is written into a database of the system project, so that when the external interface is called by the subsequent system project, the interface information of the corresponding interface can be obtained from the database, and interface calling is carried out based on the interface information.
In particular, the terminal device may write a plurality of interface information into a database of the system item in a synchronous or asynchronous manner, so as to access a plurality of interfaces of the external engineering to the system item.
Further, the database may include an interface information table and an interface parameter table. The terminal device may extract the interface basic information included in the interface information after obtaining the interface information, store the interface basic information corresponding to each interface in the interface information table one by one, use the interface ID in the interface basic information as a key, extract the interface parameter information included in the interface information, and store the interface ID and the interface parameter information corresponding to each interface in the interface parameter table. Therefore, when the interface information of each interface is called through the database, the interface basic information can be acquired from the interface information table through the interface ID, and the interface parameter information can be acquired from the interface parameter table through the interface ID.
Based on the above embodiment, the present embodiment may further include, after writing each interface information to the database of the system item:
if the source code of any interface type file under the appointed directory is detected to be updated, acquiring updated content;
updating the interface information stored in the database based on the updated content.
Specifically, the terminal device may perform system project management at the code level after importing the interface into the system. The administrator can set the access authority of the user, limit the viewing and editing operations of the user, and the authorized user can update the source codes of the interface class files under the appointed directory, so that the unified code management of the accessed interfaces and system items is realized, and the safe access is realized through the authority allocation.
Specifically, the terminal device may perform polling scan on the source code of the interface class file under the specified directory, determine whether the source code file is updated by using methods such as CRC redundancy check code, number of bytes of the file, and modification date, and if so, acquire the update content and synchronize the update content to the system item, and keep the file version before modification.
By means of the implementation mode, unified code management is conducted on the accessed interfaces and the system items, and when the source file codes of the access interfaces are detected to be updated, the updating contents are synchronized into the system items, so that the availability of the service interfaces is guaranteed.
Based on the above embodiment, the step of writing each of the interface information to the database of the system item may include:
when each interface information is written into the database, monitoring the writing execution condition of each interface information;
if any interface information fails to be written, marking the interface information;
and re-executing the writing operation of the marked interface information until all the interface information is successfully written into the database.
For network instability or other reasons, there may be a portion of the interface information that was not successfully written to the database when the interface information was written to the database of the system item. Therefore, in this embodiment, by monitoring the write execution condition of each interface information, when any one of the interface information fails to be written, the interface information is marked, and the write operation of the next interface information is continued until all the interface information corresponding to the interfaces has been written. After the writing operation is performed on all the interface information, the writing operation of the marked interface information is re-performed until all the interface information is successfully written into the database.
According to the embodiment, the writing execution condition of each interface information is monitored, and when any one interface information is not successfully written, the writing of the next interface information is directly processed, so that the program is prevented from being blocked on a task for processing the wrong interface information due to the fact that the interface information is wrong (such as a data format error).
Referring to fig. 3, fig. 3 is a flow chart illustrating another exemplary embodiment of the heterogeneous resource intelligent recognition and access method of the present application. Compared with the above embodiment, the present embodiment also tests the interface access result after the interface is accessed to the system item. The present embodiment may further include:
step S201, obtaining interface calling parameters from a database, and carrying out interface calling test based on the interface calling parameters to obtain a calling test result of an interface corresponding to the interface calling parameters.
Specifically, the interface information stored in the database may include interface call parameters, so that the terminal device may read the interface call parameters corresponding to each interface from the database, and sequentially perform call tests on each interface based on the interface call parameters corresponding to each interface.
Specifically, the terminal device may generate an interface call request based on the interface call parameters corresponding to each interface, and send the interface call request to the interface service providing system corresponding to the interface call request, and according to the response result returned by the interface service providing system. Then, the terminal device can determine the calling test result of the interface according to the response result returned by the interface service providing system. Specifically, if the terminal equipment successfully receives the response data returned by the interface service providing system, the interface call is indicated to be successful, and if the terminal equipment receives the request failure message returned by the interface service system, the interface call is indicated to be failed. For example, if the system a needs to use the data of the service provided by the system B, the system a may initiate a data acquisition request to the server of the system a, and after receiving the data acquisition request, the server of the system a generates a corresponding interface call request and sends the interface call request to the system B, and determines a call test result of the interface according to a response result returned by the system B.
Step S202, if the calling test result is failure, failure prompt information is generated.
Specifically, if the terminal device receives the request failure message returned by the interface service providing system, it indicates that the calling test result of the interface is failure, and generates failure prompt information.
The failure prompt information may include an interface ID, an interface name, and an interface call parameter used when calling the test failure result. The failure prompt information can be pushed to the user in the forms of characters, voice, short messages and the like. For example, the terminal device presents the interface management interface to the user, where the interface management interface presents the call failure result, the interface name, and the interface call parameters used when the interface is called. For another example, the terminal device may send a failure prompt to the user's handset or mailbox.
In step S203, when receiving the interface correction data returned by the user based on the failure prompt information, the interface information stored in the database is updated based on the interface correction data.
Considering that the interface information imported into the database may be incorrect or invalid, after receiving the result of the interface call test failure, the user may analyze the reason of the interface call failure based on the returned failure prompt information, if the reason of the interface call failure is that the interface call parameter information is incorrect, reconfigure the interface parameter information of the interface to obtain interface correction data, and may submit an interface correction request through an interface management interface, where the interface correction request includes the interface correction data, and after receiving the interface correction request, the terminal device analyzes the interface correction data included in the interface correction request, and updates the interface information of the corresponding interface stored in the database based on the interface correction data.
According to the method, after the interface information of each interface is imported into the database of the system project, call testing is conducted on each interface based on the interface call parameters of each interface, when the call test result is call failure, failure prompt information is generated, if interface correction data returned by a user based on the failure prompt information is received, the interface information stored in the database is updated according to the interface correction data, and the interface information imported into the system project can be checked and corrected, so that the accessed interface is effective while the interface access efficiency is improved, and subsequent interface call failure caused by error of the interface information is avoided.
Based on the above embodiment, the performing a call test on the interface corresponding to the interface call parameter based on the interface call parameter, to obtain a call test result of the interface may include:
and a, when the call test is carried out on the ports, acquiring the flow of each port in the current environment.
Specifically, the terminal device may obtain the traffic of each port through iptables.
And b, selecting a target port from the plurality of ports based on the traffic of each port.
For example, the terminal device may select the port with the smallest port traffic as the target port. Port traffic minima refers to the port that occupies the least amount of traffic among all ports.
And c, generating an interface call address based on the interface call parameter and the target port.
Specifically, the terminal device may encapsulate the interface call parameters corresponding to each interface and the target ports corresponding to each interface, to obtain the interface call addresses corresponding to each interface.
And d, calling the interface call address to obtain a response result, and determining a call test result of the interface based on the response result.
Specifically, if the terminal equipment successfully receives the response data returned by the interface service providing system, the interface call is indicated to be successful, and if the terminal equipment receives the request failure message returned by the interface service system, the interface call is indicated to be failed.
Referring to fig. 4, fig. 4 is a flowchart of another exemplary embodiment of the heterogeneous resource intelligent recognition and access method of the present application. In comparison with the above-described embodiments, the present embodiment describes how to select a destination port. The embodiment further includes:
step S301, when the interface is subjected to call test, the current time period is obtained.
Specifically, the terminal device may obtain a time point when the call test is started while the call test of the interface is started, and determine a time period corresponding to the time point based on a corresponding relationship between a preset time point and the time period, so as to obtain a current time period. The correspondence between the time point and the time period can be established in combination with actual situations. Illustratively, assume that interface 1 at the point in time when the call test is initiated is 10:29, it can be determined that the time period belongs to 10: 00-11: 00.
step S302, inputting the interface calling parameters and the current time period into the trained flow prediction model to obtain a flow prediction result.
Specifically, the terminal device may input the interface call parameter and the current time period after they are spliced to the flow prediction model, so as to obtain a flow prediction result, where the flow prediction result may be used to characterize the estimated value of system flow occupation when the interface is called in the current time period. The implementation manner of the trained flow prediction model may be:
as an embodiment, the terminal device may obtain interface call history information, where the interface call history information may include data such as a number of historical call requests of each interface in each time period, a call success rate of each interface in each time period, and the like. The history call information may be obtained from interface call records of other business systems. And then, the terminal equipment can generate a training sample by utilizing the call history information, wherein the training sample carries a label of the actual flow value when the interfaces of each time period are called, and inputs the training sample into a pre-established flow prediction model for training until reaching a training stopping condition, so as to obtain a trained flow prediction model. The training stop condition may be: the iteration number of the flow prediction model training reaches a preset iteration number threshold, or the difference value between the flow estimated value output by the flow prediction model and the flow actual value corresponding to the training sample in two continuous iteration training rounds is smaller than a preset difference value threshold. The iteration number threshold and the difference threshold may be set according to experience or actual requirements.
As another embodiment, the terminal device may train the traffic prediction model in an unsupervised manner. Specifically, the terminal device may obtain a pre-training model, where the pre-training model may be a model that is trained and has a similar task to a traffic prediction model to be trained, for example, the pre-training model may be used to predict a system traffic resource occupation situation when the interfaces of each time period are invoked, and the pre-training model may be a model based on a reinforcement learning network. In each training round of the pre-training model, the pre-training model determines a system flow occupation prediction result when the interface is called and a cumulative rewards obtained by the current training round according to interface calling parameters of the called interface corresponding to the training sample, a time period when the interface is called, a called success rate and parameters corresponding to the current training round, and updates the parameters of the pre-training model until an update stop condition is reached based on the system flow occupation prediction result when the interface is called and the cumulative rewards obtained by the current training round. Therefore, the terminal equipment can acquire the pre-training model when updating is stopped, and a trained flow prediction model is obtained.
Step S303, selecting a port with port flow matched with the flow prediction result as a target port.
Specifically, the terminal device may obtain a correspondence between the flow prediction result and the interface flow level from the database, and may obtain the interface flow level corresponding to the flow prediction result based on the correspondence between the flow prediction result and the interface flow level. The terminal equipment can also read the corresponding relation between the port flow and the port flow grade from the database, determine the port flow grade of each port based on the corresponding relation between the port flow and the port flow grade, select the port with the port flow grade consistent with the port flow grade, if there are a plurality of ports with the port flow grade consistent with the port flow grade, take the port with the port flow grade consistent with the port flow grade as the candidate port, and select the port with the smallest port flow from the candidate ports as the target port. The corresponding relationship between the flow prediction result and the interface flow level, and the corresponding relationship between the port flow and the port flow level may be established according to practical situations.
According to the embodiment, the current time period of interface calling test is acquired, then the interface calling parameters and the current time period are input into the flow prediction model to obtain the flow prediction result, and the port with the port flow matched with the flow prediction result is selected as the target port, so that the appropriate port can be selected for interface calling test, interface calling failure caused by overlarge port load is avoided, and smooth execution of the interface calling test is facilitated.
Referring to fig. 5, fig. 5 is a flowchart of another exemplary embodiment of the heterogeneous resource intelligent recognition and access method of the present application. Compared with any one of the embodiments described above, the embodiment further performs verification on the interface information after obtaining the interface information included in each interface class file. The present embodiment may further include:
and S401, carrying out integrity check on each interface information to obtain a check result.
Specifically, the terminal device may perform integrity check on the access parameters and each field in the interface information, so as to check whether the interface information is complete.
Step S402, if the checking result is incomplete, inputting the interface information into the interface information filling model to obtain the filled interface information.
For example, the terminal device may collect information such as the interface name with complete information in the Swagger framework, the class description of the interface) @ Api, the method description (@ ApiOperation), the parameter description (@ apiim imitsparames), the response description (@ ApiResonse) and so on to construct an interface data set, and train the large language model through the interface data set to obtain the interface information filling model. In implementation, the terminal device may input the interface information into the interface information filling model to obtain the filled interface information. The filled interface information is complete interface information.
Step S403, updating the interface information based on the interface information after filling.
Specifically, the terminal device replaces the interface information with the filled interface information to realize the update of the interface information.
According to the embodiment, after the interface information is acquired, the integrity of the interface information is checked, and when the interface information is incomplete, the interface information is filled, so that the interface information which is subsequently imported into a system project is prevented from being incomplete interface information data, and the success rate of the interface access is improved.
In addition, the embodiment of the application also provides a heterogeneous resource intelligent identification and access device, which may include:
the interface class acquisition module is used for scanning class files under the appointed directory, screening out class files belonging to interface classes and obtaining at least one interface class file;
the information acquisition module is used for acquiring interface information contained in each interface file, and writing each interface information into a preset interface template to obtain an interface document; the interface document is configured based on a preset data structure;
and the writing module is used for importing the interface document into the system project.
The principle and implementation process of the heterogeneous resource intelligent identification and access device are realized in this embodiment, please refer to the above embodiments, and the description is omitted here.
In addition, the embodiment of the application also provides a terminal device, which can include a memory, a processor and a heterogeneous resource intelligent identification and access program stored on the memory and capable of running on the processor, wherein the heterogeneous resource intelligent identification and access program realizes the steps of the heterogeneous resource intelligent identification and access method when being executed by the processor.
Because all the technical schemes of all the embodiments are adopted when the heterogeneous resource intelligent identification and access program is executed by the processor, the heterogeneous resource intelligent identification and access program at least has all the beneficial effects brought by all the technical schemes of all the embodiments, and the description is omitted.
In addition, the embodiment of the application also provides a computer readable storage medium, wherein the computer readable storage medium stores a heterogeneous resource intelligent identification and access program, and the heterogeneous resource intelligent identification and access program realizes the steps of the heterogeneous resource intelligent identification and access method when being executed by a processor.
Because all the technical schemes of all the embodiments are adopted when the heterogeneous resource intelligent identification and access program is executed by the processor, the heterogeneous resource intelligent identification and access program at least has all the beneficial effects brought by all the technical schemes of all the embodiments, and the description is omitted.
Compared with the prior art, the heterogeneous resource intelligent identification and access method, the heterogeneous resource intelligent identification and access device, the terminal equipment and the storage medium provided by the embodiment of the application are used for obtaining at least one interface class file by scanning class files under the appointed directory and screening out class files belonging to the interface class; then, obtaining interface information contained in each interface class file, and writing each interface information into a preset interface template to obtain an interface document; the interface document is configured based on a preset data structure; the interface document is then imported into the system project to access the plurality of interfaces to the system project. The implementation method can access a plurality of interfaces of external engineering in batches, realize automation of cross-system access and improve the efficiency of interface access. Meanwhile, according to the scheme of the embodiment, the interface information is written into the interface document with the preset data format, so that the rule of writing into system items is not required to be set for different types of interfaces, and the interface access efficiency is improved.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present application are merely for describing, and do not represent advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) as above, including several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, a controlled terminal, or a network device, etc.) to perform the method of each embodiment of the present application.
The foregoing description is only of the preferred embodiments of the present application, and is not intended to limit the scope of the claims, and all equivalent structures or equivalent processes using the descriptions and drawings of the present application, or direct or indirect application in other related technical fields are included in the scope of the claims of the present application.

Claims (6)

1. The intelligent identifying and accessing method for the heterogeneous resources is characterized by comprising the following steps:
scanning class files under the appointed directory, and screening out class files belonging to interface classes to obtain at least one interface class file;
acquiring interface information contained in each interface type file, and writing each interface information into a preset interface template to obtain an interface document; the interface document is configured based on a preset data structure;
uploading the interface document to a system import interface, analyzing interface information corresponding to each interface in the interface document by the system import interface, and writing each interface information into a database of a system project; the interface information comprises interface calling parameters;
acquiring the interface call parameters from the database, and performing interface call test based on the interface call parameters to obtain a call test result of an interface corresponding to the interface call parameters;
if the calling test result is that the calling fails, generating failure prompt information;
updating the interface information stored in the database based on the interface correction data when receiving the interface correction data returned by the user based on the failure prompt information;
The step of obtaining the call test result of the interface corresponding to the interface call parameter comprises the following steps:
when the interface is subjected to call testing, the flow of each port in the current environment and the current time period are obtained;
inputting the interface calling parameters and the current time period into a trained flow prediction model to obtain a flow prediction result; the flow prediction result is used for representing a system flow occupation estimated value of the interface when the current time period is called;
selecting a port with port flow matched with the flow prediction result as a target port;
generating an interface call address based on the interface call parameter and the target port;
calling the interface calling address to obtain a response result, and determining a calling test result of the interface based on the response result;
wherein, before the step of writing the interface information into the preset interface template to obtain the interface document, the method further comprises:
carrying out integrity check on each interface information to obtain a check result;
if the verification result is incomplete, inputting the interface information into an interface information filling model to obtain the filled interface information;
Updating the interface information based on the filled interface information.
2. The intelligent identification and access method for heterogeneous resources according to claim 1, further comprising:
if the source code of any interface class file under the appointed directory is detected to be updated, acquiring updated content;
updating the interface information stored in the database based on the updating content.
3. The intelligent heterogeneous resource identification and access method according to claim 1, wherein the step of writing the interface information into the database of the system item comprises:
when writing the interface information into the database, monitoring the writing execution condition of the interface information;
if any one of the interface information fails to be written, marking the interface information;
and re-executing the writing operation of the marked interface information until all the interface information is successfully written into the database.
4. The utility model provides a heterogeneous resource intelligent identification and access device which characterized in that, heterogeneous resource intelligent identification and access device includes:
The interface class acquisition module is used for scanning all class files under the appointed catalogue, screening out class files belonging to interface classes and obtaining all interface class files;
the information acquisition module is used for acquiring interface information contained in each interface type file, and writing each interface information into a preset interface template to obtain an interface document; the interface document is configured based on a preset data structure;
the writing module is used for uploading the interface document to a system import interface, analyzing interface information corresponding to each interface in the interface document by the system import interface, and writing each interface information into a database of a system project; the interface information comprises interface calling parameters;
acquiring the interface call parameters from the database, and performing interface call test based on the interface call parameters to obtain a call test result of an interface corresponding to the interface call parameters;
if the calling test result is that the calling fails, generating failure prompt information;
updating the interface information stored in the database based on the interface correction data when receiving the interface correction data returned by the user based on the failure prompt information;
The step of obtaining the call test result of the interface corresponding to the interface call parameter comprises the following steps:
when the interface is subjected to call testing, the flow of each port in the current environment and the current time period are obtained;
inputting the interface calling parameters and the current time period into a trained flow prediction model to obtain a flow prediction result; the flow prediction result is used for representing a system flow occupation estimated value of the interface when the current time period is called;
selecting a port with port flow matched with the flow prediction result as a target port;
generating an interface call address based on the interface call parameter and the target port;
calling the interface calling address to obtain a response result, and determining a calling test result of the interface based on the response result;
wherein, before the step of writing the interface information into the preset interface template to obtain the interface document, the method further comprises:
carrying out integrity check on each interface information to obtain a check result;
if the verification result is incomplete, inputting the interface information into an interface information filling model to obtain the filled interface information;
Updating the interface information based on the filled interface information.
5. A terminal device, characterized in that it comprises a memory, a processor and a heterogeneous resource intelligent recognition and access program stored on the memory and executable on the processor, which when executed by the processor implements the steps of the heterogeneous resource intelligent recognition and access method according to any of claims 1-3.
6. A computer readable storage medium, wherein a heterogeneous resource intelligent recognition and access program is stored on the computer readable storage medium, and the heterogeneous resource intelligent recognition and access program realizes the steps of the heterogeneous resource intelligent recognition and access method according to any one of claims 1-3 when being executed by a processor.
CN202311812296.2A 2023-12-27 2023-12-27 Heterogeneous resource intelligent identification and access method, device, equipment and storage medium Active CN117472367B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311812296.2A CN117472367B (en) 2023-12-27 2023-12-27 Heterogeneous resource intelligent identification and access method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311812296.2A CN117472367B (en) 2023-12-27 2023-12-27 Heterogeneous resource intelligent identification and access method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN117472367A CN117472367A (en) 2024-01-30
CN117472367B true CN117472367B (en) 2024-03-26

Family

ID=89624100

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311812296.2A Active CN117472367B (en) 2023-12-27 2023-12-27 Heterogeneous resource intelligent identification and access method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117472367B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110244945A (en) * 2019-05-22 2019-09-17 深圳壹账通智能科技有限公司 Interface document generation method and terminal device
CN110333850A (en) * 2019-05-30 2019-10-15 重庆金融资产交易所有限责任公司 Generation method, device, computer equipment and the storage medium of interface document
CN110908890A (en) * 2018-09-18 2020-03-24 亿阳信通股份有限公司 Automatic test method and device for interface
CN112287009A (en) * 2020-11-03 2021-01-29 平安普惠企业管理有限公司 Interface calling and interface data warehousing method, device, equipment and storage medium
CN113918308A (en) * 2021-11-05 2022-01-11 杭州安恒信息技术股份有限公司 Interface calling method, system, readable storage medium and computer equipment
CN114996039A (en) * 2022-07-28 2022-09-02 云宏信息科技股份有限公司 Cloud native system joint debugging method, system and medium based on third-party system docking

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10620945B2 (en) * 2017-12-21 2020-04-14 Fujitsu Limited API specification generation

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110908890A (en) * 2018-09-18 2020-03-24 亿阳信通股份有限公司 Automatic test method and device for interface
CN110244945A (en) * 2019-05-22 2019-09-17 深圳壹账通智能科技有限公司 Interface document generation method and terminal device
CN110333850A (en) * 2019-05-30 2019-10-15 重庆金融资产交易所有限责任公司 Generation method, device, computer equipment and the storage medium of interface document
CN112287009A (en) * 2020-11-03 2021-01-29 平安普惠企业管理有限公司 Interface calling and interface data warehousing method, device, equipment and storage medium
CN113918308A (en) * 2021-11-05 2022-01-11 杭州安恒信息技术股份有限公司 Interface calling method, system, readable storage medium and computer equipment
CN114996039A (en) * 2022-07-28 2022-09-02 云宏信息科技股份有限公司 Cloud native system joint debugging method, system and medium based on third-party system docking

Also Published As

Publication number Publication date
CN117472367A (en) 2024-01-30

Similar Documents

Publication Publication Date Title
US11954461B2 (en) Autonomously delivering software features
CN110933095A (en) Message parsing method and device
CN111984228B (en) Interface document processing method and device, computer equipment and storage medium
CN102395950A (en) Communicating with data storage systems
US11422917B2 (en) Deriving software application dependency trees for white-box testing
US20210157716A1 (en) Pre-populating continuous delivery test cases
CN111258832B (en) Interface parameter verification method, device, equipment and medium
CN110381101A (en) API gateway control system, control method, equipment and medium
US10459698B2 (en) Framework for generating adapters in an integrated development environment
CN117556008A (en) Interaction method, medium, device and computing equipment based on large language model
CN114510262A (en) Interface request parameter verification method and device
US10922075B2 (en) System and method for creating and validating software development life cycle (SDLC) digital artifacts
CN115114299A (en) Method for realizing metadata management based on Flink SQL
CN111240981A (en) Interface testing method, system and platform
CN111158654A (en) Algorithm calling method, device, server and storage medium
CN113126955A (en) Random data generation method and device, intelligent terminal and storage medium
CN112699042B (en) Unit test case generation method and device
CN111258562B (en) Java code quality inspection method, device, equipment and storage medium
CN117472367B (en) Heterogeneous resource intelligent identification and access method, device, equipment and storage medium
CN110413518B (en) Control object library generation method and device and computer readable storage medium
CN114610732A (en) Bottom-pocketing data processing method and device
CN114489674A (en) Data verification method and device of dynamic data model
CN115965227A (en) Workflow data processing method, device, equipment, storage medium and product
CN112363700A (en) Cooperative creation method and device of intelligent contract, computer equipment and storage medium
CN111151008A (en) Game operation data verification method, device, configuration background and 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
GR01 Patent grant
GR01 Patent grant