Business code auditing method and device, electronic equipment and storage medium

By generating business flow diagrams and program flow diagrams, the system automatically identifies and compares code changes, solving the problems of large workload and high difficulty in code review, improving review efficiency and accuracy, and shortening the development cycle.

CN121326334APending Publication Date: 2026-01-13INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411929388.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2026-01-13

AI Technical Summary

Technical Problem

Code review is a large and difficult task. Reviewers need to understand the logic behind the business requirements, which can easily lead to omissions and consumes a lot of time and manpower.

Method used

By generating business flow diagrams and program flow diagrams, the system automatically identifies and compares whether the code meets business requirements based on business needs and code changes, and conducts audits in accordance with audit rules.

Benefits of technology

It reduced the difficulty of code review, improved the efficiency and accuracy of review, and shortened the review and development cycle.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121326334A_ABST
    Figure CN121326334A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a business code auditing method and device, electronic equipment and a storage medium, and relates to the field of business architecture. The method comprises the steps of obtaining a service demand and a to-be-audited code, generating a service flow graph representing a service function according to the service demand, identifying code change content from the to-be-audited code and generating a related program flow graph, and determining whether the to-be-audited code meets the service demand or not according to the service flow graph and the program flow graph. Through the mode, business requirements and codes can be converted according to the business asset library and the code asset library to obtain a more standard flow graph with stronger relevance, and elements of different dimensions in the business flow graph and the program flow graph are compared in combination with an auditing rule, so that the code auditing difficulty can be reduced, the auditing efficiency and the auditing accuracy can be improved, and the code auditing efficiency can be improved. And the code auditing and developing period is shortened.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of business architecture, and in particular to a business code auditing method and device, an electronic device and a storage medium. BACKGROUND

[0002] With the development of computer technology, electronic office has been popularized in many industries such as finance. For these industries, the development and update maintenance of the business system is extremely important.

[0003] Currently, when the business requirement involves code changes, the code submitted by the developer needs to be audited by the auditor. The auditor not only needs to audit the code for its standardization and security, but also needs to audit whether the code can meet the business requirements, which is a heavy workload and high difficulty. SUMMARY

[0004] The present application provides a business code auditing method and device, an electronic device and a storage medium to solve the technical problem of heavy workload and high difficulty in code auditing.

[0005] In a first aspect, the present application provides a business code auditing method, comprising:

[0006] obtaining a business requirement and a code to be audited, the business requirement representing a change in business function, and the code to be audited being a business code that has been changed according to the business requirement;

[0007] generating a business flow graph according to the business requirement, the business flow graph representing the execution process of the changed business function;

[0008] identifying the change content in the code to be audited, and generating a program flow graph related to the change content;

[0009] determining whether the code to be audited meets the business requirement according to the business flow graph and the program flow graph.

[0010] In a second aspect, the present application provides a business code auditing device, comprising:

[0011] an obtaining module configured to obtain a business requirement and a code to be audited, the business requirement representing a change in business function, and the code to be audited being a business code that has been changed according to the business requirement;

[0012] a business flow graph module configured to generate a business flow graph according to the business requirement, the business flow graph representing the execution process of the changed business function;

[0013] a program flow graph module configured to identify the change content in the code to be audited, and generate a program flow graph related to the change content;

[0014] An auditing module is configured to determine whether the code to be audited meets the business requirement according to the business flow graph and the program flow graph.

[0015] In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory connected to the processor in communication;

[0016] The memory stores computer-executable instructions.

[0017] The processor executes the computer-executable instructions stored in the memory to implement the business code auditing method according to any one of the first aspect.

[0018] In a fourth aspect, the present application provides a computer-readable storage medium, comprising: computer-executable instructions stored in the computer-readable storage medium, the computer-executable instructions being executed by a processor to implement the business code auditing method according to any one of the first aspect.

[0019] In a fifth aspect, the present application provides a computer program product, comprising a computer program, the computer program being executed by a processor to implement the business code auditing method according to any one of the first aspect.

[0020] The business code auditing method, device, electronic device and storage medium provided by the present application can obtain a business requirement and code to be audited, generate a business flow graph representing a business function according to the business requirement, identify code change content from the code to be audited and generate a related program flow graph, and then determine whether the code to be audited meets the business requirement according to the business flow graph and the program flow graph. In this way, the business requirement and the code can be converted according to the business asset library and the code asset library to obtain a flow graph with stronger relevance and more standardization. Then, different dimensions of elements in the business flow graph and the program flow graph can be compared in combination with the auditing rules, which can reduce the difficulty of code auditing, improve the auditing efficiency and accuracy, and shorten the code auditing and development cycle. BRIEF DESCRIPTION OF DRAWINGS

