CN114115872A - Method and device for realizing service expression generation and analysis tool - Google Patents

Method and device for realizing service expression generation and analysis tool Download PDF

Info

Publication number
CN114115872A
CN114115872A CN202111324511.5A CN202111324511A CN114115872A CN 114115872 A CN114115872 A CN 114115872A CN 202111324511 A CN202111324511 A CN 202111324511A CN 114115872 A CN114115872 A CN 114115872A
Authority
CN
China
Prior art keywords
expression
business
variable
service
analyzing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111324511.5A
Other languages
Chinese (zh)
Inventor
刘家舒
门合建
陈翔
赵爽
黄凯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tianjin Health Care Big Data Co ltd
Original Assignee
Tianjin Health Care Big Data Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tianjin Health Care Big Data Co ltd filed Critical Tianjin Health Care Big Data Co ltd
Priority to CN202111324511.5A priority Critical patent/CN114115872A/en
Publication of CN114115872A publication Critical patent/CN114115872A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Stored Programmes (AREA)

Abstract

The invention relates to the application field of software systems, and particularly provides a method for realizing a service expression generation and analysis tool, which comprises the steps of firstly, inputting and generating a service expression, storing the generated expression in a database, and using the expression for next-step calling and analysis; then providing a corresponding interface, allowing an expression needing to be operated to be selected in a front-end page, and analyzing by using GroovyShell in the implementation of a background Java code; and finally, obtaining the final result of the expression. Compared with the prior art, the method and the device for inputting the business expression are used for inputting the expression based on the visual page in the business expression generating process, and are concise and easy to operate. And providing a front-end interface for analyzing the service expression, and selecting the corresponding expression for analyzing and calculating. The method provides integrated integration of input and analysis of the business expression, realizes the association of the front end and the back end, and encapsulates a perfect interface for quick and batch operation.

Description

