Interface calling method, device, equipment and storage medium

By adding a new interface to the software service and updating the unified resource identifier, the problem in the existing technology that user-customized application services cannot correctly feedback business logic execution results is solved, and efficient interface calling and correct business logic execution result feedback are achieved.

CN114637554BActive Publication Date: 2024-08-30CHINA CONSTRUCTION BANK
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210271252.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-18
Publication Date
2024-08-30
Estimated Expiration
2042-03-18

AI Technical Summary

Technical Problem

When existing productized software services provide user-customized application services, they cannot correctly feedback business logic execution results, resulting in interface call failures.

Method used

By receiving user request information, adding user tag information to the preset location of the uniform resource identifier, and updating it to match the target uniform resource identifier, the target interface is called to execute business logic and the execution result is sent to the user terminal.

Benefits of technology

It realizes quick locking of the target interface corresponding to the user request, improves the feedback efficiency of business logic execution results, and the new interface is independent of the original standard interface, avoiding the destruction of the code structure, and ensuring that both the standard interface and the target interface can correctly feedback the business Logical execution result.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114637554B
    Figure CN114637554B
Patent Text Reader

Abstract

The embodiment of the present application provides an interface calling method, apparatus, device and storage medium, the method comprising: receiving user request information; the user request information comprises user tag information and a user uniform resource identifier; adding the user tag information to a preset position of the user uniform resource identifier to obtain an updated uniform resource identifier; matching a target uniform resource identifier that matches the updated uniform resource identifier from a preset uniform resource identifier list; calling a target interface to execute a business logic corresponding to the target interface to obtain a first execution result; the target interface corresponds to the target uniform resource identifier; sending the first execution result to a user terminal; the embodiment of the present application can solve the problem that when existing productized software services provide user customized application services, the correct business logic execution results cannot be fed back to users.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of Internet technology, and in particular, relates to an interface calling method, device, equipment and storage medium. Background Art

[0002] Application services generally combine business and technology to build software services for target customers, while productized software application services are formed into a product that can be mass-produced and released through standardized and normalized processes of technology and services. In the development process of non-productized software application services, the needs of different industries and companies are different, which leads to the development of software application services in accordance with customer needs, which ultimately leads to different software application services for different people.

[0003] When existing productized software services provide user-customized application services, the user-customized interface code of the application is modified based on the original standard interface code, which destroys the standard interface code structure and causes failures when the interface is called, resulting in the inability to feedback the correct business logic execution results to the user. Summary of the invention

[0004] The embodiments of the present application provide an interface calling method, apparatus, device and storage medium, which can solve the problem that the correct business logic execution results cannot be fed back to the user when the existing productized software service provides user customized application services.

[0005] In a first aspect, an embodiment of the present application provides an interface calling method, comprising:

[0006] Receiving user request information; the user request information includes user tag information and user uniform resource identifier;

[0007] Adding the user tag information to a preset position of the user uniform resource identifier to obtain an updated uniform resource identifier;

[0008] Matching a target uniform resource identifier that matches the updated uniform resource identifier from a preset uniform resource identifier list;

[0009] Calling the target interface to execute the business logic corresponding to the target interface to obtain a first execution result; the target interface corresponds to the target uniform resource identifier;

[0010] Sending a first execution result to the user terminal.

[0011] In one embodiment, before adding the user tag information to a preset position of the user uniform resource identifier to obtain an updated uniform resource identifier, the method further includes:

[0012] A uniform resource identifier list of the software service is obtained from a preset container through a first preset interface of the application service.

[0013] In one embodiment, before receiving the user request information, the method further includes:

[0014] Get user tag information;

[0015] Add new interfaces to software services;

[0016] The user tag information is added to the preset position of the uniform resource identifier corresponding to the new interface to obtain a uniform resource identifier list.

[0017] In one embodiment, matching a target uniform resource identifier that matches the updated uniform resource identifier from a preset uniform resource identifier list includes:

[0018] Compare the uniform resource identifier list with the updated uniform resource identifier by using a preset hash algorithm;

[0019] The uniform resource identifier in the uniform resource identifier list that is compared and matched with the updated uniform resource identifier is determined as the target uniform resource identifier.

[0020] In one embodiment, the method further comprises:

[0021] Store user tag information in the thread context;

[0022] When the target interface calls the lower interface, the user tag information is extracted from the thread context;

[0023] Extract multiple implementation classes defined by the lower layer interface by calling the second preset interface;

[0024] Determine a target implementation class from multiple implementation classes, and match the implementation class mark annotation of the target implementation class with the user tag information;