[0021] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and serve to explain the principles of the present application together with the specification.

[0022] Figure 1 An application scenario schematic diagram is provided for an embodiment of the present application;

[0023] Figure 2 A flowchart of a business code auditing method is provided for an embodiment of the present application;

[0024] Figure 3 A business flow graph is provided for an embodiment of the present application; Figure 1 ​

[0025] Figure 4 A service flow provided exemplarily for an embodiment of the present application Figure 2 ;

[0026] Figure 5 A service flow provided exemplarily for an embodiment of the present application Figure 3 ;

[0027] Figure 6 A program flow provided exemplarily for an embodiment of the present application Figure 1 ;

[0028] Figure 7 A comparison diagram of a program flow diagram and a service flow diagram provided for an embodiment of the present application;

[0029] Figure 8 A flow diagram of code auditing provided for an embodiment of the present application;

[0030] Figure 9 A structure diagram of a code auditing device provided for an embodiment of the present application;

[0031] Figure 10 A structure diagram of an electronic device provided for an embodiment of the present application.

[0032] The specific embodiments of the present application have been shown through the above-mentioned drawings, and will be described in more detail hereinafter. These drawings and the written description are not intended to limit the scope of the present application concept in any way, but to illustrate the present application concept to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0033] The exemplary embodiments will be described in detail herein with reference to the attached drawings. In the following description, the same numbers are used to indicate the same or similar components. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the present application as detailed in the appended claims.

[0034] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of related data comply with relevant laws, regulations and standards of relevant countries and regions, necessary security measures are taken, public order and good customs are not violated, and appropriate operation portals are provided for users to choose authorization or refusal.

[0035] And the present application relates to the big data analysis of user information (including but not limited to personal biological characteristics, identity data, consumption data, asset data, electronic terminal operation data, etc.), and the automatic decision-making by artificial intelligence technology, and the technical solution of making a decision with significant impact on personal rights and interests based on the automatic decision-making result, providing the corresponding operation portal for the user to choose to agree or refuse the automatic decision-making result; if the user chooses to refuse, the expert decision-making process is entered.

[0036] It should be noted that the business code auditing method and device, electronic equipment and storage medium provided by the present application can be used in the field of business architecture, and can also be used in any field other than business architecture. The application field of the business code auditing method and device, electronic equipment and storage medium in the present application is not limited.

[0037] In the software development process, the code auditing personnel needs to audit the code submitted by the developer in all aspects, including code specification, safety and comprehensiveness, etc., so as to find potential problems in advance. For the specification and safety of the code, it can be judged based on the relevant coding specification, or it can be assisted by some code correction scripts and other checking tools. However, the change of the code is often caused by the demand of the business side, for example, the business department often proposes to add a new function or upgrade a function on the basis of the original version of the software. For this kind of situation, the auditing personnel not only needs to audit whether the code is standard and safe, but also needs to audit whether the code meets the demand of the business side.

[0038] Figure 1 An application scenario provided by an embodiment of the present application is shown. As shown in Figure 1 The business department may raise business demand to realize the adjustment of business function (such as adding, deleting or upgrading the original function, etc.), which requires the development department to edit the original code by adding, deleting or modifying, etc. according to the business demand, and submit the edited code to the auditing department. The auditing department not only needs to audit the specification and safety of the code itself, but also needs to audit whether the code can meet the business demand raised by the business department.

[0039] If the code meets the business requirements is audited, the auditor not only needs to have some understanding of the development knowledge such as code running, but also needs to understand the business requirements, that is, the auditor needs to sort out the business logic behind the business requirements. With the increasing complexity of business scenarios, there are many defects in the way that the auditor sorts out the business logic in order to determine whether the code meets the business logic, such as large workload, low audit efficiency, long time consumption, and the like, and this way is also easy to miss. If the code submitted by the developer cannot meet the business requirements but the auditor does not find it, the code can only be deployed to a specific project for centralized testing after that, and the developer is returned for modification after the testing problem is found, which consumes a lot of time and human cost.

[0040] To solve the above problems, the inventors propose a technical concept. First, the code used by the developer is standardized managed by the code asset library. Second, the business requirements proposed by the business personnel are standardized to generate a business flow graph and establish a corresponding relationship with the code managed by the code asset library. The part of the code to be audited that has changed is standardized processed by the code asset library to generate a program flow graph. Then, the corresponding relationship is used to audit on the basis of the program flow graph and the business flow graph, so that whether the code to be audited can meet the business requirements can be quickly determined. In this way, the auditor does not need to sort out the business logic behind the business requirements, and the business requirements and the code can be automatically processed by a self-defined tool to obtain a business flow graph and a program flow graph that are closer in format and have stronger relevance. On this basis, manual auditing or automatic auditing can be performed, which can reduce the difficulty of code auditing, improve the auditing efficiency and accuracy, and shorten the code auditing and development cycle.

[0041] The business code auditing method, device, electronic equipment and storage medium provided in the present application aim to solve the above technical problems of the prior art.

[0042] The technical solutions of the present application and how the technical solutions of the present application solve the above technical problems will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes can not be described again in some embodiments. The embodiments of the present application will be described below with reference to the drawings.

[0043] Figure 2 A flowchart of a business code auditing method provided by an embodiment of the present application is shown in FIG. 1. As shown in FIG. 1, the method comprises the following steps. Figure 2

[0044] In step S201, a business requirement and a code to be audited are obtained.

[0045] The business requirement represents a change in business function, and the code to be audited is a business code that has been changed according to the business requirement. ​

[0046] Specifically, the related business requirement can be acquired from the business side, and the code to be audited submitted by the developer can be acquired from the development side, the business requirement can refer to the change of the business function, such as the need to add a business function or update and upgrade a business function, and the modified code to be audited can be obtained by the developer modifying the original code to implement the change of the business function.

[0047] In step S202, a business flowchart is generated according to the business requirement.

[0048] The business flowchart represents the execution process of the changed business function.

[0049] Specifically, the change of the business function expressed by the business requirement can be converted into the form of the business flowchart according to the preset business asset library. The business asset library can be established by the enterprise based on the development requirement, and the business asset library can include a plurality of tasks and operations for implementing different business functions.

[0050] Referring to Figure 3 , Figure 3 A business flowchart provided exemplarily by an embodiment of the present application is shown in FIG. 2. Figure 1 , Figure 3 The left side is a business flowchart before the change according to the business requirement, Figure 3 and the right side is a business flowchart after the change according to the business requirement.

[0051] As shown in the example of Figure 3 , the user business query function can be implemented according to the original code, and the function specifically can include: ① receiving a query request -> ② verifying an account password -> ③ returning a query result. The business requirement can be to insert a sub-function of dynamic verification based on a mobile phone verification code between the verification of the account password and the return of the query result, and then the query function can be represented as: ① receiving a query request -> ② verifying an account password -> ③ verifying a mobile phone verification code -> ④ returning a query result.

[0052] Referring to Figure 4 , Figure 4 A business flowchart provided exemplarily by an embodiment of the present application is shown in FIG. 3. Figure 2 , Figure 4 The left side is a business flowchart before the change according to the business requirement, Figure 4 and the right side is a business flowchart after the change according to the business requirement.

[0053] As shown in the example of Figure 4In the example shown, the user service query function can be implemented according to the original code, and the function can specifically include: ① receiving a query request -> ② verifying an account password -> ③ checking a mobile phone verification code -> ④ returning a query result. The business requirement can be to modify the original mobile phone verification code check to user identity verification through face recognition, and the modification can be represented as: ① receiving a query request -> ② verifying an account password -> ③ face verification -> ④ returning a query result.

[0054] It should be noted that, as shown in Figure 3 and Figure 4 , the business flowchart can include multiple operations (such as receiving a query request, verifying an account password, and checking a mobile phone verification code), which can be recorded as business assets in the business asset library. The above diagram is only a part of the examples provided by the embodiments of the present application. In other possible examples, the business requirement can also be to partially delete the original business function, such as deleting the verification link and directly returning the query result after verifying the account password.

[0055] Step S203, identifying the change content in the code to be audited, and generating a program flowchart related to the change content.

[0056] Specifically, the code to be audited can be checked by a code checking tool to automatically identify the part of the code to be audited that has changed compared to the original code, and then generate a program flowchart related to the change content according to the services and methods involved in the code. The code checking tool can be a code submission change tool or other custom checking tool.

[0057] It should be noted that the service (Service) involved in the code can be the meaning expressed by the programming language used in software development, and can refer to an independent function or a group of functions. Correspondingly, the method (Method) involved in the code can also be a concept used in software development, and can refer to a function or process defined in the programming language. A service can include multiple methods. The service implements its function by calling these methods.

[0058] For example, the code used by the development side can be standardized managed in advance through the code asset library of the enterprise, such as recording the services and methods used by the developer in the code asset library. In this way, the services and methods in the code to be audited and their relationships can be converted into a program flowchart according to the code asset library, and the program flowchart includes at least the content corresponding to the services and methods involved in the change content. It can be understood that the generation of the program flowchart related to the change content in this step can be to generate a program flowchart corresponding to all the code to be audited according to the code to be audited, or to generate a program flowchart corresponding to the part of the code according to the code involved in the change content in the code to be audited.

