Service processing method modification method and device, equipment and storage medium

By defining customized methods and intercepting target access requests, the problems of inefficient modification of business processing methods and high risk of errors in software product development are solved, and system flexibility and code readability are improved.

CN119512519APending Publication Date: 2025-02-25成都赛美特信息科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411590137.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

During the software product development process, the project implementation team needs to copy and modify a large amount of code when modifying business processing methods, resulting in inefficiency, high risk of errors, and complex code management and maintenance.

Method used

By defining a custom method, the target access request sent to the request address of the original method is intercepted, and it is forwarded to the request address of the customized method, and the target access request is processed through the custom method to generate a response to avoid modifying the original product framework code.

Benefits of technology

It realizes that custom-processing specific URL requests is handled without modifying the original product framework code, which improves system flexibility and code readability, reduces the difficulty and error risk of business processing methods, and improves efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119512519A_ABST
    Figure CN119512519A_ABST
Patent Text Reader

Abstract

The invention provides a business processing method modification method and device, equipment and a storage medium, and the method comprises the steps: defining a customization method; intercepting a target access request sent to the request address of the original method, and forwarding the target access request to the request address of the customization method; processing the target access request through the customization method, and generating a target response; and returning the target response to a requester of the target access request. By adopting the method, the consumed labor cost and time are reduced, the modification difficulty and error risk of the business processing method are reduced, and the modification efficiency and accuracy of the business processing method are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing, and in particular to a business processing method modification method, device, equipment and storage medium. Background Art

[0002] In the process of software product development, in order to ensure code security, maintainability and stability, the framework code and common business logic in the project are usually packaged into JAR packages, collectively referred to as framework code. After the software company releases the product, the implementation team will conduct secondary development based on the software product released by the company when implementing the project according to the specific business needs of Party A (customer).

[0003] However, during the project implementation phase, the product code provided by the product R&D department often cannot fully meet the functional requirements of Party A. Faced with this situation, the implementation team usually has two coping strategies. The first is to feedback the requirements to the R&D department, and the R&D department will make necessary modifications to the product framework code and repackage it into a JAR package for the implementation team to use, so as to modify the business processing method. The second strategy is that the implementation team will solve some non-critical functional requirements on its own without affecting the stability of the system. If it involves the modification of the framework code, the implementation team will use a decompilation tool to decompile the JAVA code in the JAR package, copy the code out and then edit it to implement the required functions, so as to modify the business processing method.

[0004] However, the study found that in the process of modifying the business processing method in the above process, for a business class containing dozens of methods, copying all thousands of lines of code and modifying them means a lot of unnecessary duplication of work. This is not only inefficient, but also increases the risk of errors. During the modification process, developers may accidentally modify other methods, resulting in unforeseen problems and defects. And copying the code of the entire class will also complicate code management and maintenance. In the future, when conducting code review, troubleshooting or function expansion, developers need to face more code, which will cost them more time and energy to understand and locate problems. In addition, when the original class is updated or changed, the manually maintained copy code also needs to be updated accordingly, which further increases the difficulty and cost of maintenance. In summary, copying the entire class code for modification just because one method in the class needs to be modified to achieve the modification of the business processing method will increase the labor cost and time required, and increase the difficulty and error risk of modifying the business processing method, thereby reducing the efficiency and accuracy of modifying the business processing method. Summary of the invention

[0005] In view of this, the purpose of the present invention is to provide a business processing method modification method, device, equipment and storage medium to reduce the manpower cost and time required, reduce the difficulty and error risk of business processing method modification, and improve the efficiency and accuracy of business processing method modification.

[0006] In a first aspect, an embodiment of the present application provides a method for modifying a service processing method, the method comprising:

[0007] Define customized methods;

[0008] intercepting a target access request sent to a request address of the original method, and forwarding the target access request to the request address of the customized method;

[0009] Processing the target access request by the customized method to generate a target response;

[0010] The target response is returned to the requestor of the target access request.

[0011] Optionally, before defining the customized method, the method further includes:

[0012] Define a new Java class;

[0013] The customized method is defined in the Java class.

[0014] Optionally, the method further comprises:

[0015] Define interceptors;

[0016] The target access request is intercepted by the interceptor.

[0017] Optionally, intercepting the target access request sent to the request address of the original method includes:

[0018] Capturing the current access request sent by the requesting party, and obtaining the request address of the current access request;

[0019] Determine whether the request address of the current access request matches the request address of the original method;

[0020] If the request address of the current access request matches the request address of the original method, the current access request is intercepted as the target access request.