[0025] Call the target implementation class to execute the business logic corresponding to the target implementation class, and obtain a second execution result;

[0026] The second execution result is sent to the target interface.

[0027] In one embodiment, the method further comprises:

[0028] In the absence of a target implementation class, the standard implementation class is called to execute the business logic corresponding to the standard implementation class.

[0029] In one embodiment, before extracting the user tag information from the thread context, the method further includes:

[0030] Replace the original annotations in the abstract definition of the lower-level interface with the target implementation class marker annotations. The target implementation class marker annotations include standard implementation class marker annotations and customized implementation class marker annotations. The implementation class marker annotations include user tag information. The standard implementation class marker annotations correspond to the standard implementation class, and the customized implementation class marker annotations correspond to the target implementation class.

[0031] In a second aspect, an embodiment of the present application provides an interface calling device, including:

[0032] The receiving module is used to receive user request information; the user request information includes user tag information and user uniform resource identifier;

[0033] An adding module, used to add user tag information to a preset position of the user uniform resource identifier to obtain an updated uniform resource identifier;

[0034] A matching module, configured to match a target uniform resource identifier that matches the updated uniform resource identifier from a preset uniform resource identifier list;

[0035] An execution module, used for calling a target interface to execute a business logic corresponding to the target interface to obtain a first execution result; the target interface corresponds to a target uniform resource identifier;

[0036] The sending module is used to send the first execution result to the user terminal.

[0037] In one embodiment, the apparatus further comprises an acquisition module;

[0038] The acquisition module is used to acquire the uniform resource identifier list of the software service from the preset container through the first preset interface of the application service before adding the user tag information to the preset position of the user uniform resource identifier to obtain the updated uniform resource identifier.

[0039] In one embodiment, the apparatus further comprises an acquisition module;

[0040] The acquisition module is used to obtain user tag information before receiving user request information;

[0041] Adding modules is also used to add new interfaces in software services;

[0042] The adding module is also used to add user tag information at a preset position of the uniform resource identifier corresponding to the new interface to obtain a uniform resource identifier list.

[0043] In one embodiment, the matching module is specifically configured to:

[0044] Compare the uniform resource identifier list with the updated uniform resource identifier by using a preset hash algorithm;

[0045] The uniform resource identifier in the uniform resource identifier list that is compared and matched with the updated uniform resource identifier is determined as the target uniform resource identifier.

[0046] In one embodiment, the apparatus further comprises a storage module, an extraction module, a determination module, and a calling module;

[0047] A storage module, used for storing user tag information in a thread context;

[0048] An extraction module, used to extract user tag information from the thread context when the target interface calls the lower interface;

[0049] The extraction module is further used to extract multiple implementation classes defined by the lower layer interface by calling the second preset interface;

[0050] A determination module is used to determine a target implementation class from multiple implementation classes, and the implementation class mark annotation of the target implementation class matches the user tag information;

[0051] A calling module, used for calling the target implementation class to execute the business logic corresponding to the target implementation class, and obtaining a second execution result;

[0052] The sending module is also used to send the second execution result to the target interface.

[0053] In one embodiment, the calling module is further used to:

[0054] In the absence of a target implementation class, the standard implementation class is called to execute the business logic corresponding to the standard implementation class.

[0055] In one embodiment, before extracting the user tag information from the thread context, the apparatus further includes a replacement module;

[0056] The replacement module is used to replace the original annotations in the abstract definition of the lower-level interface with the target implementation class marking annotations. The target implementation class marking annotations include standard implementation class marking annotations and customized implementation class marking annotations. The implementation class marking annotations include user label information. The standard implementation class marking annotations correspond to the standard implementation class, and the customized implementation class marking annotations correspond to the target implementation class.

[0057] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the interface calling method of the first aspect when executed by the processor.

[0058] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a program for implementing information transmission is stored, and when the program is executed by a processor, the interface calling method of the first aspect is implemented.

[0059] In a fifth aspect, an embodiment of the present application provides a computer program product. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the interface calling method of the first aspect.

[0060] The interface calling method, apparatus, device and storage medium of the embodiment of the present application, after receiving user tag information and user uniform resource identifier, add the user tag information to the preset position of the user uniform resource identifier to obtain an updated uniform resource identifier, and then match the target uniform resource identifier that matches the updated uniform resource identifier from the preset uniform resource identifier list; execute the business logic corresponding to the target interface through the target interface corresponding to the target uniform resource identifier, obtain the first execution result and send it to the user terminal; based on the matching of the updated uniform resource identifier with the uniform resource identifier list, the target interface corresponding to the user request can be quickly locked, and the efficiency of returning the business logic execution result is high; and, since the target interface is a new interface added in the application service, the new interface is independent of the original standard interface in the application service, and is not generated by modifying the original standard interface, and will not destroy the code structure of the original standard interface, so that the standard interface and the target interface of the application service can both feedback the correct business logic execution result to the user. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0062] Figure 1 It is a flowchart of an interface calling method provided in an embodiment of the present application;