[0059] It should be noted that a corresponding relationship can be established between the business assets in the business asset library and the code assets in the code asset library. For example, the assets in the business asset library can have an operation of "verifying account password", and the assets in the code asset library can include a service Service2 corresponding to the operation. Using the service in the code can implement the function corresponding to the operation.

[0060] In step S204, it is determined whether the to-be-audited code meets the business requirement according to the business flow graph and the program flow graph.

[0061] Specifically, some elements can be extracted from the business flow graph and the program flow graph respectively, and then the elements are compared according to the preset audit rule, and it is determined whether the to-be-audited code meets the business requirement according to the consistency between the business elements in the business flow graph and the code elements in the program flow graph. For example, based on the corresponding relationship between the business asset library and the code asset library, the business elements in the business flow graph and the code elements in the program flow graph can be aligned in granularity, and then whether the preset requirement is met is compared in sequence.

[0062] In some possible implementation manners, for the purpose of comparison, the code elements in the program flow graph can be converted to be closer to the form of the business elements. For example, the business elements in the business flow graph can be operations representing specific functions, and the code elements in the program flow graph can be converted into forms such as annotation language or pseudo code, so that the consistency between the business elements and the code elements can be determined through keyword comparison and the like, the comparison efficiency is improved, and the comparison difficulty is reduced.

[0063] The business code auditing method provided in this embodiment can obtain a business requirement and to-be-audited code, generate a business flow graph representing business functions according to the business requirement, identify code change content from the to-be-audited code and generate a related program flow graph, and then determine whether the to-be-audited code meets the business requirement according to the business flow graph and the program flow graph. In this way, the business requirement and the code can be converted according to the business asset library and the code asset library, the flow graphs with stronger correlation and more standardization are obtained, and then the elements in different dimensions in the business flow graph and the program flow graph are compared in combination with the audit rule, which can reduce the difficulty of code auditing, improve the efficiency and accuracy of auditing, and shorten the code auditing and development cycle.

[0064] Figure 5 A business flow graph is provided in this embodiment. Figure 3 As shown in FIG. 1, the business flow graph includes a plurality of business elements. Figure 5As shown, the business flow diagram can not only contain operations (such as receiving a query request, verifying an account password, etc.) for implementing business functions, but also contain business units (such as a query processing unit, an account management unit, etc.) responsible for performing the operations, the corresponding horizontal area (the range between the upper and lower two dashed lines connected by the business unit) of the business unit is responsible for implementing the operations for the unit, and the arrow can represent the execution sequence flow direction. In addition, the business flow diagram can also contain conditional events that trigger business functions, such as Figure 5 The triangle in the above figure can represent the initial event of receiving a user's business query request, thereby triggering the subsequent operations related to the business query function.

[0065] Exemplarily, Figure 5 The business units, operations, and conditional events in the above figure can be pre-recorded in the business asset library of the enterprise as assets. The operations recorded in the business asset library can be implemented by code assets such as services or methods recorded in the code asset library. The code assets (services, methods, etc.) recorded in the code asset library can be pre-numbered to obtain the uuid (Universally Unique Identifier) of the code assets, and the operations in the business flow diagram can be directly associated with the uuid of the code assets according to the correspondence between the assets such as the operations in the business asset library and the code assets in the code asset library.

[0066] In some possible implementations, generating a business flow diagram according to the business requirement can include:

[0067] performing word segmentation processing on the business requirement to obtain a word segmentation result; traversing the word segmentation result to extract business keywords in the word segmentation result; assembling the business keywords into a sentence and extracting a business asset with the highest similarity to the sentence from a preset business asset library; and generating a business flow diagram according to the extracted business asset.

[0068] The business asset is a business operation stored in the business asset library.

[0069] In some cases, the business requirement can be only a text description of the business personnel, such as "the new version query needs to be changed to be open only to the user's personal, please add a verification function through the user's face information identification before querying", after tokenizing the description, keywords such as "add", "user", "face information", "verification" related to the business function can be extracted, these keywords can be assembled into a sentence "add user face information verification function", and then the business operation assets stored in the business asset library are calculated for similarity with this sentence, one of the business assets is "face check" with the highest similarity to this sentence, then "face check" can be added to the business flow graph to be generated as the business asset corresponding to the business requirement.