Method and device for realizing service expression generation and analysis tool
Technical Field
The invention relates to the field of software system application, and particularly provides a method and a device for realizing a service expression generation and analysis tool.
Background
In many information systems, there is a service scenario in which a textual service expression or a service object having basic logic and conditional branch conditions is converted into an operational expression that can be run using a script, and the expression is automatically parsed to obtain a result after computation. The specific service requirements can be realized by writing corresponding codes, but when the service requirements are complicated and changeable and the number of text expressions to be analyzed is large, a set of configurable and sharable text expression conversion tools is needed, and the targeted coding condition is improved for different services and different requirements.
In system application, some common expression engine calculation schemes, such as a Java script engine Java, are consistent in grammar and Java, and are not strong in expansibility, and the performance of both interpretation execution and compiling execution is poor in the aspect of running efficiency. The other expression analysis engine type is very lightweight, greatly simplifies the grammar, removes functions such as variable declaration and exception handling, and only supports simple mathematical formula operation and object method member variable calling, such as a Fel expression engine and a simplelel expression engine. The performance of the engine is high, but the grammar is single, and the engine cannot support all aspects in use.
Disclosure of Invention
Aiming at the defects of the prior art, the invention provides a method for realizing a service expression generation and analysis tool with strong practicability.
The technical scheme adopted by the invention for solving the technical problems is as follows:
a business expression generation and implementation method of analyzing the tool, record and produce the business expression at first, the expression produced is kept in the database, for the next step is called and analyzed and used; then providing a corresponding interface, allowing an expression needing to be operated to be selected in a front-end page, and analyzing by using GroovyShell in the implementation of a background Java code; and finally, obtaining the final result of the expression.
Further, the method comprises the following steps:
s1, realizing a visual page and supporting the input of business logic;
and S2, extracting the converted expression Json character string, and calculating a final result.
Further, in step S1, the front end uses Vue framework, and enters a panel by means of element components, the panel is provided with various pull-down selection boxes, and the pull-down selection box selects corresponding service parameters, and the selected service parameters are used as service variables used in the expression.
Preferably, the service parameters include arithmetic operators, relational operators and logical operators.
Furthermore, the left side of the panel is an expression display area which displays the currently input expression character string, and the right side clicks the symbol or variable selected by the mouse to be added to the input expression character string.
Furthermore, when the left character is clicked, the cursor is positioned to one side of the clicked character for displaying, and the character identified by the current cursor can be deleted by the aid of the button supporting the backspacing operation.
Furthermore, the input expression information is put into multiple groups of types to generate Json character strings, and the Json character strings are stored in corresponding fields of a background database and are used for background calling to analyze and calculate.
Further, in step S2, first, a character string entered at the front end is taken out from the database, the character string is traversed, and if the type is a variable related to the service, a corresponding variable name is obtained according to the stored variable primary key, and is replaced, and finally, an expression with a variable, which can be used for groovy shell execution, is obtained.
Further, the variables needed for analyzing the expression are stored in a Map key-value pair list, where the key is the name of the service variable that has been replaced in the previous operation S1, and the value is the value of the service variable corresponding to the name of the variable.
Further, the expression and the Map list are used as parameters, Binding object input parameters provided by Groovy are used, Groovy shell is called to analyze, and the final expression calculation result is returned.
An apparatus for implementing a business expression generation and analysis tool, comprising: at least one memory and at least one processor;
the at least one memory to store a machine readable program;
the at least one processor is configured to invoke the machine readable program to perform the method of implementation of the business expression generation and parsing tool.
Compared with the prior art, the implementation method of the business expression generation and analysis tool has the following outstanding beneficial effects:
the invention is simple and easy to operate by inputting the expression based on the visual page in the service expression generating process. And providing a front-end interface for analyzing the service expression, and selecting the corresponding expression for analyzing and calculating. The method provides integrated integration of input and analysis of the business expression, realizes the association of the front end and the back end, and encapsulates a perfect interface for quick and batch operation.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a flow diagram of a method for implementing a business expression generation and analysis tool.
Detailed Description
The present invention will be described in further detail with reference to specific embodiments in order to better understand the technical solutions of the present invention. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
A preferred embodiment is given below:
as shown in fig. 1, firstly, a service expression is input and generated, and the generated expression is stored in a database for being used in the next step of calling and analyzing; then providing a corresponding interface, allowing an expression needing to be operated to be selected in a front-end page, and analyzing by using GroovyShell in the implementation of a background Java code; and finally, obtaining the final result of the expression.
The method specifically comprises the following steps:
s1, realizing a visual page, and supporting the entry of business logic:
the front end implements an entry panel via the element components using an Vue framework. The panel provides various pull-down selection frames, and corresponding service parameters can be selected in a pull-down mode to serve as service variables used in the expression. Arithmetic operators, such as addition, subtraction, multiplication, division and remainder operations, are also provided; relational operators such as "═ or" > = ", and the like; logical operators such as buttons of "& &", "|".
And an expression display area is realized on the left side of the panel, and the currently input expression character string is displayed. The right-side click mouse selected symbol or variable is appended to the string. When a character on the left side is clicked, the cursor is positioned to one side of the character to be displayed.
The button that supports the rollback operation may be implemented to delete the character identified by the current cursor. Besides, buttons such as enter and retract are supported, so that the expression format displayed on the left panel can be more attractive.
When the character string is recorded, marking is carried out according to different types of the recorded characters. For example, the definition variable uses "variable" as a tag name of a character, "operator" as a tag name of an operator, "number" as a tag name of a numeric value, and the like. And putting the input expression information into multiple groups of types to generate a Json character string, storing the Json character string in a corresponding field of a background database, and analyzing and calculating the Json character string by background calling.
S2, extracting the converted expression Json character string, and calculating a final result:
firstly, taking out a character string input at the front end from a database, traversing the character string, if the type is a variable related to a service, obtaining a corresponding variable name according to a stored variable primary key, replacing the variable name, and finally obtaining an expression with the variable, wherein the expression can be used for executing GroovyShell.
And storing variables required by analyzing the expression into a Map key value pair list, wherein the key is the name of the service variable which is replaced in the previous step, and the value is the value of the service variable corresponding to the name of the variable.
And taking the expression and the Map list as parameters, using Binding object input parameters provided by Groovy, calling Groovy Shell to analyze, and returning a final expression calculation result.
The method can provide the Groovy script language which is required by the script function, can support a large amount of Java grammar and can be combined with Java for programming. Groovy is an agile dynamic language for Java virtual machines that can be used as a pure scripting language, in essentially the same way as Java code, and is suitable for use with Spring's dynamic language support, sufficiently supporting Java integration.
The Groovy has multiple using methods, the Groovy script can be executed by using Groovy shell in the project, the Groovy script is a command line application program, can bind data and read and analyze a Groovy expression, and is very suitable for expression analysis in a Java project.
The invention is simple and easy to operate by inputting the expression based on the visual page in the service expression generating process. And providing a front-end interface for analyzing the service expression, and selecting the corresponding expression for analyzing and calculating. The method provides integrated integration of input and analysis of the business expression, realizes the association of the front end and the back end, and encapsulates a perfect interface for quick and batch operation.
An apparatus for implementing a business expression generation and analysis tool, comprising: at least one memory and at least one processor;
at least one memory for storing a machine readable program;
at least one processor for invoking the machine readable program, performing the method of implementation of the business expression generation and parsing tool.
The above embodiments are only specific cases of the present invention, and the scope of the present invention includes but is not limited to the above embodiments, and any suitable changes or substitutions that are consistent with the method claims for implementing a business expression generating and analyzing tool of the present invention and are made by those skilled in the art should fall within the scope of the present invention.
Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that changes, modifications, substitutions and alterations can be made in these embodiments without departing from the principles and spirit of the invention, the scope of which is defined in the appended claims and their equivalents.

