Code flow chart generation method and device, electronic equipment and storage medium

By setting code flow structure specifications and flow chart node specifications, the code flow chart is automatically generated, which solves the problem that generating code flow charts in the existing technology requires a lot of manpower and high costs, and realizes efficient automatic generation of flow charts.

CN118656124APending Publication Date: 2024-09-17PING AN BANK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410741571.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-07
Publication Date
2024-09-17

AI Technical Summary

Technical Problem

Generating code flow diagrams in the existing technology requires a lot of manpower and high costs, and the workload is large and cannot be efficiently automated.

Method used

By setting the code process structure specification, the R&D personnel write the target code under this specification, scan the target code according to the preset flow chart node specification, determine the node set and association relationship, automatically generate the target flow chart, and pass verification and adjustment Generate the final target flow chart.

Benefits of technology

It reduces the manual workload, improves work efficiency, realizes the automatic generation of code flow diagrams, and reduces the steps of manual drawing and adjustment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118656124A
    Figure CN118656124A
Patent Text Reader

Abstract

The invention provides a code flow chart generation method and device, electronic equipment and a storage medium, and the method comprises the steps: responding to a code flow structure specification generation operation, and determining a code flow structure specification; the research and development personnel compile and generate a target code under the code process structure specification; scanning the target code according to a preset flow chart node specification, and determining a first node set in the target code; and generating a target flow chart of the target code according to each first node contained in the first node set. According to the method, the generated target code is limited by setting the code flow structure specification, so that the generated target code can automatically generate the target flow chart of the target code by scanning the node set, the manual workload is reduced, and the working efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for generating a code flow chart. Background Art

[0002] With the rapid development of economy, the business of banks and other financial institutions is also increasing, and the demand for R&D of financial related systems is also increasing. In the process of R&D of financial related systems, most of them still use the design method of manually inputting codes, such as the process of generating code flow charts.

[0003] In the prior art, after manually writing the code, in order to facilitate the understanding of business processes and other considerations, it is necessary to generate a flowchart of the code. The existing method of generating a code flowchart is to manually sort out the business process and then draw it on the tool. This method requires a lot of manpower, and has a large workload and high cost. Summary of the invention

[0004] In view of this, the purpose of the present application is to provide a code flow chart generation method, device, electronic device and storage medium to overcome the problems in the prior art.

[0005] In a first aspect, an embodiment of the present application provides a method for generating a code flow chart, the method comprising:

[0006] In response to the code flow structure specification generation operation, a code flow structure specification is determined; and the R&D personnel write and generate target code under the code flow structure specification;

[0007] Scanning the target code according to a preset flowchart node specification to determine a first node set in the target code;

[0008] A target flow chart of the target code is generated according to each first node included in the first node set.

[0009] In some technical solutions of the present application, the target flow chart of the target code is generated according to each first node included in the first node set, including:

[0010] Determine the sequence of each box in the target flow chart according to the superior-subordinate association relationship between each first node included in the first node set;

[0011] The blocks are connected in sequence according to the determined sequence to generate the target flow chart.

[0012] In some technical solutions of the present application, the above method further includes:

[0013] Scanning the first node to determine a set of second nodes included in the first node;

[0014] Scanning the second nodes included in the second node set again until the nodes no longer contain scannable nodes included in the flowchart node specification, and obtaining nodes of each level included in the target code;

[0015] A target flow chart of the target code is generated according to nodes at each level.

[0016] In some technical solutions of the present application, the target flow chart of the target code is generated according to each first node included in the first node set, including:

[0017] Generate a to-be-verified flow chart of the target code according to each first node included in the first node set;

[0018] The flowchart to be verified is tested, and if the flowchart to be verified passes the verification, the flowchart to be verified is used as the target flowchart of the target code.

[0019] In some technical solutions of the present application, the above method further includes:

[0020] When the flowchart to be verified fails to pass verification, in response to a flowchart adjustment operation, the adjusted flowchart to be verified is used as a target flowchart of the target code.

[0021] In some technical solutions of the present application, the above method detects the flowchart to be verified in the following manner:

[0022] The flowchart to be verified is compared with the reference flowchart for detection.

[0023] In some technical solutions of the present application, the above method detects the flowchart to be verified in the following manner:

[0024] The simulation code of the flowchart to be verified is generated and compared with the target code.

[0025] In a second aspect, an embodiment of the present application provides a device for generating a code flow chart, the device comprising:

[0026] A response module is used to respond to the code flow structure specification generation operation and determine the code flow structure specification; the R&D personnel write and generate the target code under the code flow structure specification;

[0027] A scanning module, used to scan the target code according to a preset flowchart node specification to determine a first node set in the target code;

[0028] A generating module is used to generate a target flow chart of the target code according to each first node included in the first node set.