[0070] The business asset library of an enterprise can store a number of business assets, most of which are recorded in the business asset library in a standardized form, and it is difficult for business personnel to accurately express the actual business requirement according to the record format of the business asset library. In the above embodiment, by tokenizing the business requirement and assembling it into a sentence and calculating the similarity with the assets in the business asset library, the business requirement described by the business personnel can be automatically converted into a business asset, so that a more standardized business flow graph can be generated, and the subsequent auditing difficulty can be reduced.

[0071] Figure 6 A program flow provided exemplarily for the embodiments of the present application Figure 1 As shown in Figure 6 , a corresponding program flow graph can be generated according to the services and methods used in the code and their data structures. For example, to implement the business query function, service A needs to be called through the interface to parse the business query request initiated by the user, obtain the user identity and the object the user wants to query, and then pass the user identity to service B, call service B to verify the user identity, and after verification, pass the user query object to service C to read the corresponding data from the database. Figure 6 The elements such as arrows in Figure 6 can be used to represent the calling relationship between services. It can be understood that if the service in the code also calls related methods, the Figure 6 may also include elements corresponding to the methods. The elements involved in the program flow graph can be recorded in the code asset library of the enterprise in advance.

[0072] In one embodiment, generating the program flow graph related to the change content can include:

[0073] Determining the associated code of the change content according to the location of the change content in the code to be audited; scanning the target object in the associated code; generating a program flow graph according to the target object and the calling relationship involved in the target object.

[0074] Among them, the target object includes the services and / or methods used by the associated code.

[0075] Exemplarily, the submitted code to be audited can be processed by the code submission change tool, and the part changed in the code to be audited compared with the original code is highlighted, so as to quickly locate the position of the change content in the code to be audited, and determine the code range related to the change content according to the position of the change content and the preset rule, to obtain the associated code. For example, the range covered by the upper-level target object to which the change content belongs can be determined as the associated code.

[0076] It should be noted that the target object can be a method or a service, the upper-level target object of the method can be another method or a service, and the upper-level target object of the service can be another service. The change content can refer to adding, deleting or modifying a method in the original code, or can refer to adding, deleting or modifying a service in the original code, and the upper-level target object of the change content can be determined according to the calling relationship and data structure of the change content and other codes.

[0077] Exemplarily, for the associated code, the calling relationship between the interfaces and the services can be scanned, and the program flow diagram can be formed according to the related services and the calling relationship. In addition, the methods contained in the services and the calling relationship of the methods can also be scanned to form the program flow diagram. The program flow diagram can only contain services or methods, or a combination of both.

[0078] In the above embodiment, the associated code can be obtained by dividing a certain range according to the position of the change content, so that the program flow diagram can be generated only according to the associated code, without generating the program flow diagram according to all the code to be audited, which can reduce the overall workload of code auditing and improve the auditing efficiency.

[0079] Figure 7 A comparison diagram of a program flow diagram and a business flow diagram provided by an embodiment of the present application is shown in FIG. 1. Figure 7 As shown in FIG. 1, the program flow diagram can contain services related to the change content and methods called by the services, and the business flow diagram can include functional tasks and steps determined according to business requirements. The tasks and steps can be assets recorded in the business asset library (such as verifying account password and the like). The code asset library of an enterprise can record a plurality of code assets, which can include services, methods, request entity objects and request return objects, etc. A service can have its own input and output objects, and the service can be composed of multiple method calls; a method can also have its own input and output objects, and can be composed of multiple sub-method calls.

[0080] Exemplarily, the code asset library can also record the pseudo code of the code assets, and the pseudo code can represent the service, method and the like asset elements in a form more consistent with natural language. For example, Figure 7As shown, the service in the code can call a method, the method can obtain an entity object and perform data processing to obtain a return object, the return object can include a value (Value) and an asset name recorded in the code asset library, and based on the code asset library, the code involved in the change content can be generated Figure 7 As shown in the program flow diagram, and some elements in the program flow diagram are converted into pseudo code.

[0081] In one embodiment, as Figure 8 As shown, determining whether the code to be audited meets the business requirements according to the business flow diagram and the program flow diagram can include:

[0082] Step S801, generating the pseudo code corresponding to the program flow diagram according to the preset code asset library.

[0083] The pseudo code generated in this step can refer to the above Figure 7 and corresponding examples, which will not be repeated here.

[0084] Step S802, comparing whether the pseudo code and the business flow diagram are consistent, if consistent, determining that the code to be audited meets the business requirements.

[0085] In some possible implementation manners, the keywords in the business flow diagram can be extracted to obtain first features; the keywords in the pseudo code can be extracted to obtain second features; and the first features and the second features are compared for consistency.