Claims (10)

1. A business expression generation and analysis tool implementation method, characterized by that, the entry and generation of the business expression at first, the expression produced is kept in the database, for the next step of calling and analyzing and using; then providing a corresponding interface, allowing an expression needing to be operated to be selected in a front-end page, and analyzing by using GroovyShell in the implementation of a background Java code; and finally, obtaining the final result of the expression.
2. The method of claim 1, wherein the method comprises the steps of:
s1, realizing a visual page and supporting the input of business logic;
and S2, extracting the converted expression Json character string, and calculating a final result.
3. The method of claim 2, wherein in step S1, the front end uses Vue framework, and inputs a panel via an element component, wherein the panel is provided with a plurality of drop-down selection boxes, and the drop-down selection boxes select corresponding service parameters, and the selected service parameters are used as service variables used in the expression.
4. The method of claim 3, wherein said business parameters include arithmetic, relational, and logical operators.
5. The method of claim 4, wherein the left side of the panel is an expression display area for displaying the currently entered expression string, and the right side clicks the mouse to select the symbol or variable to be added to the entered expression string.
6. The method of claim 5, wherein when a left character is clicked, the cursor is positioned to the side of the clicked character for display, and a button supporting a backspace operation can delete the character identified by the current cursor.
7. The method of claim 6, wherein the entered expression information is placed into a plurality of sets of types to generate Json strings, and the Json strings are stored in corresponding fields of a background database for background retrieval, analysis and calculation.
8. The method for implementing a business expression generation and parsing tool according to claim 7, wherein in step S2, first, a character string entered at a front end is taken out from a database, the character string is traversed, if the type is a business-related variable, a corresponding variable name is obtained according to a stored variable primary key, and is replaced, and finally, an expression with a variable, which can be used for groovy shell execution, is obtained.
9. The method of claim 8, wherein the variables needed to parse the expression are stored in a Map key-value pair list, the key is the name of the service variable that has been replaced in the previous operation S1, and the value is the value of the service variable corresponding to the name of the variable;
and the expression and the Map list are used as parameters, Binding object input parameters provided by Groovy are used, the GroovyShell is called for analysis, and the final expression calculation result is returned.
10. An apparatus for implementing a business expression generation and analysis tool, comprising: at least one memory and at least one processor;
the at least one memory to store a machine readable program;
the at least one processor, configured to invoke the machine readable program to perform the method of any of claims 1 to 9.
CN202111324511.5A 2021-11-10 2021-11-10 Method and device for realizing service expression generation and analysis tool Pending CN114115872A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111324511.5A CN114115872A (en) 2021-11-10 2021-11-10 Method and device for realizing service expression generation and analysis tool

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111324511.5A CN114115872A (en) 2021-11-10 2021-11-10 Method and device for realizing service expression generation and analysis tool