[0029] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned code flow chart generation method when executing the computer program.

[0030] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned code flow chart generation method are executed.

[0031] The technical solution provided by the embodiments of the present application may have the following beneficial effects:

[0032] The method of the present application includes determining a code flow structure specification in response to a code flow structure specification generation operation; R&D personnel write and generate target code under the code flow structure specification; scanning the target code according to a preset flowchart node specification to determine a first node set in the target code; and generating a target flowchart of the target code according to each first node contained in the first node set.

[0033] The present application limits the generated target code by setting the code flow structure specification, so that the produced target code can automatically generate the target flow chart of the target code by scanning the node set, thereby reducing the manual workload and improving work efficiency.

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

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

[0036] Figure 1 A schematic diagram of a code flow chart generation method provided in an embodiment of the present application is shown;

[0037] Figure 2 A standard schematic diagram provided by an embodiment of the present application is shown;

[0038] Figure 3aA first flow chart diagram provided in an embodiment of the present application is shown;

[0039] Figure 3b A second flow chart diagram provided in an embodiment of the present application is shown;

[0040] Figure 3c A third flow chart diagram provided in an embodiment of the present application is shown;

[0041] Figure 4 A schematic diagram of a code flow chart generating device provided in an embodiment of the present application is shown;

[0042] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0043] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.

[0044] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0045] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.

[0046] With the rapid development of economy, the business of banks and other financial institutions is also increasing, and the demand for R&D of financial related systems is also increasing. In the process of R&D of financial related systems, most of them still use the design method of manually inputting codes, such as the process of generating code flow charts.

[0047] In the prior art, after manually writing the code, in order to facilitate the understanding of business processes and other considerations, it is necessary to generate a flowchart of the code. The existing method of generating a code flowchart is to manually sort out the business process and then draw it on the tool. This method requires a lot of manpower, and has a large workload and high cost.

[0048] Based on this, the embodiments of the present application provide a code flow chart generation method, device, electronic device and storage medium, which are described below through embodiments.

[0049] Figure 1 A schematic flow chart of a code flow chart generation method provided in an embodiment of the present application is shown, wherein the method includes steps S101-S103; specifically:

[0050] S101, in response to a code flow structure specification generation operation, a code flow structure specification is determined; and a research and development personnel writes and generates a target code based on the code flow structure specification;

[0051] S102, scanning the target code according to a preset flowchart node specification to determine a first node set in the target code;

[0052] S103: Generate a target flow chart of the target code according to each first node included in the first node set.

[0053] The present application limits the generated target code by setting the code flow structure specification, so that the produced target code can automatically generate the target flow chart of the target code by scanning the node set, thereby reducing the manual workload and improving work efficiency.

[0054] Some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0055] In the above step S101, in order to efficiently generate the code flow chart, the embodiment of the present application first sets the code flow structure specification suitable for the business according to the business needs. Different code flow structure specifications can be set for different business needs. For example, the current directory structure of the industry is based on controller->action->service, that is, the controller receives the request, and then distributes it to the specific business action, and then calls the service. On this basis, the relevant specifications are defined: encapsulate the common controller class, uniformly receive the peripheral system request, and then distribute it to the specific business process Action class according to the custom matching rules. The Action class is a bridge between user requests and business logic, and each Action acts as a business agent for the customer. The Action layer assembles the business process, that is, connects service services with different functions in series to complete the business, without doing too much logical processing, and can quickly assemble to complete the function development. The service layer is an atomic service, and it must be highly reusable when designed. Specific specifications such as Figure 2 shown.

[0056] After setting the code flow structure specification, you also need to set the flowchart node specification. The specific setting can be one business flow chart corresponding to one Action, and one service corresponding to one node. The business flow chart must be defined as a specification, and the name of the flowchart is the business Action class name actually defined by the R&D personnel. The node in the flowchart must be defined as a specification, and the name of the node is the service class name actually defined by the R&D personnel.

[0057] After determining the above specifications, R&D personnel need to encode the code according to the above specifications and generate target code that meets the above specifications. In actual work, while generating the target code, the code documentation of the target code will also be generated. The code documentation is the text that accompanies the software code, which is used to explain what the code is doing, why it is written in this way, and / or how to use it.

[0058] After the target code is generated, as in the above step S102, the target code is scanned to extract the first node set from the target code. This scan is the first scan, which scans the code flow (Action class), collects the service class name set, and marks the upper and lower level association relationship of each service class according to the rules, that is, which Service class is the upper level node of the current Service class, and which Service class is the lower level node, and then saves this association relationship data in the database.

[0059] After the first node set is determined, as in the above step S103, a target flow chart of the target code is generated according to each first node included in the first node set. The specific generation process here is the generation technology in the prior art.

