CN111831365A - Interface route forwarding method, system, computer equipment and readable storage medium - Google Patents

Interface route forwarding method, system, computer equipment and readable storage medium Download PDF

Info

Publication number
CN111831365A
CN111831365A CN202010743270.7A CN202010743270A CN111831365A CN 111831365 A CN111831365 A CN 111831365A CN 202010743270 A CN202010743270 A CN 202010743270A CN 111831365 A CN111831365 A CN 111831365A
Authority
CN
China
Prior art keywords
service
class object
service implementation
interface
implementation class
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010743270.7A
Other languages
Chinese (zh)
Inventor
陈纯雁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Property and Casualty Insurance Company of China Ltd
Original Assignee
Ping An Property and Casualty Insurance Company of China 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 Ping An Property and Casualty Insurance Company of China Ltd filed Critical Ping An Property and Casualty Insurance Company of China Ltd
Priority to CN202010743270.7A priority Critical patent/CN111831365A/en
Publication of CN111831365A publication Critical patent/CN111831365A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/14Routing performance; Theoretical aspects

Abstract

The embodiment of the invention provides an interface route forwarding method, which comprises the following steps: receiving a request sent by a front end through a uniform interface path layer; sending a first preset service parameter in the request to a factory class through the unified interface path layer; generating a service implementation class object based on the first preset service parameter through the factory class and returning the service implementation class object; receiving a service implementation class object returned by the factory class through the unified interface path layer; and calling a uniform interface layer through the uniform interface path layer so as to call the service method of the service implementation class object through the uniform interface layer. The embodiment of the invention has the advantages of clear code architecture, less redundant codes, high system safety, low development cost, high fault tolerance rate and easy background management.

Description