[0063] Figure 2 It is a structural diagram of an interface calling device provided in an embodiment of the present application;

[0064] Figure 3 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0065] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only configured to explain the present application and are not configured to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.

[0066] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0067] Application services generally combine business and technology to build software services for target customers, while productized software application services are formed into a product that can be mass-produced and released by combining technology and services through standardized and normalized processes. In the development of non-productized software application services, different industries and companies have different demands, which leads to the development of software application services in accordance with customer needs, which ultimately leads to different software application services for different people. However, in the development of productized software application services, product managers deeply study the common needs of the vast demand groups, and on this basis establish a set of standardized and normalized processes to guide users to execute the processes on the premise of meeting the demand requirements. Therefore, productized software application services pursue reliability and stability requirements.

[0068] In the process of promoting productized software application services, due to the different industry groups they target, different industry understanding capabilities of product researchers, different industry in-depth mining capabilities, and different professionalism, the standardized product demand results formed are very different. As a result, the solution coverage of productized software application services cannot reach 100%, and it is inevitable to introduce customized requirements. At this time, the product code needs to be changed to adapt to the new customized requirements.

[0069] The traditional way of product-specific transformation is to add, modify or delete new requirements directly on the original code at the code level. The existing product transformation method is to modify the original code directly, using logic encapsulation and IF ELSE syntax to isolate different logics, and embed new requirements at the code level.

[0070] Although this embedding method can quickly respond to customized needs and achieve rapid iteration, due to uncertain factors such as vague new needs, insufficient abstract productization of needs, and short-term delivery pressure, the newly added code may become a one-time customized code and be severely coupled with the standard product code, which is not conducive to later maintenance. In addition, due to the different abilities, habits, and professionalism of different technicians, the work results formed are very different, which can easily destroy the original code structure and cause failures when calling the interface, resulting in the inability to feedback the correct business logic execution results to the user.

[0071] In order to solve the problems of the prior art, the embodiment of the present application provides an interface calling method, device, equipment and storage medium. After receiving the user tag information and the user uniform resource identifier, the embodiment of the present application adds the user tag information to the preset position of the user uniform resource identifier to obtain the updated uniform resource identifier, and then matches the target uniform resource identifier that matches the updated uniform resource identifier from the preset uniform resource identifier list; executes the business logic corresponding to the target interface through the target interface corresponding to the target uniform resource identifier, obtains the first execution result and sends it to the user terminal; based on the matching of the updated uniform resource identifier with the uniform resource identifier list, the target interface corresponding to the user request can be quickly locked, and the efficiency of returning the business logic execution result is high; and, since the target interface is a new interface added in the application service, the new interface is independent of the original standard interface in the application service, and is not generated by modifying the original standard interface, and will not destroy the code structure of the original standard interface, so that the standard interface and the target interface of the application service can both feedback the correct business logic execution result to the user. The interface calling method provided by the embodiment of the present application is first introduced below.

[0072] Figure 1 FIG. 1 is a flow chart showing an interface calling method provided by an embodiment of the present application. Figure 1 As shown, the method may include the following steps:

[0073] S110, receiving user request information.

[0074] The user request information may include user tag information and a user uniform resource identifier (URI). The user tag information can identify different user terminals. The embodiment of the present application can be applied to a World Wide Web (Web) server, and the Web server can receive the user request information sent by the user terminal through the http protocol.

[0075] S120, adding the user tag information to a preset position of the user uniform resource identifier to obtain an updated uniform resource identifier.

[0076] Among them, after the Web server receives the request, it first enters the interceptor to extract the user request information carried in the request parameters, and extracts the user tag information from the user request information. The user tag information can be pre-set according to the user terminal of different companies or customers, and the user tag information is added to the preset position of the user uniform resource identifier, which is then used to match the uniform resource identifier list.

[0077] S130: Match a target uniform resource identifier that matches the updated uniform resource identifier from a preset uniform resource identifier list.

[0078] In one embodiment, S130: matching a target uniform resource identifier that matches the updated uniform resource identifier from a preset uniform resource identifier list may include:

[0079] The uniform resource identifier list is compared with the updated uniform resource identifier by using a preset hash algorithm.

[0080] The uniform resource identifier in the uniform resource identifier list that is compared and matched with the updated uniform resource identifier is determined as the target uniform resource identifier.