[0086] After obtaining the pseudo code of the program flow diagram according to the code asset library, the keywords in the business flow diagram and the pseudo code can be extracted respectively through the NLP (Natural Language Processing) algorithm, and the operation content, input, output, request object and return object and other features are obtained, and then the features extracted from the pseudo code and the business flow diagram are compared based on the corresponding relationship between the code asset library and the business asset library. If the features corresponding to the corresponding relationship are consistent, the code meets the business requirements, otherwise it does not meet the business requirements.

[0087] In the above embodiments, based on the code asset library of the enterprise, the elements in the program flow diagram can be converted into pseudo code more consistent with the natural language specification, and the elements in the business flow diagram themselves conform to the natural language specification. On this basis, comparison can be performed using simpler and more efficient comparison rules, thereby improving the accuracy and efficiency of the audit. For example, the input and output objects in the pseudo code and the business flow diagram can be extracted through the NLP algorithm, and the comparison of these features can be realized by using word similarity calculation and the like.

[0088] In one embodiment, the business flow diagram contains multiple business operations, and comparing whether the first features and the second features are consistent can include:

[0089] query the code number of the target object in the code asset library; determine the correspondence between the program flow graph and the business flow graph according to the mapping relationship and the code number; align the first feature and the second feature according to the correspondence, and perform feature comparison after alignment.

[0090] The code asset library further contains a mapping relationship between the code number and the business operation.

[0091] Exemplarily, the business flow graph can contain business operations such as receiving a query request and verifying an account password, and these operations can find corresponding asset records in the business asset library. As shown in Figure 7 The program flow graph can contain target objects such as services and methods, and these target objects can find corresponding asset records in the code asset library. According to the code number (such as uuid) of the target object in the code asset record and the mapping relationship, the target objects such as services and methods in the program flow graph can be corresponded to the business operations in the business flow graph, so that the features in the corresponding flow graphs can be compared. For example, the uuid of a method in the program flow graph is M2345, the business flow graph contains a business operation of verifying an account password, and the business asset library or the code asset library can obtain the uuid corresponding to the business operation as M2345. Then the method can be corresponded to the business operation in the business flow graph, and the input and output objects can be extracted based on the pseudo code of the method and the business operation. By comparing the input and output objects of the two, it can be determined whether the first feature and the second feature are consistent.

[0092] It should be noted that the above examples can be applied to different scenarios such as adding code, deleting code or modifying original code.

[0093] Taking adding code as an example, the business requirement is to add a certain function, and the development side adds a code block c1 in the original code accordingly. The original code contains a method m1, m1 contains methods k1 and k2, and the code block c1 is inserted between k1 and k2 as an intermediate method to connect k1 and k2. The method m1 before adding c1 can be used to implement the operation steps {s1, s2, …} on the business side, k1 can be used to implement operation s1, and k2 can be used to implement operation s2. Among them, k1, k2 and m1 can find the corresponding uuid through the code asset library, and through the uuid, the related operation steps corresponding to c1 can be located in the business flow graph after adding the function, and the features can be extracted through the annotation language (such as pseudo code) of c1 and the operation steps corresponding to c1, such as operation content, input and output objects, and then compared in turn to determine whether they are consistent.

[0094] For the application of deleting code and modifying the original code, refer to the above example of adding code, which will not be repeated here.

[0095] In the above embodiment, by querying the uuid of the target object such as the service and the method, the correspondence between the elements in the program flow graph and the elements in the business flow graph can be established, so that the features to be compared can be quickly and accurately aligned when the code changes greatly, thereby ensuring the accuracy of the audit.

[0096] In one embodiment, the business code auditing method further comprises: if it is determined that the to-be-audited code does not meet the business requirements, determining a prompt type according to the business requirements, and outputting prompt information according to the prompt type.

[0097] The prompt type includes an added function, an updated function, and a deleted function.

[0098] For example, if the to-be-audited code submitted after the audit is determined to not meet the business requirements, the corresponding prompt type can be determined according to the business requirements, and corresponding measures can be taken. For example, according to the information such as the business flow graph, the program flow graph, the business asset library, and the code asset library, prompt information such as the business function name, the function description, and the to-be-repaired code position that needs to be repaired can be output. In addition, if the business requirements that are not met are to add a certain business function, relevant code assets can be referenced from the code asset library according to the similarity of the elements in the business flow graph to be used for repair.

[0099] In the above embodiment, when the code submitted by the development side has missing requirements points that do not meet the business requirements, the prompt type corresponding to the missing requirements can be determined, and prompt information such as the business function description and the to-be-repaired code position can be output, so that the developer can quickly locate the problem for repair and avoid delaying the development progress.