Interface route forwarding method, system, computer equipment and readable storage medium
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to an interface route forwarding method, system and equipment and a computer readable storage medium.
Background
To enhance user experience, developers often need to provide a large amount of customized services. Taking the financial industry as an example, a large amount of business logic needs to be developed to meet different customer requirements. However, the vast amount of business logic developed is easily used by some lawbreakers for fraudulent activities and the like. Therefore, in the process of business logic development, in order to ensure that the content in the process of interaction with the user conforms to the internet development specification, the background is often required to have corresponding content auditing and operating functions, so that the accuracy and timeliness of the content are ensured.
When the interface accepts client data transmitted by an upstream system and maintains the data, similar business functions, such as adding, deleting, searching and modifying certain types of data, are generally available. If multiple data types exist in a service system, the conventional solution is to develop a set of dedicated interfaces for the various data types, so that code architecture exception confusion and code redundancy are caused, moreover, on the interface specification level, excessive exposure of the interfaces is not beneficial to system safety, development cost of a front end and a back end is increased, and fault tolerance rate of the system is reduced. In addition, the development styles of different developers are different, which brings certain challenges to background management.
Disclosure of Invention
Embodiments of the present invention provide an interface routing forwarding method, system, computer device, and computer readable storage medium, which are used to solve the problems of abnormal and disordered code architecture, code redundancy, low system security, high development cost, low fault tolerance rate, and difficult background management.
One aspect of the embodiments of the present invention provides an interface route forwarding method, where the method includes: receiving a request sent by a front end through a uniform interface path layer; sending a first preset service parameter in the request to a factory class through the unified interface path layer; generating a service implementation class object based on the first preset service parameter through the factory class and returning the service implementation class object; receiving a service implementation class object returned by the factory class through the unified interface path layer; and calling a uniform interface layer through the uniform interface path layer so as to call the service method of the service implementation class object through the uniform interface layer.
Optionally, the step of sending the first preset service parameter in the request to the factory class through the unified interface path layer further includes: analyzing the request to obtain a plurality of service parameters; checking whether each service parameter is legal or not; if the illegal service parameters exist, returning error report information; and if all the service parameters are legal parameters, finishing the inspection and transmitting a first preset service parameter in the plurality of service parameters to the factory class.
Optionally, the factory class is preconfigured with a plurality of factory methods, and the factory methods are used for creating corresponding service implementation class objects according to the introduced service parameters.
Optionally, the factory class is predefined with a plurality of routing forwarding rules and a plurality of service implementation classes; the step of generating a service implementation class object based on the first preset service parameter through the factory class and returning the service implementation class object includes: inquiring and matching a corresponding routing forwarding rule according to the first preset service parameter; if the matched route forwarding rule is inquired, generating the service implementation class object according to the matched route forwarding rule and returning the service implementation class object; and if the matched route forwarding rule is not inquired, returning a null value.
Optionally, the step of generating and returning the service implementation class object according to the matched route forwarding rule includes: and generating a corresponding service implementation class object in the factory class according to the type value matching in the first preset service parameter.
Optionally, between the step of receiving the service implementation class object returned by the factory class through the unified interface path layer and the step of calling the unified interface layer through the unified interface path layer, the method further includes a step of verifying the service implementation class object: judging whether the parameter of the service implementation class object is a null value or not and whether the service implementation class object is a subclass of the uniform interface layer or not; if the parameter of the service implementation class object is not a null value or the service implementation class object is not a subclass of the uniform interface layer, the verification fails; and if the parameters of the service implementation class object are null values and the service implementation class object is a subclass of the uniform interface layer, the verification is successful.
Optionally, the step of calling a unified interface layer through the unified interface path layer to call the service method of the service implementation class object through the unified interface layer further includes: forwarding the request to a unified interface layer template class implementation through the unified interface layer; judging whether the business realization class object overwrites the uniform interface layer template class; if the business implementation class object rewrites the method of the uniform interface layer template class, operating the rewritten homonymy method; and if the service implementation class object does not rewrite the method of the uniform interface layer template class, operating the uniform method in the uniform interface layer template class.
An aspect of the embodiments of the present invention further provides an interface route forwarding system, where the interface route forwarding system includes: the first receiving module is used for receiving a request sent by a front end through a unified interface path layer; the sending module is used for sending the first preset service parameter in the request to a factory class through the unified interface path layer; the generating module is used for generating a service implementation class object based on the first preset service parameter through the factory class and returning the service implementation class object; the second receiving module is used for receiving the service implementation class object returned by the factory class through the unified interface path layer; and the calling module is used for calling a uniform interface layer through the uniform interface path layer so as to call the service method of the service implementation class object through the uniform interface layer.
An aspect of the embodiments of the present invention further provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the interface route forwarding method as described above when executing the computer program.
An aspect of the embodiments of the present invention further provides a computer-readable storage medium, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor executes the computer program to implement the steps of the interface route forwarding method as described above.
According to the interface route forwarding method, the system, the equipment and the computer readable storage medium provided by the embodiment of the invention, the exposed interfaces are reduced through the unified interface path layer controller, the unified interface layer service and the like, the unified management is carried out aiming at the similar functional interfaces, the standard management interfaces are developed in a unified manner, the fault tolerance rate of the system is improved, the workload of front-end and back-end joint debugging is reduced, and the communication cost and the development cost during the joint debugging are reduced. The interface function is clearly divided, and a back-end developer only needs to care about the logic development of the corresponding service system. The method can also customize and develop the service logic aiming at the specific service scene of the corresponding service system, the universal service logic does not need to be repeatedly developed, the development workload is reduced, the error rate is reduced, the reusability and the expandability of the interface are improved, and the familiarity cost of a developer to the codes is also reduced.
The embodiment of the invention has the advantages of clear code architecture, less redundant codes, high system safety, low development cost, high fault tolerance rate and easy background management.
Drawings
Fig. 1 schematically shows a software architecture diagram of an interface route forwarding method according to an embodiment of the present invention;
fig. 2 schematically shows a flowchart of an interface route forwarding method according to a first embodiment of the present invention;
FIG. 3 is a flow diagram schematically illustrating a method of interface route forwarding embodied in the method;
fig. 4 schematically shows a block diagram of an interface route forwarding system according to a third embodiment of the present invention; and
fig. 5 is a schematic diagram illustrating a hardware architecture of a computer device suitable for implementing the interface route forwarding method according to a third embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the descriptions relating to "first", "second", etc. in the embodiments of the present invention are only for descriptive purposes and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In addition, technical solutions between various embodiments may be combined with each other, but must be realized by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination should not be considered to exist, and is not within the protection scope of the present invention.
Fig. 1 schematically shows a software architecture diagram of an interface route forwarding method according to an embodiment of the present invention. In an exemplary embodiment, the software architecture diagram includes: a unified interface path layer (controller), a unified interface layer (service), a Factory class (Factory), a unified interface layer template class (adapter), and a service implementation class (service implementation). Wherein:
the unified interface path layer is used for capturing a request initiated by a front end (such as a computer, a smart phone, and the like), such as: query request, delete request, update request. That is, the unified interface path layer is configured with only one generic interface, which serves as a request entry for each front end.
The unified interface layer is used for exposing an interface (referred to as an external interface path herein) to the outside.
The uniform interface layer template class realizes a parent class for an interface, inherits the uniform interface layer and does not relate to specific logic.
The service implementation class object can inherit the uniform interface layer template class and rewrite the corresponding method to implement the customized logic.
And the factory class configures a plurality of routing forwarding rules for establishing corresponding service implementation according to the routing forwarding rules.
Example one
Fig. 2 schematically shows a flowchart of an interface route forwarding method according to a first embodiment of the present invention. It is to be understood that the flow charts in the embodiments of the present method are not intended to limit the order in which the steps are performed. The following description is made by way of example with the computer device 2 as the execution subject.
As shown in fig. 2, the interface route forwarding method may include steps S200 to S210, where:
step S200, receiving the request sent by the front end through the unified interface path layer.
After receiving the request sent by the front end, the unified interface path layer may perform one or more of the following operations on the request: parameter checking, object conversion, object return assembly, exception handling and the like. Taking parameter verification as an example:
(1) analyzing the request to obtain a plurality of service parameters;
(2) checking whether each service parameter is legal or not;
(3) if the illegal service parameters exist, returning error report information;
(4) and if all the service parameters are legal parameters, finishing the inspection, and transmitting a first preset service parameter in the plurality of service parameters to the factory class.
Step S202, the first preset service parameter in the request is sent to a Factory class Factory through the unified interface path layer.
The unified interface path layer may send the first preset service parameter to the factory class and call a factory method of the factory class, so that the factory class generates a corresponding service implementation class object according to the first preset service parameter. The factory method is pre-created and used to create different business implementation class objects based on the incoming parameters.
Step S204, generating a service implementation class object based on the first preset service parameter through the factory class, and returning the service implementation class object.
The factory class is predefined with a plurality of routing forwarding rules and a plurality of service implementation class objects. And automatically adapting the corresponding interface and the realized service realization class object according to the established route forwarding rule to achieve the aim of realizing service logic.
In an exemplary embodiment, the step S204 may be implemented by: step S204A, inquiring and matching a corresponding route forwarding rule according to the first preset service parameter; step S204B, if a matched route forwarding rule is inquired, generating the service implementation class object according to the matched route forwarding rule and returning the service implementation class object; step S204C, if no matching route forwarding rule is found, returning a null value.
In an exemplary embodiment, the step of generating and returning the service implementation class object according to the matching routing forwarding rule includes: and generating a corresponding service implementation class object (exemplarily, the service implementation class object can be injected by spring management) in the factory class according to the type value matching in the first preset service parameter. It should be noted that the first preset service parameter is a service parameter obtained by the controller analyzing the request.
Step S206, receiving the service implementation class object returned by the factory class through the unified interface path layer.
And the factory class generates the service implementation class object, returns the service implementation class object to a controller and assigns the service implementation class object to the unified interface layer.
In an exemplary embodiment, after receiving the service implementation class object returned by the factory class, the unified interface path layer may perform validity check on a parameter of the service implementation class object. The method comprises the following specific steps: judging whether the parameter of the service implementation class object is a null value or not and whether the service implementation class object is a subclass of the uniform interface layer or not; if the parameter of the service implementation class object is not a null value or the service implementation class object is not a subclass of the uniform interface layer, the verification fails; and if the parameters of the service implementation class object are null values and the service implementation class object is a subclass of the uniform interface layer, the verification is successful. Through the validity verification, program errors can be prevented. For example: if the verification fails, the program may be stopped to prevent program error.
Step S208, calling a uniform interface layer through the uniform interface path layer so as to call the service method of the service implementation class object through the uniform interface layer.
Specifically, the request parameter analyzed by the uniform interface path layer is transmitted to the uniform interface layer, so as to implement service logic.
In an exemplary embodiment, step S208 may be implemented by steps S208A-S208D:
step S208A, forwarding the request to a unified interface layer template class implementation through the unified interface layer. Step S208B, determining whether the service implementation class object overwrites the method of the unified interface layer template class. Step S208C, if the service implementation class object overwrites the method of the uniform interface layer template class, the rewritten method with the same name is run. Step S208D, if the service implementation class object does not have the method of rewriting the unified interface layer template class, running the unified method in the unified interface layer template class.
The unified interface layer is used for uniformly receiving the calling operation of the unified interface path layer.
If the parameter of the service implementation class object is not null, different service methods can be called according to the service scene. According to the polymorphic and inherited characteristics of JAVA, because the service implementation class object inherits the uniform interface layer template class, any method in the uniform interface layer template class can be rewritten according to a changeable service scene, and the uniform interface layer can forward the request to the uniform interface layer template class for implementation. That is, the service implementation class object inherits the uniform interface layer template class and rewrites the corresponding interface logic, and what is actually running is the interface logic rewritten by the service implementation class object. It is understood that the service implementation class object inherits the uniform interface layer template class, that is, the service implementation class object inherits all implementation methods in the uniform interface layer template class. The method logic operation in the inherited unified interface layer template class can be called, and the homonymous method in the unified interface layer template class can be rewritten according to a specific service scene to customize a differentiated service logic method. When the uniform interface layer forwards the request to the uniform interface layer template class for realization, the corresponding service realization class is matched, and whether the matched corresponding service realization class rewrites the same-name method in the uniform interface layer template class is judged.
For ease of understanding, as shown in fig. 3, a specific implementation flow is provided below:
the front end initiates a request, after the controller captures the request, the controller firstly checks whether the parameters necessary for the service are legal, and if not, the controller returns a prompt error report message. And after the parameters are checked, the first preset service parameters in the request enter the Factory, and according to the corresponding routing forwarding rule, the corresponding service implementation object is generated, returned and assigned to the service. If no route forwarding condition is met, a NULL value (NULL) is returned. Returning to the controller, it is necessary to check whether the serviceimplementation object returned by the Factory is a null value, and the like, so as to prevent a program from making an error. And if the parameter of the serviceImplement object is not null, continuing to call the self service method. According to the characteristics of multiple states and inheritance of Java, because the service instance inherits the adapter, any method in the adapter can be rewritten according to a variable service scene, and the service can forward the request (or the request parameters in the request) to the adapter for realization. At this time, since the serviceim inherits the adapter, it also inherits all implementation methods in the adapter. The method can be used for calling the method logic in the inherited adapter to run, and can also be used for rewriting the homonymous method in the adapter according to a specific service scene, and customizing and designing the business logic method belonging to the adapter to realize the method. When the service forwards the request to the adapter, it will be determined whether the corresponding service instance object overwrites the method with the same name in the adapter. If the same-name method is rewritten, directly operating the logic of the customized same-name method after rewriting; and if the same-name method is not rewritten, calling a uniform method in the adapter and operating according to the logic in the adapter.
As described above, in this embodiment, the similar functional interfaces can be managed in a unified manner, so that the number of externally exposed interfaces is reduced, and the fault tolerance of the system is improved. And the standard management interface is developed uniformly, the workload of front-end and back-end joint debugging is reduced, and the communication cost and the development cost during the joint debugging are reduced. The interface function is clearly divided, and a back-end developer only needs to care about the logic development of the corresponding service system. The method can also customize and develop the service logic aiming at the specific service scene of the corresponding service system, the universal service logic does not need to be repeatedly developed, the development workload is reduced, the error rate is reduced, the reusability and the expandability of the interface are improved, and the familiarity cost of a developer to the codes is also reduced.
EXAMPLE III
Fig. 4 is a block diagram schematically illustrating an interface route forwarding system according to a third embodiment of the present invention, which may be divided into one or more program modules, and the one or more program modules are stored in a storage medium and executed by one or more processors to implement the third embodiment of the present invention. The program modules referred to in the embodiments of the present invention refer to a series of computer program instruction segments that can perform specific functions, and the following description will specifically describe the functions of the program modules in the embodiments.
As shown in fig. 4, the interface route forwarding system 400 may include a first receiving module 410, a sending module 420, a generating module 430, a second receiving module 440, and a calling module 450, wherein:
a first receiving module 410, configured to receive, through the unified interface path layer, a request sent by the front end.
A sending module 420, configured to send the first preset service parameter in the request to the factory class through the unified interface path layer.
A generating module 430, configured to generate a service implementation class object based on the first preset service parameter through the factory class, and return the service implementation class object.
A second receiving module 440, configured to receive, through the unified interface path layer, the service implementation class object returned by the factory class.
The invoking module 450 is configured to invoke a unified interface layer through the unified interface path layer, so as to invoke the service method of the service implementation class object through the unified interface layer.
In an exemplary embodiment, the sending module 420 is further configured to: analyzing the request to obtain a plurality of service parameters; checking whether each service parameter is legal or not; if the illegal service parameters exist, returning error report information; and if all the service parameters are legal parameters, finishing the inspection and transmitting a first preset service parameter in the plurality of service parameters to the factory class.
In an exemplary embodiment, the factory class is pre-configured with a plurality of factory methods for creating corresponding business implementation class objects from the incoming business parameters.
In an exemplary embodiment, the factory class is predefined with a plurality of routing forwarding rules and a plurality of service implementation classes; the generating module 430 is further configured to: inquiring and matching a corresponding routing forwarding rule according to the first preset service parameter; if the matched route forwarding rule is inquired, generating the service implementation class object according to the matched route forwarding rule and returning the service implementation class object; and if the matched route forwarding rule is not inquired, returning a null value.
In an exemplary embodiment, the step of generating and returning the service implementation class object according to the matching routing forwarding rule includes: and generating a corresponding service implementation class object in the factory class according to the type value matching in the first preset service parameter.
In an exemplary embodiment, a verification module (not identified) is further included for: judging whether the parameter of the service implementation class object is a null value or not and whether the service implementation class object is a subclass of the uniform interface layer or not; if the parameter of the service implementation class object is not a null value or the service implementation class object is not a subclass of the uniform interface layer, the verification fails; and if the parameters of the service implementation class object are null values and the service implementation class object is a subclass of the uniform interface layer, the verification is successful.
In an exemplary embodiment, the calling module 450 is further configured to: forwarding the request to a unified interface layer template class implementation through the unified interface layer; judging whether the business realization class object overwrites the uniform interface layer template class; if the business implementation class object rewrites the method of the uniform interface layer template class, operating the rewritten homonymy method; and if the service implementation class object does not rewrite the method of the uniform interface layer template class, operating the uniform method in the uniform interface layer template class.
EXAMPLE III
Fig. 5 schematically shows a hardware architecture diagram of a computer device 2 suitable for implementing the interface route forwarding method according to a third embodiment of the present invention. In the present embodiment, the computer device 2 is a device capable of automatically performing numerical calculation and/or information processing in accordance with a command set in advance or stored. For example, the server may be a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server, or a rack server (including an independent server or a server cluster composed of a plurality of servers). As shown in fig. 5, the computer device 6 includes at least, but is not limited to: memory 510, processor 520, and network interface 530 may be communicatively linked to each other by a system bus. Wherein:
the memory 510 includes at least one type of computer-readable storage medium including a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the storage 510 may be an internal storage module of the computer device 2, such as a hard disk or a memory of the computer device 2. In other embodiments, the memory 510 may also be an external storage device of the computer device 2, such as a plug-in hard disk provided on the computer device 2, a Smart Memory Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like. Of course, memory 510 may also include both internal and external memory modules of computer device 2. In this embodiment, the memory 510 is generally used for storing an operating system installed in the computer device 2 and various types of application software, such as program codes of the interface route forwarding method. In addition, the memory 510 may also be used to temporarily store various types of data that have been output or are to be output.
Processor 520 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 520 is generally used for controlling the overall operation of the computer device 2, such as performing control and processing related to data interaction or communication with the computer device 2. In this embodiment, processor 520 is configured to execute program codes stored in memory 510 or process data.
Network interface 530 may include a wireless network interface or a wired network interface, and network interface 530 is typically used to establish communication links between computer device 2 and other computer devices. For example, the network interface 530 is used to connect the computer device 2 with an external terminal through a network, establish a data transmission channel and a communication link between the computer device 2 and the external terminal, and the like. The network may be a wireless or wired network such as an Intranet (Intranet), the Internet (Internet), a global system for Mobile communications (GSM), Wideband Code Division Multiple Access (WCDMA), a 4G network, a 5G network, Bluetooth (Bluetooth), or Wi-Fi.
It should be noted that FIG. 5 only shows a computer device having components 510 and 530, but it should be understood that not all of the shown components are required and that more or fewer components may be implemented instead.
In this embodiment, the interface route forwarding method stored in the memory 510 may also be divided into one or more program modules and executed by one or more processors (in this embodiment, the processor 520) to implement the embodiment of the present invention.
Example four
The present invention also provides a computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to perform the steps of: receiving a request sent by a front end through a uniform interface path layer; sending a first preset service parameter in the request to a factory class through the unified interface path layer; generating a service implementation class object based on the first preset service parameter through the factory class and returning the service implementation class object; receiving a service implementation class object returned by the factory class through the unified interface path layer; and calling a uniform interface layer through the uniform interface path layer so as to call the service method of the service implementation class object through the uniform interface layer.
In this embodiment, the computer-readable storage medium includes a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the computer readable storage medium may be an internal storage unit of the computer device, such as a hard disk or a memory of the computer device. In other embodiments, the computer readable storage medium may be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the computer device. Of course, the computer-readable storage medium may also include both internal and external storage devices of the computer device. In this embodiment, the computer-readable storage medium is generally used to store an operating system and various types of application software installed in the computer device, for example, the program code of the interface route forwarding method in the embodiment, and the like. Further, the computer-readable storage medium may also be used to temporarily store various types of data that have been output or are to be output.
It will be apparent to those skilled in the art that the modules or steps of the embodiments of the invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, embodiments of the invention are not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. An interface route forwarding method, the method comprising:
receiving a request sent by a front end through a uniform interface path layer;
sending a first preset service parameter in the request to a factory class through the unified interface path layer;
generating a service implementation class object based on the first preset service parameter through the factory class and returning the service implementation class object;
receiving a service implementation class object returned by the factory class through the unified interface path layer; and
and calling a uniform interface layer through the uniform interface path layer so as to call the service method of the service implementation class object through the uniform interface layer.
2. The interface route forwarding method according to claim 1, wherein the step of sending the first preset service parameter in the request to a factory class through the unified interface path layer further comprises:
analyzing the request to obtain a plurality of service parameters;
checking whether each service parameter is legal or not;
if the illegal service parameters exist, returning error report information; and
and if all the service parameters are legal parameters, finishing the inspection, and transmitting a first preset service parameter in the plurality of service parameters to the factory class.
3. The interface route forwarding method of claim 1, wherein the factory class is pre-configured with a plurality of factory methods, and wherein the factory methods are used to create corresponding service implementation class objects according to the incoming service parameters.
4. The interface route forwarding method according to claim 1, wherein the factory class is predefined with a plurality of route forwarding rules and a plurality of service implementation classes;
the step of generating a service implementation class object based on the first preset service parameter through the factory class and returning the service implementation class object includes:
inquiring and matching a corresponding routing forwarding rule according to the first preset service parameter;
if the matched route forwarding rule is inquired, generating the service implementation class object according to the matched route forwarding rule and returning the service implementation class object; and
and if no matched route forwarding rule is inquired, returning a null value.
5. The interface route forwarding method of claim 4, wherein the step of generating and returning the service implementation class object according to the matched route forwarding rule comprises:
and generating a corresponding service implementation class object in the factory class according to the type value matching in the first preset service parameter.
6. The interface route forwarding method according to claim 1, wherein between the step of receiving the service implementation class object returned by the factory class through the unified interface path layer and the step of calling the unified interface layer through the unified interface path layer, the method further comprises a step of verifying the service implementation class object:
judging whether the parameter of the service implementation class object is a null value or not and whether the service implementation class object is a subclass of the uniform interface layer or not;
if the parameter of the service implementation class object is not a null value or the service implementation class object is not a subclass of the uniform interface layer, the verification fails; and
and if the parameters of the service implementation class object are null values and the service implementation class object is a subclass of the uniform interface layer, the verification is successful.
7. The interface route forwarding method of claim 1, wherein a unified interface layer is invoked through the unified interface path layer to invoke the service method of the service implementation class object through the unified interface layer, further comprising:
forwarding the request to a unified interface layer template class implementation through the unified interface layer;
judging whether the business realization class object overwrites the uniform interface layer template class;
if the business implementation class object rewrites the method of the uniform interface layer template class, operating the rewritten homonymy method; and
and if the service implementation class object does not have the method for rewriting the uniform interface layer template class, operating the uniform method in the uniform interface layer template class.
8. An interface routing forwarding system, comprising:
the first receiving module is used for receiving a request sent by a front end through a unified interface path layer;
the sending module is used for sending the first preset service parameter in the request to a factory class through the unified interface path layer;
the generating module is used for generating a service implementation class object based on the first preset service parameter through the factory class and returning the service implementation class object;
the second receiving module is used for receiving the service implementation class object returned by the factory class through the unified interface path layer; and
and the calling module is used for calling a uniform interface layer through the uniform interface path layer so as to call the service method of the service implementation class object through the uniform interface layer.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor when executing the computer program is configured to implement the steps of the interface route forwarding method according to any one of claims 1 to 7.
10. A computer-readable storage medium having stored therein a computer program executable by at least one processor to cause the at least one processor to perform the steps of the interface route forwarding method of any one of claims 1-7.
CN202010743270.7A 2020-07-29 2020-07-29 Interface route forwarding method, system, computer equipment and readable storage medium Pending CN111831365A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010743270.7A CN111831365A (en) 2020-07-29 2020-07-29 Interface route forwarding method, system, computer equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010743270.7A CN111831365A (en) 2020-07-29 2020-07-29 Interface route forwarding method, system, computer equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN111831365A true CN111831365A (en) 2020-10-27

