Business logic exception handling method, device, computer equipment and storage medium

By obtaining and analyzing the similarity of business logic, filtering out the reference business logic and obtaining processing strategies, the problem of business logic exception handling is solved and rapid repair is achieved.

CN113886818BActive Publication Date: 2024-12-03CHINA PING AN LIFE INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111266363.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-28
Publication Date
2024-12-03
Estimated Expiration
2041-10-28

AI Technical Summary

Technical Problem

The complexity of business logic makes it difficult to find an effective solution when an exception occurs, especially in payment problems, password recovery problems, and system process problems.

Method used

By obtaining the similarity between the business logic of the program to be detected and the historical business logic, filter out the most similar reference business logic, analyze its exception problems, and obtain processing strategies, and fix the exception problems based on this strategy.

Benefits of technology

When there is an exception in the business logic, it quickly finds an effective processing solution, and automatically finds the most similar reference business logic to obtain processing strategies, achieving rapid and timely repairs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113886818B_ABST
    Figure CN113886818B_ABST
Patent Text Reader

Abstract

The present application relates to the field of software monitoring technology, and provides a method, apparatus, computer equipment and storage medium for handling exceptions in business logic, wherein the method comprises: obtaining the business logic of a program to be detected, and obtaining all historical business logics from a database, respectively calculating the similarity between the business logic and each historical business logic, screening out a reference business logic having the greatest similarity to the business logic, analyzing the business logic, obtaining an analysis result, judging whether the business logic has an abnormal problem according to the analysis result, and when judging that the business logic has an abnormal problem according to the analysis result, judging whether the reference business logic has had an abnormal problem before, and when judging that the reference business logic has had an abnormal problem before, obtaining a corresponding processing strategy according to the abnormal problem, and repairing the abnormal problem of the business logic based on the processing strategy, so as to quickly and timely process the business logic of the program to be detected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of software monitoring technology. Specifically, the present application relates to a method, device, computer equipment and storage medium for handling business logic exceptions. Background Art

[0002] In the development and update of the system, it is necessary to separate the business logic and the technical logic to achieve a faster and more stable development method. For the realization of system business, due to the complexity of business logic and the high reusability of technical logic, the system implementation can be divided into business logic and technical logic, thus achieving high reuse of technology. However, due to its complexity, it is difficult to find effective solutions when anomalies occur, such as payment problems, password retrieval problems, and some system process problems. After the development is completed, some business logic anomalies may be found. Summary of the invention

[0003] The main purpose of this application is to provide a business logic exception handling method, device, computer equipment and storage medium, so as to quickly find an effective processing solution when an exception occurs in the business logic.

[0004] In order to achieve the above-mentioned object of the invention, the present application provides a method for handling business logic exceptions, which comprises the following steps:

[0005] Obtain the business logic of the program to be tested and obtain all historical business logic from the database;

[0006] Calculating the similarity between the business logic and each of the historical business logics respectively;

[0007] Filter out the historical business logic with the greatest similarity to the business logic from all the historical business logics to obtain the reference business logic;

[0008] Analyze the business logic to obtain analysis results, and determine whether there are any abnormal problems in the business logic according to the analysis results;

[0009] When it is determined according to the analysis result that the business logic has an abnormal problem, determining whether the reference business logic has had the abnormal problem;

[0010] When it is determined that the reference business logic has the abnormal problem, a corresponding processing strategy is obtained according to the abnormal problem;

[0011] The abnormal problem of the business logic is repaired based on the processing strategy.

[0012] Preferably, obtaining a corresponding processing strategy according to the abnormal problem includes:

[0013] Calculate the probability that the abnormal problem will cause other abnormal problems to occur;

[0014] Filter out other abnormal problems with the highest probability of being caused by the abnormal problem from other abnormal problems, and obtain related abnormal problems;

[0015] Obtain a first processing strategy corresponding to the relevant abnormal problem in the reference business logic and a second processing strategy corresponding to the abnormal problem, and use the first processing strategy and the second processing strategy as the processing strategies.

[0016] Preferably, respectively calculating the similarity between the business logic and each of the historical business logics includes:

[0017] Obtaining a keyword of the business logic to obtain a first keyword; wherein the first keyword is used to describe key information of the business logic;

[0018] Respectively obtain the keywords of each of the historical business logics to obtain the second keywords of each of the historical business logics; wherein the second keywords are used to describe key information of the historical business logic;

[0019] Convert the first keyword into a vector to obtain a first word vector;

[0020] Convert each second keyword of the historical business logic into a vector respectively to obtain a plurality of second word vectors;