[0060] In the above step S103, when generating the flowchart, the embodiment of the present application determines the order of the boxes in the target flowchart based on the hierarchical relationship between the first nodes contained in the first node set; then connects the boxes in sequence according to the determined order to generate the target flowchart.

[0061] In an optional embodiment, the above-mentioned scan is only the first scan, which mainly scans out the first node from the target code, mainly the Service class name set. There may also be branch nodes of the flowchart in each Service class. Therefore, the embodiment of the present application also needs to detect each first node contained in the first set again. Get the second node set contained in the first node. After obtaining the second node set, it is necessary to detect the second node contained in the second node set again. Determine the third node set from the second node, and then detect the third node in the third node set, determine the fourth node set from the third node, and so on. Detect in a loop until no nodes in the above specifications can be detected. At this time, the nodes at all levels contained in the target code can be obtained. Then generate the target flowchart according to the nodes at all levels.

[0062] like Figure 3a As shown, it is a flow chart generated according to the first node set; Figure 3b is a flow chart generated according to the first node set and the second node set; Figure 3c It is a flowchart generated according to the first node set, the second node set and the third node set.

[0063] In an optional implementation, in order to ensure the accuracy of generating the target flow chart, before obtaining the target flow chart, the flow chart generated according to all node sets is referred to as the flow chart to be verified in the embodiment of the present application. By verifying the flow chart to be verified, the flow chart to be verified that has passed the verification is referred to as the target flow chart of the target code. If the flow chart to be verified is verified, and it does not pass the verification, the user needs to adjust the flow chart to be verified that has not passed the verification, and the adjusted flow chart to be verified is referred to as the target flow chart of the target code. The adjustment here includes adjusting the connection relationship of the boxes in the flow chart, adjusting the box names, adding and deleting boxes, etc.

[0064] In the embodiment of the present application, when verifying the flowchart to be verified, two verification methods are included. Among them, the first verification method is: by comparing the flowchart to be verified with the reference flowchart. The second verification method is: by generating a simulation code of the flowchart to be verified and comparing it with the target code.

[0065] For the first verification method: the reference flowchart here can be generated based on the code document. By performing text recognition on the code document, keywords or words are extracted from the code document. The specific text recognition can be achieved by means of a text recognition model. By establishing training texts for keywords in this field, the basic model is trained to obtain a text recognition model. The code document is input into the text recognition model to obtain keywords output by the text recognition model. These keywords are mainly used to determine the nodes of the flowchart. A reference flowchart is generated based on the order in which the keywords appear and the textual logical relationship between the keywords.

[0066] The reference flow chart here can also be preset. For example, the flow chart to be verified has ten levels of nodes. Since the reference flow chart serves as a reference for comparison, the reference flow chart set here can be a complete flow chart, can be only a framework of a flow chart, or only contain some of the nodes.

[0067] After obtaining the reference flowchart, the image similarity between the flowchart to be verified and the reference flowchart is calculated, and then an image similarity threshold needs to be set. The image similarity threshold here is specifically set according to the content of the reference flowchart. For example, if the reference flowchart is a complete flowchart, the image similarity threshold here can be set to 100%. If the reference flowchart here is just a framework, the image similarity threshold here can be set to 30%. If the reference flowchart here is just a part of the nodes, the image similarity threshold here can be set according to the proportion of the number of nodes appearing in the reference flowchart in the flowchart to be verified, for example, set to 5%. After that, the image similarity of the two is compared with the image similarity threshold. If the image similarity is greater than or equal to the image similarity threshold, it is considered that the flowchart to be verified has passed the verification, and the flowchart to be verified is used as the target flowchart of the target code.

[0068] For the second verification method: After obtaining the flowchart to be verified, the embodiment of the present application uses the flowchart to be verified for reverse deduction. That is, the flowchart to be verified is used to generate simulation code. In the specific generation process, low-code development tools, etc. can be used. Use the simulation code corresponding to the flowchart generator to be verified, and then calculate the code similarity between the simulation code and the target code. Taking into account the situation that there may be multiple implementation methods for the same function, when calculating the code similarity, the embodiment of the present application uses the functional implementation in the simulation code and the target code as the minimum calculation unit. That is, if the simulation code and the target code are the same or similar in functional implementation, the two segments of code are considered to be similar.

[0069] By setting a code similarity threshold, the code similarity of the two is compared with the code similarity threshold. If the code similarity is greater than or equal to the code similarity threshold, it is considered that the flowchart to be verified has passed the verification, and the flowchart to be verified is used as the target flowchart of the target code.

[0070] Figure 4 A schematic diagram of the structure of a code flow chart generating device provided in an embodiment of the present application is shown, the device comprising:

[0071] A response module is used to respond to the code flow structure specification generation operation and determine the code flow structure specification; the R&D personnel write and generate the target code under the code flow structure specification;

