Automatic code generation method and system for quickly adjusting transaction flow docking
Technical Field
The invention relates to the technical field of computers, in particular to an automatic code generation method and system for quickly adjusting transaction flow docking.
Background
The existing e-commerce platform docking project mainly comprises the following steps: the system comprises a plurality of items such as commodity synchronization, transaction flow control, event processing, data analysis, display data output and the like. However, in the existing project, different e-commerce platforms have a problem of great difference in transaction flow, in the process, a programmer is required to perform work such as code development, when a plurality of table structures are involved in a model, even if the table structures are involved in addition, modification and deletion of fields, code production needs to be performed again, so that excessive manual participation and a large amount of time and labor are required to perform repeated code production work in the code production process.
The existing code generator generally generates a directory structure defined by a specific frame and a file of naming rules defined in advance by the specific frame according to a specific format, and in an actual project, all aspects of the frame and the directory should be customized by the project itself, so that each script change record in history cannot be recorded in the using process, and the existing code generator does not have the capability of automatically merging scripts in the same change.
Most of the existing code generators are connected to corresponding databases, code generation can be realized only by the support of the databases, and the existing code generators are usually limited by account numbers and passwords and corresponding dictionary reading permission, so that the existing code generators are not convenient to use.
In the prior art, for different transaction flows in an e-commerce platform, a background needs to encode each transaction flow respectively, and the different transaction flows cannot be butted with each other with large workload and long time consumption, so that a large amount of repeated programming labor is caused.
Accordingly, the prior art is yet to be improved and developed.
Disclosure of Invention
In view of the defects of the prior art, the invention aims to provide an automatic code generation method and system for quickly adjusting transaction flow docking, and aims to solve the defects that in the prior art, for different transaction flows in an e-commerce platform, a background needs to code each transaction flow respectively, the docking workload between different transaction flows is large, the consumed time is long, and a large amount of repeated programming labor is caused.
The technical scheme of the invention is as follows:
an automated code generation method for fast adjustment of transaction flow docking, wherein the method comprises:
A. obtaining each transaction flow in the e-commerce platform in advance, abstracting each transaction flow into a corresponding flow operation assembly, and obtaining a code template corresponding to the flow operation assembly and storing the code template in a component library;
B. acquiring code configuration parameters of a transaction process corresponding to a code to be generated input through a user interface, and acquiring structural data according to the acquired code configuration parameters;
C. extracting a corresponding code template from a component library according to a transaction flow corresponding to a code to be generated and the type of the code;
D. and filling the structural data and the code configuration parameters into the extracted code template to obtain the code to be generated.
The automated code generation method for rapid adjustment of transaction flow docking, wherein the step a further comprises:
and A1, performing data conversion among the flow operation components through a data adapter.
The automated code generation method for rapid adjustment of transaction flow docking, wherein the step D is followed by the step of:
E. and executing after the code to be generated is obtained, and adjusting the butt joint of the transaction flow.
The automatic code generation method for rapid adjustment of transaction flow docking comprises the following steps of:
s1, the data adapter and the flow operation component are stored in a special directory in the form of plug-in.
The automated code generation method for rapid adjustment of transaction flow docking, wherein the step a further comprises:
a2, acquiring the flow operation components input by the user, judging whether the flow operation components input by the user conform to the component format of the component library, and if so, adding the codes corresponding to the flow operation components input by the user to the component library to form a new code template.
An automated code generation system for fast adjustment of transaction flow docking, wherein the system comprises:
the code template storage module is used for acquiring each transaction flow in the e-commerce platform in advance, abstracting each transaction flow into a corresponding flow operation assembly, and acquiring a code template corresponding to the flow operation assembly and storing the code template in the assembly library;
the data acquisition module is used for acquiring code configuration parameters of a transaction process corresponding to a code to be generated, which is input through a user interface, and acquiring structural data according to the acquired code configuration parameters;
the template extraction module is used for extracting a corresponding code template from the component library according to the transaction flow corresponding to the code to be generated and the type of the code;
and the code generation module is used for filling the structural data and the code configuration parameters into the extracted code template to obtain the code to be generated.
The automatic code generation system for rapidly adjusting the transaction flow docking comprises a code template storage module, a code module and a code module, wherein the code template storage module comprises:
and the data conversion unit is used for performing data conversion among the flow operation components through the data adapter.
The automated code generation system for fast adjustment of transaction flow docking, wherein the system further comprises:
and the transaction flow docking module is used for executing after acquiring the code to be generated and adjusting the docking of the transaction flow.
The automated code generation system for fast adjustment of transaction flow docking, wherein the system further comprises:
and the storage module is used for storing the data adapter and the flow operation assembly in a specific directory in a plug-in mode.
The automatic code generation system for rapidly adjusting the transaction flow docking comprises a code template storage module, a code module and a code module, wherein the code template storage module comprises:
and the code template adding unit is used for acquiring the flow operation assembly input by the user, judging whether the flow operation assembly input by the user accords with the assembly format of the assembly library, and adding the code corresponding to the flow operation assembly input by the user into the assembly library to form a new code template if the flow operation assembly input by the user accords with the assembly format of the assembly library.
The invention provides an automatic code generation method and system for quickly adjusting the butt joint of transaction flows.
Drawings
FIG. 1 is a flowchart of an automated code generation method for fast adjusting transaction flow docking according to a preferred embodiment of the present invention.
FIG. 2 is a schematic diagram of the operation of an automated code generation system for fast adjustment transaction flow docking according to a preferred embodiment of the present invention.
FIG. 3 is a functional block diagram of an automated code generation system for fast justification transaction flow docking in accordance with a preferred embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and effects of the present invention clearer and clearer, the present invention is described in further detail below. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The present invention provides a flow chart of a preferred embodiment of an automated code generation method for fast adjustment of transaction flow docking, as shown in fig. 1, wherein the method comprises:
step S100, obtaining each transaction flow in the e-commerce platform in advance, abstracting each transaction flow into a corresponding flow operation assembly, and obtaining a code template corresponding to the flow operation assembly and storing the code template in a component library.
In specific implementation, the transaction flow in the e-commerce platform includes but is not limited to the flows of shopping carts, orders, payments, comments, popularization and the like. In the docking, different merchants have differences and commonalities in transaction flow. Designing basic event elements in a graphical mode according to the commonalities of the basic event elements; and the flow docking is realized through graphical operation.
Various process operation components such as shopping carts, orders, payments, comments, promotions, and the like are abstracted from each transaction process. Each flow operation component corresponds to one node, each node is a program module with independent functions, and the function modules are interacted through data streams. The code of the implementation of the node is a code template and is stored in the component library.
In the following embodiments, flow operation components are represented by nodes.
Further, step S100 further includes:
and S101, performing data conversion among the flow operation components through a data adapter.
In specific implementation, since the service logics processed by the components are different, in order to connect each node, a data adapter is required to be placed between two connected nodes, and the data adapter is used for data conversion.
Further, step S100 further includes:
and S102, acquiring the flow operation assembly input by the user, judging whether the flow operation assembly input by the user accords with the assembly format of the assembly library, and if so, adding a code corresponding to the flow operation assembly input by the user to the assembly library to form a new code template.
During specific implementation, a user can add a self-defined node according to specific service requirements, and seamless access can be realized only by a component realized according to a protocol with the same specification as that of the component library, so that the component becomes a component of the component library.
In a further embodiment, step S100 further includes, before:
step S1, the data adapter and the process operation component are stored in a specific directory in the form of plug-ins.
In specific implementation, the nodes and the data adapters appear in a plug-in mode, and the plug-in mechanism enables users to flexibly expand the code generation tool according to specific service requirements.
The flow relation among the nodes, the data adapter and each node technically reflects an XML configuration fragment, and then the analysis engine executes the service flow according to the analyzed XML fragment. Part of the XML fragment code is as follows:
<config>
< | component definition node >
<node>
< | define the group ID to which the node belongs- - - >)
<groupId></groupId>
< | define unique identification of a node within the group to which it belongs- - ]
<artifactId></ artifactId>
< | specific definition of node attributes is defined- - >)
<define></define>
</node>
< | adapter nodes >
<adapter>
< | define the group ID to which the node belongs- - - >)
<groupId></groupId>
< | define unique identification of a node within the group to which it belongs- - ]
<artifactId></ artifactId>
< | the front node of the adapter is defined- - > -)
<preNode>
<! -group ID to which front node belongs- - > -)
<groupId></groupId>
< | the unique identification of the front-end node within the group to which it belongs- - > -
<artifactId></ artifactId>
</preNode>
< | define the Back node of the adapter- - > -)
<nextNode>
<! -group ID to which the back-end node belongs- - > -)
<groupId></groupId>
< | the unique identification of a post node within the group to which it belongs- - ]
<artifactId></ artifactId>
</nextNode>
</adapter>
</config>
The above fragment codes define the component definition node and the adapter node, respectively. The component defines the group ID of the node, the unique identification of the node in the group and the specific definition of the node attribute. The adapter node defines the group ID of the node, defines the unique identification of the node in the group, and defines the data of the front node of the adapter, the group ID of the front node, the unique identification of the front node in the group, defines the back node of the adapter, the group ID of the back node, the unique identification of the back node in the group.
And S200, acquiring code configuration parameters of the transaction process corresponding to the code to be generated input through the user interface, and acquiring structural data according to the acquired code configuration parameters.
In specific implementation, a user displays a transaction flow on a user interface, obtains a code configuration parameter of the transaction flow of a code to be generated input on the user interface, and obtains structural data according to the code configuration parameter. The structure parameter refers to data corresponding to different codes and containing a specific structure. The invention uses java language to realize the bottom layer. But may be implemented in other programming languages.
And S300, extracting a corresponding code template from the component library according to the transaction flow corresponding to the code to be generated and the type of the code.
In specific implementation, if the code of the user is detected to be java code, the transaction flow to be adjusted by the user is obtained, and the corresponding code template with the code type of java code is obtained from the component library.
And S400, filling the structural data and the code configuration parameters into the extracted code template to obtain the code to be generated.
And during specific implementation, the obtained structural data and the configuration information configured by the user are filled into the extracted code template to obtain the code to be generated. The filling of the code template is based on a keyword principle, corresponding positions, such as table names, column areas, annotation areas and the like, are replaced at the keyword content, and before the content is not assembled, the corresponding positions are not replaced but are respectively assembled according to grammar rules; in addition, the basic attribute and the data type in the interface template are also completed based on one template classification, and finally, unified keyword verification, type definition limitation and the like are completed.
In a further embodiment, after step S400, the method further includes:
and S500, executing after the code to be generated is obtained, and adjusting the butt joint of the transaction flow.
In specific implementation, after the code to be generated is generated, the user executes the corresponding code, so that the existing transaction flow is adjusted.
The present invention also provides a schematic diagram of the working principle of a preferred embodiment of an automated code generation system for rapidly adjusting transaction flow docking, as shown in fig. 2, a built-in node is a component abstracted in advance according to a business flow, such as: the system comprises a shopping cart assembly, an order assembly and a built-in sub-analysis engine corresponding to the assembly in a matched manner; the user-defined node is a node which is defined by a user in a personalized mode according to specific service requirements, and is matched with a sub-analysis engine corresponding to the user-defined component, wherein the user-defined node and the corresponding sub-analysis engine conform to technical specifications. That is, components implemented as long as they are in compliance with the specification can seamlessly access the automated code generation system as components of the component library. Meanwhile, since the service logics processed by the components are different, in order to connect each node, a data adapter is required to be arranged between two connected nodes, and the data adapter is used for data conversion.
An automated code generation system includes a design-time environment and a runtime environment. "design time environment" refers to an environment in which a business process is configured by means of a graphical interface; "runtime environment" refers to an environment that runs a business process configured by the "design time environment".
The nodes and the analysis engine can be seamlessly accessed to the code generation tool to be the components and the sub-analysis engine of the component library as long as the nodes and the analysis engine are placed in the specified directory of the automatic code generation system in a plug-in mode.
The nodes and the data adapters of the automatic code generation system appear in a plug-in mode, and the plug-in mechanism enables users to flexibly expand the automatic code generation system according to specific business requirements.
According to the method, the automatic code generation method for rapidly adjusting the transaction flow docking is provided, the commodities and the transaction flows of different merchants are analyzed firstly in the project development process, and then the rapid code generation is performed only through graphical operation and parameter setting by using the method, so that the docking development flow is accelerated, and repeated programming labor is reduced.
In an exemplary embodiment, the apparatus may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer readable storage medium comprising instructions, such as a memory comprising instructions, executable by a processor of an apparatus to perform the above method is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
The present invention also provides a functional block diagram of a preferred embodiment of an automated code generation system for fast adjustment of transaction flow docking, as shown in fig. 3, the system comprising:
the code template storage module 100 is used for acquiring each transaction flow in the e-commerce platform in advance, abstracting each transaction flow into a corresponding flow operation component, and acquiring a code template corresponding to the flow operation component and storing the code template in a component library; as shown in the method embodiment.
The data acquisition module 200 is configured to acquire a code configuration parameter of a transaction flow corresponding to a code to be generated, which is input through a user interface, and obtain structural data according to the acquired code configuration parameter; as shown in the method embodiment.
The template extraction module 300 is used for extracting a corresponding code template from the component library according to the transaction flow corresponding to the code to be generated and the type of the code; as shown in the method embodiment.
The code generation module 400 is configured to fill the extracted code template with the structural data and the code configuration parameters to obtain a code to be generated; as shown in the method embodiment.
The automatic code generation system for rapidly adjusting the transaction flow docking comprises a code template storage module, a code module and a code module, wherein the code template storage module comprises:
the data conversion unit is used for performing data conversion among the process operation components through a data adapter; as shown in the method embodiment.
The automated code generation system for fast adjustment of transaction flow docking, wherein the system further comprises:
the transaction flow docking module is used for acquiring the code to be generated and then executing the code to be generated and adjusting the docking of the transaction flow; as shown in the method embodiment.
The automated code generation system for fast adjustment of transaction flow docking, wherein the system further comprises:
the storage module is used for storing the data adapter and the flow operation assembly in a specific directory in a plug-in mode; as shown in the method embodiment.
The automatic code generation system for rapidly adjusting the transaction flow docking comprises a code template storage module, a code module and a code module, wherein the code template storage module comprises:
the code template adding unit is used for acquiring the flow operation assembly input by the user, judging whether the flow operation assembly input by the user accords with the assembly format of the assembly library, and adding the code corresponding to the flow operation assembly input by the user to the assembly library to form a new code template if the flow operation assembly input by the user accords with the assembly format of the assembly library; as shown in the method embodiment.
In summary, the present invention provides an automated code generation method and system for fast adjusting transaction flow docking, the method includes: obtaining each transaction flow in the e-commerce platform in advance, abstracting each transaction flow into a corresponding flow operation assembly, and obtaining a code template corresponding to the flow operation assembly and storing the code template in a component library; acquiring code configuration parameters of a transaction process corresponding to a code to be generated input through a user interface, and acquiring structural data according to the acquired code configuration parameters; extracting a corresponding code template from a component library according to a transaction flow corresponding to a code to be generated and the type of the code; and filling the structural data and the code configuration parameters into the extracted code template to obtain the code to be generated. The invention can analyze commodities and transaction flows of different merchants, and only needs to carry out rapid code generation through graphical operation and parameter setting, thereby accelerating the docking development flow and reducing repeated programming labor.
It is to be understood that the invention is not limited to the examples described above, but that modifications and variations may be effected thereto by those of ordinary skill in the art in light of the foregoing description, and that all such modifications and variations are intended to be within the scope of the invention as defined by the appended claims.