[0021] The cosine distance between the first word vector and each of the second word vectors is calculated respectively as the similarity.

[0022] Preferably, when the business logic includes a plurality of the first keywords, converting the first keywords into vectors to obtain first word vectors includes:

[0023] Convert each of the first keywords into a vector respectively to obtain multiple word vectors;

[0024] Calculate an average vector of the multiple word vectors, and use the average vector as the first word vector.

[0025] Preferably, the analyzing the business logic to obtain the analysis result includes:

[0026] Extracting data features of the business logic by principal component analysis;

[0027] A mapping of the data features is obtained by using a multi-mapping method, and a logistic regression algorithm or a random forest algorithm is used to troubleshoot abnormal problems in the mapping to obtain an analysis result.

[0028] Preferably, the analyzing the business logic to obtain the analysis result includes:

[0029] The business logic is input into a preset business logic vulnerability detection engine to obtain an analysis result output by the business logic vulnerability detection engine; wherein the analysis result includes whether the program to be detected has a business logic vulnerability and the type of business logic vulnerability when a business logic vulnerability exists, and the business logic vulnerability type includes an unauthorized vulnerability and a text message bomb vulnerability.

[0030] Furthermore, after the abnormal problem of the business logic is repaired based on the processing strategy, it also includes:

[0031] Determine whether the abnormal problem of the business logic is successfully repaired;

[0032] If not, the repair process of the abnormal problem and the reason why it cannot be repaired are recorded, and the repair process and the reason why it cannot be repaired are sent to the terminal where the preset target user is located.

[0033] The present application also provides a business logic exception handling device, which includes:

[0034] The first acquisition module is used to acquire the business logic of the program to be detected and obtain all historical business logic from the database;

[0035] A calculation module, used to respectively calculate the similarity between the business logic and each of the historical business logics;

[0036] A screening module, used to screen out the historical business logic with the greatest similarity to the business logic from all the historical business logics, to obtain the reference business logic;

[0037] An analysis module is used to analyze the business logic, obtain analysis results, and determine whether there are abnormal problems in the business logic according to the analysis results;

[0038] A judgment module, used for judging whether the reference business logic has had the abnormal problem when it is judged that the business logic has the abnormal problem according to the analysis result;

[0039] A second acquisition module is used to acquire a corresponding processing strategy according to the abnormal problem when it is determined that the reference business logic has the abnormal problem;

[0040] A repair module is used to repair the abnormal problem of the business logic based on the processing strategy.

[0041] The present application also provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the above methods when executing the computer program.

[0042] The present application also 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 any of the above methods are implemented.

[0043] The present application provides a method, device, computer equipment and storage medium for handling business logic exceptions, which obtain the business logic of a program to be detected, obtain all historical business logics from a database, calculate the similarity between the business logic and each historical business logic, screen out the historical business logic with the greatest similarity to the business logic from all historical business logics, obtain reference business logic, analyze the business logic, obtain analysis results, and judge whether there is an abnormal problem in the business logic according to the analysis results. When it is judged that there is an abnormal problem in the business logic according to the analysis results, judge whether there is an abnormal problem in the reference business logic. When it is judged that there is an abnormal problem in the reference business logic, obtain a corresponding processing strategy according to the abnormal problem, and repair the abnormal problem of the business logic based on the processing strategy, so as to automatically find the reference business logic that is most similar to the business logic when an abnormality occurs in the business logic, obtain an effective processing strategy based on the reference business logic, and use the processing strategy to quickly and timely process the business logic. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 A flowchart of a method for handling exceptions in business logic according to an embodiment of the present application;

[0045] Figure 2 This is a schematic block diagram of the structure of a device for handling exceptions in the business logic of an embodiment of the present application;

[0046] Figure 3 A schematic block diagram of the structure of a computer device according to an embodiment of the present application.

[0047] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0049] The present application proposes a method for handling business logic exceptions, with a server as the execution subject. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), as well as big data and artificial intelligence platforms.

[0050] The exception handling method of this business logic is used to solve the technical problem that it is difficult to find an effective solution when an exception occurs due to the complexity of the business logic. Figure 1 In one embodiment, the exception handling method of the business logic includes the following steps:

[0051] S11, obtaining the business logic of the program to be tested, and obtaining all historical business logic from the database;

[0052] S12, respectively calculating the similarity between the business logic and each of the historical business logics;

[0053] S13, selecting the historical business logic with the greatest similarity to the business logic from all the historical business logics to obtain a reference business logic;

[0054] S14, analyzing the business logic to obtain an analysis result, and judging whether there is an abnormality in the business logic according to the analysis result;

