An Online Design and Implementation Method for Calculation Formulas Based on Antlr
Through the online design method based on ANTLR, the problems of long development cycle and poor reusability of calculation formulas in financial risk control systems are solved, and efficient and low-coupled calculation formula design is realized, supporting multi-scenario use and real-time configuration, improving the processing efficiency of software business.
Patent Information
- Application Number
- CN202211232181.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-08
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2042-10-08
AI Technical Summary
The calculation formula development cycle in the financial risk control system is long, and cannot be modified and used immediately, with high development and maintenance costs, single use scenarios without reusability, dynamic configuration, and high coupling, resulting in low software business processing efficiency.
The online design method of calculation formulas based on ANTLR is adopted, and lexical rules are generated through the SSM architecture and the ANTLR framework, business classes are written and customized listeners are implemented. Combined with front-end pages and workflow audits, the online design and cache of calculation formulas is realized, and multi-angle error monitoring and data permission isolation are supported.
It realizes high reusability and low coupling of calculation formulas, reduces the cost of development and online time, supports multiple scenarios, improves software business processing efficiency, and ensures the accuracy and real-timeness of calculation formulas.
Smart Images

Figure CN115525261B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the application field of risk control technology of financial companies, and is an Antlr-based online design and implementation method for calculation formulas. Background Art
[0002] The engine, the central brain of financial risk control, contains node configurations for various rules, strategies, models, and third-party services. When configuring and running the activiti decision flow, it is necessary to calculate the return results of each node so that the engine can determine the specific execution process of the decision flow. In the past, the common development model was that when there was a new way to calculate the results, it was necessary to propose requirements to the risk control developers. After the development and testing were completed, the version was released online. Only then could the strategy personnel use the calculation formula, and it was bound to the usage scenario, with a very high degree of coupling. A new set of calculation formulas had to be developed for new scenarios. With the development of the company, the addition and iteration of business scenarios, this method exposed the following shortcomings: it takes a long time from the entire requirement to the launch; it requires an increase in human development costs; it is impossible to achieve real-time, ready-to-use; the calculation formula is not reusable, cannot be dynamically configured, and has a single applicable scenario;
[0003] Therefore, a new calculation formula development method is urgently needed to solve the above problems, achieve dynamic configuration, and improve software business processing efficiency in a highly reusable and low-coupling manner. Summary of the invention
[0004] The purpose of the present invention is to solve the following problems: the calculation formula development and launch cycle are long; it is not possible to use it immediately after modification; the development and maintenance costs are high; the usage scenario is single and has no reusability.
[0005] To solve the above problems, the present invention adopts the following technical solutions:
[0006] An online design and implementation method for a calculation formula based on Antlr comprises the following steps:
[0007] Step 1: Create a new Java microservice project, adopt the SSM architecture, implement containerized management of business objects through Spring, and use Mybatis as the persistence engine for data objects;
[0008] Step 2. Write the g4 file of the ANTLR framework in the Java microservice project, write the lexical rules and grammar rules in the g4 file, and use the ANTLR built-in code generation command to compile the g4 file into the basic java template code. The template code generates empty code for the key defined by the lexical rules and grammar rules; the template code includes: visitor abstract class, grammar error listener, lexical error listener, lexical parser, grammar parser
[0009] Step 3: Write methods and attributes in the visitor abstract class compiled and generated in Step 2 for business class reuse. Write a custom lexical error listener and a syntax error listener to reuse the template code of the two listeners compiled and generated in Step 2, and specifically implement it in Java by inheritance to implement the specific logic of the empty code in Step 2;
[0010] Step 4: Store the field types, function names, logical operators, and arithmetic operators defined in the lexical rules in the database, and isolate data permissions;
[0011] Step 5: Display the basic information stored in Step 4 on the controls of the front-end page, and input calculation formulas through the controls of the front-end page; Step 6: Test the calculation formulas input in Step 5. Only after passing the test can they be submitted and saved, and an audit task is submitted;
[0012] Step 7: In the workflow audit link, audit the audit task submitted in Step 6. After the audit is completed, only the roles with permissions can use the corresponding calculation formulas;
[0013] Step 8: Cache the calculation formulas that have passed the audit in Redis;
[0014] Step 9: The front end calls the interface to obtain the Redis cache information of the user role and obtain the calculation formula.
[0015] In the above technical solution, Step 2 includes the following steps:
[0016] Step 2.1: Create a new text file named with the suffix g4;
[0017] Step 2.2: Write lexical rules in the text file: Each rule is in the form of key: value, starting with an uppercase letter and used for lexical analysis. Step 2.2 is specifically as follows:
[0018] Step 2.2.1: Write the code for identifying the field type of the calculation formula input variable, such as: LONG, DOUBLE, STRING, BOOLEAN, DATE, and define the identification mark '@' for the field header;
[0019] Step 2.2.2: Write basic functions: the function names of set processing functions, string processing functions, date processing functions, SUM, AVG, MEDIAN, MIN, MAX, and define the identification mark '$' for basic functions.
[0020] Step 2.2.3: Write the names of business processing functions. The business processing functions are equivalent to encapsulated calculation formula operators, which are highly reusable implementations, and define the identification mark '#' for business processing functions.
[0021] Step 2.2.4: Write basic logical operator codes: 'AND', 'OR', 'IF', 'ELSE'; write Chinese pseudocode in an easy-to-understand way for business personnel on the page: "and, or, and, if...then, if...then...else";
[0022] Step 2.2.5: Write arithmetic operators using basic +, -, *, / , %, ^, power operations (3^2), !;
[0023] Step 2.2.6: Define the hidden channel for comment text. Comments can be set during page configuration.
[0024] Step 2.3: Write grammar rules in a text file: Each rule is in the form of key:value, starts with a lowercase letter, is used for grammar analysis, starts with:; ends with |, and separates multiple rules;
[0025] Step 2.3.1: Write regular expressions to identify the types of input variables in step 2.2.2, including numeric expressions, string expressions, Boolean expressions, time expressions, and nested combination expressions of various fields;
[0026] Step 2.3.2: Write a regular expression to identify the names of the basic functions in step 2.2.3.
[0027] Step 2.3.3: Write regular expressions for the logical operators in step 2.2.5 and the arithmetic operators in step 2.2.6;
[0028] Step 2.3.4: Write various combinations of nested expressions of input variables + logical operators + arithmetic operators + basic functions;
[0029] Step 2.4: Use ANTLR's own code generation command to compile the g4 file after writing the lexical rules and grammar rules into the following template codes: visitor abstract class, grammar error listener, lexical error listener, lexical parser, grammar parser, etc. These template codes generate empty codes for the keys defined by the lexical rules and grammar rules, without specific implementation logic.
[0030] In the above technical solution, step 3 includes the following steps:
[0031] Step 3.1: Write methods and attributes in the visitor abstract class compiled and generated in Step 2.4 in the business class, which is specifically implemented by inheritance in Java. Write the business logic of the basic functions in this business class, such as string disassembling, summing of decimals and integers, implementation of maximum and minimum values; identification of input variable types, replacement of logical operator pseudocode, operation logic of arithmetic operators. When the calculation formula code is actually parsed and run, it will call the business code defined here according to the key defined in the lexicon.
[0032] Step 3.2: Write a custom lexical error listener and a syntax error listener to reuse the two listener template codes compiled and generated in Step 2.4, which is specifically implemented by inheritance in Java. When the program actually runs, the lexical parser and syntax parser generated in Step 2 will split the input calculation formula into a syntax tree. The lexical and syntax keys defined in Step 2 both belong to the nodes of the syntax tree. Listen to the lexical node object through the custom lexical error listener, and listen to the syntax node object through the custom syntax error listener. If a specific event occurs on this object, such as: matching this node, ending this node, regular expression mismatch, calculation error, syntax error, then execute the corresponding error message in the custom listener.
[0033] In the above technical solution, Step 4 includes the following steps:
[0034] Step 4.1: Maintain the arithmetic operators, logical operators, and basic function information defined in Step 2.2 in the MySql table. Here, the table fields are designed with role fields to achieve data permission isolation for different roles;
[0035] Step 4.2: Write the initialization code for the Java microservice project, and listen to the container initialization event of the spring framework through the method provided by the Spring framework. When the Java microservice project starts, automatically query the basic information of the corresponding role permissions and initialize it into the redis cluster to optimize the page access efficiency.
[0036] In the above technical solution, Step 5 includes the following steps:
[0037] Step 5.1: Display the basic functions, arithmetic operators, and logical operators stored in Step 4 on the controls of the front-end page. Maintain a mapping table of code - Chinese pseudocode in mySql, and display it in the form of pseudocode on the page for the convenience of business personnel to use;
[0038] Step 5.2: The controls support dragging, clicking, dropdown box selection, automatic completion of text input, and highlighting effects to assist business personnel in combining and defining a new calculation formula.
[0039] In the above technical solution, Step 6 includes the following steps:
[0040] Step 6.1: Add a test button. When the test button is clicked, first verify the correctness of the calculation formula expression. If the verification fails, highlight the corresponding incorrect pseudo-code block and prompt the corresponding error message. If it passes, dynamically construct the corresponding input variable dialog box, enter the corresponding variable values, and click the test. It can only be submitted and saved after passing the test;
[0041] Step 6.2: The saved calculation formula data will be stored in the mySql database and become a custom function, with the corresponding status being temporarily stored;
[0042] Step 6.3: The page supports batch selection and submission. When submitting, attach a text area to write the function description and the reason for submission. After submission, the corresponding status is pending review.
[0043] In the above technical solution, step 7 includes the following steps:
[0044] 7.1: The review and submission use the activiti workflow to complete the approval process;
[0045] 7.2: After the review is completed, configure the usage permissions for the corresponding roles. Only the roles with permissions can use the corresponding calculation formula.
[0046] In the above technical solution, step 8 includes the following steps:
[0047] Step 8.1: After the review passes, modify the corresponding mysql field status to "reviewed";
[0048] Step 8.2: To ensure the consistency of concurrent data, use the Canal microservice to monitor the binary log file of the Mysql master-slave replication, parse the log, and synchronize it to redis for incremental, deletion, and modification synchronization updates.
[0049] Because the present invention adopts the above technical solution, it has the following beneficial effects:
[0050] 1. It saves the time and cost of requirement communication, development, and release.
[0051] 2. Replace Java code editing with Chinese pseudo-code, allowing those who understand the business better to write business code.
[0052] 3. Data permission isolation provides a set of data for the corresponding role, enabling efficient configuration and use.
[0053] 4. The custom function design with high reusability and low coupling degree is suitable for multiple scenarios.
[0054] 5. Online development and real-time use truly realize the empowerment of work with technology.
[0055] 6. Use multi-angle error monitoring to remind users of pseudo code editing errors in real time, allowing users to get started quickly.
[0056] 7. Use Canal microservice monitoring to ensure that each calculation result is the most accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 This is a comparison chart between the traditional development model and the development model of this application;
[0058] Figure 2 This is the SSM system architecture diagram;
[0059] Figure 3 Operational flow chart for calculation formula;
[0060] Figure 4 Create / update flowcharts for calculation formulas. DETAILED DESCRIPTION
[0061] The following is a detailed description of the embodiments of the present invention. Although the present invention will be described and illustrated in conjunction with some specific embodiments, it should be noted that the present invention is not limited to these embodiments. On the contrary, modifications or equivalent substitutions made to the present invention should all be included in the scope of the claims of the present invention.
[0062] In addition, in order to better illustrate the present invention, numerous specific details are given in the following specific embodiments. It will be understood by those skilled in the art that the present invention can also be implemented without these specific details.
[0063] 1: Create a new Java microservice project, using the SSM architecture. The SSM framework is an integration of SpringMVC, Spring and Mybatis frameworks, and is a standard MVC model. It divides the entire system into four layers: View layer, Controller layer, Service layer, and DAO layer. Spring MVC is used to forward requests and manage views, and Spring is used to implement containerized management of business objects. Mybatis is used as a persistence engine for data objects. 2: Write the g4 file of the ANTLR framework under the Java microservice project, write lexical rules and grammar rules in the g4 file, and use the ANTLR built-in code generation command to compile the g4 file into the basic java template code, generating empty code for the key defined by the lexical rules and grammar rules; the template code includes: visitor abstract class, grammar error listener, lexical error listener, lexical parser, and grammar parser.
[0064] The following steps are involved:
[0065] Step 2.1: Create a new text file and name it with the suffix g4;
[0066] Step 2.2: Write lexical rules in a text file: Each rule is in the form of key: value, starting with an uppercase letter and used for lexical analysis;
[0067] Step 2.2.1: Write the identification codes for the input variable field types of calculation formulas, such as: LONG, DOUBLE, STRING, BOOLEAN, DATE. Define the identification mark '@' for the field header;
[0068] Step 2.2.2: Write basic functions, such as: set processing functions, string processing functions, date processing functions, and the function names of SUM, AVG, MEDIAN, MIN, MAX. Define the identification mark '$' for basic functions;
[0069] Step 2.2.3: Write the names of business processing functions. Business processing functions are equivalent to encapsulated calculation formula operators, which are highly reusable implementations. Define the identification mark '#' for business processing functions;
[0070] Step 2.2.4: Write the codes for basic logical operators, such as 'AND', 'OR', 'IF', 'ELSE', etc. Display them to business personnel on the page in an easy-to-understand way, such as writing Chinese-style pseudo-code as:
AND, OR, AND, If.... Then, If... Then... Else
[0071] Step 2.2.5: Write arithmetic operators using basic +, -, *, / , %, ^ (exponentiation) power operations (3^2),!, continuous multiplication (3! = 3 * 2 * 1 = 6);
[0072] Step 2.2.6: Define a hidden channel for comment text to support comment setting during page configuration;
[0073] Step 2.3: Write syntax rules in a text file: Each rule is in the form of key: value, starting with a lowercase letter and used for syntax analysis. Start with ':'; end with it, and use '|' to separate multiple rules;
[0074] Step 2.3.1: Write regular expressions for identifying various input variable types in Step 2.2.2, including numeric expressions, string expressions, boolean expressions, time expressions, and nested combination expressions of various fields, etc.;
[0075] Step 2.3.2: Write regular expressions for identifying each function name of the basic functions in Step 2.2.3;
[0076] Step 2.3.3: Write regular expressions for the logical operators in Step 2.2.5 and the arithmetic operators in Step 2.2.6;
[0077] Step 2.3.4: Write various combinations of nested expressions of input variables + logical operators + arithmetic operators + basic functions;
[0078] Step 2.4: Use the code generation command that comes with ANTLR to compile the g4 file after writing the lexical rules and grammar rules into the following template codes: visitor abstract class, grammar error listener, lexical error listener, lexical parser, grammar parser, etc. These template codes generate empty codes for the keys defined by the lexical rules and grammar rules in step 2, without specific implementation logic;
[0079] 3. Write code to implement the specific logic of the empty code generated in step 2.4.
[0080] Step 3.1: Write a business class to reuse the methods and properties in the visitor abstract class compiled and generated in step 2. In Java, it is implemented by inheritance. In this business class, write the business logic of basic functions: such as string decomposition, sum of decimals and integers, maximum and minimum value implementation, etc.; input variable type recognition; pseudo code replacement of logical operators; arithmetic operator operation logic, etc. When the calculation formula code is actually parsed and run, the business code defined here will be called according to the key defined in the lexical method;
[0081] Step 3.2: Write a custom lexical error listener and a grammatical error listener to reuse the two listener template codes compiled and generated in step 2.4, and implement them in Java using inheritance. When the program is actually running, the lexical parser and grammatical parser generated in step 2 will split the input calculation formula into a grammar tree. The lexical and grammatical keys defined in step 2 belong to the nodes of the grammar tree. The lexical node objects are listened to through the custom lexical error listener, and the grammar node objects are listened to through the custom grammar error listener. If a specific event occurs on the object, such as: matching the node, ending the node, regular expression mismatch, calculation error, grammar error, etc., the corresponding error message in the custom listener will be executed;
[0082] 4: The field types, function names, logical operators, and arithmetic operators defined in the lexical rules are stored in the database to isolate data permissions.
[0083] Step 4.1: Maintain the arithmetic operators, logical operators, and basic function information defined in step 2 into the MySql table. The table field here is designed with a role field to isolate data permissions for different roles.
[0084] Step 4.2: Write the initialization code for the Java microservice project. Listen for the Spring container initialization event through the methods provided by the Spring framework. When the Java microservice project starts, automatically query the basic information of the corresponding role permissions and initialize it into the redis cluster to optimize the page access efficiency;
[0085] 5: Front-end component display.
[0086] Step 5.1: Display the basic functions, arithmetic operators, and logical operators stored in the database in Step 4 on the controls of the front-end page. Maintain a mapping table of code-Chinese pseudocode in mySql and display it on the page in the form of pseudocode for the convenience of business personnel;
[0087] Step 5.2: The controls support drag-and-drop, click, dropdown selection, text input auto-completion, and highlighting effects to assist business personnel in combining and defining a new calculation formula;
[0088] 6: Online real-time testing.
[0089] Step 6.1: Add a test button. When the test button is clicked, first verify the correctness of the calculation formula expression. If the verification fails, highlight the corresponding incorrect pseudocode block and prompt the corresponding error message. If it passes, dynamically construct the corresponding input variable pop-up box, enter the corresponding variable value, and click the test button. It can only be submitted and saved after passing the test;
[0090] Step 6.2: The calculation formula data after saving will be stored in the mySql database and become a custom function with the corresponding status of "temporarily saved";
[0091] Step 6.3: The page supports batch check and submission. When submitting, attach a text area to write the function description and submission reason. The corresponding status after submission is "pending review";
[0092] 7: Add a workflow review link to prevent incorrect online deployment.
[0093] 7.1: The review submission uses the activiti workflow to complete the approval process;
[0094] 7.2: After the review is completed, configure the usage permissions for the corresponding roles. Only the roles with permissions can use the corresponding calculation formula;
[0095] 8: Synchronize cache data.
[0096] Step 8.1: After the review is passed, modify the corresponding mysql field status to "reviewed";
[0097] Step 8.2: To ensure the consistency of concurrent data, the Canal microservice is used to monitor the binary log file of MySQL master-slave replication, parse the log, and synchronize it to Redis for incremental, deletion, and modification synchronization updates;
[0098] 9: Front-end interface query.
[0099] Step 9.1: The front-end invokes the interface to obtain the Redis cache information of the user role for the decision-making page to use calculation formulas, achieving the principle of efficient use and reuse.
Claims
1. An online design and implementation method for calculation formulas based on Antlr, characterized in that, The following steps are involved: Step 1: Create a new Java microservice project, adopt the SSM architecture, implement containerized management of business objects through Spring, and use Mybatis as the persistence engine for data objects; Step 2: Write the g4 file of the ANTLR framework in the Java microservice project, write the lexical rules and grammatical rules in the g4 file, and use the ANTLR built-in code generation command to compile the g4 file into the basic java template code. The template code generates empty code for the key defined by the lexical rules and grammatical rules; The template code includes: visitor abstract class, syntax error listener, lexical error listener, lexical parser, syntax parser; Step 3: Write a business class to reuse the methods and properties in the visitor abstract class compiled in step 2, write a custom lexical error listener and a syntax error listener to reuse the two listener template codes compiled in step 2, and use inheritance to implement the specific logic of the empty code in step 2 in Java; Step 4: Store the field types, function names, logical operators, and arithmetic operators defined in the lexical rules into the database, and isolate data permissions; Step 5: Display the basic information entered in step 4 on the controls of the front-end page, and enter the calculation formula through the controls of the front-end page; Step 6: Test the calculation formula entered in step 5. Only after the test passes can it be submitted for saving and the review task is submitted; Step 7: The workflow review phase reviews the review tasks submitted in step 6. After the review is completed, only the authorized roles can use the corresponding calculation formula; Step 8: Cache the approved calculation formula in redis; Step 9. The front-end calls the interface to obtain the user's role redis cache information and obtain the calculation formula.
2. The method for online design and implementation of a calculation formula based on Antlr according to claim 1, characterized in that Step 2 includes the following steps: Step 2.1: Create a new text file and name it with the suffix g4; Step 2.2: Write lexical rules in a text file: Each rule is in the form of key:value, starts with an uppercase letter, and is used for lexical analysis. Step 2.2 is as follows: Step 2.2.1: Write the calculation formula and input the variable field type identification code such as: LONG, DOUBLE, STRING, BOOLEAN, DATE, and define the identification mark '@' of the field header; Step 2.2.2: Write basic functions: set processing function, string processing function, date processing function, SUM, AVG, MEDIAN, MIN, MAX function names, define the identification mark '$' of the basic function; Step 2.2.3: Write the name of the business processing function. The business processing function is equivalent to the encapsulated calculation formula operator, which is a highly reusable implementation. Define the business processing function identification mark '#'; Step 2.2.4: Write basic logical operator codes: 'AND', 'OR', 'IF', 'ELSE'; write Chinese pseudocode in an easy-to-understand way for business personnel on the page: "and, or, and, if...then, if...then...else"; Step 2.2.5: Write arithmetic operators using basic +, –, *, / , %, ^, power operations (3^2), !; Step 2.2.6: Define the hidden channel of the comment text. Comments can be set when supporting page configuration; Step 2.3: Write grammar rules in a text file: Each rule is in the form of key:value, starts with a lowercase letter, is used for grammar analysis, starts with:; ends with |, and multiple rules are separated; Step 2.3.1: Write regular expressions to identify the types of input variables in step 2.2.2, including numeric expressions, string expressions, Boolean expressions, time expressions, and nested combination expressions of various fields; Step 2.3.2: Write a regular expression to identify the names of the basic functions in step 2.2.
3. Step 2.3.3: Write regular expressions for the logical operators in step 2.2.5 and the arithmetic operators in step 2.2.6; Step 2.3.4: Write various combinations of nested expressions of input variables + logical operators + arithmetic operators + basic functions; Step 2.4: Use ANTLR's own code generation command to compile the g4 file after writing the lexical rules and grammar rules into the following: visitor abstract class, grammar error listener, lexical error listener, lexical parser, grammar parser template code. These template codes generate empty codes for the keys defined by the lexical rules and grammar rules, without specific implementation logic.
3. The method for online design and implementation of a calculation formula based on Antlr according to claim 2, wherein Step 3 includes the following steps: Step 3.1: Write a business class to reuse the methods and properties in the visitor abstract class compiled and generated in step 2.
4. In Java, use inheritance to implement it. Write the business logic of basic functions in this business class: such as string decomposition, sum of decimals and integers, and implementation of maximum and minimum values; identification of input variable types, pseudo-code replacement of logical operators, and operation logic of arithmetic operators. When the calculation formula code is actually parsed and run, the business code defined here will be called according to the key defined in the lexical method; Step 3.2: Write custom lexical error listeners and syntax error listeners to reuse the two listener template codes compiled and generated in step 2.
4. In Java, inheritance is used to implement them. When the program is actually running, the lexical parser and syntax parser generated in step 2 will split the input calculation formula into a syntax tree. The lexical and syntax keys defined in step 2 belong to the nodes of the syntax tree. The lexical node objects are listened to through the custom lexical error listener, and the syntax node objects are listened to through the custom syntax error listener. If specific events occur on the object, such as matching the node, ending the node, regular expression mismatch, calculation error, syntax error, the corresponding error information in the custom listener is executed.
4. The online design and implementation method of a calculation formula based on Antlr according to claim 3, characterized in that Step 4 includes the following steps: Step 4.1: Maintain the arithmetic operators, logical operators, and basic function information defined in step 2.2 into the MySql table. The table field here is designed with a role field to isolate data permissions for different roles. Step 4.2: Write the initialization code for the Java microservice project. By using the method provided by the Spring framework, listen for the container initialization event of the Spring framework. When the Java microservice project starts, automatically query the basic information of the corresponding role permissions, initialize it into the redis cluster, and optimize the page access efficiency.
5. The online design and implementation method of a calculation formula based on Antlr according to claim 1, characterized in that Step 5 includes the following steps: Step 5.1: Display the basic functions, arithmetic operators, and logical operators stored in Step 4 on the controls of the front-end page. Maintain a mapping table of code - Chinese pseudocode in mySql, and display the page in the form of pseudocode for the convenience of business personnel to use; Step 5.2: The controls support drag-and-drop, click, dropdown selection, text input auto-completion, and highlighting effects to assist business personnel in combining and defining a new calculation formula.
6. The online design and implementation method of a calculation formula based on Antlr according to claim 1, wherein, Step 6 includes the following steps: Step 6.1: Add a test button. When the test button is clicked, first verify the correctness of the calculation formula expression. If the verification fails, highlight the corresponding incorrect pseudocode block and prompt the corresponding error message. If it passes, dynamically construct the corresponding input variable pop-up box, enter the corresponding variable values, and click the test. Only after the test passes can it be submitted and saved; Step 6.2: The saved calculation formula data will be stored in the mySql database and become a custom function, with the corresponding status being temporarily stored; Step 6.3: The page supports batch selection and submission. When submitting, attach a text area to write the function description and the reason for submission. After submission, the corresponding status is pending review.
7. The online design and implementation method of a calculation formula based on Antlr according to claim 1, characterized in that, Step 7 includes the following steps: Step 7.1: The review and submission adopt the activiti workflow method to complete the approval process; Step 7.2: After the review is completed, configure the usage permissions for the corresponding roles. Only the roles with permissions can use the corresponding calculation formula.
8. The method for online design and implementation of a calculation formula based on Antlr according to claim 1, characterized in that Step 8 includes the following steps: Step 8.1: After the review is passed, modify the corresponding mysql field status to "reviewed"; Step 8.2: To ensure the consistency of concurrent data, use the Canal microservice to listen to the binary log file of the Mysql master-slave replication, parse the log, and synchronize it to redis for incremental, deletion, and modification synchronization updates.
Citation Information
Patent Citations
Method for automatically synthesizing commonly-used cyclic abstracts and generating program specifications
CN106681786A
Method and script engine for realizing service function
CN110908640A