Family

ID=72921089

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010743270.7A Pending CN111831365A (en) 2020-07-29 2020-07-29 Interface route forwarding method, system, computer equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN111831365A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113452575A (en) * 2021-06-24 2021-09-28 河北幸福消费金融股份有限公司 Service test method, system, device and storage medium
CN114996181A (en) * 2021-03-02 2022-09-02 北京同邦卓益科技有限公司 Interface routing method and device, electronic equipment and storage medium
WO2023098241A1 (en) * 2021-12-03 2023-06-08 深圳前海微众银行股份有限公司 Request processing method and apparatus

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110088011A1 (en) * 2009-10-14 2011-04-14 Vermeg Sarl Automated Enterprise Software Development
CN108040126A (en) * 2017-12-29 2018-05-15 贵阳语玩科技有限公司 Initiate the method and device of HTTP request
CN109254916A (en) * 2018-08-30 2019-01-22 郑州云海信息技术有限公司 A kind of method and server of the visualization RestFul interface testing relying on injection based on Spring

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110088011A1 (en) * 2009-10-14 2011-04-14 Vermeg Sarl Automated Enterprise Software Development
CN108040126A (en) * 2017-12-29 2018-05-15 贵阳语玩科技有限公司 Initiate the method and device of HTTP request
CN109254916A (en) * 2018-08-30 2019-01-22 郑州云海信息技术有限公司 A kind of method and server of the visualization RestFul interface testing relying on injection based on Spring

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
VIVIANXLA: "java中controller,service,serviceImpl,mapper,xml等几个文件的作用理解,以简单的查询为例", 《HTTPS://WWW.JIANSHU.COM/P/7E0364A827A7》 *
刘启文: "《Java Web编程技术》", 30 August 2016, 北京航空航天大学出版社出版发行 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114996181A (en) * 2021-03-02 2022-09-02 北京同邦卓益科技有限公司 Interface routing method and device, electronic equipment and storage medium
CN114996181B (en) * 2021-03-02 2023-09-26 北京同邦卓益科技有限公司 Interface routing method and device, electronic equipment and storage medium
CN113452575A (en) * 2021-06-24 2021-09-28 河北幸福消费金融股份有限公司 Service test method, system, device and storage medium
CN113452575B (en) * 2021-06-24 2022-11-22 河北幸福消费金融股份有限公司 Service test method, system, device and storage medium
WO2023098241A1 (en) * 2021-12-03 2023-06-08 深圳前海微众银行股份有限公司 Request processing method and apparatus