[0055] S15. When it is determined according to the analysis result that the business logic has an abnormal problem, determine whether the reference business logic has had the abnormal problem;

[0056] S16. When it is determined that the reference business logic has the abnormal problem, a corresponding processing strategy is obtained according to the abnormal problem;

[0057] S17. Repair the abnormal problem of the business logic based on the processing strategy.

[0058] As described in the above step S11, the business logic of the program to be tested is first of all business in terms of name. This business generally refers to the function to be implemented by the program, that is, the customer's business. To implement these businesses, there is a process. The process is a chain formed according to a certain relationship. The relationship between the chains has a certain logic. The combination constitutes the business logic, which can be displayed in the form of a business logic diagram or text. For example, after the mobile terminal obtains the transfer transaction request information, it is necessary to judge the validity of the obtained information form, such as whether the transfer amount is a value greater than zero, whether the number of digits of the transfer bank card number is valid, etc. If all the request information contents meet the formal validity, it is necessary to combine the specific information of the obtained transaction request, and standardize the information according to the combination method agreed in advance.

[0059] In one embodiment, when obtaining the business logic of the program to be tested, the server can sort out the business logic of the system interface call part of the program to be tested, and determine the system interface exception scenario that needs to be simulated based on the business logic. For the convenience of description, the system interface involved in the system interface exception scenario that needs to be simulated is called the target system interface. Based on the target system interface, the specified source code location can be determined, and the business logic can be called from the specified source code location.

[0060] This embodiment can also collect all historical business logics in advance and store all historical business logics in a database, wherein the historical business logics include abnormal business logics that occurred during the testing of the program in the past time period.

[0061] As described in step S12 above, this embodiment compares the business logic with each historical business logic, and calculates the similarity between the business logic and each historical business logic. The similarity is used to reflect the correlation between the current business logic and each historical business logic. The higher the similarity, the stronger the correlation between the two and the closer the logical relationship. Specifically, when calculating the similarity between the business logic and each historical business logic, if the business logic is displayed in the form of a business logic diagram, the process shown in the business logic diagram is the process necessary to implement a certain business. The similarity between the two can be determined by comparing the business logic diagram corresponding to the business logic and the business logic diagram corresponding to each historical business logic. For example, by comparing whether the number of input boxes in the two business logic diagrams is the same, whether the number of nodes is consistent, and whether the process nodes are consistent, the similarity of the two business logic diagrams can be determined. When the number of input boxes is the same, the number of nodes is consistent, and the process nodes are consistent, the similarity of the two business logic diagrams is higher. Among them, when comparing whether the contents in the input boxes are the same, a semantic detection method can be used.

[0062] As described in the above step S13, this embodiment selects the historical business logic with the greatest similarity to the business logic from all historical business logics based on the similarity, and uses the historical business logic with the greatest similarity to the business logic as the reference business logic, that is, selects the historical business logic closest to the business logic from all historical business logics.

[0063] As described in the above steps S14-S17, this embodiment analyzes the business logic to obtain analysis results, including whether the number of nodes is missing and whether the connection of the process nodes is wrong, so as to determine whether there is an abnormal problem in the business logic according to the analysis results. When it is determined that the business logic has an abnormal problem according to the analysis results, it is further determined whether the reference business logic has had an abnormal problem. When it is determined that the reference business logic has had the abnormal problem, the corresponding processing strategy when processing the abnormal problem of the reference business logic is obtained from the database, and the abnormal problem of the business logic is repaired based on the processing strategy, so as to automatically find the reference business logic that is most similar to the business logic when an abnormality occurs in the business logic, obtain an effective processing strategy based on the reference business logic, and use the processing strategy to process the business logic in a timely manner. Among them, the database stores the processing strategy corresponding to the abnormal problem of each historical business logic.

[0064] The present application provides a method for handling business logic exceptions, which obtains the business logic of a program to be detected, obtains all historical business logics from a database, calculates the similarity between the business logic and each historical business logic, selects the historical business logic with the greatest similarity to the business logic from all historical business logics, obtains reference business logic, analyzes the business logic, obtains analysis results, and determines whether the business logic has an abnormal problem based on the analysis results. When it is determined that the business logic has an abnormal problem based on the analysis results, determines whether the reference business logic has had an abnormal problem. When it is determined that the reference business logic has had an abnormal problem, obtains a corresponding processing strategy based on the abnormal problem, and repairs the abnormal problem of the business logic based on the processing strategy, so as to automatically find the reference business logic that is most similar to the business logic when an abnormality occurs in the business logic, obtain an effective processing strategy based on the reference business logic, and use the processing strategy to process the business logic quickly and timely.

