A code execution method, device, equipment and storage medium thereof
By generating execution logic graphs and using Java reflection technology and Spring containers to obtain financial business code blocks, the problems of labor consumption and low code reuse efficiency in financial business APP development are solved, and efficient code reuse and rapid calling are achieved.
Patent Information
- Application Number
- CN202410045924.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-10
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2044-01-10
AI Technical Summary
Existing technologies consume a lot of manpower in the development of financial business apps and are not conducive to the reuse and quick calling of the same business function codes.
By generating an execution logic graph, identifying and setting the distinguished block name and execution logic distinguished code of the code block, writing it into the configuration file in the form of multiple operators, and using Java reflection technology and Spring container to obtain the target code block.
It enables free acquisition and reuse of the same or similar codes, reduces development manpower consumption, and improves code calling efficiency.
Smart Images

Figure CN117785181B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of financial technology and is applied to scenarios where financial services are rapidly generated, and in particular to a code execution method, apparatus, device, and storage medium thereof. Background Art
[0002] With the rapid development of the financial industry, the business scope of financial companies is becoming increasingly broad, and the amount of financial data processed is also increasing. Although the amount of financial data processed is increasing, most financial business apps may have the same business processing functions, such as user login, security verification, face recognition and other general functions.
[0003] In current financial companies, the development of financial business apps is mostly done by programmers who write program codes, directly compile the written code content, and then execute the compiled code content. This method is not only labor-intensive, but also not conducive to the reuse and quick calling of the same business function code. Summary of the Invention
[0004] The purpose of the embodiments of the present application is to propose a code execution method, device, equipment and storage medium thereof to solve the problem that the existing technology in the development of financial business APPs is not only labor-intensive but also not conducive to the reuse and rapid calling of the same business function code.
[0005] In order to solve the above technical problems, the embodiments of the present application provide a code execution method, which adopts the following technical solutions:
[0006] A code execution method comprises the following steps:
[0007] Obtain the completed financial business code;
[0008] Identifying the execution logic sequence of all code blocks in the financial business code according to the target requirement document, and generating an execution logic graph, wherein the target requirement document includes the execution logic sequence of all code blocks in the financial business code;
[0009] Parsing the financial business code with reference to the execution logic graph, obtaining all the code blocks, and setting distinguishing block names for all the code blocks;
[0010] Setting execution logic distinction codes of all code blocks based on the execution logic graph;
[0011] According to the execution logic distinguishing code, the distinguishing block name is written into the code execution configuration file in the form of a multi-element operator to obtain a written code execution configuration file;
[0012] Parsing all polynomial operators in the code execution configuration file to obtain distinguishing block names of all code blocks;
[0013] Using Java reflection technology and Spring container, and combining with the execution logic map, sequentially obtain target code blocks with distinguishing block names of all code blocks;
[0014] The financial service code is compiled and executed according to the target code block and the preset compilation template.
[0015] Furthermore, the execution logic sequence includes the execution method names corresponding to all the code blocks and the calling relationship between the execution methods. The step of identifying the execution logic sequence of all the code blocks in the financial business code according to the target requirement document and generating the execution logic graph specifically includes:
[0016] Obtaining the execution method names corresponding to all code blocks through the target requirement document;
[0017] Determining the execution logic among all code blocks according to the calling relationships among the various execution methods, wherein the calling relationships among the various execution methods include vertical calling relationships, loop calling relationships, and conditional calling relationships;
[0018] Generate an execution logic graph based on the execution logic between all code blocks and the execution method names;
[0019] The step of parsing the financial business code with reference to the execution logic graph, obtaining all the code blocks, and setting distinguishing block names for all the code blocks specifically includes:
[0020] Based on the execution logic graph, obtain all the code blocks and the execution method names corresponding to all the code blocks;
[0021] The execution method name is set as the distinguishing block name.
[0022] Furthermore, the step of setting the execution logic difference codes of all the code blocks based on the execution logic graph specifically includes:
[0023] Identifying, through the execution logic graph, code blocks with vertical calling relationships, code blocks with circular calling relationships, and code blocks with conditional calling relationships among all the code blocks;
[0024] For the code blocks having a vertical calling relationship, setting execution logic distinction coding between the code blocks using a preset first coding strategy according to the vertical calling relationship;
[0025] For the code blocks having a circular calling relationship, according to the circular calling relationship, a preset second coding strategy is used to set execution logic difference coding between the code blocks;
[0026] For the code blocks with conditional call relationships, a preset third encoding strategy is used to set execution logic difference encoding between the code blocks according to the conditional call relationships.
[0027] Furthermore, the step of distinguishing the codes according to the execution logic and writing the distinguishing block names into the code execution configuration file in the form of a multi-element operator to obtain the written code execution configuration file specifically includes:
[0028] Based on the execution logic distinguishing code, the distinguishing block names corresponding to the code blocks with vertical calling relationships and the distinguishing block names corresponding to the code blocks with circular calling relationships are written into the code execution configuration file in the form of a multi-element operator;
[0029] Based on the execution logic distinguishing code, writing the distinguishing block name corresponding to the code block with the conditional call relationship into the code execution configuration file;
[0030] Until the number of multi-element operators written into the code execution configuration file reaches a stable value, a completed code execution configuration file is obtained.
[0031] Furthermore, the step of writing the distinguishing block names corresponding to the code blocks with vertical calling relationships and the distinguishing block names corresponding to the code blocks with circular calling relationships into the code execution configuration file in the form of a multi-element operator based on the execution logic distinguishing code specifically includes:
[0032] Step 501, obtaining the distinguishing block names corresponding to the code blocks with vertical calling relationships and the distinguishing block names corresponding to the code blocks with circular calling relationships;
[0033] Step 502 , arbitrarily selecting two target distinguishing block names from the distinguishing block names corresponding to the code blocks with vertical calling relationships and the distinguishing block names corresponding to the code blocks with circular calling relationships;
[0034] Step 503: determining whether there is a direct calling relationship between the two target distinguishing block names according to the execution logic distinguishing code, wherein the direct calling relationship means that one target distinguishing block name is directly called by the other target distinguishing block name;
[0035] Step 504: If there is no direct calling relationship between the two target distinguishing block names, continue to execute steps 502 to 503;
[0036] Step 505: If there is a direct calling relationship between the two target distinguishing block names, the target distinguishing name to be called is used as the relationship expression to fill the field, the target distinguishing block name to be directly called is used as the first expression to fill the field, the NULL value is used as the second expression to fill the field, a ternary operator is constructed, and the ternary operator is written into the code execution configuration file.
[0037] Furthermore, the step of writing the distinguishing block names corresponding to the code blocks with conditional call relationships into the code execution configuration file based on the execution logic distinguishing codes specifically includes:
[0038] Step 601, obtaining the distinguishing block name corresponding to the code block with the conditional call relationship;
[0039] Step 602, randomly selecting M target distinguishing block names from the distinguishing block names corresponding to the code blocks having the conditional call relationship;
[0040] Step 603: judging, based on the execution logic distinguishing code, whether the M target distinguishing block names satisfy a relationship in which M-1 target distinguishing block names are selected and called by the remaining target distinguishing block name;
[0041] Step 604: If the M target distinguishing block names do not meet the relationship in which M-1 target distinguishing block names are selected and called by the remaining target distinguishing block name, then continue to execute steps 602 to 603;
[0042] Step 605: If the M target distinguishing block names meet the relationship in which M-1 target distinguishing block names are selected and called by the remaining target distinguishing block name, the target distinguishing block name to be selected and called is used as the relational expression filling field, and the target distinguishing block name to be selected and called is used as the first expression filling field to the M-1 expression filling field respectively, a multi-element operator is generated, and the multi-element operator is written into the code execution configuration file, where M is a positive integer greater than 2.
[0043] Furthermore, the step of using Java reflection technology and Spring container, and combining the execution logic graph to sequentially obtain target code blocks with distinguishing block names of all code blocks specifically includes:
[0044] Determine the calling relationship between all code blocks in combination with the execution logic graph;
[0045] According to the calling relationship between all the code blocks, Java reflection technology and Spring container are used to generate a reflection calling function with the distinguishing block names of all the code blocks as reflection parameters;
[0046] Based on the reflection call function, all code blocks corresponding to the distinguished block names are sequentially obtained as the target code blocks;
[0047] The preset compilation template reserves a target number of placeholders, the target number of placeholders are used to fill the target code blocks, the preset compilation template includes a main function entry of program execution, and the step of compiling and executing the financial business code according to the target code blocks and the preset compilation template specifically includes:
[0048] The target code blocks are filled into the corresponding placeholders in the preset compilation template one by one to generate a financial business code to be compiled;
[0049] The financial business code to be compiled is compiled to obtain a compiled financial business code;
[0050] The compiled financial business code is executed according to the main function entry of program execution.
[0051] To solve the above technical problems, the embodiment of the application also provides a code execution device, which adopts the technical scheme as follows:
[0052] A code execution device comprises:
[0053] A code acquisition module is configured to acquire a compiled financial business code;
[0054] An execution logic identification module is configured to identify an execution logic sequence of all code blocks in the financial business code according to a target requirement document to generate an execution logic graph, wherein the target requirement document contains the execution logic sequence of all code blocks in the financial business code;
[0055] A distinguished block name setting module is configured to parse the financial business code by referring to the execution logic graph, acquire all code blocks, and set distinguished block names of the code blocks;
[0056] A distinguished code setting module is configured to set execution logic distinguished codes of all code blocks based on the execution logic graph;
[0057] A write-in execution configuration file module is configured to write the distinguished block names into a code execution configuration file in the form of a multi-element operator according to the execution logic distinguished codes to obtain a written-in code execution configuration file;
[0058] A multi-element operator analysis module is configured to analyze all multi-element operators in the code execution configuration file to obtain the distinguished block names of all code blocks;
[0059] A code block reflection acquisition module is used to use Java reflection technology and Spring container, and in combination with the execution logic graph, sequentially acquire target code blocks with distinguishing block names of all code blocks;
[0060] The compiling and executing module is used to compile and execute the financial service code according to the target code block and a preset compiling template.
[0061] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:
[0062] A computer device includes a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the above-mentioned code execution method when executing the computer-readable instructions.
[0063] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:
[0064] A computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the code execution method described above.
[0065] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0066] The code execution method of the embodiment of the present application obtains a completed financial business code; identifies the execution logic sequence of all code blocks in the financial business code according to a target requirements document and generates an execution logic map; parses the financial business code with reference to the execution logic map to obtain all code blocks and sets distinguishing block names and execution logic distinguishing codes for all code blocks; writes the distinguishing block names into a code execution configuration file in the form of a multi-operator based on the execution logic distinguishing codes to obtain a completed code execution configuration file; parses all multi-operators in the code execution configuration file and sequentially obtains target code blocks using Java reflection technology and a Spring container in combination with the execution logic map; and compiles and executes the financial business code according to the target code blocks and a preset compilation template. By writing the distinguishing block names corresponding to all code blocks into the code execution configuration file, Java reflection technology and a Spring container are used to use the distinguishing block names as reflection parameters when calling a code block to obtain the target code block. This method not only enables the free acquisition of target code blocks based on identical or similar codes in different financial businesses, but also facilitates the reuse and rapid calling of identical or similar codes. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] In order to more clearly illustrate the solutions in this application, a brief introduction will be given below to the drawings required for use in the description of the embodiments of this application. Obviously, the drawings described below are some embodiments of this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0068] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;
[0069] Figure 2 is a flowchart of an embodiment of a code execution method according to the present application;
[0070] Figure 3 yes Figure 2 A flowchart of a specific embodiment of step 204 is shown;
[0071] Figure 4 yes Figure 2 A flowchart of a specific embodiment of step 205 is shown;
[0072] Figure 5 yes Figure 4 A flowchart of a specific embodiment of step 401 is shown;
[0073] Figure 6 yes Figure 4 A flowchart of a specific embodiment of step 402 is shown;
[0074] Figure 7 yes Figure 4 A flowchart of a specific embodiment of step 403 is shown;
[0075] Figure 8 is a structural diagram of an embodiment of a code execution device according to the present application;
[0076] Figure 9 It is a structural diagram of an embodiment of a computer device according to the present application. DETAILED DESCRIPTION
[0077] Unless otherwise defined, all technical and scientific terms used herein have the same meanings as commonly understood by those skilled in the art to which this application belongs. The terms used in the specification of the application are for the purpose of describing specific embodiments only and are not intended to limit this application. The terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of this application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0078] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0079] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0080] like Figure 1 As shown, system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. Network 104 is a medium for providing communication links between terminal devices 101, 102, 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables.
[0081] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0082] Terminal devices 101, 102, and 103 can be various electronic devices with display screens and support web browsing, including but not limited to smartphones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 (Moving Picture Experts Group Audio Layer IV), laptop computers, desktop computers, etc.
[0083] The server 105 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal devices 101 , 102 , and 103 .
[0084] It should be noted that the code execution method provided in the embodiments of the present application is generally executed by a server / terminal device, and accordingly, the code execution device is generally set in the server / terminal device.
[0085] It should be understood that Figure 1The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as required.
[0086] Continue to refer Figure 2 , shows a flow chart of an embodiment of a code execution method according to the present application. The code execution method comprises the following steps:
[0087] Step 201: Obtain the completed financial business code.
[0088] In this embodiment, the completed financial business code is the completed financial business code pushed by the target writing end, wherein the completed financial business code refers to the financial business code that has not yet been compiled. The target writing end includes the programmer's code writing end or the target financial company's code repository, and the completed financial business code is pre-stored in the code repository.
[0089] By obtaining the completed financial business code, different code blocks can be screened out according to different financial businesses for free combination and compilation, so that the completed financial business code can be reused according to needs and the financial business code to be compiled can be quickly generated.
[0090] Step 202: Identify the execution logic sequence of all code blocks in the financial business code according to the target requirement document, and generate an execution logic graph, wherein the target requirement document includes the execution logic sequence of all code blocks in the financial business code.
[0091] In this embodiment, all code blocks in the financial business code refer to all code blocks encapsulated in method functions.
[0092] In this embodiment, the execution logic order includes the one-to-one corresponding execution method names of all the code blocks and the calling relationship between each execution method, wherein the calling relationship between each execution method includes a vertical calling relationship, a loop calling relationship, and a conditional calling relationship.
[0093] In this embodiment, the step of identifying the execution logic order of all code blocks in the financial business code according to the target requirement document and generating an execution logic graph specifically includes: obtaining the execution method names corresponding to all the code blocks through the target requirement document; determining the execution logic between all the code blocks according to the calling relationship between each execution method; and generating an execution logic graph according to the execution logic between all the code blocks and the execution method names.
[0094] By combining the target requirement document to identify the execution logic order of all code blocks in the financial business code, an execution logic graph is generated, which facilitates the direct and intuitive determination of the calling relationship between all code blocks through the execution logic graph in subsequent processing.
[0095] Step 203: parse the financial business code with reference to the execution logic graph, obtain all the code blocks, and set distinguishing block names for all the code blocks.
[0096] In this embodiment, the steps of parsing the financial business code with reference to the execution logic graph, obtaining all the code blocks, and setting the distinguishing block names of all the code blocks specifically include: obtaining all the code blocks and the execution method names corresponding to all the code blocks based on the execution logic graph; setting the execution method name as the distinguishing block name.
[0097] Since all the code blocks refer to all the code blocks encapsulated in method functions, setting the execution method name to the distinguishing block name makes it easy to directly obtain the corresponding code block with the execution method name when using the corresponding code block.
[0098] Step 204: Set execution logic distinction codes for all code blocks based on the execution logic graph.
[0099] Continue to refer Figure 3 , Figure 3 yes Figure 2 The flowchart of a specific embodiment of step 204 shown includes:
[0100] Step 301: Identify, through the execution logic graph, code blocks with vertical call relationships, code blocks with loop call relationships, and code blocks with conditional call relationships among all the code blocks;
[0101] Step 302: For the code blocks having a vertical calling relationship, a preset first coding strategy is used to set execution logic distinction coding between the code blocks according to the vertical calling relationship;
[0102] Step 303: For the code blocks having a circular calling relationship, a preset second coding strategy is used to set execution logic differentiation coding between the code blocks according to the circular calling relationship;
[0103] Step 304 : For the code blocks with the conditional call relationship, a preset third coding strategy is used to set execution logic distinction coding between the code blocks according to the conditional call relationship.
[0104] In this embodiment, the preset first coding strategy, the preset second coding strategy and the preset third coding strategy have certain differences in coding format, and their purpose is to distinguish the codes corresponding to the code blocks with vertical calling relationships, the code blocks with circular calling relationships and the code blocks with conditional calling relationships. Specifically, for example, the preset first coding strategy corresponds to the code blocks with vertical calling relationships, and adopts the coding strategy of "a" spliced with "i" for encoding, wherein "a" represents the vertical calling relationship identifier, "i" represents the coding value, which is an increasing positive integer, and the increase of "i" indicates the existence of a direct calling relationship, such as the coding results a1 and a2, "a" indicates that the code blocks with vertical calling relationships are encoded, and the i values corresponding to "a1" and "a2" have an increasing relationship, indicating that the code block corresponding to "a1" directly calls the code block corresponding to "a2"; similarly, the preset second coding strategy corresponds to the code blocks with circular calling relationships, and adopts "b " is encoded by the encoding strategy of splicing "k" together, wherein "b" represents the loop call relationship identifier symbol, "k" represents the encoding value, which is an increasing positive integer, and the increase of "k" indicates that there is a direct calling relationship, such as the encoding results b1 and b2, "b" indicates that the code block with the loop call relationship is encoded, and the k values corresponding to "b1" and "b2" are in an increasing relationship, indicating that the code block corresponding to "b1" directly calls the code block corresponding to "b2"; the preset third encoding strategy corresponds to the code block with the conditional calling relationship, and is encoded by the encoding strategy of splicing "c" together with "j", wherein "c" represents the conditional calling relationship identifier symbol, and "j" represents the encoding value, which is a positive integer. Different "j" indicates that there are different conditional calling selections, such as c1 and c2, "c" indicates that the code block with the conditional calling relationship is encoded, and the j values corresponding to "c1" and "c2" indicate that the code blocks corresponding to "c1" or "c2" may be selected for calling according to different conditions.
[0105] Step 205 : Differentiate the code according to the execution logic, and write the distinguishing block name into the code execution configuration file in the form of a multi-element operator to obtain a completed code execution configuration file.
[0106] In this embodiment, the multi-ary operator includes a ternary operator, a quaternary operator, a quinary operator, etc. The "multi-ary" in the specific "multi-ary operator" is determined by the number of selectable conditions. Assuming that there are two selectable conditions, it is a ternary operator; if there are three selectable conditions, it is a quaternary operator, and so on. They will not be repeated here.
[0107] Continue to refer Figure 4 , Figure 4 yes Figure 2The flowchart of a specific embodiment of step 205 shown includes:
[0108] Step 401, based on the execution logic distinguishing code, write the distinguishing block names corresponding to the code blocks with vertical calling relationships and the distinguishing block names corresponding to the code blocks with circular calling relationships into the code execution configuration file in the form of a multi-element operator;
[0109] Continue to refer Figure 5 , Figure 5 yes Figure 4 The flowchart of a specific embodiment of step 401 shown includes:
[0110] Step 501, obtaining the distinguishing block names corresponding to the code blocks with vertical calling relationships and the distinguishing block names corresponding to the code blocks with circular calling relationships;
[0111] Step 502 , arbitrarily selecting two target distinguishing block names from the distinguishing block names corresponding to the code blocks with vertical calling relationships and the distinguishing block names corresponding to the code blocks with circular calling relationships;
[0112] Step 503: determining whether there is a direct calling relationship between the two target distinguishing block names according to the execution logic distinguishing code, wherein the direct calling relationship means that one target distinguishing block name is directly called by the other target distinguishing block name;
[0113] In this embodiment, the step of judging whether there is a direct calling relationship between the two target distinguishing block names based on the execution logic distinguishing code specifically includes: obtaining the execution logic distinguishing code corresponding to the two target distinguishing block names; if the execution logic distinguishing code identifies that the two target distinguishing block names have the same calling relationship identification symbol, and the code value is an increasing positive integer, then there is a direct calling relationship between the two target distinguishing block names; otherwise, if the execution logic distinguishing code identifies that the two target distinguishing block names have the same loop calling relationship identification symbol, and the code values are the maximum code value and the minimum code value respectively, then there is a direct calling relationship between the two target distinguishing block names; otherwise, there is no direct calling relationship between the two target distinguishing block names.
[0114] Specifically, if the execution logic distinction code identifies that the two target distinction block names have the same loop call relationship identification symbol, and the code values are the maximum code value and the minimum code value respectively, then there is a direct call relationship between the two target distinction block names. Since they have the same loop call relationship identification symbol, there is a direct call relationship between the two target distinction block names when the code values are the maximum code value and the minimum code value respectively.
[0115] Step 504: If there is no direct calling relationship between the two target distinguishing block names, continue to execute steps 502 to 503;
[0116] Step 505: If there is a direct calling relationship between the two target distinguishing block names, the target distinguishing name to be called is used as the relationship expression to fill the field, the target distinguishing block name to be directly called is used as the first expression to fill the field, the NULL value is used as the second expression to fill the field, a ternary operator is constructed, and the ternary operator is written into the code execution configuration file.
[0117] Since this embodiment is to determine whether there is a direct calling relationship between two target distinguishing block names, a ternary operator is used to construct a corresponding ternary operation relationship between the two target distinguishing block names. In fact, in this embodiment, there is only one selectable condition, but in order to adopt the said multi-element operator, a NULL value is expanded as the second selectable condition.
[0118] Step 402: Based on the execution logic distinguishing code, the distinguishing block name corresponding to the code block with the conditional call relationship is written into the code execution configuration file;
[0119] Continue to refer Figure 6 , Figure 6 yes Figure 4 The flowchart of a specific embodiment of step 402 shown includes:
[0120] Step 601, obtaining the distinguishing block name corresponding to the code block with the conditional call relationship;
[0121] Step 602, randomly selecting M target distinguishing block names from the distinguishing block names corresponding to the code blocks having the conditional call relationship;
[0122] Step 603: judging, based on the execution logic distinguishing code, whether the M target distinguishing block names satisfy a relationship in which M-1 target distinguishing block names are selected and called by the remaining target distinguishing block name;
[0123] In this embodiment, M-1 represents M minus 1 target distinguishing block name.
[0124] Step 604: If the M target distinguishing block names do not meet the relationship in which M-1 target distinguishing block names are selected and called by the remaining target distinguishing block name, then continue to execute steps 602 to 603;
[0125] Step 605: If the M target distinguishing block names meet the relationship in which M-1 target distinguishing block names are selected and called by the remaining target distinguishing block name, the target distinguishing block name to be selected and called is used as the relational expression filling field, and the target distinguishing block name to be selected and called is used as the first expression filling field to the M-1 expression filling field respectively, a multi-element operator is generated, and the multi-element operator is written into the code execution configuration file, where M is a positive integer greater than 2.
[0126] In this embodiment, the M is less than or equal to the number of distinct block names corresponding to the code blocks having the conditional call relationship.
[0127] Step 403: until the number of multi-element operators written into the code execution configuration file reaches a stable value, a completed code execution configuration file is obtained.
[0128] Continue to refer Figure 7 , Figure 7 yes Figure 4 The flowchart of a specific embodiment of step 403 shown includes:
[0129] Step 701: according to a preset timed monitoring task, regularly counting the number of multivariate operators written in the code execution configuration file to obtain statistical results;
[0130] Step 702: If there are changes in N consecutive statistical results, the number of multivariate operators written in the code execution configuration file has not reached a stable value, and regular monitoring continues, where N is a positive integer greater than 1.
[0131] Step 703: If N consecutive statistical results are the same, the number of multivariate operators written in the code execution configuration file reaches a stable value, and a completed code execution configuration file is obtained, where N is a positive integer greater than 1.
[0132] Step 206: parse all the multi-element operators in the code execution configuration file to obtain the distinguishing block names of all the code blocks.
[0133] Step 207: Using Java reflection technology and Spring container, and combining with the execution logic graph, sequentially obtain target code blocks with distinguishing block names of all code blocks.
[0134] In this embodiment, the step of using Java reflection technology and Spring container, and combining with the execution logic graph to sequentially obtain the target code blocks of the distinguishing block names of all the code blocks, specifically includes: determining the calling relationship between all the code blocks in combination with the execution logic graph; based on the calling relationship between all the code blocks, using Java reflection technology and Spring container, and generating a reflection calling function with the distinguishing block names of all the code blocks as reflection parameters; based on the reflection calling function, sequentially obtaining the code blocks corresponding to all the distinguishing block names as the target code blocks.
[0135] By writing the distinguishing block names corresponding to all code blocks into the code execution configuration file, when calling the code block, Java reflection technology and Spring container are used to use the distinguishing block name as a reflection parameter to obtain the target code block. This not only allows free acquisition of target code blocks based on the same or similar codes in different financial businesses, but also facilitates the reuse and quick call of the same or similar codes. For example, two different financial business apps launched by the same financial company, assuming that both financial business apps have a user login function, obviously, the user login function uses the same or similar code. The above method not only facilitates the reuse of the code corresponding to the user login function, but also facilitates quick call through configuration files and reflection functions. There is no need to repeatedly develop for different financial business apps, saving manpower consumption for financial companies.
[0136] Step 208: compile and execute the financial service code according to the target code block and the preset compilation template.
[0137] In this embodiment, a target number of placeholders are reserved in the preset compilation template, and the target number of placeholders are used to fill the target code blocks. The preset compilation template includes a main function entry for program execution.
[0138] Specifically, the step of compiling and executing the financial business code according to the target code block and the preset compilation template specifically includes: filling the target code blocks into the corresponding placeholders in the preset compilation template one by one to generate the financial business code to be compiled; compiling the financial business code to be compiled to obtain the compiled financial business code; and executing the compiled financial business code according to the main function entry of the program execution.
[0139] This application obtains the completed financial business code; identifies the execution logic sequence of all code blocks in the financial business code based on the target requirements document and generates an execution logic map; parses the financial business code with reference to the execution logic map to obtain all code blocks, and sets the distinguishing block names and execution logic distinguishing codes for all code blocks. By writing the distinguishing block names corresponding to all code blocks into the code execution configuration file in the form of a multi-operator, when calling the code block, Java reflection technology and Spring container are used to use the distinguishing block name as a reflection parameter to obtain the target code block. This allows the target code block to be freely obtained based on the same or similar code in different financial businesses, and also facilitates the reuse and rapid calling of the same or similar code.
[0140] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to achieve optimal results.
[0141] Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0142] In an embodiment of the present application, the method obtains completed financial business code; identifies the execution logic sequence of all code blocks in the financial business code based on the target requirements document to generate an execution logic map; and parses the financial business code with reference to the execution logic map to obtain all code blocks, and sets distinguishing block names and execution logic distinguishing codes for all code blocks. By writing the distinguishing block names corresponding to all code blocks into a code execution configuration file in the form of a multi-ary operator, Java reflection technology and a Spring container are used to use the distinguishing block names as reflection parameters to obtain the target code block when the code block is called. This allows for the free acquisition of target code blocks based on identical or similar codes in different financial businesses, and facilitates the reuse and rapid call of identical or similar codes.
[0143] Further references Figure 8 , as a response to the above Figure 2 In order to realize the method shown in FIG, the present application provides an embodiment of a code execution device. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0144] like Figure 8 As shown, the code execution device 800 of this embodiment includes: a code acquisition module 801, an execution logic identification module 802, a distinguishing block name setting module 803, a distinguishing encoding setting module 804, a writing execution configuration file module 805, a multi-operator parsing module 806, a code block reflection acquisition module 807, and a compilation and execution module 808. Among them:
[0145] The code acquisition module 801 is used to acquire the completed financial business code;
[0146] An execution logic identification module 802 is configured to identify the execution logic sequence of all code blocks in the financial business code based on a target requirement document, wherein the target requirement document includes the execution logic sequence of all code blocks in the financial business code, and generate an execution logic graph;
[0147] A distinguishing block name setting module 803 is used to parse the financial business code with reference to the execution logic map, obtain all the code blocks, and set distinguishing block names for all the code blocks;
[0148] A distinguishing code setting module 804 is configured to set the execution logic distinguishing codes of all the code blocks based on the execution logic graph;
[0149] The execution configuration file writing module 805 is used to distinguish the codes according to the execution logic, write the distinguishing block names into the code execution configuration file using a multi-ary operator, and obtain the written code execution configuration file;
[0150] A multi-operator parsing module 806 is used to parse all multi-operators in the code execution configuration file to obtain the distinguishing block names of all code blocks;
[0151] A code block reflection acquisition module 807 is configured to use Java reflection technology and Spring container, and in combination with the execution logic graph, sequentially acquire target code blocks distinguished by block names of all code blocks;
[0152] The compiling and executing module 808 is configured to compile and execute the financial service code according to the target code block and a preset compiling template.
[0153] This application obtains the completed financial business code; identifies the execution logic sequence of all code blocks in the financial business code based on the target requirements document and generates an execution logic map; parses the financial business code with reference to the execution logic map to obtain all code blocks, and sets the distinguishing block names and execution logic distinguishing codes for all code blocks. By writing the distinguishing block names corresponding to all code blocks into the code execution configuration file in the form of a multi-operator, when calling the code block, Java reflection technology and Spring container are used to use the distinguishing block name as a reflection parameter to obtain the target code block. This allows the target code block to be freely obtained based on the same or similar code in different financial businesses, and also facilitates the reuse and rapid calling of the same or similar code.
[0154] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing related hardware via computer-readable instructions. The computer-readable instructions can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes in the above-described method embodiments. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0155] It should be understood that although the steps in the flowcharts of the accompanying drawings are shown in sequence as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some of the steps in the flowcharts of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0156] To solve the above technical problems, the present application also provides a computer device. Figure 9 , Figure 9 This is a basic structural block diagram of the computer device in this embodiment.
[0157] The computer device 9 comprises a memory 9a, a processor 9b, and a network interface 9c, which are connected to each other through a system bus. It should be noted that only the computer device 9 with components 9a-9c is shown in the figure, but it should be understood that all the components shown are not required to be implemented, and more or fewer components can be alternatively implemented. Among them, those skilled in the art can understand that the computer device herein is a device capable of automatically performing numerical calculation and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0158] The computer device can be a desktop computer, a notebook computer, a palm computer, a cloud server, and the like. The computer device can interact with the user through a keyboard, a mouse, a remote controller, a touchpad, a voice control device, and the like.
[0159] The memory 9a comprises at least one type of readable storage medium, including a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the memory 9a can be an internal storage unit of the computer device 9, such as a hard disk or a memory of the computer device 9. In other embodiments, the memory 9a can also be an external storage device of the computer device 9, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, and the like. Of course, the memory 9a can also include both the internal storage unit and the external storage device of the computer device 9. In the present embodiment, the memory 9a is generally used to store an operating system and various application software installed in the computer device 9, such as computer readable instructions of a code execution method, and the like. In addition, the memory 9a can also be used to temporarily store various data that have been output or will be output.
[0160] In some embodiments, the processor 9b may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 9b is generally used to control the overall operation of the computer device 9. In this embodiment, the processor 9b is used to execute computer-readable instructions stored in the memory 9a or process data, such as computer-readable instructions for executing the code execution method.
[0161] The network interface 9c may include a wireless network interface or a wired network interface. The network interface 9c is generally used to establish a communication connection between the computer device 9 and other electronic devices.
[0162] The computer device proposed in this embodiment belongs to the field of financial technology and is used in scenarios where financial services are quickly generated. This application obtains the completed financial service code; identifies the execution logic order of all code blocks in the financial service code according to the target requirement document, and generates an execution logic map; parses the financial service code with reference to the execution logic map, obtains all code blocks, and sets the distinguishing block names and execution logic distinguishing codes of all code blocks. By writing the distinguishing block names corresponding to all code blocks into the code execution configuration file in the form of a multi-operator, when calling the code block, java reflection technology and Spring container are used, and the distinguishing block name is used as a reflection parameter to obtain the target code block, which can not only freely obtain the target code block according to the same or similar codes in different financial services, but also facilitate the reuse and quick calling of the same or similar codes.
[0163] The present application also provides another embodiment, namely, providing a computer-readable storage medium, wherein the computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions can be executed by a processor to enable the processor to perform the steps of the code execution method as described above.
[0164] The computer-readable storage medium proposed in this embodiment belongs to the field of financial technology and is used in scenarios where financial services are quickly generated. This application obtains the completed financial service code; identifies the execution logic order of all code blocks in the financial service code according to the target requirement document, and generates an execution logic map; parses the financial service code with reference to the execution logic map, obtains all code blocks, and sets the distinguishing block names and execution logic distinguishing codes of all code blocks. By writing the distinguishing block names corresponding to all code blocks into the code execution configuration file in the form of a multi-operator, when calling the code block, java reflection technology and Spring container are used, and the distinguishing block name is used as a reflection parameter to obtain the target code block, which can not only freely obtain the target code block according to the same or similar codes in different financial services, but also facilitate the reuse and quick calling of the same or similar codes.
[0165] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0166] Obviously, the embodiments described above are only some of the embodiments of the present application, rather than all of the embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application has been described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions described in the aforementioned specific embodiments, or to make equivalent replacements for some of the technical features therein. Any equivalent structure made using the contents of the present application specification and the accompanying drawings, directly or indirectly used in other related technical fields, is also within the scope of patent protection of the present application.
Claims
1. A code execution method, characterized in that: The steps include: Obtain the completed financial business code; Identifying the execution logic sequence of all code blocks in the financial business code according to the target requirement document and generating an execution logic graph, wherein the target requirement document contains the execution logic sequence of all code blocks in the financial business code, and the execution logic sequence includes the one-to-one correspondence between the execution method names of all code blocks and the calling relationship between the execution methods. Specifically, the step of identifying the execution logic sequence of all code blocks in the financial business code according to the target requirement document and generating the execution logic graph includes: Obtaining the execution method names corresponding to all code blocks through the target requirement document; Determining the execution logic among all code blocks according to the calling relationships among the various execution methods, wherein the calling relationships among the various execution methods include vertical calling relationships, loop calling relationships, and conditional calling relationships; Generate an execution logic graph based on the execution logic between all code blocks and the execution method names; The financial service code is parsed with reference to the execution logic graph, all the code blocks are obtained, and distinguishing block names of all the code blocks are set. The steps of parsing the financial service code with reference to the execution logic graph, obtaining all the code blocks, and setting distinguishing block names of all the code blocks specifically include: Based on the execution logic graph, obtain all the code blocks and the execution method names corresponding to all the code blocks; Setting the execution method name to the distinguishing block name; Setting execution logic distinction codes of all code blocks based on the execution logic graph; According to the execution logic distinguishing code, the distinguishing block name is written into the code execution configuration file in the form of a multi-element operator to obtain a written code execution configuration file; Parsing all polynomial operators in the code execution configuration file to obtain distinguishing block names of all code blocks; Using Java reflection technology and Spring container, and combining the execution logic map, sequentially obtain target code blocks with distinguishing block names of all code blocks; The financial service code is compiled and executed according to the target code block and the preset compilation template.
2. The code execution method according to claim 1, characterized in that: The step of setting the execution logic difference codes of all the code blocks based on the execution logic graph specifically includes: Identifying, through the execution logic graph, code blocks with vertical calling relationships, code blocks with circular calling relationships, and code blocks with conditional calling relationships among all the code blocks; For the code blocks having a vertical calling relationship, setting execution logic distinction coding between the code blocks using a preset first coding strategy according to the vertical calling relationship; For the code blocks having a circular calling relationship, according to the circular calling relationship, a preset second coding strategy is used to set execution logic difference coding between the code blocks; For the code blocks with conditional call relationships, a preset third encoding strategy is used to set execution logic difference encoding between the code blocks according to the conditional call relationships.
3. The code execution method according to claim 2, wherein: The step of writing the distinguishing block name into the code execution configuration file using a multi-element operator according to the execution logic distinguishing code to obtain the written code execution configuration file specifically includes: Based on the execution logic distinguishing code, the distinguishing block names corresponding to the code blocks with vertical calling relationships and the distinguishing block names corresponding to the code blocks with circular calling relationships are written into the code execution configuration file in the form of a multi-element operator; Based on the execution logic distinguishing code, writing the distinguishing block name corresponding to the code block with the conditional call relationship into the code execution configuration file; Until the number of multi-element operators written into the code execution configuration file reaches a stable value, a completed code execution configuration file is obtained.
4. The code execution method according to claim 3, characterized in that: The step of writing the distinguishing block names corresponding to the code blocks with vertical calling relationships and the distinguishing block names corresponding to the code blocks with circular calling relationships into the code execution configuration file in the form of a multi-element operator based on the execution logic distinguishing code specifically includes: Step 501, obtaining the distinguishing block names corresponding to the code blocks with vertical calling relationships and the distinguishing block names corresponding to the code blocks with circular calling relationships; Step 502 , arbitrarily selecting two target distinguishing block names from the distinguishing block names corresponding to the code blocks with vertical calling relationships and the distinguishing block names corresponding to the code blocks with circular calling relationships; Step 503: determining whether there is a direct calling relationship between the two target distinguishing block names according to the execution logic distinguishing code, wherein the direct calling relationship means that one target distinguishing block name is directly called by the other target distinguishing block name; Step 504: If there is no direct calling relationship between the two target distinguishing block names, continue to execute steps 502 to 503; Step 505: If there is a direct calling relationship between the two target distinguishing block names, the target distinguishing name to be called is used as the relationship expression to fill the field, the target distinguishing block name to be directly called is used as the first expression to fill the field, the NULL value is used as the second expression to fill the field, a ternary operator is constructed, and the ternary operator is written into the code execution configuration file.
5. The code execution method according to claim 3, wherein: The step of writing the distinguishing block names corresponding to the code blocks having the conditional call relationship into the code execution configuration file based on the execution logic distinguishing code specifically includes: Step 601, obtaining the distinguishing block name corresponding to the code block with the conditional call relationship; Step 602, randomly selecting M target distinguishing block names from the distinguishing block names corresponding to the code blocks having the conditional call relationship; Step 603: judging, based on the execution logic distinguishing code, whether the M target distinguishing block names satisfy a relationship in which M-1 target distinguishing block names are selected and called by the remaining target distinguishing block name; Step 604: If the M target distinguishing block names do not meet the relationship in which M-1 target distinguishing block names are selected and called by the remaining target distinguishing block name, then continue to execute steps 602 to 603; Step 605: If the M target distinguishing block names meet the relationship in which M-1 target distinguishing block names are selected and called by the remaining target distinguishing block name, the target distinguishing block name to be selected and called is used as the relational expression filling field, and the target distinguishing block name to be selected and called is used as the first expression filling field to the M-1 expression filling field respectively, a multi-element operator is generated, and the multi-element operator is written into the code execution configuration file, where M is a positive integer greater than 2.
6. The code execution method according to claim 1, wherein: The step of using Java reflection technology and Spring container, and combining the execution logic graph to sequentially obtain target code blocks with distinguished block names from all code blocks specifically includes: Determine the calling relationship between all code blocks in combination with the execution logic graph; According to the calling relationship between all the code blocks, Java reflection technology and Spring container are used to generate a reflection calling function with the distinguishing block names of all the code blocks as reflection parameters; Based on the reflection calling function, the code blocks corresponding to all distinguishing block names are sequentially obtained as the target code blocks; A target number of placeholders are reserved in the preset compilation template, and the target number of placeholders are used to fill the target code block. The preset compilation template includes a main function entry for program execution. The step of compiling and executing the financial business code according to the target code block and the preset compilation template specifically includes: Filling the target code blocks into the corresponding placeholders in the preset compilation template one by one to generate the financial business code to be compiled; Compiling the financial service code to be compiled to obtain compiled financial service code; According to the main function entry of the program execution, the compiled financial business code is executed.
7. A code execution device, characterized in that: The code execution device is used to implement the steps of the code execution method according to any one of claims 1 to 6, and the code execution device includes: The code acquisition module is used to obtain the completed financial business code; An execution logic identification module is configured to identify the execution logic sequence of all code blocks in the financial business code based on a target requirement document and generate an execution logic graph, wherein the target requirement document includes the execution logic sequence of all code blocks in the financial business code, and the execution logic sequence includes the one-to-one correspondence between the execution method names of all code blocks and the calling relationship between the execution methods. Specifically, the steps of identifying the execution logic sequence of all code blocks in the financial business code based on the target requirement document and generating the execution logic graph include: Obtaining the execution method names corresponding to all code blocks through the target requirement document; Determining the execution logic among all code blocks according to the calling relationships among the various execution methods, wherein the calling relationships among the various execution methods include vertical calling relationships, loop calling relationships, and conditional calling relationships; Generate an execution logic graph based on the execution logic between all code blocks and the execution method names; A distinguishing block name setting module is used to parse the financial business code with reference to the execution logic map, obtain all the code blocks, and set the distinguishing block names of all the code blocks. The steps of parsing the financial business code with reference to the execution logic map, obtaining all the code blocks, and setting the distinguishing block names of all the code blocks specifically include: Based on the execution logic graph, obtain all the code blocks and the execution method names corresponding to all the code blocks; Setting the execution method name to the distinguishing block name; A distinguishing code setting module, configured to set the execution logic distinguishing codes of all the code blocks based on the execution logic graph; A write execution configuration file module is used to distinguish codes according to the execution logic, write the distinguishing block names into the code execution configuration file in the form of a multi-ary operator, and obtain a written code execution configuration file; A multi-operator parsing module, configured to parse all multi-operators in the code execution configuration file to obtain distinguishing block names of all code blocks; A code block reflection acquisition module is used to use Java reflection technology and Spring container, and in combination with the execution logic graph, sequentially acquire target code blocks with distinguishing block names of all code blocks; The compiling and executing module is used to compile and execute the financial service code according to the target code block and a preset compiling template.
8. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores computer-readable instructions, and when the processor executes the computer-readable instructions, the steps of the code execution method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the code execution method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Code relationship generation method and device, electronic device and storage medium
CN110333898A
Script file generation method and device, computer equipment and storage medium
CN115756581A