[0021] In a second aspect, an embodiment of the present application provides a device for modifying a service processing method, the device comprising:

[0022] Customized method definition module, used to define customized methods;

[0023] A request interception module, used to intercept a target access request sent to a request address of the original method, and forward the target access request to the request address of the customized method;

[0024] A response generation module, used to process the target access request through the customized method and generate a target response;

[0025] A response returning module is used to return the target response to the requester of the target access request.

[0026] Optionally, the device further comprises a Java class definition module;

[0027] The Java class definition module is used to define a new Java class before defining a customized method; and is also used to define the customized method in the Java class.

[0028] Optionally, the device further comprises:

[0029] Interceptor definition module, used to define interceptors;

[0030] The interceptor execution module is used to intercept the target access request through the interceptor execution.

[0031] Optionally, intercepting the target access request sent to the request address of the original method includes:

[0032] Capturing the current access request sent by the requesting party, and obtaining the request address of the current access request;

[0033] Determine whether the request address of the current access request matches the request address of the original method;

[0034] If the request address of the current access request matches the request address of the original method, the current access request is intercepted as the target access request.

[0035] In a third aspect, an embodiment of the present application provides a computer device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor and the memory communicate through the bus, and when the machine-readable instructions are executed by the processor, the steps of the business processing method modification method described in any optional implementation manner of the first aspect are performed.

[0036] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the business processing method modification method described in any optional implementation manner of the first aspect above are executed.

[0037] The technical solution provided by this application includes but is not limited to the following beneficial effects:

[0038] This application defines a customized method, intercepts the target access request sent to the request address of the original method, forwards the target access request to the request address of the customized method, and processes the target access request through the customized method, so as to realize the customized processing of specific URL requests without modifying the original product framework code. This interceptor-based mechanism not only improves the flexibility of the system, but also makes the business logic clearer and easier to maintain, while improving the readability of the code. At the same time, after generating the target response for the target access request, the target response is returned to the requester of the target access request, which can ensure the normal processing of the business. Since other URL requests are still processed according to the original service process, the stability and reliability of the entire system are guaranteed. The above scheme is adopted to reduce the labor cost and time required, reduce the difficulty and error risk of modifying the business processing method, and improve the efficiency and accuracy of modifying the business processing method.

[0039] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0041] Figure 1 A flowchart of a method for modifying a service processing method provided in Embodiment 1 of the present invention is shown;

[0042] Figure 2 A flowchart of a customized method definition method provided by the first embodiment of the present invention is shown;

[0043] Figure 3 A flowchart of an interceptor definition method provided by Embodiment 1 of the present invention is shown;

[0044] Figure 4 A flow chart of an access request interception method provided by Embodiment 1 of the present invention is shown;

[0045] Figure 5 A flowchart of a specific service processing method modification method provided by the first embodiment of the present invention is shown;

[0046] Figure 6 A schematic diagram showing the structure of a device for modifying a service processing method provided in Embodiment 2 of the present invention is shown;

[0047] Figure 7 A schematic diagram of the structure of a computer device provided in Embodiment 3 of the present invention is shown. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present invention.

[0049] Embodiment 1

[0050] To facilitate understanding of this application, Figure 1 The content described in the flowchart of a business processing method modification method provided by the first embodiment of the present invention is described in detail for the first embodiment of the present application.

[0051] See also Figure 1 As shown, Figure 1 A flowchart of a method for modifying a service processing method provided in the first embodiment of the present invention is shown, wherein the method comprises steps S101 to S104:

[0052] S101: Define customization method.

[0053] Specifically, the defined customBizMethod customized method replaces or extends the logic of the first defined method firstBizMethod (ie, the original method described below) in the original ProductService product service class.

[0054] S102: intercepting a target access request sent to a request address of the original method, and forwarding the target access request to the request address of the customized method.

[0055] Specifically, identify the access requests sent by each requester, and use the access request sent to the URL request address http: / / host:port / rest / products / firstBizMethod of the original method as the target access request, and capture and process the request before it reaches the target service. When the interceptor identifies that the URL address of the request is http: / / host:port / rest / products / firstBizMethod, it will not directly forward the request to the request address of the original method to the original service processing class (such as ProductService). The interceptor will forward the request address (or the content of the request) to a newly defined class CustomProductService customer product service customBizMethod customized method method. This CustomProductService customer product service class contains custom business logic for processing the data received from the request of the firstBizMethod original method, and may perform a series of operations based on business needs.