Publications (1)

Publication Number Publication Date
CN114115872A true CN114115872A (en) 2022-03-01

Family

ID=80377872

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111324511.5A Pending CN114115872A (en) 2021-11-10 2021-11-10 Method and device for realizing service expression generation and analysis tool

Country Status (1)

Country Link
CN (1) CN114115872A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115169290A (en) * 2022-07-19 2022-10-11 上海中汇亿达金融信息技术有限公司 Method for identifying expression computation paths

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105302556A (en) * 2015-10-27 2016-02-03 北京京东尚科信息技术有限公司 Calculation realization method and system and server apparatus
CN110908640A (en) * 2019-11-26 2020-03-24 京东数字科技控股有限公司 Method for realizing service function and script engine
CN113190283A (en) * 2021-04-15 2021-07-30 北京致远互联软件股份有限公司 Groovy language based visual calculation formula realization method
CN113312053A (en) * 2020-02-27 2021-08-27 北京沃东天骏信息技术有限公司 Data processing method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105302556A (en) * 2015-10-27 2016-02-03 北京京东尚科信息技术有限公司 Calculation realization method and system and server apparatus
CN110908640A (en) * 2019-11-26 2020-03-24 京东数字科技控股有限公司 Method for realizing service function and script engine
CN113312053A (en) * 2020-02-27 2021-08-27 北京沃东天骏信息技术有限公司 Data processing method and device
CN113190283A (en) * 2021-04-15 2021-07-30 北京致远互联软件股份有限公司 Groovy language based visual calculation formula realization method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
醉卧雕龙舫、: "基于vue与element ui的vue-cron插件的使用及将定时任务cron表达式解析成中文", pages 1 - 19, Retrieved from the Internet <URL:《https://blog.csdn.net/qq_41863697/article/details/109294333》> *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115169290A (en) * 2022-07-19 2022-10-11 上海中汇亿达金融信息技术有限公司 Method for identifying expression computation paths

Similar Documents

Publication Publication Date Title
CN106775770B (en) Search method for constructing query statement based on class information
EP3336721B1 (en) Method and system for generating a parser and parsing complex data
EP2778914A1 (en) Method and system for generating a parser and parsing complex data
CN109710250B (en) Visualization engine system and method for constructing user interface
US10409820B2 (en) Semantic mapping of form fields
CN109308254B (en) Test method, test device and test equipment
US11301643B2 (en) String extraction and translation service
CN110837362A (en) Method, system and editor for editing rule of guide type visual graphic modularization
JP2020017277A (en) Web reporting design system for programming event operation, based on graphic interface
Smajevic et al. From conceptual models to knowledge graphs: a generic model transformation platform
JP3305949B2 (en) Program analyzer
CN113283216A (en) Webpage content display method, device, equipment and storage medium
CN114201615B (en) Scientific research data change review method and server based on data snapshot
CN114115872A (en) Method and device for realizing service expression generation and analysis tool
CN111475196A (en) Compiling alarm tracing method and device, electronic equipment and computer readable medium
JP2008140095A (en) Decision-making support system
US8701086B2 (en) Simplifying analysis of software code used in software systems
CN113419721A (en) Web-based expression editing method, device, equipment and storage medium
CN116643739A (en) Decision engine implementation method, device, equipment and storage medium
CN111126008A (en) XSD-based code generation method and device, computer equipment and storage medium
CN117075893A (en) Mobile terminal page generation method and system based on VUE
CN116610558A (en) Code detection method, device, electronic equipment and computer readable storage medium
CN111126012B (en) Custom generation expression method and device
CN114879965A (en) Data settlement method, device, equipment and storage medium
CN114816420A (en) Data processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination