[go: up one dir, main page]

CN117312438B - Data processing methods, electronic devices and readable storage media - Google Patents

Data processing methods, electronic devices and readable storage media

Info

Publication number
CN117312438B
CN117312438B CN202311279860.9A CN202311279860A CN117312438B CN 117312438 B CN117312438 B CN 117312438B CN 202311279860 A CN202311279860 A CN 202311279860A CN 117312438 B CN117312438 B CN 117312438B
Authority
CN
China
Prior art keywords
data
end view
rule
view layer
expression
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.)
Active
Application number
CN202311279860.9A
Other languages
Chinese (zh)
Other versions
CN117312438A (en
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.)
Zhongke Yungu Technology Co Ltd
Original Assignee
Zhongke Yungu Technology 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 Zhongke Yungu Technology Co Ltd filed Critical Zhongke Yungu Technology Co Ltd
Priority to CN202311279860.9A priority Critical patent/CN117312438B/en
Publication of CN117312438A publication Critical patent/CN117312438A/en
Application granted granted Critical
Publication of CN117312438B publication Critical patent/CN117312438B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/26Visual data mining; Browsing structured data
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/258Data format conversion from or to a database

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

本申请公开了一种数据处理方法、电子设备及可读存储介质,数据处理方法包括:根据业务代码创建前端视图层对象,前端视图层对象中包括至少一类自然语言;基于前端视图层对象执行规则定义操作,根据操作结果生成JSON格式数据;解析JSON格式数据,以构建形成SpEL表达式。如此,能够基于业务代码自动生成SpEL表达式,实现自然语言与SpEL表达式之间的快速转换,操作简单,可视化程度高。

This application discloses a data processing method, an electronic device, and a readable storage medium. The data processing method includes: creating a front-end view layer object based on business code, the front-end view layer object including at least one type of natural language; executing rule-defined operations based on the front-end view layer object, generating JSON format data based on the operation results; and parsing the JSON format data to construct a SpEL expression. In this way, SpEL expressions can be automatically generated based on business code, achieving rapid conversion between natural language and SpEL expressions, with simple operation and high visualization.

Description