[0056] S103: Processing the target access request through the customized method to generate a target response.

[0057] Specifically, the customBizMethod customized method of the CustomProductService customized method will execute the corresponding business logic according to the received request data and may generate a response.

[0058] S104: Return the target response to the requester of the target access request.

[0059] Specifically, this response will then be captured by the interceptor and returned to the requester (ie, the user or client) of the target access request.

[0060] This method of modifying a class method code in the product framework JAR package by combining interception requests can achieve customized processing of specific URL requests without modifying the original product framework code. This interception-based mechanism not only improves the flexibility of the system, but also makes the business logic clearer and easier to maintain, while improving the readability of the code. At the same time, since other URL requests are still processed according to the original service process, the stability and reliability of the entire system are guaranteed. During the project implementation process, on-site developers can use this method to efficiently handle functional requirement changes proposed by customers, reduce ineffective communication with product R&D personnel, and improve work efficiency.

[0061] In an alternative embodiment, see Figure 2 As shown, Figure 2 A flowchart of a customized method definition method provided by the first embodiment of the present invention is shown, wherein before defining the customized method, the method further includes steps S201 to S202:

[0062] S201: Define a new Java class.

[0063] S202: Define the customized method in the Java class.

[0064] Specifically, create a new Java class named CustomProductService.java. The package name, class name, and method name of this class can be defined according to actual needs. The new class CustomProductService.java is used to implement the business logic code changes required by the customer site. The customBizMethod method defined will replace or extend the logic of the firstBizMethod method in the original ProductService class.

[0065] In an alternative embodiment, see Figure 3 As shown, Figure 3 A flowchart of an interceptor definition method provided in the first embodiment of the present invention is shown, wherein the method further includes steps S301 to S302:

[0066] S301: define interceptor;

[0067] S302: intercepting the target access request through the interceptor.

[0068] Specifically, an interceptor is defined, the purpose of which is to capture and process the target access request before it reaches the target service.

[0069] In an alternative embodiment, see Figure 4 As shown, Figure 4 A flowchart of an access request interception method provided in the first embodiment of the present invention is shown, wherein the interception of a target access request sent to a request address of an original method comprises steps S401 to S403:

[0070] S401: Capture the current access request sent by the requester, and obtain the request address of the current access request.

[0071] S402: Determine whether the request address of the current access request matches the request address of the original method.

[0072] S403: If the request address of the current access request matches the request address of the original method, intercepting the current access request as the target access request.

[0073] Specifically, the URL request address of the user's access request is obtained. When the user requests to access the URL address of the original method http: / / host:port / rest / products / firstBizMethod, the interceptor will intercept the request address (or the request content) and then forward it to the customBizMethod method of the newly defined class CustomProductService for processing.

[0074] See also Figure 5 As shown, Figure 5 A flowchart of a specific business processing method modification method provided by the first embodiment of the present invention is shown, wherein, in order to define a new customized method customBizMethod, it is necessary to decompile the com.lsa.sc.service.ProductService.class file from the product framework JAR package to obtain the key information configured therein, such as the URL address and request parameters set in the original method. This can better understand the existing functional capabilities, and expand and optimize them on this basis. Therefore, first decompile the code com.lsa.sc.service.ProductService.class in the product framework JAR package, create a CustomProductService.java class and method customBizMethod, and add the business function requirements proposed by the customer on site. Then intercept the request address of the original method firstBizMethod in the interceptor CustomBizInterceptor, forward the address to customBizMethod, and hand over the business logic originally handled by firstBizMethod to customBizMethod for completion. That is, the interceptor adopts the redirection business processing method to forward the request sent with the request address of http: / / host:port / rest / products / firstBizMethod to the customBizMethod method in the CustomProductService.java class to handle the business logic modification without destroying the product framework code.

[0075] Embodiment 2

[0076] Embodiment 2 of the present invention provides a device for modifying a service processing method, see Figure 6 As shown, Figure 6A schematic diagram of the structure of a device for modifying a service processing method provided in Embodiment 2 of the present invention is shown, wherein the device comprises:

[0077] A customized method definition module 601 is used to define a customized method;

[0078] A request interception module 602, configured to intercept a target access request sent to a request address of the original method, and forward the target access request to the request address of the customized method;

[0079] A response generation module 603, configured to process the target access request by the customized method and generate a target response;

[0080] The response returning module 604 is used to return the target response to the requester of the target access request.

[0081] In an optional embodiment, the apparatus further comprises a Java class definition module;