Similar Documents

Publication Publication Date Title
CN111831365A (en) Interface route forwarding method, system, computer equipment and readable storage medium
US10171315B2 (en) Orchestration process template for generation of orchestration process to tolerate errors
CN110505162B (en) Message transmission method and device and electronic equipment
US20230036357A1 (en) Method and apparatus for authority control, computer device and storage medium
CN111258900A (en) Interface test script generation method, system, equipment and storage medium
CN111988337A (en) Authority management method and system
CN111290742A (en) Parameter verification method and device, electronic equipment and readable storage medium
CN111914194B (en) Business system changing method and device, electronic equipment and storage medium
CN111414391A (en) Method and system for accessing multiple data sources
CN110083338B (en) Service system based on intelligent gateway
CN112835782B (en) Interface access test method and system
CN112039900A (en) Network security risk detection method, system, computer device and storage medium
CN111338716A (en) Data processing method and device based on rule engine and terminal equipment
Gunawan et al. Compositional verification of application-level security properties
CN113468212A (en) Event execution method and device and electronic equipment
CN111984236A (en) Component standardization management method and device, computer equipment and readable storage medium
CN110166530A (en) Processing method, electronic device and computer equipment based on micro services return value
CN111507676A (en) Method, device, storage medium and system for establishing and implementing business order flow
CN115396221A (en) Authorization processing method, device and system, electronic equipment and storage medium
CN113742235A (en) Method and device for checking codes
CN113626001A (en) API dynamic editing method and device based on script
CN111580799A (en) Domain specific language script assembling method and system
CN114880144A (en) Page data processing method and device, computer equipment and storage medium
CN111984484A (en) Non-invasive micro-service access method and system
CN117827176A (en) Code generation method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20201027

RJ01 Rejection of invention patent application after publication