[0072] A scanning module, used to scan the target code according to a preset flowchart node specification to determine a first node set in the target code;

[0073] A generating module is used to generate a target flow chart of the target code according to each first node included in the first node set.

[0074] The step of generating a target flow chart of the target code according to each first node included in the first node set includes:

[0075] Determine the sequence of each box in the target flow chart according to the superior-subordinate association relationship between each first node included in the first node set;

[0076] The blocks are connected in sequence according to the determined sequence to generate the target flow chart.

[0077] The scanning module is further used to scan the first node to determine a set of second nodes included in the first node;

[0078] Scanning the second nodes included in the second node set again until the nodes no longer contain scannable nodes included in the flowchart node specification, and obtaining nodes of each level included in the target code;

[0079] The generating module is also used to generate the target flow chart of the target code according to the nodes at each level.

[0080] The step of generating a target flow chart of the target code according to each first node included in the first node set includes:

[0081] Generate a to-be-verified flow chart of the target code according to each first node included in the first node set;

[0082] The device further includes a detection module for detecting the flowchart to be verified, and if the flowchart to be verified passes the verification, using the flowchart to be verified as a target flowchart of the target code.

[0083] The device further comprises a detection module, which is further used for, when the flowchart to be verified fails to pass the verification, responding to a flowchart adjustment operation and using the adjusted flowchart to be verified as a target flowchart of the target code.

[0084] The flowchart to be verified is tested in the following manner:

[0085] The flowchart to be verified is compared with the reference flowchart for detection.

[0086] The flowchart to be verified is tested in the following manner:

[0087] The simulation code of the flowchart to be verified is generated and compared with the target code.

[0088] like Figure 5 As shown, an embodiment of the present application provides an electronic device for executing the code flow chart generation method in the present application, the device includes a memory, a processor, a bus, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the code flow chart generation method when executing the computer program.

[0089] Specifically, the above-mentioned memory and processor may be general-purpose memory and processor, which are not specifically limited here. When the processor runs the computer program stored in the memory, the above-mentioned code flow chart generation method can be executed.

[0090] Corresponding to the code flow chart generation method in the present application, an embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned code flow chart generation method are executed.

[0091] Specifically, the storage medium can be a general storage medium, such as a mobile disk, a hard disk, etc. When the computer program on the storage medium is run, the above-mentioned code flow chart generation method can be executed.

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

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

[0094] In addition, each functional unit in the embodiments provided in the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

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

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

[0097] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-mentioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-mentioned embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application. They should all be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims

1. A code flow chart generation method, characterized in that: The method comprises: In response to the code flow structure specification generation operation, a code flow structure specification is determined; and the R&D personnel write and generate target code under the code flow structure specification; Scanning the target code according to a preset flowchart node specification to determine a first node set in the target code; A target flow chart of the target code is generated according to each first node included in the first node set.

2. The method according to claim 1, characterized in that The step of generating a target flow chart of the target code according to each first node included in the first node set includes: Determine the sequence of each box in the target flow chart according to the superior-subordinate association relationship between each first node included in the first node set; The blocks are connected in sequence according to the determined sequence to generate the target flow chart.

3. The method according to claim 1, characterized in that The method further comprises: Scanning the first node to determine a set of second nodes included in the first node; Scanning the second nodes included in the second node set again until the nodes no longer contain scannable nodes included in the flowchart node specification, and obtaining nodes of each level included in the target code; A target flow chart of the target code is generated according to nodes at each level.

4. The method according to claim 3, characterized in that The step of generating a target flow chart of the target code according to each first node included in the first node set includes: Generate a to-be-verified flow chart of the target code according to each first node included in the first node set; The flowchart to be verified is tested, and if the flowchart to be verified passes the verification, the flowchart to be verified is used as the target flowchart of the target code.

5. The method according to claim 4, characterized in that The method further comprises: When the flowchart to be verified fails to pass verification, in response to a flowchart adjustment operation, the adjusted flowchart to be verified is used as a target flowchart of the target code.

6. The method according to claim 4, characterized in that The method detects the flowchart to be verified in the following manner: The flowchart to be verified is compared with the reference flowchart for detection.

7. The method according to claim 4, characterized in that The method detects the flowchart to be verified in the following manner: The simulation code of the flowchart to be verified is generated and compared with the target code.

8. A code flow chart generating device, characterized in that: The device comprises: A response module is used to respond to the code flow structure specification generation operation and determine the code flow structure specification; the R&D personnel write and generate the target code under the code flow structure specification; A scanning module, used to scan the target code according to a preset flowchart node specification to determine a first node set in the target code; A generating module is used to generate a target flow chart of the target code according to each first node included in the first node set.

9. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the code flow chart generation method as described in any one of claims 1 to 7 are performed.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the code flow chart generation method according to any one of claims 1 to 7 are executed.