[0065] In one embodiment, in step S16, obtaining a corresponding processing strategy according to the abnormal problem may specifically include:

[0066] S161, calculating the probability that the abnormal problem causes other abnormal problems to occur;

[0067] S162, screening out other abnormal problems with the highest probability of being caused by the abnormal problem from other abnormal problems, and obtaining related abnormal problems;

[0068] S163: Obtain a first processing strategy corresponding to the relevant abnormal problem in the reference business logic and a second processing strategy corresponding to the abnormal problem, and use the first processing strategy and the second processing strategy as the processing strategies.

[0069] After determining the abnormal problem of the business logic, this embodiment counts the number of times the abnormal problem occurs to obtain a first value, and counts the number of times other abnormal problems occur when the abnormal problem occurs to obtain a second value, calculates the ratio of the second value to the first value, and uses the ratio as the probability that the abnormal problem causes other abnormal problems to occur, and screens out other abnormal problems with the highest probability caused by the abnormal problem from other abnormal problems, and uses them as related abnormal problems of the abnormal problem, and then obtains a first processing strategy for related abnormal problems in the reference business logic and a second processing strategy corresponding to the abnormal problem, and sends the processing strategy composed of the first processing strategy and the second processing strategy to the developer's terminal for reference by the developer during development or program detection, and also processes related abnormal problems to reduce the occurrence of abnormal problems and related abnormal problems.

[0070] In one embodiment, in step S12, respectively calculating the similarity between the business logic and each of the historical business logics may specifically include:

[0071] S121. Acquire a keyword of the business logic to obtain a first keyword; wherein the first keyword is used to describe key information of the business logic;

[0072] S122, respectively obtaining a keyword of each of the historical business logics to obtain a second keyword of each of the historical business logics; wherein the second keyword is used to describe key information of the historical business logic;

[0073] S123, converting the first keyword into a vector to obtain a first word vector;

[0074] S124, converting each second keyword of the historical business logic into a vector respectively to obtain a plurality of second word vectors;

[0075] S125. Calculate the cosine distance between the first word vector and each of the second word vectors as the similarity.

[0076] When the business logic and the historical business logic are both expressed in text form, the keywords of the business logic are obtained to obtain the first keyword, and the first keyword is used to describe the key information of the business logic, such as which functions are mainly implemented. At the same time, the keywords of each historical business logic are obtained respectively to obtain the second keyword corresponding to each historical business logic. The first keyword is converted into a vector using the word2vec word vector tool to obtain the first word vector, and the word2vec word vector tool is used to convert each second keyword into a vector respectively to obtain the second word vector corresponding to each historical business logic. The cosine distance between the first word vector and each second word vector is calculated respectively, and the cosine distance is used as the similarity to accurately evaluate the similarity between the business logic and the historical business logic.

[0077] Among them, word2vec is a process of mapping a one-hot sparse word vector into an n-dimensional (n is generally several hundred) dense vector using a one-layer neural network. In natural language processing, the most fine-grained object is a word. If part-of-speech tagging is required, there can be a series of sample data (x, y). Among them, x represents the word, y represents the part of speech, that is, to find a mapping relationship of x->y. However, the words in natural language processing are abstract summaries of humans and are in symbolic form (such as Chinese, English, Latin, etc.), so they need to be converted into numerical form, or embedded in a mathematical space. This embedding method is called word embedding, and Word2vec is a type of word embedding.

[0078] The Word2vec word vector tool is used to obtain the byproduct of model training - model parameters (here specifically the weights of the neural network), and use these parameters as a vectorized representation of the input x. This vector is called a word vector.

[0079] In one embodiment, when the business logic includes a plurality of the first keywords, converting the first keyword into a vector to obtain a first word vector includes:

[0080] Convert each of the first keywords into a vector respectively to obtain multiple word vectors;

[0081] Calculate an average vector of the multiple word vectors, and use the average vector as the first word vector.

[0082] In this embodiment, when the business logic includes multiple first keywords, when determining the first word vector, each first keyword is first converted into a vector to obtain multiple word vectors, and then the average vector of the multiple word vectors is calculated, and the average vector is used as the first word vector. For example, when the multiple word vectors corresponding to the multiple first keywords are W1, W2, and W3 respectively, the average vector is

[0083]

[0084] In one embodiment, in step S14, analyzing the business logic to obtain analysis results may specifically include:

[0085] S141, extracting data features of the business logic by principal component analysis;

[0086] S142. Obtain a mapping of the data feature using multiple mapping methods, and use a logistic regression algorithm or a random forest algorithm to troubleshoot abnormal problems in the mapping to obtain an analysis result.

[0087] This embodiment preprocesses the business logic according to the error rules. The preprocessing method is to extract the data features of the business logic through principal component analysis, then obtain the mapping of the data features of the business logic through multiple mapping methods, and finally use a logistic regression algorithm or a random forest algorithm to check the mapping for abnormal problems, and obtain an analysis result of whether there are abnormal problems in the business logic.

[0088] Among them, principal component analysis (PCA) is a data analysis method. It transforms data features into a set of linearly independent representations of each dimension through linear transformation, which can be used to extract the main characteristic components of the data and can also be used for dimensionality reduction of high-dimensional data. Specifically, principal component analysis maps the n-dimensional features of business logic to k-dimensions. This k-dimension is a new orthogonal feature also called principal component. It is a k-dimensional feature reconstructed on the basis of the original n-dimensional features, and sequentially finds a set of mutually orthogonal coordinate axes from the original space. The selection of new coordinate axes is closely related to the data itself. Among them, the first new coordinate axis is selected as the direction with the largest variance in the business logic, the second new coordinate axis is selected as the direction with the largest variance in the plane orthogonal to the first coordinate axis, and the third axis is the direction with the largest variance in the plane orthogonal to the first and second axes. And so on, n such coordinate axes can be obtained. In this way, the new coordinate axes obtained have most of the variance contained in the first k coordinate axes, and the variance contained in the following coordinate axes is almost 0, so the remaining coordinate axes can be ignored, and only the first k coordinate axes containing most of the variance are retained. Therefore, it is equivalent to retaining only the dimensional features containing most of the variance, and ignoring the feature dimensions containing almost 0 variance, thus realizing the dimensionality reduction and extraction of data features of business logic.

[0089] The multinomial mapping method is also called polynomial feature mapping. After mapping multiple data features into high-dimensional space respectively through certain mapping, it is convenient to classify data features in high-dimensional space. For example, Laplace feature mapping can construct the relationship between data features from a local perspective. If two data features are very similar, then the two data features will appear as close as possible in the high-dimensional space, otherwise they will appear as far away as possible in the high-dimensional space to achieve the classification of data features. Among them, the mapping of the data features includes the spatial vectors of the data features in the high-dimensional space, the positional relationship between the data features, and so on.

[0090] Logistic regression (LR), also known as logistic regression analysis method, is a classification and prediction algorithm that can predict the probability of future results based on the performance of current data. For example, the probability of purchase can be set as the dependent variable, and the user's characteristic attributes, such as gender, age, registration time, etc., can be set as independent variables to predict the probability of purchase based on the characteristic attributes. This embodiment is used to predict abnormal problems.

[0091] The random forest algorithm is an algorithm that integrates multiple trees through the idea of ​​ensemble learning. Its basic unit is the classification tree, which randomizes the use of variables and data, that is, it can randomize the mapping, generate many classification trees, and then summarize the results of the classification trees. The random forest algorithm improves the prediction accuracy without significantly increasing the amount of calculation. The prediction results are also relatively robust to missing data and unbalanced data, and can well predict the effects of up to thousands of variables.

[0092] In one embodiment, analyzing the business logic to obtain the analysis result may specifically include:

[0093] The business logic is input into a preset business logic vulnerability detection engine to obtain an analysis result output by the business logic vulnerability detection engine; wherein the analysis result includes whether the program to be detected has a business logic vulnerability and the type of business logic vulnerability when a business logic vulnerability exists, and the business logic vulnerability type includes an unauthorized vulnerability and a text message bomb vulnerability.

[0094] Specifically, the purpose of this embodiment is to detect whether there is a business logic vulnerability in the application program, so the program to be detected is called the application to be detected. Among them, there are two modes of application programs: C / S mode and B / S mode. The application program in the C / S mode is a client / server program, which generally runs independently, while the application program in the B / S mode is a browser / server application, which generally runs with the help of browsers such as IE. The application program in this embodiment can be an application program in the C / S mode or an application program in the B / S mode, and the embodiment of the present invention does not specifically limit this.

[0095] In order to perform business logic vulnerability detection on the program to be detected, this embodiment first obtains the business logic of the program to be detected, inputs the business logic into the business logic vulnerability detection engine, and obtains the analysis results output by the business logic vulnerability detection engine. It should be noted that the business logic vulnerability detection engine is an engine that includes multiple business logic vulnerability detection components, and each business logic vulnerability detection component can detect a type of business logic vulnerability. The business logic vulnerability detection component encapsulates a method for performing business logic vulnerability detection on the program to be detected, which can be reused infinitely after one integration, greatly reducing the energy investment of application developers.

