Business flow chart reverse construction method and device based on source code
By parsing HTML and JS source code to construct business process diagrams and automatically generating service call lists, the problem of unclear display of business process diagrams in existing technologies is solved, and efficient business process management and optimization are achieved.
Patent Information
- Application Number
- CN202511887323.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-15
- Publication Date
- 2026-03-17
AI Technical Summary
Business process diagrams are difficult to display clearly in existing IT application systems. Existing technologies rely on manual operation and are costly. It is also difficult to synchronize the process diagrams with the actual system operation status.
By parsing Hypertext Markup Language files and front-end script files, a service call list is constructed, a JSON configuration script is generated, and a business process diagram is rendered, thus achieving automated reverse engineering.
The visualization and explicit representation of business processes can be completed without human intervention, improving the efficiency and quality of flowchart construction, reducing the workload of personnel, and enhancing the degree of automation and accuracy.
Smart Images

Figure CN121680930A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method and apparatus for reverse engineering a business process diagram based on source code. Background Technology
[0002] In existing IT application systems, many business processes are implemented through hard coding, lacking an intuitive way of displaying them, making it difficult to present business process diagrams clearly.
[0003] Existing technologies primarily offer two types of solutions. One relies on manually outlining business processes and drawing flowcharts in tools like BPM. While feasible, this approach is labor-intensive and inefficient. The other involves manually operating the system and using automated tools to collect operation data and generate process scripts. This method is mainly used in testing scenarios. However, these automated tools rely on manual operation to generate process scripts and cannot reflect the actual operating logic of the system in real time. Both solutions generally suffer from problems such as excessive manual intervention, high costs, and difficulty in synchronizing flowcharts with the actual system operation status, making process management and optimization more complex and inefficient.
[0004] Therefore, there is an urgent need for a technical solution that can reduce human intervention and enable real-time visualization and automatic generation of business processes. Summary of the Invention
[0005] In view of this, embodiments of the present invention provide a method and apparatus for reverse engineering a business process diagram based on source code, so as to solve the problems of difficulty and high cost in drawing flowcharts.
[0006] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:
[0007] The first aspect of this invention discloses a method for reverse engineering a business process diagram based on source code, the method comprising:
[0008] Parse the event and service call relationships in Hypertext Markup Language files and front-end script files, and construct a service call list;
[0009] A JSON configuration script for generating a business process diagram based on the service call list;
[0010] The JSON configuration script is parsed to generate a rendered diagram of the business process.
[0011] Preferably, the step of parsing the event and service call relationships in the hypertext markup language file and the front-end script file to construct a service call list includes:
[0012] The Hypertext Markup Language (HMRL) file is converted into a Document Object Model (DOM) tree using a HMRL parser.
[0013] Traverse the document object model tree to obtain the elements that contain event response functionality, and the hierarchical path of the elements in the document object model tree;
[0014] The front-end script file is converted into an abstract syntax tree using a front-end script parser;
[0015] Traverse the abstract syntax tree to obtain event information; the event information includes at least a callback function.
[0016] Traverse the abstract syntax subtree of the callback function to obtain all the interface call information used to initiate network requests;
[0017] Based on the elements, the hierarchical path, the event information, and the interface call information, a service call list is constructed.
[0018] Preferably, the step of constructing a service call list based on the element, the hierarchical path, the event information, and the interface call information includes:
[0019] The element, the hierarchical path, the event information, and the interface call information are associated to obtain multiple records, and the record corresponds to the call path of the service.
[0020] Create a unique identifier for each record and attributes for each record;
[0021] A service call list is constructed based on all records and the unique identifier of each record, as well as the attributes of each record.
[0022] Preferably, the JSON configuration script for generating the business process diagram based on the service call list includes:
[0023] Parsing the service call list yields multiple records;
[0024] Extract the process steps and connection information of the service call path from each record;
[0025] Based on the process step information and the process step connection information, a JSON configuration script for generating a business process diagram is generated.
[0026] Preferably, parsing the JSON configuration script to generate a rendered business process diagram includes:
[0027] The JSON configuration script was parsed using a business process diagramming tool to obtain each service, the connection relationships between services, and the call types.
[0028] The format of each service, the format of the connection relationship between services, and the format of the call type are converted into the data format required for visualization, and then rendered to generate a rendering diagram of the business process diagram.
[0029] A second aspect of this invention discloses a reverse engineering apparatus for business process diagrams based on source code, the apparatus comprising:
[0030] The building unit is used to parse the event and service call relationships in Hypertext Markup Language files and front-end script files, and build a service call list;
[0031] The JSON script generation unit is used to generate a JSON configuration script for the business process diagram based on the service call list.
[0032] The rendering unit is used to parse the JSON configuration script and generate a rendering of the business process diagram.
[0033] Preferably, the building unit includes:
[0034] The first conversion module is used to convert Hypertext Markup Language files into Document Object Model Trees using a Hypertext Markup Language parser;
[0035] The first traversal module is used to traverse the document object model tree to obtain the elements containing event response functions, and the hierarchical path of the elements in the document object model tree;
[0036] The second conversion module is used to convert front-end script files into abstract syntax trees through a front-end script parser.
[0037] The second traversal module traverses the abstract syntax tree to obtain event information; the event information includes at least a callback function.
[0038] The third traversal module traverses the abstract syntax subtree of the callback function to obtain all interface call information used to initiate network requests;
[0039] The construction module is used to construct a service call list based on the elements, the hierarchical path, the event information, and the interface call information.
[0040] Preferably, the building module includes:
[0041] The association submodule is used to associate the element, the hierarchical path, the event information, and the interface call information to obtain multiple records, and the record corresponds to the call path of the service;
[0042] Create a submodule to create a unique identifier for each record and attributes for each record;
[0043] The construction submodule is used to build a service call list based on all records and the unique identifier of each record, as well as the attributes of each record.
[0044] Preferably, the JSON script generation unit is specifically used for:
[0045] Parse the service call list to obtain multiple records; extract the process step information and process step connection information of the service call path from each record; generate a JSON configuration script for the business process diagram based on the process step information and the process step connection information.
[0046] Preferably, the rendering image generation unit is specifically used for:
[0047] The JSON configuration script is parsed using a business process diagram drawing tool to obtain each service, the connection relationships between services, and the call types. The format of each service, the format of the connection relationships between services, and the format of the call types are converted into the data format required for visualization, and a rendered diagram of the business process diagram is generated.
[0048] Based on the above embodiments of the present invention, a method and apparatus for reverse engineering a business process diagram based on source code is provided. This method parses the event and service call relationships in Hypertext Markup Language (HTML) files and front-end script files to construct a service call list; generates a JSON configuration script for the business process diagram based on the service call list; and parses the JSON configuration script to generate a rendered diagram of the business process diagram. By automatically analyzing the source code and reverse-engineering the business process diagram, the visualization and explicitness of the business process can be achieved without manual intervention, significantly improving the efficiency and quality of business process diagram construction. This process automatically generates a service call list by deeply analyzing the business events and service call relationships in HTML and JS source code, and constructs the business process diagram based on this list. This improves the efficiency and quality of business process diagram construction, while also reducing the workload of personnel and enhancing the automation and accuracy of the entire business process management. Attached Figure Description
[0049] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0050] Figure 1 A flowchart of a method for reverse engineering a business process diagram based on source code, provided in an embodiment of the present invention;
[0051] Figure 2This is an example diagram illustrating the sequence relationship between page events and service calls provided in an embodiment of the present invention.
[0052] Figure 3 A rendering example of a business process diagram provided in an embodiment of the present invention;
[0053] Figure 4 This is a structural block diagram of a business process diagram reverse engineering device based on source code, provided in an embodiment of the present invention. Detailed Implementation
[0054] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0055] In this application, the terms "comprising," "including," or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0056] As can be seen from the background technology, existing technologies mainly suffer from problems such as reliance on manual operation, high cost, and difficulty in synchronizing flowcharts with the actual system operation status, resulting in complex and inefficient process management and optimization.
[0057] Therefore, this invention provides a method and apparatus for reverse engineering business process diagrams based on source code. It parses the event and service call relationships in Hypertext Markup Language (HTML) files and front-end script files to construct a service call list; generates a JSON configuration script for the business process diagram based on the service call list; and parses the JSON configuration script to generate a rendered diagram of the business process diagram. By automatically analyzing the source code and reverse-engineering the business process diagram, the visualization and explicitness of the business process can be achieved without manual intervention, significantly improving the efficiency and quality of business process diagram construction. This process automatically generates a service call list by deeply analyzing the business events and service call relationships in HTML and JS source code, and constructs the business process diagram based on this list. This improves the efficiency and quality of business process diagram construction, while also reducing the workload of personnel and enhancing the automation and accuracy of the entire business process management.
[0058] See Figure 1The diagram shows a flowchart of a business process diagram reverse engineering method based on source code, provided by an embodiment of the present invention.
[0059] Step S101: Parse the event and service call relationships in the Hypertext Markup Language file and the front-end script file, and construct a service call list.
[0060] In the specific implementation step S101, a hypertext markup language file and a front-end script file are obtained. The hypertext markup language file is parsed using a hypertext markup language parser, and the front-end script file is parsed using a front-end script parser, thereby constructing a service call list based on the parsing results.
[0061] It should be noted that the specific implementation process is as follows (processes A1 to A6):
[0062] Process A1: Convert the Hypertext Markup Language file into a Document Object Model tree using a Hypertext Markup Language parser.
[0063] It should be noted that the Hypertext Markup Language parser (HTML parser) is a software component used to convert HTML (Hypertext Markup Language) files into structured data that can be manipulated by programs.
[0064] Understandably, the core function of an HTML parser is to break down HTML tags (such as <html>, <body ... The HTML document is parsed into a structured DOM tree (also known as the Document Object Model tree). This tree structure reflects the hierarchical relationships and element content of the HTML document.
[0065] Process A2: Traverse the Document Object Model (DOM) tree to obtain the elements that contain event response functionality, as well as the hierarchical path of the elements in the DOM tree.
[0066] It should be noted that the document object model tree is traversed to view all HTML elements and identify those that contain event response functionality.
[0067] For example, jQuery's $(document).ready(function(){}) or $(function){};
[0068] jQuery's $(window).load(function(){});
[0069] window.onload = function(){}.
[0070] As we can understand, event handling refers to event handlers bound to elements, such as onclick and onmouseover in JavaScript. These event handlers enable elements to trigger corresponding behaviors (such as opening links or displaying messages) when the user interacts with the page (e.g., when a button is clicked).
[0071] Interaction events such as: Form events: onclick, onblur, onchange, oncontextmenu, onfocus, onformchange, onforminput, oninput, oninvalid, onreset, onselect, onsubmit. Keyboard events: onkeydown, onkeypress, onkeyup. Mouse events: onclick, ondblclick, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onscroll.
[0072] It should be noted that the hierarchical path indicates the position of the element in the document object model tree.
[0073] For example, if a button is located Inside, and this Since it's located inside, the button's hierarchy path can be represented as > > <button>This helps to clarify the structure and position of elements on the page.
[0074] Process A3: Convert the front-end script file into an abstract syntax tree using a front-end script parser.
[0075] It should be noted that the front-end script file (i.e., JavaScript file) is converted into an Abstract Syntax Tree (AST) by a front-end script parser (such as Babel, Esprima, Acorn, etc.).
[0076] For example: parsing page initialization events in front-end script files using a front-end script parser, including... <script>< / script> The JavaScript code snippet executed in the script.
[0077] Understandably, AST is a way of representing code in a tree structure, which can show the syntactic structure and relationships of the code.
[0078] Process A4: Traverse the abstract syntax tree to obtain event information.
[0079] Specifically, the event information is extracted from the abstract syntax tree, and the event information includes at least the callback function.
[0080] It should be noted that callback functions are functions that are executed when an event is triggered, and this information is very important for understanding the interactive behavior of front-end scripts.
[0081] For example, user interactions (such as clicking, typing, hovering, etc.) are usually bound to certain DOM elements, and callback functions are the code that is executed when the event occurs.
[0082] Process A5: Traverse the abstract syntax subtree of the callback function to obtain all interface call information used to initiate network requests.
[0083] Specifically, the purpose of traversing the abstract syntax subtree of the callback function is to deeply analyze the code of the callback function and extract the interface call information involving network requests.
[0084] Understandably, this process allows for the identification of all network interactions and an understanding of how applications communicate with servers or interfaces.
[0085] Process A6: Construct a service call list based on elements, hierarchical paths, event information, and interface call information.
[0086] It should be noted that the specific implementation process of process A6 is as follows (processes B1 to B3):
[0087] Process B1: Associate elements, hierarchical paths, event information, and interface call information to obtain multiple records, recording the call paths of the corresponding services.
[0088] It's important to note that front-end interfaces are typically composed of different elements, such as buttons, input fields, and forms. The position of each element on the page can be identified using a hierarchical path (such as a DOM tree path). For example, a button might be located under the path `div > section > form > button`. Hierarchical paths help to accurately locate individual elements on the page.
[0089] Understandably, when a user interacts with the interface, elements may trigger events such as click events and submit events, which in turn affect page behavior. For example, clicking a button may trigger the "onClick" event. Figure 2 As shown, certain events can further trigger calls to backend interfaces. These calls are typically API requests (such as those sent using "fetch" or "axios") and include the URL, input parameters, and request methods (such as GET or POST).
[0090] By associating elements, hierarchical paths, event information, and API calls, a set of records is obtained, each reflecting the user's interaction with the interface.
[0091] Understandably, each record contains information such as the order in which events are triggered, the corresponding API call path, and the location where the event occurs, providing a foundation for creating a unique identifier and service call list later.
[0092] Procedure B2: Create a unique identifier for each record and attributes for each record.
[0093] Understandably, each record represents a specific service call process, and a unique identifier and related attributes need to be created for it.
[0094] In some embodiments, the attributes of each record include: event type (such as click, submit, input, etc.), element hierarchy path, API call information, call order, and timestamp. These attributes provide detailed information that helps in analyzing and tracking each interaction process and its corresponding service call.
[0095] Process B3: Construct a service call list based on all records, the unique identifier of each record, and the attributes of each record.
[0096] Understandably, after integrating all the records, a complete service call list is formed. This list not only includes basic information about each service call, but also records their sequential relationships, triggering conditions, and related parameters.
[0097] For example, the structure of a service call manifest includes: a unique identifier for each record, used to index each call; a call path, describing the sequence of events and the path of the API calls; and detailed information for each API call, including the API URL, the input parameters passed, and the output parameters returned.
[0098] Step S102: Generate a JSON configuration script for the business process diagram based on the service call list.
[0099] In the specific implementation step S102, the service call list is first parsed to obtain multiple records; then, the process link information and process link connection information of the service call path are extracted from each record; finally, based on the process link information and process link connection information, a JSON configuration script for the business process diagram is generated.
[0100] It should be noted that process step information represents each operation or task in the business process (such as button clicks, form submissions, etc.). Process step connection information represents the sequential relationship, branching conditions, or loop logic between these steps.
[0101] Understandably, based on this extracted information, a JSON configuration script for a business process diagram is generated. This script describes the structure and logic of the entire business process, including each process step and the control relationships between them.
[0102] For example, process steps may be connected together by control instructions such as sequence, branching, or looping to form a complete business process diagram. Each step is bound to a specific service, representing the service call triggered when the user interacts with the system.
[0103] In summary, this process transforms the temporal relationship between page events and service calls into a business process diagram, helping to understand the system's workflow and service call logic more clearly through visualization.
[0104] It should be added that the JSON configuration script structure for the business process diagram is as follows:
[0105] {
[0106] "pagename": [{"html / js file name"}],
[0107] "creatime": "Reverse build time",
[0108] "process": [
[0109] {
[0110] "process_id": "process ID",
[0111] "process_desc": "Process description",
[0112] "component_id": "The bound service"
[0113] "component_args": {
[0114] "inargs":{}
[0115] "outargs":{}
[0116] }
[0117] "next": [
[0118] {
[0119] "case ": " ",
[0120] "next ": " ",
[0121] "type": "branch"
[0122] } ]
[0124] } ]
[0126] }
[0127] As is understandable, in the JSON structure above, `pagename` specifies the HTML or JS filename of the current page, `creatime` represents the reverse engineering time, i.e., the time when the business process diagram was generated. `process` contains the various stages of the business process, each with the following attributes:
[0128] process_id: A unique identifier for a process.
[0129] process_desc: A description of the process, explaining its function or operation.
[0130] component_id: The service ID bound to this component.
[0131] component_args: The input and output parameters of this component service, including:
[0132] inargs: Input parameters.
[0133] outargs: Output parameters.
[0134] next: Contains information about the next stage, including control over branches and process connections.
[0135] The `case` expression for branching has two forms:
[0136] JavaScript expression: Returns true or false to determine whether to jump to the next step, for example: ${transinfo.transinfo.transinfo.donext}==false.
[0137] Case expressions: Use switch expressions to determine different situations and decide which flow to jump to.
[0138] next: Specifies the ID or name of the next step.
[0139] type: Branch type, indicating whether this step is a branch, or the way to control the flow jump.
[0140] Step S103: Parse the JSON configuration script and generate a rendered diagram of the business process diagram.
[0141] In the specific implementation step S103, the business process diagram drawing tool is used to parse the JSON configuration script to obtain each service, the connection relationship between services, and the call type; then the format of each service, the format of the connection relationship between services, and the format of the call type are converted into the data format required for visualization graphics, and the rendering diagram of the business process diagram is generated.
[0142] It should be noted that the rendered image is available from [link / reference]. Figure 3 As shown, the main components of a business process include services, solid lines, and dashed lines. Services are connected by lines; solid lines represent synchronous calls, while dashed lines represent asynchronous calls. Dashed lines typically originate from execution triggered by frontend requests, indicating that the service call is asynchronous. By connecting and distinguishing these elements, the order of service calls and their synchronous or asynchronous characteristics in the business process can be clearly demonstrated.
[0143] In this embodiment of the invention, by automatically analyzing the source code and reverse-engineering the business process diagram, the visualization and explicitness of the business process can be achieved without manual intervention, significantly improving the efficiency and quality of business process diagram construction. This process automatically generates a service call list by deeply analyzing the business events and service call relationships in the HTML and JS source code, and constructs the business process diagram based on this list. In this way, not only is the need for manual intervention reduced, but the workload of personnel is also effectively alleviated, improving the automation level and accuracy of the entire business process management.
[0144] Corresponding to the reverse engineering method for business process diagrams based on source code provided in the above embodiments of the present invention, see also... Figure 4 The diagram shows a structural block diagram of a business process diagram reverse engineering device based on source code, provided in an embodiment of the present invention.
[0145] The device includes: a construction unit 401, a JSON script generation unit 402, and a rendering graph generation unit 403.
[0146] Construction unit 401 is used to parse the call relationships between events and services in hypertext markup language files and front-end script files, and to build a service call list.
[0147] JSON script generation unit 402 is used to generate a JSON configuration script for a business process diagram based on the service call list.
[0148] The JSON script generation unit 402 is specifically used for: parsing the service call list to obtain multiple records; extracting the process step information and process step connection information of the service call path from each record; and generating a JSON configuration script for the business process diagram based on the process step information and process step connection information.
[0149] The rendering unit 403 is used to parse the JSON configuration script and generate a rendering of the business process diagram.
[0150] The rendering unit 403 is specifically used to: parse the JSON configuration script using a business process diagram drawing tool to obtain each service, the connection relationship between services, and the call type; convert the format of each service, the format of the connection relationship between services, and the format of the call type into the data format required for visualization graphics, and render and generate a rendering diagram of the business process diagram.
[0151] In this embodiment of the invention, by automatically analyzing the source code and reverse-engineering the business process diagram, the visualization and explicitness of the business process can be achieved without manual intervention, significantly improving the efficiency and quality of business process diagram construction. This process automatically generates a service call list by deeply analyzing the business events and service call relationships in the HTML and JS source code, and constructs the business process diagram based on this list. In this way, not only is the need for manual intervention reduced, but the workload of personnel is also effectively alleviated, improving the automation level and accuracy of the entire business process management.
[0152] Combination Figure 4 The content shown, the construction unit 401, includes: a first conversion module, a first traversal module, a second conversion module, a second traversal module, a third traversal module and a construction module.
[0153] The first conversion module is used to convert Hypertext Markup Language (HTML) files into Document Object Model (DOM) trees using an HTML parser.
[0154] The first traversal module is used to traverse the Document Object Model (DOM) tree to obtain the elements that contain event response functionality, as well as the hierarchical path of the elements in the DOM tree.
[0155] The second conversion module is used to convert front-end script files into abstract syntax trees through the front-end script parser.
[0156] The second traversal module traverses the abstract syntax tree to obtain event information; the event information includes at least the callback function.
[0157] The third traversal module uses the abstract syntax subtree of the callback function to obtain all the interface call information used to initiate network requests.
[0158] The building module is used to construct a service call list based on elements, hierarchical paths, event information, and API call information.
[0159] Combination Figure 4 The content shown is a building block, including: associated submodules, created submodules, and built submodules.
[0160] The association submodule is used to associate elements, hierarchical paths, event information, and interface call information to obtain multiple records, which record the call paths of the corresponding services.
[0161] Create a submodule to create a unique identifier for each record and the attributes for each record.
[0162] The build submodule is used to construct a service call list based on all records, the unique identifier of each record, and the attributes of each record.
[0163] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for system or system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and relevant parts can be referred to the descriptions in the method embodiments. The systems and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0164] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0165] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.< / button>
Claims
1. A method for reverse engineering a business process diagram based on source code, characterized in that, The method includes: Parse the event and service call relationships in Hypertext Markup Language files and front-end script files, and construct a service call list; A JSON configuration script for generating a business process diagram based on the service call list; The JSON configuration script is parsed to generate a rendered diagram of the business process.
2. The method according to claim 1, characterized in that, The process of parsing the event and service call relationships in the Hypertext Markup Language (HTML) files and front-end script files, and constructing a service call list, includes: The Hypertext Markup Language (HMRL) file is converted into a Document Object Model (DOM) tree using a HMRL parser. Traverse the document object model tree to obtain the elements that contain event response functionality, and the hierarchical path of the elements in the document object model tree; The front-end script file is converted into an abstract syntax tree using a front-end script parser; Traverse the abstract syntax tree to obtain event information; the event information includes at least a callback function. Traverse the abstract syntax subtree of the callback function to obtain all the interface call information used to initiate network requests; Based on the elements, the hierarchical path, the event information, and the interface call information, a service call list is constructed.
3. The method according to claim 2, characterized in that, The process of constructing a service call list based on the elements, the hierarchical path, the event information, and the interface call information includes: The element, the hierarchical path, the event information, and the interface call information are associated to obtain multiple records, and the record corresponds to the call path of the service. Create a unique identifier for each record and attributes for each record; A service call list is constructed based on all records and the unique identifier of each record, as well as the attributes of each record.
4. The method according to claim 1, characterized in that, The JSON configuration script for generating the business process diagram based on the service call list includes: Parsing the service call list yields multiple records; Extract the process steps and connection information of the service call path from each record; Based on the process step information and the process step connection information, a JSON configuration script for generating a business process diagram is generated.
5. The method according to claim 1, characterized in that, The process of parsing the JSON configuration script and generating a rendered business process diagram includes: The JSON configuration script was parsed using a business process diagramming tool to obtain each service, the connection relationships between services, and the call types. The format of each service, the format of the connection relationship between services, and the format of the call type are converted into the data format required for visualization, and then rendered to generate a rendering diagram of the business process diagram.
6. A reverse engineering device for business process diagrams based on source code, characterized in that, The device includes: The building unit is used to parse the event and service call relationships in Hypertext Markup Language files and front-end script files, and build a service call list; The JSON script generation unit is used to generate a JSON configuration script for the business process diagram based on the service call list. The rendering unit is used to parse the JSON configuration script and generate a rendering of the business process diagram.
7. The apparatus according to claim 6, characterized in that, The building unit includes: The first conversion module is used to convert Hypertext Markup Language files into Document Object Model Trees using a Hypertext Markup Language parser; The first traversal module is used to traverse the document object model tree to obtain the elements containing event response functions, and the hierarchical path of the elements in the document object model tree; The second conversion module is used to convert front-end script files into abstract syntax trees through a front-end script parser. The second traversal module traverses the abstract syntax tree to obtain event information; the event information includes at least a callback function. The third traversal module traverses the abstract syntax subtree of the callback function to obtain all interface call information used to initiate network requests; The construction module is used to construct a service call list based on the elements, the hierarchical path, the event information, and the interface call information.
8. The apparatus according to claim 7, characterized in that, The building module includes: The association submodule is used to associate the element, the hierarchical path, the event information, and the interface call information to obtain multiple records, and the record corresponds to the call path of the service; Create a submodule to create a unique identifier for each record and attributes for each record; The construction submodule is used to build a service call list based on all records and the unique identifier of each record, as well as the attributes of each record.
9. The apparatus according to claim 6, characterized in that, The JSON script generation unit is specifically used for: Parse the service call list to obtain multiple records; extract the process step information and process step connection information of the service call path from each record; generate a JSON configuration script for the business process diagram based on the process step information and the process step connection information.
10. The apparatus according to claim 6, characterized in that, The rendering unit is specifically used for: The JSON configuration script is parsed using a business process diagram drawing tool to obtain each service, the connection relationships between services, and the call types. The format of each service, the format of the connection relationships between services, and the format of the call types are converted into the data format required for visualization, and a rendered diagram of the business process diagram is generated.