[0081] Among them, the preset uniform resource identifier list includes multiple groups of uniform resource identifiers with added user tag information. Based on the matching between the updated uniform resource identifier and the uniform resource identifier list, the uniform resource identifier in the uniform resource identifier list that is consistent with the user tag information in the updated uniform resource identifier can be quickly locked, and each uniform resource identifier in the uniform resource identifier list is mapped with a corresponding interface. Based on this mapping, the target interface corresponding to the user request can be quickly locked.

[0082] In one embodiment, before S110: receiving user request information, the method may further include:

[0083] Get user tag information.

[0084] Add new interfaces to software services.

[0085] The user tag information is added to the preset position of the uniform resource identifier corresponding to the new interface to obtain a uniform resource identifier list.

[0086] Among them, in order to ensure the rapid determination of the target interface, before the application interface executes the business logic, the interface in the application service is first configured. Specifically, the user tag information is first obtained, and then a new interface is added to the software service. Finally, the user tag information is added to the preset position of the uniform resource identifier corresponding to the new interface to form a uniform resource identifier list. For example, if the framework of the application service is SpringMVC, the uniform resource identifier list is registered in the Spring IOC container through the RequestMappingHanderMapping interface and cached in the local memory for application when S130 matches.

[0087] S140, calling the target interface to execute the business logic corresponding to the target interface to obtain a first execution result.

[0088] The target interface corresponds to the target uniform resource identifier. For example, in the SpringMVC architecture, the business logic can be distributed to the target interface through the dispatcher.

[0089] S150: Send a first execution result to the user terminal.

[0090] After the target interface is called to execute the business logic corresponding to the target interface and obtain the first execution result, the first execution result can be sent to the user terminal, thereby providing the user with feedback on the correct business logic execution result.

[0091] After receiving user tag information and user uniform resource identifier, the embodiment of the present application adds the user tag information to a preset position of the user uniform resource identifier to obtain an updated uniform resource identifier, and then matches a target uniform resource identifier that matches the updated uniform resource identifier from a preset uniform resource identifier list; executes the business logic corresponding to the target interface through a target interface corresponding to the target uniform resource identifier, obtains a first execution result and sends it to the user terminal; based on matching the updated uniform resource identifier with the uniform resource identifier list, the target interface corresponding to the user request can be quickly locked, and the efficiency of returning the business logic execution result is high; and, since the target interface is a new interface added to the application service, the new interface is independent of the original standard interface in the application service, and is not generated by modifying the original standard interface, and will not destroy the code structure of the original standard interface, so that the standard interface and the target interface of the application service can both feedback the correct business logic execution result to the user.

[0092] In one embodiment, before S120: adding the user tag information to a preset position of the user uniform resource identifier to obtain an updated uniform resource identifier, the method may further include:

[0093] A uniform resource identifier list of the software service is obtained from a preset container through a first preset interface of the application service.

[0094] The uniform resource identifier list of the software service can be pre-stored in a preset container, and the uniform resource identifier list of the software service can be obtained from the preset container through a specific first preset interface. For example, if the framework of the application service is SpringMVC, the uniform resource identifier list can be registered in the Spring IOC container through the RequestMappingHanderMapping interface and cached in the local memory, and the uniform resource identifier list can be obtained from the Spring IOC container through the RequestMappingHanderMapping interface.

[0095] The embodiment of the present application obtains a uniform resource identifier list of software services from a preset container based on a first preset interface, which facilitates the matching of subsequently updated uniform resource identifiers with the uniform resource identifier list, can quickly lock the target interface corresponding to the user request, and efficiently returns the business logic execution results.

[0096] In one embodiment, the method may further include:

[0097] Store user tag information in the thread context.

[0098] In the case where the target interface calls the lower layer interface, the user tag information is extracted from the thread context.

[0099] A plurality of implementation classes defined by the lower layer interface are extracted by calling the second preset interface.

[0100] The implementation class needs to be extracted using a specific second preset interface. For example, taking the SpringMVC framework as an example, the second preset interface may be the SpringContext#getBeanByType interface.

[0101] Determines a target implementation class from among multiple implementation classes.

[0102] Among them, the implementation class mark annotation of the target implementation class matches the user tag information. Taking the SpringMVC framework as an example, the target implementation class can be determined in the following steps: the encapsulated ServiceRouter routing distributor calls the SpringContext#getBeanByType interface to extract all the implementation classes defined by the lower-level interfaces at one time, which includes the productized standard implementation class and the customized implementation class. Then, the user tag information is used to perform hash matching with the implementation class mark annotation to match the only implementation class, that is, the target implementation class.