[0096] In this embodiment, the unauthorized vulnerability is a very common business logic vulnerability. It is caused by the server's excessive trust in the data operation request made by the client and the neglect of the determination of the user's operation authority. As a result, by modifying the relevant parameters, other users' add, delete, check and modify functions can be obtained, thus causing the unauthorized vulnerability. The SMS bomb vulnerability is also a very common business logic vulnerability. It means that the program is exploited by malicious users to continuously send repeated spam SMS to a mobile phone number.

[0097] In one embodiment, after the abnormal problem of the business logic is repaired based on the processing strategy, the method further includes:

[0098] Determine whether the abnormal problem of the business logic is successfully repaired;

[0099] If not, the repair process of the abnormal problem and the reason why it cannot be repaired are recorded, and the repair process and the reason why it cannot be repaired are sent to the terminal where the preset target user is located.

[0100] This embodiment records the repair process of the abnormal problem and the reason why it cannot be repaired in real time, and determines whether the abnormal problem of the business logic is successfully repaired. If it is determined that the abnormal problem of the business logic is not successfully repaired, it is necessary to record the reason why it cannot be repaired, and send the repair process and the reason why it cannot be repaired to the terminal where the preset target user is located, such as the terminal where the developer is located, so that the developer can manually repair the abnormal problem based on the repair process and the reason why it cannot be repaired.

[0101] Reference Figure 2 In an embodiment of the present application, a business logic exception handling device is also provided, including:

[0102] The first acquisition module 11 is used to acquire the business logic of the program to be detected and acquire all historical business logic from the database;

[0103] A calculation module 12, used to respectively calculate the similarity between the business logic and each of the historical business logics;

[0104] A screening module 13 is used to screen out the historical business logic with the greatest similarity to the business logic from all the historical business logics to obtain a reference business logic;

[0105] The analysis module 14 is used to analyze the business logic, obtain analysis results, and determine whether there is an abnormality in the business logic according to the analysis results;

[0106] A judgment module 15, configured to judge whether the reference business logic has had the abnormal problem when it is determined that the business logic has an abnormal problem according to the analysis result;

[0107] A second acquisition module 16 is used to acquire a corresponding processing strategy according to the abnormal problem when it is determined that the reference business logic has the abnormal problem;

[0108] The repair module 17 is used to repair the abnormal problem of the business logic based on the processing strategy.

[0109] In this embodiment, the business logic of the program to be tested is first of all business, which generally refers to the function to be implemented by the program, that is, the customer's business. To implement these businesses, there is a process. The process is a chain formed by a certain relationship. The relationship between the chains has a certain logic. The combination constitutes the business logic, which can be displayed in the form of a business logic diagram or text. For example, after the mobile terminal obtains the transfer transaction request information, it is necessary to judge the validity of the obtained information form, such as whether the transfer amount is a value greater than zero, whether the number of digits of the transfer bank card number is valid, etc. If all the request information contents meet the formal validity, it is necessary to combine the specific information of the acquired transaction request, and standardize the information according to the pre-agreed combination method.

[0110] In one embodiment, when obtaining the business logic of the program to be tested, the server can sort out the business logic of the system interface call part of the program to be tested, and determine the system interface exception scenario that needs to be simulated based on the business logic. For the convenience of description, the system interface involved in the system interface exception scenario that needs to be simulated is called the target system interface. Based on the target system interface, the specified source code location can be determined, and the business logic can be called from the specified source code location.

[0111] This embodiment can also collect all historical business logics in advance and store all historical business logics in a database, wherein the historical business logics include abnormal business logics that occurred during the testing of the program in the past time period.

[0112] This embodiment compares the business logic with each historical business logic, and calculates the similarity between the business logic and each historical business logic. The similarity is used to reflect the degree of correlation between the current business logic and each historical business logic. The higher the similarity, the stronger the correlation between the two, and the closer the logical relationship. Specifically, when calculating the similarity between the business logic and each historical business logic, if the business logic is displayed in the form of a business logic diagram, the process shown in the business logic diagram is the process necessary to implement a certain business. The similarity between the two can be determined by comparing the business logic diagram corresponding to the business logic and the business logic diagram corresponding to each historical business logic. For example, by comparing whether the number of input boxes in the two business logic diagrams is the same, whether the number of nodes is consistent, and whether the process nodes are consistent, the similarity of the two business logic diagrams can be determined. When the number of input boxes is the same, the number of nodes is consistent, and the process nodes are consistent, the similarity of the two business logic diagrams is higher. Among them, when comparing whether the contents in the input boxes are the same, a semantic detection method can be used.