Data processing method, electronic device and readable storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a data processing method, an electronic device, and a readable storage medium.
Background
SpEL (Spring Expression Language) is an expression language in Spring Framework. It is a powerful expression language for dynamically accessing and manipulating object diagrams at runtime. SpEL can be used for various purposes such as attribute access, method calls, mathematical operations, logical operations, conditional expressions, and the like. SpEL is similar to the expression languages of other programming languages, and also references the characteristics of some XML and XPath. It allows the values of the expressions to be calculated dynamically at run-time, enabling a more flexible and dynamic programming approach. In Spring Framework SpEL is widely used in configuration files such as XML configuration, annotation configuration, java configuration, etc. By SpEL, expressions can be used in the configuration file to dynamically configure the behavior of the application according to the runtime conditions. Spring Framework is an open source application Framework for building enterprise-level JAVA applications. It provides a series of solutions and tools for simplifying the development process of JAVA applications, which can help developers build maintainable, extensible and efficient applications.
The inventors found in the study that in the prior art, specific rules need to be defined by SpEL expressions for rule execution, spEL expressions need to be input when rules and actions are defined on pages, and natural language input parsing is not supported. However, spEL expressions generally require mastering a variety of keywords and grammar rules, are not easily mastered by ordinary users or programming novices, and are difficult to learn. The SpEL expression is generally a sentence composed of some symbols and keywords, which is not easily understood by non-professionals and clients, and the code readability is poor. The structure and syntax of SpEL expressions are relatively complex, requiring a degree of skill and experience if there are errors that require modification or debugging.
Disclosure of Invention
The application aims to provide a data processing method, a device, a system and a computer readable storage medium, which can automatically generate SpEL expressions based on service codes, realize quick conversion between natural language and SpEL expressions, and have simple operation and high visualization degree.
To achieve the above object:
in a first aspect, an embodiment of the present application provides a data processing method, where the method includes:
creating a front end view layer object according to the business codes, wherein the front end view layer object comprises at least one type of natural language;
performing rule definition operation based on the front end view layer object, and generating JSON format data according to an operation result;
parsing the JSON format data to construct a SpEL expression.
In an embodiment, the creating a front end view layer object according to the business code, wherein the front end view layer object comprises at least one kind of natural language, and the method comprises the following steps:
Acquiring first data and second data in a service code, wherein the first data comprises information of a class in the service code, and the second data comprises Chinese annotation information in the service code;
Generating third data according to the first data and the second data;
generating a front end view layer object according to the third data.
In one embodiment, the method further comprises:
and acquiring the first data and the second data in the service codes through a JAVA reflection mechanism.
In one embodiment, the anomalies in the process of acquiring the first data and the second data in the business code are captured and processed.
In an embodiment, the rule definition operation is performed based on the front end view layer object, and JSON format data is generated according to the operation result, including:
creating a rule tree according to the front end view layer object, wherein the rule tree comprises a definable rule frame;
executing rule definition operation through the definable rule frame to receive business rule data, wherein the business rule data comprises first business rule data and second business rule data, the first business rule data is acquired through the front end view layer object, and the second business rule data is input through a user;
JSON format data is generated based on the front end hierarchy object and the business rule data.
In an embodiment, the rule definition operation includes one or more of an initial value setting, a comparator selection, a selection value type setting, and a match result input.
In an embodiment, the parsing the JSON format data to construct a SpEL expression includes:
Analyzing a data structure according to the JSON data;
Extracting a numerical value in the JSON data according to the data structure;
And splicing the numerical values in a character string splicing mode to construct and form SpEL expression.
In an embodiment, after parsing the JSON format data to construct a SpEL expression, the method further includes:
Parsing the SpEL expression using a SpEL parser and compiling into an evaluable expression object;
And evaluating the expression object to obtain an evaluation result of the expression.
In a second aspect, the embodiment of the application also provides a data processing system, which comprises a first data processing module, a second data processing module and a third data processing module, wherein,
The first data processing module is used for creating a front end view layer object according to the service codes, wherein the front end view layer object comprises at least one type of natural language;
The second data processing module is used for receiving input data based on the front end view layer object to generate JSON format data;
The third data processing module is configured to parse the JSON format data to construct and form SpEL expressions.
In a third aspect, an embodiment of the present application further provides an electronic device, where the electronic device includes a processor, a memory, and a computer program stored on the memory and executable on the processor, where the computer program is executed by the processor to implement the steps of the data processing method described above.
In a fourth aspect, embodiments of the present application provide a computer readable storage medium having a computer program stored therein, which when executed by a processor, implements the steps of the data processing method described above.
The data processing method, device and system and computer readable storage medium provided by the embodiment of the application comprise the steps of creating a front end view layer object according to service codes, wherein the front end view layer object comprises at least one type of natural language, executing rule definition operation based on the front end view layer object, generating JSON format data according to an operation result, and analyzing the JSON format data to construct and form SpEL expression. Therefore, the SpEL expression can be automatically generated based on the service code, the rapid conversion between the natural language and the SpEL expression is realized, the operation is simple, and the visualization degree is high.
Drawings
FIG. 1 is a schematic diagram of a data processing system according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of data processing performed by the first data processing module according to the embodiment of the present invention;
FIG. 3 is a schematic view of a main interface of a front end view layer object provided by an embodiment of the present invention;
FIG. 4 is a schematic diagram of an operation interface of a front end view layer object according to an embodiment of the present invention;
FIG. 5 is a second schematic view of an operation interface of a front end view layer object according to an embodiment of the present invention;
FIG. 6 is a third view of an operator interface of a front end view layer object according to an embodiment of the present invention;
FIG. 7 is a diagram illustrating an operation interface of a front end view layer object according to an embodiment of the present invention;
FIG. 8 is a fifth view of an operator interface for a front end view layer object according to an embodiment of the present invention;
FIG. 9 is a schematic diagram of a structure of stored data according to an embodiment of the present invention;
Fig. 10 is a flowchart of a data processing method according to an embodiment of the present invention.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the application. Rather, they are merely examples of apparatus and methods consistent with aspects of the application as detailed in the accompanying claims.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, the element(s) defined by the phrase "comprising one does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other like elements in different embodiments of the application having the same meaning as may be defined by the same meaning as they are explained in this particular embodiment or by further reference to the context of this particular embodiment.
It should be understood that although the terms first, second, third, etc. may be used herein to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope herein. The term "if" as used herein may be interpreted as "at..once" or "when..once" or "in response to a determination", depending on the context. Furthermore, as used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context indicates otherwise. It will be further understood that the terms "comprises," "comprising," "includes," and/or "including" specify the presence of stated features, steps, operations, elements, components, items, categories, and/or groups, but do not preclude the presence, presence or addition of one or more other features, steps, operations, elements, components, items, categories, and/or groups. The terms "or" and/or "as used herein are to be construed as inclusive, or meaning any one or any combination. Thus, "A, B or C" or "A, B and/or C" means "any of A, B, C, A and B, A and C, B and C, A, B and C". An exception to this definition will occur only when a combination of elements, functions, steps or operations are in some way inherently mutually exclusive.
It should be understood that, although the steps in the flowcharts in the embodiments of the present application are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited in order and may be performed in other orders, unless explicitly stated herein. Moreover, at least some of the steps in the figures may include multiple sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, the order of their execution not necessarily occurring in sequence, but may be performed alternately or alternately with other steps or at least a portion of the other steps or stages.
It should be noted that, in this document, step numbers such as S210 and S220 are adopted, and the purpose of the present application is to more clearly and briefly describe the corresponding content, and not to constitute a substantial limitation on the sequence, and those skilled in the art may execute S220 first and then S210 when implementing the present application, which is within the scope of protection of the present application.
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
In the following description, suffixes such as "module", "part" or "unit" for representing elements are used only for facilitating the description of the present application, and have no specific meaning per se. Thus, "module," "component," or "unit" may be used in combination.
First embodiment
Referring to fig. 1, a data processing system provided in the present application includes a first data processing module, a second data processing module, and a third data processing module. The main functions of the first data processing module are business code culture based on a reflection mechanism and automatic construction of front end view layer objects. The main function of the second data processing module is to edit an image interface and store data for the front end view layer object constructed by the first data processing module. The main function of the third data processing module is to convert the data stored by the second data processing module into SpEL expressions.
In the first data processing module, performing a middle culture process on all classes, attributes, methods and the like in the business codes, and automatically constructing a front end view layer object. It should be noted that the front end view layer is the portion of the Web or mobile application with which the user interacts directly. A front end view object refers to a collection of elements and components that make up a visual interface. In the front end framework or library, the developer uses components, elements, etc. to build the various parts of the page. These view layer objects may be buttons, input boxes, images, paragraphs, and the like.
As shown in FIG. 2, in a first data processing module, a developer can use annotations to mark and specify Chinese names, such as @ ZBomType ("Chinese names"), on classes, attributes, methods, parameters. During system initialization, class information (i.e., first data) may be obtained through a reflection mechanism, including, but not limited to, class names, attributes, methods, and constructors. Chinese annotation information (i.e., second data) in the business code may also be obtained through a reflection mechanism. In Java, the reflection mechanism allows a program to obtain type information and manipulate classes, interfaces, fields, methods, constructors, etc. at runtime. Objects, calling methods, access attributes, obtaining information of classes, etc. can be dynamically created at runtime through reflection mechanisms.
Then, after the custom annotation is completed and the first data and the second data are acquired through the reflection mechanism, the acquired data are subjected to a middle culture process. Specifically, the names of the classes, attributes, methods may be added to the corresponding chinese names according to the chinese names specified in the annotations. Thus, the first data processing module dynamically acquires information such as class, attribute, method and the like in the service code by using a reflection mechanism, and automatically performs Chinese culture processing on the information according to the notes added on the class, the method and the parameters to obtain third data.
And finally, constructing a front end view layer object according to the third data such as the class, the attribute, the method and the like after the Chinese culture, and converting the third data into a JSON format to be transmitted to the front end.
In an embodiment, the first data processing module may also implement exception handling. By capturing and handling anomalies that may occur in reflection operations, such as class absence, method absence, etc., more friendly error cues and a more stable and robust operating environment are provided, providing reliability of the code.
In one embodiment, the first data processing module employs a caching mechanism to improve performance. After the class information is acquired and the middle culture processing is performed, the processing result can be cached. When the same class is used next time, the information of the class of the culture can be directly obtained from the cache, and repeated execution of the reflecting operation is avoided, so that the response speed and the performance of the system are improved.
In one embodiment, the first data processing module can dynamically acquire the currently callable method and the accessible attribute information through the reflection mechanism and the annotation, and provide the currently callable method and the accessible attribute information to the front-end object so as to display and execute the corresponding operation.
Therefore, the class, the attribute, the method and the like in the business code can be easily processed in a Chinese culture mode through the first data processing module, and a corresponding front end view layer object is automatically generated. Meanwhile, the first data processing module can dynamically return the current callable method and the accessible attribute information to the front-end object according to the request content of the front-end, and provide corresponding parameter options for the operating method, so that efficient interaction with the front-end is realized. Meanwhile, through automatic construction and Chinese culture processing of the front end view layer object, service data can be displayed to a user in a friendly and understandable mode.
Referring to fig. 3, in the second data processing module, the association relationship of elements and components in the front end view layer object may be presented using a regular tree form. For example, for the parent rule box homemade-out of process agreement, two child rule boxes 1100 and 1103 are associated. The 1100 rule boxes are associated with rule boxes such as H10 and A18, and the 1103 rule boxes are associated with rule boxes such as H20, H21, H39 and A21. Clicking on any of the rule boxes may enter the rule definition operation interface as shown in fig. 4. The rule definition operation mainly consists of four parts, namely initial value setting, comparator selection, selection value type and matching result.
For the operation of initial value setting, initial values are mainly classified into several types of attributes, objects, sets, and methods. The attribute is a single, unchangeable value, such as the utility. The Object is translated from an Object (Object) in JAVA, and attribute selection, such as an extended view, is possible. An object in JAVA refers to an instance of a class. An object is a data structure that exists in memory and has attributes (member variables) and methods (member functions) that can store data and perform operations. The collection is translated by Map in JAVA, and value, such as material version attribute, can be obtained by inputting key value. Map is a data structure in Java for storing key-value pairs (keys-value pairs). Each key is unique and the corresponding value can be accessed through the key. The method is translated by a Service layer in JAVA, and can be used for selecting the method to be called. The Service layer, namely the Service logic layer, is a middle layer between a Controller (Controller) and a data access layer (DAO layer), and is mainly responsible for processing Service logic, coordinating different Service operations and providing a high-level interface for an upper layer.
For the operation of selecting the comparer, the comparer mainly comprises a plurality of types of operations of more than, less than, equal to, not equal to, in a collection, empty and the like. For the selection value type, an input value, a selection variable, and the like may be selected. For the matching result, a custom value may be entered through an input box.
Four specific cases are exemplified below.
As shown in fig. 5, when the initial value is selected as the object "extended view", the next-level object attribute selection may be performed, and the initial value is filled into the box after the selection is completed. Such as "extended view. Material coding", the hierarchical relationship is represented by "". When multiple judgment is needed, the method can be used forTo add conditions, and or logical decisions are made. The comparator selection in FIG. 5 is equal to selecting an input value in the selection value type box that matches the definition rule, such as "26594512532154416" or "123456789", and defining an example result in the result box when the match was successful. Multiple logical decisions for each case are similar.
As shown in fig. 6, when the initial value is selected as the set "material version attribute", the input can be customized on the lower line, and the corresponding value is matched from the set through the key value. Such as "Material version property PQN. 3 CZ". Where "," is used to denote a hierarchical relationship, other conditional choices are consistent with the examples described above.
As shown in fig. 7, when the initial value is selected as the method "extended view service class", the next level selection may be performed to select a method in the service class. For example, "extend service attempt class, acquire earthwork ()", fill input parameters in brackets, input parameters can select the attribute of background input, and input character string can be customized. In fig. 7, the input parameters "material version", "factory" and "process attribute" are the attributes transmitted in the background, and "GY9MaterialPreRevision" and "pgy9_ GROOVECUTTING" are the custom input strings.
As shown in fig. 8, when the initial value is selected as the attribute "business", other condition selections are identical to those of the above example.
In the third data processing module, the JSON format data returned by the front end is analyzed and converted into a JAVA object. Then the SpEL expressions are spliced. As shown in fig. 9, JSON format data mainly includes three parts. initValue, result and map. Wherein initValue denotes an initial value, such as "utility". result represents a result, such as an "example result". map represents the connection logic between the comparator, input value and condition, such as "map", "map1", "map2", "map3" and "map4".
In actual implementation, the JSON data returned by the front end is firstly analyzed into a corresponding data structure. Values for the three parts initValue, result and map are then extracted from the parsed data structure. These values are obtained using a corresponding method according to the structure of the JSON data. The map has four keys, namely a comparator, an input value, an and or, and a value of the and or as an array structure, and a set name, such as map1, is stored for representing a logical relationship among a plurality of conditions. Next, based on the extracted data, a SpEL expression string is constructed in a string concatenation manner. The specific construction process depends on the form of the data and the required expression logic. The expression may be defined using comparators, operators, functions, and the like. Ensuring that the generated expression strings conform to the grammar rules of SpEL. For map median conversion splicing, logic connection among all conditions is realized through depth-first search, and the specific operation is as follows:
a. And acquiring the value of the map key from the analyzed JSON data. And obtaining the value of the map in a corresponding mode according to the method and the data structure of the parsing library.
And b, extracting the comparer and the input value from the map. According to the structure of the JSON data, the comparator and the input value are acquired using corresponding methods. The comparer and the input value can be of the types of character strings, numbers and the like, and corresponding type conversion is carried out according to actual conditions.
C. And extracting and or values. And acquiring the value of the sum or according to the structure of the JSON data. Since their values are array structures, they can be extracted as sets or lists using corresponding methods. Each element represents a name of a condition or combination of conditions, such as "map1".
D. A conditional logical expression is constructed. And constructing an expression representing the conditional logic according to the extracted comparer, the input value and the value of the sum and the or. The conditions are combined using logical operators (e.g., & &, ||) depending on the specific requirements and programming language used.
E. Using the extracted comparator, input value, and conditional logical expression, combined into SpEL expression, as the condition in fig. 4, the splice is converted into SpEL expression as:
Condition:{(#extendpandView.getItemId()=="26594512532154416"&&#extendpandView.getItemId()=="123456789")||#extendpandView.getItemId()=="987654321"}
action # { # result [ 'result' ] = "example result" }
The Expression string is parsed using a parser (ExpressionParser) of SpEL and compiled into an evaluable Expression object (Expression). And calling a getValue () method of the expression object to obtain an evaluation result of the expression, and when the result is true/false, indicating that the expression conversion is correct. The result of the expression is processed or the next operation is performed as needed. Depending on the outcome of the expression, it may be decided to execute different logic.
Second embodiment
Referring to fig. 10, a data processing method provided by an embodiment of the present application may be implemented by a data processing system provided by an embodiment of the present application, where the data processing system may be implemented by software and/or hardware, and the data processing method provided by the embodiment of the present application includes:
Step S210, creating a front end view layer object according to the business codes, wherein the front end view layer object comprises at least one type of natural language.
In one embodiment, a front end view layer object is created according to a business code, wherein the front end view layer object comprises at least one type of natural language and comprises:
Acquiring first data and second data in a service code, wherein the first data comprises information of a class in the service code, and the second data comprises Chinese annotation information in the service code;
Generating third data according to the first data and the second data;
a front end view layer object is generated from the third data.
In an implementation manner, the data processing method of the embodiment of the application further comprises the step of acquiring the first data and the second data in the service code through a JAVA reflection mechanism.
This step may be performed by a first data processing module in the data processing system.
In the first data processing module, performing a middle culture process on all classes, attributes, methods and the like in the business codes, and automatically constructing a front end view layer object. It should be noted that the front end view layer is the portion of the Web or mobile application with which the user interacts directly. A front end view object refers to a collection of elements and components that make up a visual interface. In the front end framework or library, the developer uses components, elements, etc. to build the various parts of the page. These view layer objects may be buttons, input boxes, images, paragraphs, and the like.
As shown in FIG. 2, in a first data processing module, a developer can use annotations to mark and specify Chinese names, such as @ ZBomType ("Chinese names"), on classes, attributes, methods, parameters. During system initialization, class information (i.e., first data) may be obtained through a reflection mechanism, including, but not limited to, class names, attributes, methods, and constructors. Chinese annotation information (i.e., second data) in the business code may also be obtained through a reflection mechanism. In Java, the reflection mechanism allows a program to obtain type information and manipulate classes, interfaces, fields, methods, constructors, etc. at runtime. Objects, calling methods, access attributes, obtaining information of classes, etc. can be dynamically created at runtime through reflection mechanisms.
Then, after the custom annotation is completed and the first data and the second data are acquired through the reflection mechanism, the acquired data are subjected to a middle culture process. Specifically, the names of the classes, attributes, methods may be added to the corresponding chinese names according to the chinese names specified in the annotations. Thus, the first data processing module dynamically acquires information such as class, attribute, method and the like in the service code by using a reflection mechanism, and automatically performs Chinese culture processing on the information according to the notes added on the class, the method and the parameters to obtain third data.
And finally, constructing a front end view layer object according to the third data such as the class, the attribute, the method and the like after the Chinese culture, and converting the third data into a JSON format to be transmitted to the front end.
Optionally, the data processing method further comprises capturing and processing anomalies in the process of acquiring the first data and the second data in the business code. Here, the first data processing module may also implement exception handling. By capturing and handling anomalies that may occur in reflection operations, such as class absence, method absence, etc., more friendly error cues and a more stable and robust operating environment are provided, providing reliability of the code.
Optionally, the first data processing module employs a caching mechanism to improve performance. After the class information is acquired and the middle culture processing is performed, the processing result can be cached. When the same class is used next time, the information of the class of the culture can be directly obtained from the cache, and repeated execution of the reflecting operation is avoided, so that the response speed and the performance of the system are improved.
Optionally, the first data processing module can dynamically acquire the currently callable method and the accessible attribute information through the reflection mechanism and the annotation and provide the currently callable method and the accessible attribute information to the front-end object so as to display and execute the corresponding operation.
Therefore, the class, the attribute, the method and the like in the business code can be easily processed in a Chinese culture mode through the first data processing module, and a corresponding front end view layer object is automatically generated. Meanwhile, the first data processing module can dynamically return the current callable method and the accessible attribute information to the front-end object according to the request content of the front-end, and provide corresponding parameter options for the operating method, so that efficient interaction with the front-end is realized. Meanwhile, through automatic construction and Chinese culture processing of the front end view layer object, service data can be displayed to a user in a friendly and understandable mode.
And step S220, performing rule definition operation based on the front end view layer object, and generating JSON format data according to an operation result.
In an embodiment, performing rule definition operation based on the front end view layer object, generating JSON format data according to the operation result, including:
Creating a rule tree according to the front end view layer object, wherein the rule tree comprises a definable rule frame;
Executing rule definition operation through a definable rule frame to receive business rule data, wherein the business rule data comprises first business rule data and second business rule data, the first business rule data is acquired through a front end view layer object, and the second business rule data is input through a user;
JSON format data is generated based on the front end hierarchy object and business rule data.
In one embodiment, the rule definition operation includes one or more of an initial value setting, a comparator selection, a selection value type setting, and a match result input.
This step may be performed by a second data processing module in the data processing system.
As shown in fig. 3, in the second data processing module, the association of elements and components in the front end view layer object may be exposed using a regular tree form. For example, for the parent rule box homemade-out of process agreement, two child rule boxes 1100 and 1103 are associated. The 1100 rule boxes are associated with rule boxes such as H10 and A18, and the 1103 rule boxes are associated with rule boxes such as H20, H21, H39 and A21. Clicking on any of the rule boxes may enter the rule definition operation interface as shown in fig. 4. The rule definition operation mainly consists of four parts, namely initial value setting, comparator selection, selection value type and matching result.
For the operation of initial value setting, initial values are mainly classified into several types of attributes, objects, sets, and methods. The attribute is a single, unchangeable value, such as the utility. The Object is translated from an Object (Object) in JAVA, and attribute selection, such as an extended view, is possible. An object in JAVA refers to an instance of a class. An object is a data structure that exists in memory and has attributes (member variables) and methods (member functions) that can store data and perform operations. The collection is translated by Map in JAVA, and value, such as material version attribute, can be obtained by inputting key value. Map is a data structure in Java for storing key-value pairs (keys-value pairs). Each key is unique and the corresponding value can be accessed through the key. The method is translated by a Service layer in JAVA, and can be used for selecting the method to be called. The Service layer, namely the Service logic layer, is a middle layer between a Controller (Controller) and a data access layer (DAO layer), and is mainly responsible for processing Service logic, coordinating different Service operations and providing a high-level interface for an upper layer.
For the operation of selecting the comparer, the comparer mainly comprises a plurality of types of operations of more than, less than, equal to, not equal to, in a collection, empty and the like. For the selection value type, an input value, a selection variable, and the like may be selected. For the matching result, a custom value may be entered through an input box.
Four specific cases are exemplified below.
As shown in fig. 5, when the initial value is selected as the object "extended view", the next-level object attribute selection may be performed, and the initial value is filled into the box after the selection is completed. Such as "extended view. Material coding", the hierarchical relationship is represented by "". When multiple judgment is needed, the method can be used forTo add conditions, and or logical decisions are made. The comparator selection in FIG. 5 is equal to selecting an input value in the selection value type box that matches the definition rule, such as "26594512532154416" or "123456789", and defining an example result in the result box when the match was successful. Multiple logical decisions for each case are similar.
As shown in fig. 6, when the initial value is selected as the set "material version attribute", the input can be customized on the lower line, and the corresponding value is matched from the set through the key value. Such as "Material version property PQN. 3 CZ". Where "," is used to denote a hierarchical relationship, other conditional choices are consistent with the examples described above.
As shown in fig. 7, when the initial value is selected as the method "extended view service class", the next level selection may be performed to select a method in the service class. For example, "extend service attempt class, acquire earthwork ()", fill input parameters in brackets, input parameters can select the attribute of background input, and input character string can be customized. In fig. 7, the input parameters "material version", "factory" and "process attribute" are the attributes transmitted in the background, and "GY9MaterialPreRevision" and "pgy9_ GROOVECUTTING" are the custom input strings.
As shown in fig. 8, when the initial value is selected as the attribute "business", other condition selections are identical to those of the above example.
And S230, analyzing the JSON format data to construct and form SpEL expression.
In one embodiment, parsing JSON format data to construct SpEL expressions includes:
analyzing a data structure according to the JSON data;
extracting numerical values in the JSON data according to the data structure;
And splicing the numerical values in a character string splicing mode to construct and form SpEL expression.
In one embodiment, after parsing the JSON format data to construct the SpEL expression, further comprising:
The parser of SpEL is used to parse SpEL expression and compile it into an evaluable expression object;
and evaluating the expression object to obtain an evaluation result of the expression.
This step may be performed by a third data processing module in the data processing system.
In the third data processing module, the JSON format data returned by the front end is analyzed and converted into a JAVA object. Then the SpEL expressions are spliced. As shown in fig. 9, JSON format data mainly includes three parts. initValue, result and map. Wherein initValue denotes an initial value, such as "utility". result represents a result, such as an "example result". map represents the connection logic between the comparator, input value and condition, such as "map", "map1", "map2", "map3" and "map4".
In actual implementation, the JSON data returned by the front end is firstly analyzed into a corresponding data structure. Values for the three parts initValue, result and map are then extracted from the parsed data structure. These values are obtained using a corresponding method according to the structure of the JSON data. The map has four keys, namely a comparator, an input value, an and or, and a value of the and or as an array structure, and a set name, such as map1, is stored for representing a logical relationship among a plurality of conditions. Next, based on the extracted data, a SpEL expression string is constructed in a string concatenation manner. The specific construction process depends on the form of the data and the required expression logic. The expression may be defined using comparators, operators, functions, and the like. Ensuring that the generated expression strings conform to the grammar rules of SpEL. For map median conversion splicing, logic connection among all conditions is realized through depth-first search, and the specific operation is as follows:
a. And acquiring the value of the map key from the analyzed JSON data. And obtaining the value of the map in a corresponding mode according to the method and the data structure of the parsing library.
And b, extracting the comparer and the input value from the map. According to the structure of the JSON data, the comparator and the input value are acquired using corresponding methods. The comparer and the input value can be of the types of character strings, numbers and the like, and corresponding type conversion is carried out according to actual conditions.
C. And extracting and or values. And acquiring the value of the sum or according to the structure of the JSON data. Since their values are array structures, they can be extracted as sets or lists using corresponding methods. Each element represents a name of a condition or combination of conditions, such as "map1".
D. A conditional logical expression is constructed. And constructing an expression representing the conditional logic according to the extracted comparer, the input value and the value of the sum and the or. The conditions are combined using logical operators (e.g., & &, ||) depending on the specific requirements and programming language used.
E. Using the extracted comparator, input value, and conditional logical expression, combined into SpEL expression, as the condition in fig. 4, the splice is converted into SpEL expression as:
Condition:{(#extendpandView.getItemId()=="26594512532154416"&&#extendpandView.getItemId()=="123456789")||#extendpandView.getItemId()=="987654321"}
action # { # result [ 'result' ] = "example result" }
The Expression string is parsed using a parser (ExpressionParser) of SpEL and compiled into an evaluable Expression object (Expression). And calling a getValue () method of the expression object to obtain an evaluation result of the expression, and when the result is true/false, indicating that the expression conversion is correct. The result of the expression is processed or the next operation is performed as needed. Depending on the outcome of the expression, it may be decided to execute different logic.
The specific implementation of the data processing method according to the embodiment of the present application may refer to the data processing system according to the first embodiment.
In summary, in the method provided in the above embodiment, a front end view layer object is created according to a service code, where the front end view layer object includes at least one type of natural language, a rule definition operation is performed based on the front end view layer object, JSON format data is generated according to an operation result, and the JSON format data is parsed to construct and form SpEL expressions. Therefore, the SpEL expression can be automatically generated based on the service code, the rapid conversion between the natural language and the SpEL expression is realized, the operation is simple, and the visualization degree is high.
Based on the same inventive concept as the previous embodiments, the present embodiment further provides an electronic device, including a processor, a memory, and a computer program stored on the memory and executable on the processor, where the computer program implements the above data processing method when executed by the processor. The specific step flow implemented when the computer program is executed by the processor is described with reference to the embodiment shown in fig. 1, and will not be described herein.
Based on the same inventive concept as the previous embodiments, the present embodiment further provides a computer readable storage medium, in which a computer program is stored, and the computer readable storage medium may be a Memory such as a magnetic random access Memory (FRAM, ferromagnetic random access Memory), a Read Only Memory (ROM), a programmable Read Only Memory (PROM, programmable Read-Only Memory), an erasable programmable Read Only Memory (EPROM, erasable Programmable Read-Only Memory), an electrically erasable programmable Read Only Memory (EEPROM, ELECTRICALLY ERASABLE PROGRAMMABLE READ-Only Memory), a Flash Memory (Flash Memory), a magnetic surface Memory, an optical disc, or a compact disc Read Only Memory (CD-ROM, compact Disc Read-Only Memory), or various devices including one or any combination of the above, such as a mobile phone, a computer, a tablet device, a personal digital assistant, and the like. The computer program stored in the computer readable storage medium realizes the data processing method when being executed by a processor. The specific step flow implemented when the computer program is executed by the processor is described with reference to the embodiment shown in fig. 1, and will not be described herein.
The technical features of the above-described embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above-described embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
In this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a list of elements is included, and may include other elements not expressly listed.
The foregoing is merely illustrative of the present invention, and the present invention is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (8)

1.一种数据处理方法,其特征在于,所述方法包括:1. A data processing method, characterized in that the method comprises: 根据业务代码创建前端视图层对象,所述前端视图层对象中包括至少一类自然语言;A front-end view layer object is created based on the business code, and the front-end view layer object includes at least one type of natural language; 基于所述前端视图层对象执行规则定义操作,根据操作结果生成JSON格式数据;Based on the front-end view layer object, perform the rule definition operation and generate JSON format data according to the operation result; 解析所述JSON格式数据,以构建形成SpEL表达式;Parse the JSON format data to construct a SpEL expression; 所述基于所述前端视图层对象执行规则定义操作,根据操作结果生成JSON格式数据,包括:The step of performing rule-defined operations based on the front-end view layer object and generating JSON format data based on the operation results includes: 根据所述前端视图层对象创建规则树,所述规则树包括可定义规则框;A rule tree is created based on the front-end view layer object, the rule tree including a definable rule box; 通过所述可定义规则框执行规则定义操作,以接收业务规则数据,所述业务规则数据包括第一业务规则数据和第二业务规则数据,所述第一业务规则数据通过所述前端视图层对象获取,所述第二业务规则数据通过用户输入;The rule definition operation is performed through the definable rule box to receive business rule data, which includes first business rule data and second business rule data. The first business rule data is obtained through the front-end view layer object, and the second business rule data is obtained through user input. 基于所述前端视图层对象和所述业务规则数据生成JSON格式数据;Generate JSON format data based on the front-end view layer object and the business rule data; 所述规则定义操作包括初始值设置、比较符选择、选择值类型设置和匹配结果输入中的一项或多项。The rule definition operation includes one or more of the following: initial value setting, comparison operator selection, selection value type setting, and matching result input. 2.根据权利要求1所述的方法,其特征在于,所述根据业务代码创建前端视图层对象,所述前端视图层对象中包括至少一类自然语言,包括:2. The method according to claim 1, characterized in that, in the step of creating a front-end view layer object based on business code, the front-end view layer object includes at least one type of natural language, including: 获取业务代码中的第一数据和第二数据,其中,所述第一数据包括所述业务代码中类的信息,所述第二数据包括所述业务代码中的中文注解信息;Obtain first data and second data from the business code, wherein the first data includes class information in the business code, and the second data includes Chinese annotation information in the business code; 根据所述第一数据和所述第二数据生成第三数据;Generate third data based on the first data and the second data; 根据所述第三数据生成前端视图层对象。A front-end view layer object is generated based on the third data. 3.根据权利要求2所述的方法,其特征在于,所述方法,还包括:3. The method according to claim 2, characterized in that the method further comprises: 通过JAVA反射机制获取所述业务代码中的第一数据和第二数据。The first and second data in the business code are obtained through the Java reflection mechanism. 4.根据权利要求2或3所述的方法,其特征在于,所述方法,还包括:4. The method according to claim 2 or 3, characterized in that the method further comprises: 捕获并处理所述获取业务代码中的第一数据和第二数据的过程中的异常。Capture and handle exceptions during the process of obtaining the first and second data in the business code. 5.根据权利要求1所述的方法,其特征在于,所述解析所述JSON格式数据,以构建形成SpEL表达式,包括:5. The method according to claim 1, wherein parsing the JSON format data to construct a SpEL expression comprises: 根据所述JSON格式数据解析出数据结构;The data structure is parsed from the JSON format data; 根据所述数据结构提取所述JSON格式数据中的数值;Extract the numerical values from the JSON format data according to the data structure; 通过字符串拼接方式拼接所述数值以构建形成SpEL表达式。The numerical values are concatenated using string concatenation to construct a SpEL expression. 6.根据权利要求1或5所述的方法,其特征在于,所述解析所述JSON格式数据,以构建形成SpEL表达式之后,还包括:6. The method according to claim 1 or 5, characterized in that, after parsing the JSON format data to construct the SpEL expression, it further includes: 使用SpEL的解析器解析所述SpEL表达式,并编译为可评估的表达式对象;The SpEL expression is parsed using the SpEL parser and compiled into an evaluable expression object; 评估所述表达式对象,得到表达式的评估结果。The expression object is evaluated to obtain the evaluation result of the expression. 7.一种电子设备,其特征在于,包括处理器、存储器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述计算机程序被所述处理器执行时实现如权利要求1至6中任一项所述的数据处理方法的步骤。7. An electronic device, characterized in that it comprises a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the data processing method as described in any one of claims 1 to 6. 8.一种计算机可读存储介质,其特征在于,存储有计算机程序,所述计算机程序被处理器执行时,实现权利要求1至6中任一项所述的数据处理方法的步骤。8. A computer-readable storage medium, characterized in that it stores a computer program, which, when executed by a processor, implements the steps of the data processing method according to any one of claims 1 to 6.
CN202311279860.9A 2023-09-29 2023-09-29 Data processing methods, electronic devices and readable storage media Active CN117312438B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311279860.9A CN117312438B (en) 2023-09-29 2023-09-29 Data processing methods, electronic devices and readable storage media

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311279860.9A CN117312438B (en) 2023-09-29 2023-09-29 Data processing methods, electronic devices and readable storage media

Publications (2)

Publication Number Publication Date
CN117312438A CN117312438A (en) 2023-12-29
CN117312438B true CN117312438B (en) 2025-12-02

Family

ID=89286239

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311279860.9A Active CN117312438B (en) 2023-09-29 2023-09-29 Data processing methods, electronic devices and readable storage media

Country Status (1)

Country Link
CN (1) CN117312438B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103577174A (en) * 2012-08-01 2014-02-12 北京奥鹏远程教育中心有限公司 Visualized generation method and system of calculation rule scripts
CN110196719A (en) * 2019-05-20 2019-09-03 中国工商银行股份有限公司 A kind of business rule generation method and system based on natural language processing

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7562340B2 (en) * 2006-03-23 2009-07-14 International Business Machines Corporation Method for graphically building business rule conditions
CN108228173B (en) * 2018-01-16 2021-08-31 北明软件有限公司 Visual data interface development system and method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103577174A (en) * 2012-08-01 2014-02-12 北京奥鹏远程教育中心有限公司 Visualized generation method and system of calculation rule scripts
CN110196719A (en) * 2019-05-20 2019-09-03 中国工商银行股份有限公司 A kind of business rule generation method and system based on natural language processing

Also Published As

Publication number Publication date
CN117312438A (en) 2023-12-29

Similar Documents

Publication Publication Date Title
Ceder The quick Python book
TWI493464B (en) System and method for late bound programmatic assistance
US7890923B2 (en) Configurable pattern detection method and apparatus
US9524279B2 (en) Help document animated visualization
US20060026559A1 (en) Automatic content completion of valid values for method argument variables
US7761843B2 (en) Computer source code generator
JP4951416B2 (en) Program verification method and program verification apparatus
CN109739494B (en) A Tree-LSTM-based API usage code generation recommendation method
US20130346939A1 (en) Methods and Systems Utilizing Behavioral Data Models With Views
US20200210158A1 (en) Automated or machine-enhanced source code debugging
CN105378658A (en) Automatic source code generation
US10572278B2 (en) Smart controls for user interface design and implementation
CN115048104A (en) Code generation method and device based on syntax tree and electronic equipment
CN115202626A (en) Low-code front-end development method supporting multi-technology stack components
CN116400910A (en) A Code Performance Optimization Method Based on API Replacement
WO2020023951A1 (en) Bidirectional evaluation for general-purpose programming
CN119576339A (en) Script code processing method and device, and non-volatile storage medium
CN113934429A (en) Design draft conversion method and device, computer equipment and storage medium
US9529573B2 (en) Graphical user interface generation through use of a binary file
Irwin et al. Object oriented metrics: Precision tools and configurable visualisations
CN115291851A (en) Software development kit code generation method, device, equipment and storage medium
CN117312438B (en) Data processing methods, electronic devices and readable storage media
Indamutsa et al. Advanced discovery mechanisms in model repositories
CN119127285A (en) A software toolkit development method, device, computer equipment and storage medium
CN118260292A (en) A method to simplify database operations in iOS application development

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
GR01 Patent grant
GR01 Patent grant