[0103] The target implementation class is called to execute the business logic corresponding to the target implementation class to obtain a second execution result.

[0104] The second execution result is sent to the target interface.

[0105] Among them, in the case of calling the lower interface from the upper interface, that is, the case of the target interface calling the lower interface, the routing distributor cannot obtain the user tag information in the target interface, and thus cannot determine which implementation classes in the lower interface should be called. Therefore, in order to accurately call the lower interface, the user tag information is stored in the thread context for the routing distributor to obtain, and then determine the target implementation class according to the routing distributor. After determining the target implementation class from multiple implementation classes, the target implementation class can be applied to execute the business logic corresponding to the target implementation class to obtain the second execution result, and the second execution result is sent to the target interface. After receiving it, the target interface can feed back the second execution result to the user terminal.

[0106] The embodiment of the present application determines the target implementation class from multiple implementation classes based on user tag information, ensuring that when the target interface calls the lower-level interface, the target implementation class can be quickly locked. After the target implementation class is applied to execute the business logic corresponding to the target implementation class to obtain the second execution result, it can be sent to the target interface, thereby realizing efficient calling of the target interface to the lower-level interface.

[0107] In one embodiment, the method may further include:

[0108] In the absence of a target implementation class, the standard implementation class is called to execute the business logic corresponding to the standard implementation class.

[0109] Among them, if the target implementation class does not exist, it means that the user request is not a customized implementation class or the customized implementation class requested by the user has not been pre-set, then the standard implementation class is called to execute the business logic corresponding to the standard implementation class, and an alarm log is generated to remind the developer to determine whether a customized implementation class needs to be added.

[0110] In one embodiment, before extracting the user tag information from the thread context, the method may further include:

[0111] Replace the original annotation in the abstract definition of the underlying interface with the target implementation class marker annotation.

[0112] Among them, the target implementation class marking annotation may include the standard implementation class marking annotation and the customized implementation class marking annotation, the implementation class marking annotation may include user tag information, the standard implementation class marking annotation corresponds to the standard implementation class, and the customized implementation class marking annotation corresponds to the target implementation class. The embodiment of the present application realizes the distinction between the standard implementation class and the customized implementation class by updating the marking annotation, and does not destroy the code of the original standard implementation class. When implementing the customized implementation class, the productized standard implementation class can be directly inherited, that is, the standard implementation class can be directly used, or the customized implementation class can be called. The two do not interfere with each other, which improves the stability of the application service. Taking the SpringMVC framework as an example, the original annotations are @Component annotation and @Service annotation, and the target implementation class marking annotations are @StandardComp annotation and @PersonaliseComp annotation. The former is the implementation class marking annotation of the productized standard implementation definition interface, and the latter is the implementation class annotation mark of the customized implementation definition interface. The productized standard implementation class of the interface adds @StandardComp to the class header for marking, and the customized implementation class adds @PersonaliseComp to the class header and adds user tag information in the annotation parameters, such as @PersonaliseComp("user tag information").

[0113] After receiving user tag information and user uniform resource identifier, the embodiment of the present application adds the user tag information to a preset position of the user uniform resource identifier to obtain an updated uniform resource identifier, and then matches a target uniform resource identifier that matches the updated uniform resource identifier from a preset uniform resource identifier list; executes the business logic corresponding to the target interface through a target interface corresponding to the target uniform resource identifier, obtains a first execution result and sends it to the user terminal; based on matching the updated uniform resource identifier with the uniform resource identifier list, the target interface corresponding to the user request can be quickly locked, and the efficiency of returning the business logic execution result is high; and, since the target interface is a new interface added to the application service, the new interface is independent of the original standard interface in the application service, and is not generated by modifying the original standard interface, and will not destroy the code structure of the original standard interface, so that the standard interface and the target interface of the application service can both feedback the correct business logic execution result to the user. Through the above embodiments, when responding to customized needs, the new code can be isolated from the original product standard implementation by adding a new interface but sharing the URI and the same downstream interface definition. It can be implemented by simply adding some encapsulation block codes, and the impact on the existing Web application service transformation is negligible, achieving the purpose of no interference between the original interface and the new interface, and realizing parallel services of customized interfaces and standard interfaces.

[0114] Figure 1 Describes the interface calling method. Figure 2 and attached Figure 3 Describe the device provided in the embodiment of the present application.

[0115] Figure 2 A schematic diagram showing the structure of an interface calling device provided by an embodiment of the present application is shown. Figure 2 Each module in the device shown has the function of realizing Figure 1 The functions of each step in the process can achieve the corresponding technical effects. Figure 2 As shown, the device may include (in one embodiment, the device may include):