[0113] In this embodiment, based on the similarity, the historical business logic with the greatest similarity to the business logic is screened out from all historical business logics, and the historical business logic with the greatest similarity to the business logic is used as the reference business logic, that is, the historical business logic closest to the business logic is screened out from all historical business logics.

[0114] This embodiment analyzes the business logic to obtain analysis results, including whether the number of nodes is missing and whether the connection of the process nodes is wrong, so as to determine whether there is an abnormal problem in the business logic based on the analysis results. When it is determined that the business logic has an abnormal problem based on the analysis results, it is further determined whether the reference business logic has had an abnormal problem. When it is determined that the reference business logic has had the abnormal problem, the corresponding processing strategy when processing the abnormal problem of the reference business logic is obtained from the database, and the abnormal problem of the business logic is repaired based on the processing strategy, so as to automatically find the reference business logic that is most similar to the business logic when an abnormality occurs in the business logic, obtain an effective processing strategy based on the reference business logic, and use the processing strategy to process the business logic in a timely manner. Among them, the database stores the processing strategy corresponding to the abnormal problem of each historical business logic.

[0115] As described above, it can be understood that the various components of the business logic exception handling device proposed in the present application can implement the functions of any one of the business logic exception handling methods described above, and the specific structure will not be repeated.

[0116] Reference Figure 3 In the embodiment of the present application, a computer device is also provided, whose internal structure can be as follows Figure 3As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor designed by the computer is used to provide computing and control capabilities. The memory of the computer device includes a storage medium and an internal memory. The storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the storage medium. The database of the computer device is used to store data such as processing strategies and business logic. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a business logic exception handling method is implemented.

[0117] The above processor executes the above business logic exception handling method, including:

[0118] Obtain the business logic of the program to be tested and obtain all historical business logic from the database;

[0119] Calculating the similarity between the business logic and each of the historical business logics respectively;

[0120] Filter out the historical business logic with the greatest similarity to the business logic from all the historical business logics to obtain the reference business logic;

[0121] Analyze the business logic to obtain analysis results, and determine whether there are any abnormal problems in the business logic according to the analysis results;

[0122] When it is determined according to the analysis result that the business logic has an abnormal problem, determining whether the reference business logic has had the abnormal problem;

[0123] When it is determined that the reference business logic has the abnormal problem, a corresponding processing strategy is obtained according to the abnormal problem;

[0124] The abnormal problem of the business logic is repaired based on the processing strategy.

[0125] 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, a method for handling exceptions in a business logic is implemented, including the steps of:

[0126] Obtain the business logic of the program to be tested and obtain all historical business logic from the database;

[0127] Calculating the similarity between the business logic and each of the historical business logics respectively;

[0128] Filter out the historical business logic with the greatest similarity to the business logic from all the historical business logics to obtain the reference business logic;

[0129] Analyze the business logic to obtain analysis results, and determine whether there are any abnormal problems in the business logic according to the analysis results;

[0130] When it is determined according to the analysis result that the business logic has an abnormal problem, determining whether the reference business logic has had the abnormal problem;

[0131] When it is determined that the reference business logic has the abnormal problem, a corresponding processing strategy is obtained according to the abnormal problem;

[0132] The abnormal problem of the business logic is repaired based on the processing strategy.

[0133] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media provided in the present application and used in the embodiments can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double-speed data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0134] In summary, the greatest beneficial effects of this application are:

[0135] The present application provides a method, device, computer equipment and storage medium for handling business logic exceptions, which obtain the business logic of a program to be detected, obtain all historical business logics from a database, calculate the similarity between the business logic and each historical business logic, screen out the historical business logic with the greatest similarity to the business logic from all historical business logics, obtain reference business logic, analyze the business logic, obtain analysis results, and judge whether there is an abnormal problem in the business logic according to the analysis results. When it is judged that there is an abnormal problem in the business logic according to the analysis results, judge whether there is an abnormal problem in the reference business logic. When it is judged that there is an abnormal problem in the reference business logic, obtain a corresponding processing strategy according to the abnormal problem, and repair the abnormal problem of the business logic based on the processing strategy, so as to automatically find the reference business logic that is most similar to the business logic when an abnormality occurs in the business logic, obtain an effective processing strategy based on the reference business logic, and use the processing strategy to quickly and timely process the business logic.

[0136] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method 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, device, article or method. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, device, article or method including the element.