[0100] Figure 9 A structural diagram of a business code auditing device provided in an embodiment of the present application is shown in FIG. 9. Figure 9 As shown in FIG. 9, the business code auditing device 900 includes:

[0101] An acquisition module 901 is configured to acquire business requirements and to-be-audited code. The business requirements represent changes in business functions, and the to-be-audited code is business code that has been changed according to the business requirements.

[0102] A business flow graph module 902 is configured to generate a business flow graph according to the business requirements. The business flow graph represents the execution process of the changed business functions.

[0103] A program flow graph module 903 is configured to identify the changed content in the to-be-audited code and generate a program flow graph related to the changed content.

[0104] An audit module 904 is configured to determine whether the to-be-audited code meets the business requirements according to the business flow graph and the program flow graph.

[0105] In an embodiment, the program flow graph module 903 can be further configured to determine associated code of the change content according to a location of the change content in the to-be-audited code; scan target objects in the associated code, the target objects including services and / or methods used by the associated code; and generate a program flow graph according to the target objects and call relations involved in the target objects.

[0106] In an embodiment, the audit module 904 can be further configured to generate a pseudo code corresponding to the program flow graph according to a preset code asset library; and compare the pseudo code with the business flow graph to determine whether the to-be-audited code meets the business requirement if the pseudo code is consistent with the business flow graph.

[0107] In an embodiment, the audit module 904 can be further configured to extract keywords in the business flow graph to obtain first features; extract keywords in the pseudo code to obtain second features; and compare the first features with the second features.

[0108] In an embodiment, the audit module 904 can be further configured to query a code number of the target object in the code asset library, the code asset library further containing a mapping relationship between the code number and a business operation; determine a corresponding relationship between the program flow graph and the business flow graph according to the mapping relationship and the code number; align the first features and the second features according to the corresponding relationship, and perform feature comparison after the alignment.

[0109] In an embodiment, the audit module 904 can be further configured to, if it is determined that the to-be-audited code does not meet the business requirement, determine a prompt type according to the business requirement, and output prompt information according to the prompt type, the prompt type including an added function, an updated function, and a deleted function.

[0110] The business code audit apparatus provided in the embodiment can be used to execute the technical solutions in any of the method embodiments, and has similar implementation principles and technical effects, which will not be described here.

[0111] It should be understood that the apparatus embodiments described above are only illustrative, and the apparatus of the present application can also be implemented in other ways. For example, the division of units / modules in the above embodiments is only a logical function division, and another division manner can be used in actual implementation. For example, multiple units / modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed.

[0112] In addition, each functional unit / module in each embodiment of the present application can be integrated in one unit / module, or each unit / module can exist physically, or two or more units / modules can be integrated together. The integrated unit / module can be realized in the form of hardware or in the form of a software program module.

[0113] Figure 10 A structural schematic diagram of an electronic device is provided in the embodiments of the present application. As shown in the figure, the electronic device 100 includes: Figure 10

[0114] a processor 101, a memory 102, and a communication interface 103;

[0115] The memory 102 is configured to store executable instructions of the processor 101. The executable instructions can be computer executable instructions.

[0116] The processor 101 is configured to execute the technical solutions in any of the preceding method embodiments by executing the executable instructions.

[0117] Optionally, the memory 102 can be independent or integrated with the processor 101.

[0118] Optionally, when the memory 102 is independent of the processor 101, the electronic device 100 can further include:

[0119] a bus 104, the memory 102 and the communication interface 103 are connected with the processor 101 through the bus 104 and complete communication among each other, and the communication interface 103 is configured to communicate with other devices.

[0120] Optionally, the communication interface 103 can be realized by a transceiver. The communication interface is configured to realize communication between the database access device and other devices (for example, a client, a read-write library and a read-only library). The memory can include a random access memory (RAM) and can also include a non-volatile memory, for example, at least one disk memory.

[0121] ​The bus 104 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one line is shown in the figure, but it does not mean that there is only one bus or only one type of bus.

[0122] The processor described above can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.

[0123] The electronic device is used to execute the technical solutions in any of the preceding method embodiments, and has similar implementation principles and technical effects, which will not be described here.

[0124] The embodiments of the present application also provide a readable storage medium, which can be a computer readable storage medium, and a computer program is stored on the readable storage medium, and the computer program is executed by a processor to implement the technical solutions provided by any of the preceding method embodiments.

[0125] The embodiments of the present application also provide a computer program product, which includes a computer program, and the computer program is executed by a processor to implement the technical solutions provided by any of the preceding method embodiments.