[0082] The Java class definition module is used to define a new Java class before defining a customized method; and is also used to define the customized method in the Java class.

[0083] In an optional embodiment, the device further comprises:

[0084] Interceptor definition module, used to define interceptors;

[0085] The interceptor execution module is used to intercept the target access request through the interceptor execution.

[0086] In an optional implementation, intercepting the target access request sent to the request address of the original method includes:

[0087] Capturing the current access request sent by the requesting party, and obtaining the request address of the current access request;

[0088] Determine whether the request address of the current access request matches the request address of the original method;

[0089] If the request address of the current access request matches the request address of the original method, the current access request is intercepted as the target access request.

[0090] Embodiment 3

[0091] Based on the same application concept, see Figure 7 As shown, Figure 7 FIG. 4 shows a schematic diagram of the structure of a computer device provided by Embodiment 3 of the present invention, wherein: Figure 7As shown, a computer device 700 provided in Embodiment 3 of the present application includes:

[0092] A processor 701, a memory 702 and a bus 703, wherein the memory 702 stores machine-readable instructions executable by the processor 701. When the computer device 700 is running, the processor 701 communicates with the memory 702 via the bus 703. When the processor 701 is running, the machine-readable instructions execute the steps of the business processing method modification method shown in the above-mentioned embodiment 1.

[0093] Embodiment 4

[0094] Based on the same application concept, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the business processing method modification method described in any one of the above embodiments are executed.

[0095] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0096] The computer program product for modifying the business processing method provided in the embodiment of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the method described in the previous method embodiment. The specific implementation can be found in the method embodiment and will not be repeated here.

[0097] The business processing method modification device provided in the embodiment of the present invention can be specific hardware on the device or software or firmware installed on the device. The implementation principle and technical effects of the device provided in the embodiment of the present invention are the same as those of the aforementioned method embodiment. For the sake of brief description, the parts not mentioned in the device embodiment can refer to the corresponding contents in the aforementioned method embodiment. Technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above can all refer to the corresponding processes in the aforementioned method embodiment, and will not be repeated here.

[0098] In the embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.

[0099] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0100] In addition, each functional unit in the embodiment provided by the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0101] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.

[0102] It should be noted that similar numbers and letters represent similar items in the following figures. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are only used to distinguish the description and are not to be understood as indicating or implying relative importance.

[0103] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, those skilled in the art should understand that any person skilled in the art can still modify the technical solutions described in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or perform equivalent replacements on some of the technical features thereof; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention. They should all be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims

1. A method for modifying a business processing method, characterized in that: The method comprises: Define customized methods; intercepting a target access request sent to a request address of the original method, and forwarding the target access request to the request address of the customized method; Processing the target access request by the customized method to generate a target response; The target response is returned to the requestor of the target access request.

2. The method according to claim 1, characterized in that: Before defining the customized method, the method further includes: Define a new Java class; The customized method is defined in the Java class.

3. The method according to claim 1, characterized in that The method further comprises: Define interceptors; The target access request is intercepted by the interceptor.

4. The method according to claim 1, characterized in that The intercepting of the target access request sent to the request address of the original method includes: Capturing the current access request sent by the requesting party, and obtaining the request address of the current access request; Determine whether the request address of the current access request matches the request address of the original method; If the request address of the current access request matches the request address of the original method, the current access request is intercepted as the target access request.

5. A business processing method modification device, characterized in that: The device comprises: Customized method definition module, used to define customized methods; A request interception module, used to intercept a target access request sent to a request address of the original method, and forward the target access request to the request address of the customized method; A response generation module, used to process the target access request through the customized method and generate a target response; A response returning module is used to return the target response to the requester of the target access request.

6. The device according to claim 5, characterized in that The device also includes a Java class definition module; The Java class definition module is used to define a new Java class before defining a customized method; and is also used to define the customized method in the Java class.

7. The device according to claim 5, characterized in that The device also includes: Interceptor definition module, used to define interceptors; The interceptor execution module is used to intercept the target access request through the interceptor execution.

8. The device according to claim 5, characterized in that The intercepting of the target access request sent to the request address of the original method includes: Capturing the current access request sent by the requesting party, and obtaining the request address of the current access request; Determine whether the request address of the current access request matches the request address of the original method; If the request address of the current access request matches the request address of the original method, the current access request is intercepted as the target access request.

9. A computer device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the business processing method modification method as described in any one of claims 1 to 4 are performed.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the business processing method modification method as claimed in any one of claims 1 to 4 are executed.