[0116] The receiving module is used to receive user request information, which includes user tag information and user uniform resource identifier.

[0117] The adding module is used to add the user tag information to the preset position of the user uniform resource identifier to obtain an updated uniform resource identifier.

[0118] The matching module is used to match a target uniform resource identifier that matches the updated uniform resource identifier from a preset uniform resource identifier list.

[0119] The execution module is used to call the target interface to execute the business logic corresponding to the target interface to obtain a first execution result. The target interface corresponds to the target uniform resource identifier.

[0120] The sending module is used to send the first execution result to the user terminal.

[0121] After receiving user tag information and user uniform resource identifier, the embodiment of the present application adds the user tag information to a preset position of the user uniform resource identifier to obtain an updated uniform resource identifier, and then matches a target uniform resource identifier that matches the updated uniform resource identifier from a preset uniform resource identifier list; executes the business logic corresponding to the target interface through a target interface corresponding to the target uniform resource identifier, obtains a first execution result and sends it to the user terminal; based on matching the updated uniform resource identifier with the uniform resource identifier list, the target interface corresponding to the user request can be quickly locked, and the efficiency of returning the business logic execution result is high; and, since the target interface is a new interface added to the application service, the new interface is independent of the original standard interface in the application service, and is not generated by modifying the original standard interface, and will not destroy the code structure of the original standard interface, so that the standard interface and the target interface of the application service can both feedback the correct business logic execution result to the user.

[0122] In one embodiment, the device further includes an acquisition module.

[0123] The acquisition module is used to acquire the uniform resource identifier list of the software service from the preset container through the first preset interface of the application service before adding the user tag information to the preset position of the user uniform resource identifier to obtain the updated uniform resource identifier.

[0124] In one embodiment, the device further includes an acquisition module.

[0125] The acquisition module is used to obtain user tag information before receiving user request information.

[0126] Add modules are also used to add new interfaces in software services.

[0127] The adding module is also used to add user tag information at a preset position of the uniform resource identifier corresponding to the new interface to obtain a uniform resource identifier list.

[0128] In one embodiment, the matching module is specifically configured to:

[0129] The uniform resource identifier list is compared with the updated uniform resource identifier by using a preset hash algorithm.

[0130] The uniform resource identifier in the uniform resource identifier list that is compared and matched with the updated uniform resource identifier is determined as the target uniform resource identifier.

[0131] In one embodiment, the device further includes a storage module, an extraction module, a determination module and a calling module.

[0132] The storage module is used to store user tag information in the thread context.

[0133] The extraction module is used to extract user tag information from the thread context when the target interface calls the lower interface.

[0134] The extraction module is also used to extract multiple implementation classes defined by the lower layer interface by calling the second preset interface.

[0135] The determination module is used to determine a target implementation class from multiple implementation classes, and the implementation class mark annotation of the target implementation class matches the user tag information.

[0136] The calling module is used to call the target implementation class to execute the business logic corresponding to the target implementation class to obtain a second execution result.

[0137] The sending module is also used to send the second execution result to the target interface.

[0138] In one embodiment, the calling module is further used to:

[0139] In the absence of a target implementation class, the standard implementation class is called to execute the business logic corresponding to the standard implementation class.

[0140] In one embodiment, before extracting the user tag information from the thread context, the device further includes a replacement module.

[0141] The replacement module is used to replace the original annotations in the abstract definition of the lower-level interface with the target implementation class marking annotations. The target implementation class marking annotations include standard implementation class marking annotations and customized implementation class marking annotations. The implementation class marking annotations include user label information. The standard implementation class marking annotations correspond to the standard implementation class, and the customized implementation class marking annotations correspond to the target implementation class.

[0142] After receiving user tag information and user uniform resource identifier, the embodiment of the present application adds the user tag information to a preset position of the user uniform resource identifier to obtain an updated uniform resource identifier, and then matches a target uniform resource identifier that matches the updated uniform resource identifier from a preset uniform resource identifier list; executes the business logic corresponding to the target interface through a target interface corresponding to the target uniform resource identifier, obtains a first execution result and sends it to the user terminal; based on matching the updated uniform resource identifier with the uniform resource identifier list, the target interface corresponding to the user request can be quickly locked, and the efficiency of returning the business logic execution result is high; and, since the target interface is a new interface added to the application service, the new interface is independent of the original standard interface in the application service, and is not generated by modifying the original standard interface, and will not destroy the code structure of the original standard interface, so that the standard interface and the target interface of the application service can both feedback the correct business logic execution result to the user. Through the above embodiments, when responding to customized needs, the new code can be isolated from the original product standard implementation by adding a new interface but sharing the URI and the same downstream interface definition. It can be implemented by simply adding some encapsulation block codes, and the impact on the existing Web application service transformation is negligible, achieving the purpose of no interference between the original interface and the new interface, and realizing parallel services of customized interfaces and standard interfaces.