[0137] The above description is only a preferred embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A business logic exception handling method, It is characterized in that include: Obtain the business logic of the program to be tested and obtain all historical business logic from the database; Calculating the similarity between the business logic and each of the historical business logics respectively; Filter out the historical business logic with the greatest similarity to the business logic from all the historical business logics to obtain the reference business logic; Analyze the business logic to obtain analysis results, and determine whether there are any abnormal problems in the business logic according to the analysis results; When it is determined according to the analysis result that the business logic has an abnormal problem, determining whether the reference business logic has had the abnormal problem; When it is determined that the reference business logic has the abnormal problem, a corresponding processing strategy is obtained according to the abnormal problem; Repairing the abnormal problem of the business logic based on the processing strategy; The respectively calculating the similarity between the business logic and each of the historical business logics includes: Obtaining a keyword of the business logic to obtain a first keyword; wherein the first keyword is used to describe key information of the business logic; Respectively obtain the keywords of each of the historical business logics to obtain the second keywords of each of the historical business logics; wherein the second keywords are used to describe key information of the historical business logic; Convert the first keyword into a vector to obtain a first word vector; Convert each second keyword of the historical business logic into a vector respectively to obtain a plurality of second word vectors; respectively calculating the cosine distance between the first word vector and each of the second word vectors as the similarity; When the business logic includes a plurality of the first keywords, converting the first keywords into vectors to obtain first word vectors includes: Convert each of the first keywords into a vector respectively to obtain multiple word vectors; Calculate an average vector of the multiple word vectors, and use the average vector as the first word vector; The analyzing the business logic to obtain the analysis result includes: Extracting data features of the business logic by principal component analysis; A mapping of the data feature is obtained by using a multi-mapping method, and a logistic regression algorithm or a random forest algorithm is used to troubleshoot abnormal problems in the mapping to obtain an analysis result; The system interface involved in the system interface exception scenario to be simulated is called the target system interface, and the specified source code location is determined based on the target system interface, and the business logic is retrieved from the specified source code location; The similarity is determined by comparing the business logic graph corresponding to the business logic and the business logic graph corresponding to each historical business logic, including comparing whether the number of input boxes in the two business logic graphs is the same, whether the number of nodes is consistent, and / or whether the process nodes are consistent.

2. The method according to claim 1, It is characterized in that The obtaining a corresponding processing strategy according to the abnormal problem includes: Calculate the probability that the abnormal problem will cause other abnormal problems to occur; Filter out other abnormal problems with the highest probability of being caused by the abnormal problem from other abnormal problems, and obtain related abnormal problems; Obtain a first processing strategy corresponding to the relevant abnormal problem in the reference business logic and a second processing strategy corresponding to the abnormal problem, and use the first processing strategy and the second processing strategy as the processing strategies.

3. The method according to claim 1, It is characterized in that After the abnormal problem of the business logic is repaired based on the processing strategy, the method further includes: Determine whether the abnormal problem of the business logic is successfully repaired; If not, the repair process of the abnormal problem and the reason why it cannot be repaired are recorded, and the repair process and the reason why it cannot be repaired are sent to the terminal where the preset target user is located.

4. The method according to claim 1, It is characterized in that The analyzing the business logic to obtain the analysis result includes: The business logic is input into a preset business logic vulnerability detection engine to obtain an analysis result output by the business logic vulnerability detection engine; wherein the analysis result includes whether the program to be detected has a business logic vulnerability and the type of business logic vulnerability when a business logic vulnerability exists, and the business logic vulnerability type includes an unauthorized vulnerability and a text message bomb vulnerability.

5. A business logic exception handling device, used to execute the method according to any one of claims 1 to 4, It is characterized in that include: The first acquisition module is used to acquire the business logic of the program to be detected and obtain all historical business logic from the database; A calculation module, used to respectively calculate the similarity between the business logic and each of the historical business logics; A screening module, used to screen out the historical business logic with the greatest similarity to the business logic from all the historical business logics, to obtain the reference business logic; An analysis module is used to analyze the business logic, obtain analysis results, and determine whether there are abnormal problems in the business logic according to the analysis results; A judgment module, used for judging whether the reference business logic has had the abnormal problem when it is judged that the business logic has the abnormal problem according to the analysis result; A second acquisition module is used to acquire a corresponding processing strategy according to the abnormal problem when it is determined that the reference business logic has the abnormal problem; A repair module is used to repair the abnormal problem of the business logic based on the processing strategy.

6. A computer device, It is characterized in that include: processor; Memory; The memory stores a computer program, and the processor implements the exception handling method of the business logic described in any one of claims 1 to 4 when executing the computer program.

7. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the service logic exception handling method described in any one of claims 1 to 4.