[0126] The integrated units / modules, if realized in the form of software program modules and sold or used as independent products, can be stored in a computer readable memory. Based on this understanding, the technical solutions of the present application or the whole or part of the technical solutions that essentially contribute to the prior art can be embodied in the form of a software product, which is stored in a memory and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the embodiments of the present application. The memory described above includes a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.

[0127] In the above embodiments, the description of each of the embodiments focuses on different aspects of the embodiments. The parts not described in detail in a certain embodiment can be seen in the relevant description of the other embodiments. The technical features of the above embodiments can be combined in any manner. In order to make the description simple, not all possible combinations of the technical features in the above embodiments are described, however, as long as the combinations of the technical features do not exist contradictory, they should be considered as falling within the scope of the disclosure.

[0128] Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. It is intended that the specification and examples be considered as exemplary only, with the true scope and spirit of the application being indicated by the following claims.

[0129] It should be understood that the application is not limited to the precise construction that has been described above and shown in the accompanying drawings, and that various modifications and changes can be made by those skilled in the art without departing from the scope of the application. The scope of the application is limited only by the appended claims.

Claims

1. A business code auditing method, characterized by, The method comprises the following steps: obtaining a business requirement and to-be-audited code, wherein the business requirement represents a change of a business function, and the to-be-audited code is business code that has been changed according to the business requirement; generating a business flow graph according to the business requirement, wherein the business flow graph represents an execution process of the changed business function; identifying a change content in the to-be-audited code, and generating a program flow graph related to the change content; determining whether the to-be-audited code meets the business requirement according to the business flow graph and the program flow graph.

2. The method of claim 1, wherein, The generating of the program flow graph related to the change content comprises the following steps: determining associated code of the change content according to a position of the change content in the to-be-audited code; scanning a target object in the associated code, wherein the target object comprises a service and / or a method used by the associated code; generating a program flow graph according to the target object and a calling relationship involved in the target object.

3. The method of claim 2, wherein, The determining of whether the to-be-audited code meets the business requirement according to the business flow graph and the program flow graph comprises the following steps: generating a pseudo code corresponding to the program flow graph according to a preset code asset library; comparing the pseudo code with the business flow graph, and if they are consistent, determining that the to-be-audited code meets the business requirement.

4. The method of claim 3, wherein, The comparing of the pseudo code with the business flow graph comprises the following steps: extracting a keyword in the business flow graph to obtain a first feature; extracting a keyword in the pseudo code to obtain a second feature; comparing whether the first feature and the second feature are consistent.

5. The method of claim 4, wherein, The business flow graph comprises a plurality of business operations, and the comparing of whether the first feature and the second feature are consistent comprises the following steps: inquiring a code number of the target object in the code asset library, wherein the code asset library further comprises a mapping relationship between the code number and a business operation; determining a corresponding relationship between the program flow graph and the business flow graph according to the mapping relationship and the code number; aligning the first feature and the second feature according to the corresponding relationship, and performing feature comparison after the alignment.

6. The method according to any one of claims 1 to 5, characterized in that, The method further comprises the following steps: if it is determined that the to-be-audited code does not meet the business requirement, determining a prompt type according to the business requirement, and outputting prompt information according to the prompt type, wherein the prompt type comprises an added function, an updated function and a deleted function.

7. The method according to any one of claims 1 to 5, characterized in that, The generating of the business flow graph according to the business requirement comprises the following steps: performing word segmentation on the business requirement to obtain a word segmentation result; traversing the word segmentation result to extract a business keyword in the word segmentation result; assembling the business keyword into a sentence, and extracting a business asset with the highest similarity to the sentence from a preset business asset library, wherein the business asset is a business operation stored in the business asset library; generating a business flow graph according to the extracted business asset.

8. A business code auditing apparatus characterized by comprising: The method comprises the following steps: an obtaining module, configured to obtain a business requirement and to-be-audited code, wherein the business requirement represents a change of a business function, and the to-be-audited code is business code that has been changed according to the business requirement; a business flow graph module, configured to generate a business flow graph according to the business requirement, wherein the business flow graph represents an execution process of the changed business function; a program flow graph module, configured to identify a change in the code to be audited and generate a program flow graph related to the change; an auditing module, configured to determine whether the code to be audited meets the business requirement according to the business flow graph and the program flow graph.

9. An electronic device, comprising: comprise: a processor, and a memory connected to the processor in communication; the memory stores computer-executed instructions; the processor executes the computer-executed instructions stored in the memory to implement the method of any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, the computer-readable storage medium stores computer-executed instructions, and the computer-executed instructions are executed by the processor to implement the method of any one of claims 1 to 7.