[0143] Figure 3 FIG. 1 is a schematic diagram showing the structure of an electronic device provided by an embodiment of the present application. Figure 3 As shown, the device may include a processor 301 and a memory 302 storing computer program instructions.

[0144] Specifically, the processor 301 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0145] The memory 302 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 302 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In one example, the memory 302 may include a removable or non-removable (or fixed) medium, or the memory 302 is a non-volatile solid-state memory. The memory 302 may be inside or outside the integrated gateway disaster recovery device.

[0146] In one example, the memory 302 may be a read-only memory (ROM). In one example, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM), or a flash memory, or a combination of two or more of these.

[0147] The processor 301 reads and executes the computer program instructions stored in the memory 302 to implement Figure 1 The method in the embodiment shown in the figure is achieved Figure 1 The corresponding technical effects achieved by executing the method in the example shown are not repeated here for the sake of brevity.

[0148] In one example, the electronic device may further include a communication interface 303 and a bus 310. Figure 3 As shown, the processor 301, the memory 302, and the communication interface 303 are connected via a bus 310 and communicate with each other.

[0149] The communication interface 303 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.

[0150] Bus 310 includes hardware, software or both, and the components of online data flow billing equipment are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (Accelerated Graphics Port, AGP) or other graphics bus, enhanced industry standard architecture (Extended Industry Standard Architecture, EISA) bus, front side bus (Front Side Bus, FSB), Hyper Transport (Hyper Transport, HT) interconnection, industry standard architecture (Industry Standard Architecture, ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 310 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the present application considers any suitable bus or interconnection.

[0151] The electronic device can execute the interface calling method in the embodiment of the present application, thereby realizing Figure 1 The corresponding technical effects of the described interface calling method.

[0152] In addition, in combination with the interface calling method in the above embodiment, the embodiment of the present application can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any one of the interface calling methods in the above embodiment is implemented.

[0153] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.

[0154] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), appropriate firmware, plug-in, function card, etc. When implemented in software, the elements of the present application are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or communication link by a data signal carried in a carrier. "Machine-readable medium" may include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (Radio Frequency, RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.

[0155] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.

[0156] The above reference is according to the method of the embodiment of the present application, the flow chart of the device (system) and the computer program product and / or the block diagram described various aspects of the present application.It should be understood that each square box in the flow chart and / or the block diagram and the combination of each square box in the flow chart and / or the block diagram can be realized by computer program instructions.These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the realization of the function / action specified in one or more square boxes of the flow chart and / or the block diagram.Such a processor can be but is not limited to a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit.It can also be understood that each square box in the block diagram and / or the flow chart and the combination of the square boxes in the block diagram and / or the flow chart can also be realized by the dedicated hardware that performs the specified function or action, or can be realized by the combination of dedicated hardware and computer instructions.

[0157] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.

Claims

1. An interface calling method, It is characterized in that include: Receiving user request information; the user request information includes user tag information and user uniform resource identifier; Adding the user tag information to a preset position of the user uniform resource identifier to obtain an updated uniform resource identifier; Matching a target uniform resource identifier that matches the updated uniform resource identifier from a preset uniform resource identifier list; Calling a target interface to execute a business logic corresponding to the target interface to obtain a first execution result; the target interface corresponds to the target uniform resource identifier; The target interface is a new interface added in the application service; Sending the first execution result to the user terminal.

2. The interface calling method according to claim 1, It is characterized in that Before adding the user tag information to a preset position of the user uniform resource identifier to obtain an updated uniform resource identifier, the method further includes: A uniform resource identifier list of software services is obtained from a preset container through a first preset interface of the application service.

3. The interface calling method according to claim 1, It is characterized in that Before receiving the user request information, the method further includes: Get user tag information; Add new interfaces to the application service; The user tag information is added to the preset position of the uniform resource identifier corresponding to the new interface to obtain the uniform resource identifier list.

4. The interface calling method according to claim 1, It is characterized in that The step of matching a target uniform resource identifier that matches the updated uniform resource identifier from a preset uniform resource identifier list includes: Comparing the uniform resource identifier list with the updated uniform resource identifier by using a preset hash algorithm; The uniform resource identifier in the uniform resource identifier list that is compared and matched with the updated uniform resource identifier is determined as the target uniform resource identifier.

5. The interface calling method according to any one of claims 1 to 4, It is characterized in that The method further comprises: Storing the user tag information in a thread context; In the case where the target interface calls a lower layer interface, extracting the user tag information from the thread context; Extracting multiple implementation classes defined by the lower layer interface by calling a second preset interface; Determine a target implementation class from the multiple implementation classes, wherein the implementation class mark annotation of the target implementation class matches the user tag information; Calling the target implementation class to execute the business logic corresponding to the target implementation class to obtain a second execution result; The second execution result is sent to the target interface.

6. The interface calling method according to claim 5, It is characterized in that The method further comprises: In the case where the target implementation class does not exist, the standard implementation class is called to execute the business logic corresponding to the standard implementation class.

7. The interface calling method according to claim 6, It is characterized in that Before extracting the user tag information from the thread context, the method further includes: The original annotations in the abstract definition of the lower-level interface are replaced with target implementation class marking annotations, wherein the target implementation class marking annotations include standard implementation class marking annotations and customized implementation class marking annotations, and the implementation class marking annotations include the user tag information. The standard implementation class marking annotations correspond to the standard implementation class, and the customized implementation class marking annotations correspond to the target implementation class.

8. An interface calling device, It is characterized in that include: A receiving module, used for receiving user request information; The user request information includes user tag information and a user uniform resource identifier; An adding module, used for adding the user tag information to a preset position of the user uniform resource identifier to obtain an updated uniform resource identifier; A matching module, configured to match a target uniform resource identifier that matches the updated uniform resource identifier from a preset uniform resource identifier list; An execution module, used for calling a target interface to execute a business logic corresponding to the target interface to obtain a first execution result; the target interface corresponds to the target uniform resource identifier; The target interface is a new interface added in the application service; A sending module is used to send the first execution result to a user terminal.

9. The interface calling device according to claim 8, It is characterized in that The device also includes an acquisition module; The acquisition module is used to acquire a software service uniform resource identifier list from a preset container through a first preset interface of the application service before adding the user tag information to a preset position of the user uniform resource identifier to obtain an updated uniform resource identifier.

10. The interface calling device according to claim 8, It is characterized in that The device also includes an acquisition module; The acquisition module is used to acquire user tag information before receiving the user request information; The adding module is also used to add a new interface in the software service; The adding module is further used to add the user tag information at the preset position of the uniform resource identifier corresponding to the new interface to obtain the uniform resource identifier list.

11. The interface calling device according to claim 8, It is characterized in that The matching module is specifically used for: Comparing the uniform resource identifier list with the updated uniform resource identifier by using a preset hash algorithm; The uniform resource identifier in the uniform resource identifier list that is compared and matched with the updated uniform resource identifier is determined as the target uniform resource identifier.

12. The interface calling device according to any one of claims 8 to 11, It is characterized in that The device also includes a storage module, an extraction module, a determination module and a calling module; The storage module is used to store the user tag information in the thread context; The extraction module is used to extract the user tag information from the thread context when the target interface calls the lower interface; The extraction module is further used to extract multiple implementation classes defined by the lower layer interface by calling the second preset interface; The determination module is used to determine a target implementation class from the multiple implementation classes, wherein the implementation class mark annotation of the target implementation class matches the user tag information; The calling module is used to call the target implementation class to execute the business logic corresponding to the target implementation class to obtain a second execution result; The sending module is further used to send the second execution result to the target interface.

13. The interface calling device according to claim 12, It is characterized in that The calling module is also used for: In the case where the target implementation class does not exist, the standard implementation class is called to execute the business logic corresponding to the standard implementation class.

14. The interface calling device according to claim 13, It is characterized in that Before extracting the user tag information from the thread context, the device further includes a replacement module; The replacement module is used to replace the original annotation in the abstract definition of the lower-level interface with the target implementation class marking annotation, the target implementation class marking annotation includes the standard implementation class marking annotation and the customized implementation class marking annotation, the implementation class marking annotation includes the user tag information, the standard implementation class marking annotation corresponds to the standard implementation class, and the customized implementation class marking annotation corresponds to the target implementation class.

15. An electronic device, It is characterized in that include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the interface calling method according to any one of claims 1 to 7.

16. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores an implementation program for information transmission, and when the program is executed by a processor, the interface calling method according to any one of claims 1 to 7 is implemented.

17. A computer program product, It is characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the interface calling method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Electronic device, springmvc-based data interface, automatic description generation method and storage medium

    CN108255513A

  • Single sign-on method, device, computer equipment and storage medium

    CN109286633A