CN110297632A - Code generating method and device - Google Patents

Code generating method and device Download PDF

Info

Publication number
CN110297632A
CN110297632A CN201910507093.XA CN201910507093A CN110297632A CN 110297632 A CN110297632 A CN 110297632A CN 201910507093 A CN201910507093 A CN 201910507093A CN 110297632 A CN110297632 A CN 110297632A
Authority
CN
China
Prior art keywords
node
operator
business
processed
operator node
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
CN201910507093.XA
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.)
Baidu Online Network Technology Beijing Co Ltd
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and 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 Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201910507093.XA priority Critical patent/CN110297632A/en
Publication of CN110297632A publication Critical patent/CN110297632A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/34Graphical or visual programming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation

Abstract

The embodiment of the present invention provides a kind of code generating method and device, this method comprises: the corresponding multiple operator nodes of the process flow for obtaining business to be processed, process flow includes multiple processing steps, each operator node is used to execute at least one step in multiple processing steps, according to the process flow of business to be processed, obtain the corresponding frame diagram of multiple operator nodes, frame diagram is used to indicate the association dependence between multiple operator nodes, configurationization processing is carried out to frame diagram, generates the corresponding business logic codes of business to be processed.In embodiments of the present invention, by the way that the process flow of business to be processed is abstracted into multiple operator nodes, and multiple operator nodes are associated using frame diagram, to constitute the connection framework of entire background server, then configurationization processing is carried out to frame diagram, business logic codes are generated, the efficiency of server-side code exploitation is greatly improved.

Description

Code generating method and device
Technical field
The present embodiments relate to field of computer technology more particularly to a kind of code generating methods and device.
Background technique
Current code automatic generation method is usually applied to graphical user interface (Graphical User Interface, GUI) client, specifically, pass through code editor carry out interface visual element dragging and splicing, constitute The skeleton code of client element control is subsequently filled corresponding element response events code, realizes the generation of client code.
Then, above-mentioned code production decision is only for the client for having GUI, for the background server of not GUI, this Kind scheme is not applicable.
Summary of the invention
The embodiment of the present invention provides a kind of code generating method and device, and the code development for improving server end is imitated Rate.
In a first aspect, the embodiment of the present invention provides a kind of code generating method, comprising:
The corresponding multiple operator nodes of process flow of business to be processed are obtained, the process flow includes multiple processing steps Suddenly, each operator node is used to execute at least one processing step in the multiple processing step;
According to the process flow of the business to be processed, the corresponding frame diagram of the multiple operator node, the frame are obtained Frame figure is patterned operation to the multiple operator node and obtains;
Configurationization processing is carried out to the frame diagram, generates the corresponding business logic codes of the business to be processed.
In a kind of possible design, the process flow according to the business to be processed obtains the multiple operator The corresponding frame diagram of node, comprising:
According to the process flow of the business to be processed, the association dependence between the multiple operator node is obtained, The association dependence is used to indicate the triggering relationship between the multiple operator node, wherein the association dependence It is relied on including Dependent Demand and selection, when the Dependent Demand indicates upstream node triggered as normal, executes present node, Yi Jishang It when swimming node exception-triggered or skipping triggering, skips present node and is triggered to downstream node, the selection, which relies on, to be indicated When upstream node is triggered as normal or exception-triggered or skips triggering, present node is executed;
According to the association dependence, the frame diagram is obtained by graphical operation.
It is described that configurationization processing is carried out to the frame diagram in a kind of possible design, generate the business to be processed Corresponding business logic codes, comprising:
According to the frame diagram, the corresponding configuration file of the frame diagram is generated;
According to the business to be processed, the property parameters of each operator node are configured in the configuration file, are obtained new Configuration file;
According to the new configuration file, the corresponding business logic codes of the business to be processed are generated.
In a kind of possible design, the multiple operator node includes initial operator node, terminates operator node, and Independent operator node and/or directed acyclic graph (Directed Acyclic Graph, DAG) operator node;
The initial operator node is used to receive the request data package of client transmission, and carries out to the request data package Parsing, the end operator node are used to send response data packet to the client, and the independent operator node is for executing A processing step in the multiple processing step, the DAG operator node is for executing in the multiple processing step At least two processing steps.
In a kind of possible design, the initial operator node, the end operator node and the independent operator Node calls a general operator respectively;The DAG operator node calls at least two general operators, wherein the general calculation Son calculates operator for the generalization of the called business for handling different disposal process.
In a kind of possible design, the general operator is provided at least one of lower interface:
Pre-process interface, Processing Interface, post-process interface.
In a kind of possible design, the triggered as normal indicates that the service logic of present node is correct, to downstream node Carry out triggered as normal;The exception-triggered indicates that the service logic of the present node is incorrect, carries out to downstream node abnormal Triggering;It is described skip triggering indicate upstream node exception-triggered when, skip present node, and carry out skipping touching to downstream node Hair.
Second aspect, the embodiment of the present invention provide a kind of code generating unit characterized by comprising
Obtain module, the corresponding multiple operator nodes of process flow for obtaining business to be processed, the process flow Including multiple processing steps, each operator node is used to execute at least one processing step in the multiple processing step;
The acquisition module is also used to the process flow according to the business to be processed, obtains the multiple operator node Corresponding frame diagram, the frame diagram are patterned operation to the multiple operator node and obtain;
Processing module generates the corresponding business of the business to be processed for carrying out configurationization processing to the frame diagram Logical code.
In a kind of possible design, the acquisition module is specifically used for:
According to the process flow of the business to be processed, the association dependence between the multiple operator node is obtained, The association dependence is used to indicate the triggering relationship between the multiple operator node, wherein the association dependence It is relied on including Dependent Demand and selection, when the Dependent Demand indicates upstream node triggered as normal, executes present node, Yi Jishang It when swimming node exception-triggered or skipping triggering, skips present node and is triggered to downstream node, the selection, which relies on, to be indicated When upstream node is triggered as normal or exception-triggered or skips triggering, present node is executed;
According to the association dependence, the frame diagram is obtained by graphical operation.
In a kind of possible design, the processing module is specifically used for:
According to the frame diagram, the corresponding configuration file of the frame diagram is generated;
According to the business to be processed, the property parameters of each operator node are configured in the configuration file, are obtained new Configuration file;
According to the new configuration file, the corresponding business logic codes of the business to be processed are generated.
In a kind of possible design, the multiple operator node includes initial operator node, terminates operator node, and Independent operator node and/or directed acyclic graph DAG operator node;
The initial operator node is used to receive the request data package of client transmission, and carries out to the request data package Parsing, the end operator node are used to send response data packet to the client, and the independent operator node is for executing A processing step in the multiple processing step, the DAG operator node is for executing in the multiple processing step At least two processing steps.
In a kind of possible design, the initial operator node, the end operator node and the independent operator Node calls a general operator respectively;The DAG operator node calls at least two general operators, wherein the general calculation Son calculates operator for the generalization of the called business for handling different disposal process.
In a kind of possible design, the general operator is provided at least one of lower interface:
Pre-process interface, Processing Interface, post-process interface.
In a kind of possible design, the triggered as normal indicates that the service logic of present node is correct, to downstream node Carry out triggered as normal;The exception-triggered indicates that the service logic of the present node is incorrect, carries out to downstream node abnormal Triggering;It is described skip triggering indicate upstream node exception-triggered when, skip present node, and carry out skipping touching to downstream node Hair.
The third aspect, the embodiment of the present invention provide a kind of terminal, comprising:
Memory and processor;
The memory, for storing program code;
The processor, the code for calling said program code to execute as described in the first aspect embodiment of the present invention are raw At method.
Fourth aspect, the embodiment of the present invention provide a kind of readable storage medium storing program for executing, meter are stored on the readable storage medium storing program for executing Calculation machine program;The computer program when executed, realizes the code building side as described in the first aspect embodiment of the present invention Method.
The embodiment of the present invention provides a kind of code generating method and device, this method comprises: obtaining the place of business to be processed The corresponding multiple operator nodes of process are managed, process flow includes multiple processing steps, and each operator node is for executing multiple places At least one step in reason step obtains the corresponding frame diagram of multiple operator nodes according to the process flow of business to be processed, Frame diagram is used to indicate the association dependence between multiple operator nodes, carries out configurationization processing to frame diagram, generate wait locate The corresponding business logic codes of reason business.In embodiments of the present invention, more by the way that the process flow of business to be processed to be abstracted into A operator node, and be associated multiple operator nodes using frame diagram, to constitute the connection of entire background server Then framework carries out configurationization processing to frame diagram, generates business logic codes, greatly improve server-side code exploitation Efficiency.
Detailed description of the invention
Fig. 1 is the flow chart for the code generating method that one embodiment of the invention provides;
Fig. 2 is the schematic diagram for the directed acyclic graph operator node that one embodiment of the invention provides;
Fig. 3 be another embodiment of the present invention provides code generating method flow chart;
Fig. 4 is the schematic diagram for the general operator that one embodiment of the invention provides;
Fig. 5 is the schematic diagram for the directed acyclic graph that one embodiment of the invention provides;
Fig. 6 is the structural schematic diagram for the code generating unit that one embodiment of the invention provides;
Fig. 7 is the structural schematic diagram for the terminal that one embodiment of the invention provides.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is A part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art Every other embodiment obtained without creative efforts, shall fall within the protection scope of the present invention.
First to the present embodiments relate to technical term be illustrated:
Client code: typically referring to the code with GUI product, such as: web page code, application program The code of the terminal devices such as (Application, APP) code, computer client code operation.
Code server: referring to no GUI, operate in server background, and receiving terminal apparatus or background service are asked It asks, thus the computer code of feedback response.
Directed acyclic graph DAG: refer to that any a line has direction, and the figure of loop is not present.
Current code building scheme is mainly carried out by code editor primarily directed to the code building of client The dragging and splicing of interface visual element constitute the skeleton code of client element control, are subsequently filled corresponding element response Event code realizes the generation of client code.However, this scheme is not suitable for the background server without GUI, for Possessing the large-scale background server of large amount of complex business, enterprise usually puts into a large amount of manpower and carries out code development at present, however, It is low that this will cause code server development efficiency.
To solve the above-mentioned problems, the embodiment of the present invention provides a kind of code generating method, this method comprises: obtaining wait locate The corresponding multiple operator nodes of the process flow of reason business, process flow includes multiple processing steps, and each operator node is used for At least one step in multiple processing steps is executed, according to the process flow of business to be processed, obtains multiple operator nodes pair The frame diagram answered, frame diagram carry out configurationization place to frame diagram for indicating the association dependence between multiple operator nodes Reason, generates the corresponding business logic codes of business to be processed.
In embodiments of the present invention, it by the way that the process flow of business to be processed is abstracted into multiple operator nodes, and uses Multiple operator nodes are associated by frame diagram, so that the connection framework of entire background server is constituted, then to frame diagram Configurationization processing is carried out, business logic codes are generated, greatly improves the efficiency of server-side code exploitation.
The technical solution of the above embodiment of the present invention is described in detail using several specific embodiments below.
Fig. 1 is the flow chart for the code generating method that one embodiment of the invention provides, the executing subject of the embodiment of the present invention It can be without limitation with terminal device, such as computer, mobile terminal, the embodiment of the present invention.As shown in Figure 1, this method includes Following steps:
S101, the corresponding multiple operator nodes of process flow for obtaining business to be processed.
In the present embodiment, process flow includes multiple processing steps, and each operator node is for executing multiple processing steps At least one step in rapid.Wherein, the process flow of business to be processed can be according to function division, i.e., at least one Manage the corresponding function of step.
For example, business to be processed is backstage payment transaction, according to the function division of payment transaction, backstage payment transaction Process flow usually may include verifying user identity, verifying user right, verifying user account remaining sum, withhold, return to Client withhold record and etc..Each step is mapped as an operator node, then the process flow of business to be processed can be with It is mapped as multiple operator nodes.After completing aforesaid operations, i.e., terminal device can obtain the process flow pair of business to be processed The multiple operator nodes answered.
In a kind of possible design, the multiple operator node includes initial operator node, terminates operator node, and Independent operator node and/or DAG operator node.Initial operator node is used to receive the request data package of client transmission, and right Request data package is parsed, and is terminated operator node and is used to send response data packet, independent operator node and described to client DAG operator node carries out business processing for treating processing business, and specifically, independent operator node is for executing multiple processing steps A processing step in rapid, DAG operator node are used to execute at least two processing steps in multiple processing steps.
Wherein, initial Start operator node can receive the request of client transmission by the node as initial end Request data packet carries out field parsing to the data packet, and by taking payment transaction as an example, initial operator node passes through to client The request data packet of transmission is parsed, and the identity of user is parsed, to complete the verifying to user identity.Specifically, The parsing of request data packet can be parsed by data packet schema predetermined, data packet schema conduct Configuration file can be downloaded in advance in load to Start operator node, and the embodiment of the present invention can realize number in any manner Parsing according to packet schema to request data packet, details are not described herein again.
Wherein, schema, that is, extensible markup language framework (XML Schema), based on extensible markup language, Describe the structure of XML document.
Terminate end of the End operator node as operator node, passes through the node returning response response data packet To client, the response data packet of return is packaged using data packet schema predetermined, data packet schema As configuration file, can be downloaded in advance in load to End operator node, the embodiment of the present invention can be realized in any manner Encapsulation of the data packet schema to response data packet, details are not described herein again.Equally by taking payment transaction as an example, completion of withholing Afterwards, response data packet is packaged by End operator node, returns to client, should to enable the client to parsing Response data packet obtains this information such as record, including deducted amount, time of withholing of withholing of trading.
In a kind of possible design, initial operator node, end operator node and independent operator node call respectively One general operator;DAG operator node calls at least two general operators.
General operator refers to unitized calculating operator, is suitable for a variety of different business, during code development, Without the calculating operator different for each business development to be processed, in the present embodiment, by calling general operator, Ke Yiti The efficiency of high code development.
Wherein, operator node simple for data processing, such as initial operator node terminate operator node and individually calculate Child node calls a general operator, and executes two for the business processing of some complexity, such as an operator node Processing step, then the operator node can be DAG operator node (also referred to as node of graph), and DAG operator node needs to call at least two A general operator, wherein be the nested relationship relied between general operator in DAG operator node, for example, demand required according to Rely, selection optional dependence, can specifically refer to the subsequent associated description to the association dependence between operator node.
Fig. 2 is the schematic diagram for the directed acyclic graph operator node that one embodiment of the invention provides, as shown in Fig. 2, the DAG is calculated Child node includes six general operators, is connected between general operator by directed edge.Wherein, these directed edges can be expressed as leading to It is relied on the relationship relied between operator, such as required dependence, optional, depending on the process flow of business, The embodiment of the present invention is without limitation.It should be noted that DAG operator node can encapsulate independent service logic Come, that is, the logic of multiple operator nodes is encapsulated, is easy to be multiplexed.
It should be noted that each general operator can carry out local computing, outer remote access can also be carried out, such as Access external data base, external file etc..By taking payment transaction as an example, verifying user right, withholds this at verifying user account remaining sum Several steps can be mapped as a Single operator node, wherein when verifying user right, for example, password is tested one by one Card, can locally carry out password authentification, external data base can also be accessed, come verify the user input password whether and outside The account stored in portion's database, corresponding password was consistent, if unanimously, user right is verified, if inconsistent, Then user right authentication failed, what needs to be explained here is that, if password authentification is correct, illustrating the service logic of the node just Really.
S102, according to the process flow of business to be processed, obtain the corresponding frame diagram of multiple operator nodes.
In the present embodiment, frame diagram is patterned operation to multiple operator nodes and obtains.Obtain industry to be processed After the corresponding multiple operator nodes of the operation flow of business, according to the process flow of business to be processed, graphical operation obtains multiple The corresponding frame diagram of operator node.Wherein, frame diagram can be directed acyclic graph DAG, can also be hub-and-spoke configuration figure, the present invention Embodiment is without limitation.
In the program in the specific implementation, according to the process flow of business to be processed, determine between multiple operator nodes It is associated with dependence, then according to the association dependence, graphical operation obtains the corresponding directed acyclic of multiple operator nodes Scheme DAG directed acyclic graph DAG.Wherein, directed acyclic DAG shown in the corresponding directed acyclic graph DAG of multiple operator nodes and Fig. 2 is calculated The schematic diagram of child node is similar, and details are not described herein.Wherein, association dependence is used to indicate the touching between multiple operator nodes Hair relationship, wherein association dependence includes that Dependent Demand and selection rely on, and Dependent Demand indicates upstream node triggered as normal When, when executing present node and upstream node exception-triggered or skipping triggering, skips present node and carry out to downstream node Triggering, select to rely on indicate upstream node for triggered as normal or exception-triggered or when skipping triggering, execution present node.
S103, configurationization processing is carried out to frame diagram, generate the corresponding business logic codes of business to be processed.
In the present embodiment, after obtaining the corresponding frame diagram of multiple operator nodes, configurationization processing is carried out to the frame diagram, Generate the corresponding business logic codes of business to be processed, specifically, generate the corresponding configuration file of the frame diagram, then according to The demand of processing business, configures the property parameters of each operator node in the configuration file, so that new configuration file is obtained, Then according to new configuration file, the corresponding business logic codes of business to be processed are generated.
Wherein, the property parameters of operator node may include the title of operator node, calling general operator, call it is logical With parameters such as the function of operator, the upstream node of operator node and downstream nodes, can according to the process flow of business to be processed, Dynamic adjusts each property parameters, and the embodiment of the present invention is without limitation.Certainly, those skilled in the art can use any Mode is realized according to new configuration file, automatically generates the corresponding business logic codes of business to be processed, details are not described herein again.
Code generating method provided in this embodiment obtains the corresponding multiple operator sections of process flow of business to be processed Point, process flow include multiple processing steps, and each operator node is used to execute at least one step in multiple processing steps, According to the process flow of business to be processed, the corresponding frame diagram of multiple operator nodes is obtained, frame diagram is for indicating multiple operators Association dependence between node carries out configurationization processing to frame diagram, generates business to be processed corresponding service logic generation Code.In embodiments of the present invention, by the way that the process flow of business to be processed is abstracted into multiple operator nodes, and frame diagram is used Multiple operator nodes are associated, to constitute the connection framework of entire background server, then frame diagram is matched Setting processing, generates business logic codes, greatly improves the efficiency of server-side code exploitation.
On the basis of the above embodiments, Fig. 3 be another embodiment of the present invention provides code generating method flow chart, As shown in figure 3, this method specifically includes the following steps:
S201, the corresponding multiple operator nodes of process flow for obtaining business to be processed.
In the present embodiment, multiple operator nodes include initial operator node, terminate operator node, and individually operator section Point and/or DAG operator node.Initial operator node, terminate operator node and independent operator node call respectively one it is general Operator, DAG operator node call at least two general operators.Wherein, general operator refers to unitized calculating operator, is applicable in In a variety of different business, during code development, without being directed to the different calculating operator of each business development to be processed, In the present embodiment, by calling general operator, the efficiency of code development can be improved.
Further, in order to improve the versatility of general operator, general operator is provided at least one of lower interface: pre- Processing Interface, Processing Interface, post-process interface.
Fig. 4 is the schematic diagram for the general operator that one embodiment of the invention provides, as shown in figure 4, the offer of general operator connects Mouth includes pretreatment interface, Processing Interface, post-process interface.
Wherein, Processing Interface in_process () is the generic logic pre-defined, can be according to actual needs (wait locate The process flow of reason business) adjusting parameter;Pretreatment interface pre_process (), post-process interface post_process () are Customize interface, can be compressed, format conversion etc. operation.For example, Start operator node can be used for verifying user Permission, Start operator node call a general operator, and the interface which provides includes pre_process (), in_ Process (), post_process (), if the request data packet that client is sent is encrypted packet, pre_ Process () can be used for decompressing, and user right then be verified in in_process (), then in post_process In () data formatted, compressed etc. with operation, triggers downstream node later.
It should be noted that can not also include in_process () in the interface that operator node provides, directly by pre- Processing Interface pre_process (), post-process interface post_process (), then trigger downstream node.With specific reference to wait locate Depending on reason business, the embodiment of the present invention is without limitation.
S202, according to the process flow of business to be processed, obtain the association dependence between the multiple operator node.
Wherein, association dependence is used to indicate the triggering relationship between multiple operator nodes, wherein association dependence For indicating the triggering relationship between multiple operator nodes, wherein association dependence includes that demand required is relied on and selected Optional dependence is selected, when Dependent Demand indicates upstream node triggered as normal, present node is executed and upstream node touches extremely It when sending out or skipping triggering, skips present node and is triggered to downstream node, selecting to rely on indicates upstream node for normal touching Hair or exception-triggered or when skipping triggering, execute present node, i.e., no matter why upstream node triggers, and will execute and work as prosthomere Point.
Triggered as normal indicates that the service logic of present node is correct, carries out triggered as normal to downstream node;Exception-triggered table Show that the service logic of present node is incorrect, carries out exception-triggered to downstream node;Skipping triggering indicates that upstream node touches extremely When hair, present node is skipped, and carries out skipping triggering to downstream node, tells downstream node " present node is skipped ".
In the above-described embodiments, by taking payment transaction as an example, the process flow of payment transaction includes verifying user identity, verifying User right, withholds, returns to client and withhold at verifying user account remaining sum, these steps can be mapped as one by one Single operator node determines that the association between single operator node relies on and closes then according to the process flow of payment transaction System can rely on for required and/or optional is relied on.If verifying the corresponding operator node (upstream node) of user identity Single operator node (present node) corresponding with verifying user right is required dependence, when upstream node service logic When correct when correct (namely verify user identity), triggered as normal can be just carried out to downstream node, if upstream node industry Be engaged in logic it is incorrect (it is incorrect namely to verify user identity), present node can be skipped directly, backward verifying user The corresponding downstream node of account balance is triggered, that is to say, that can skip verifying user right, directly verifying user account Remaining sum.
Alternatively, the corresponding operator node (upstream node) of verifying user identity and the corresponding single of verifying user right are calculated Child node (present node) is optional dependence, and no matter what triggering mode upstream node belongs to, and present node will execute.
It should be noted that the association dependence between multiple operator nodes is the process flow according to business to be processed Depending on, the embodiment of the present invention is without limitation.
S203, according to the association dependence, frame diagram is obtained by graphical operation.
In the present embodiment, according to the association dependence between operator node, frame can be drawn by image conversion operation Frame figure.In a kind of possible design, frame diagram is directed acyclic graph DAG.Fig. 5 is the oriented nothing that one embodiment of the invention provides The schematic diagram of ring figure, as shown in figure 5, directed acyclic graph DAG include four operator nodes, respectively Start operator node, End operator node, Echo operator node (operator node 1 is expressed as in Fig. 5), Echo2 operator node (are expressed as in Fig. 5 Operator node 2), each operator node passes through association dependence connection, the upstream of Echo operator node and Echo2 operator node Node is Start operator node, downstream node is End operator node, Echo operator node, Echo2 operator node respectively and Start operator node is required dependence, and End operator node and Echo operator node rely on for required, End operator section Point and Echo2 operator node are optional dependence.
Wherein, Echo operator node, Echo2 operator node can be Single operator node or DAG operator node.
S204, according to frame diagram, generate the corresponding configuration file of frame diagram.
S205, according to business to be processed, the property parameters of each operator node are configured in configuration file, obtain new match Set file.
By taking the directed acyclic graph DAG in Fig. 5 as an example, new configuration file is as follows:
[@Node]
Name:start // operator nodename
So where so:start.so // general operator
Reg_name:Start // general operator register method
To:echo, echo2 // downstream node
[@Node]
Name:end
so:end.so
reg_name:End
From:echo, echo2 // upstream node
[@Node]
Name:echo
so:echo.so
reg_name:Echo
from:start
to:end
[@Node]
Name:echo2
so:echo2.so
reg_name:Echo2
from:start
to:end
Wherein, Name:start indicates that operator nodename is start;
So:start.so indicates the shared library (share object library, so) where general operator, wherein so In encapsulate the functions of multiple general operators, can be configured according to practical business demand;
Reg_name:Start indicates the register method of general operator, that is, the logical of entitled Start is matched from so With operator, can be configured according to practical business demand;
To:echo, echo2 indicate that the downstream node of the node is echo, echo2;
From:echo, echo2 indicate that the upstream node of the node is echo, echo2;
Wherein, the property parameters of operator node include the functional parameter of operator node, by taking start operator node as an example, are used Request data packet is sent in parsing client, then needs to obtain the function of parsing data, i.e., configures parsing data for so So could match the general operator of entitled Start from so later.
The property parameters of operator node further include detailed programs parameter, such as: IP address, port and the sheet of external service Ground lexicon configuration parameter etc., is not shown detailed programs parameter in above-mentioned configuration file.
Equally by taking start operator node as an example, start operator node is used to receive the request data of client transmission Packet, therefore, it is necessary to configure the IP address of start operator node external service, port.In addition, due to request data packet Schema is stored in start operator node in the form of electronic dictionary, when parsing request data packet, due to data packet Format is unknown, and server does not know how to parse, then needs to configure electronic dictionary, reads the schema of request data packet, so Request data packet is parsed afterwards, therefore also needs to configure local dictionary.The embodiment of the present invention does not match needs The property parameters for the operator node set are limited, depending on practical business demand.
S206, according to new configuration file, generate the corresponding business logic codes of business to be processed.
In the present embodiment, those skilled in the art can be realized in any manner according to configured configuration file, The corresponding business logic codes of business to be processed are automatically generated, details are not described herein again.
The generation method of code provided in this embodiment obtains the corresponding multiple operator sections of process flow of business to be processed Point obtains the association dependence between multiple operator nodes according to the process flow of business to be processed, and association dependence is used In indicating the triggering relationship between the multiple operator node, according to association dependence, frame is obtained by graphical operation Figure generates the corresponding configuration file of frame diagram according to business to be processed and configures each calculation in configuration file according to frame diagram The property parameters of child node obtain new configuration file, according to new configuration file, generate the corresponding business of business to be processed and patrol Collect code.In embodiments of the present invention, by the way that the process flow of business to be processed is abstracted into multiple operator nodes, and frame is used Multiple operator nodes are associated by frame figure, to constitute the connection framework of entire background server, then to frame diagram into Row configurationization processing, generates business logic codes, greatly improves the efficiency of server-side code exploitation.
Fig. 6 is the structural schematic diagram for the code generating unit that one embodiment of the invention provides, as shown in Figure 6.The present embodiment The code generating unit 10 of offer includes:
Obtain module 11, the corresponding multiple operator nodes of process flow for obtaining business to be processed, the processing stream Journey includes multiple processing steps, and each operator node is used to execute at least one processing step in the multiple processing step;
The acquisition module 11, is also used to the process flow according to the business to be processed, obtains the multiple operator section The corresponding frame diagram of point, the frame diagram are patterned operation to the multiple operator node and obtain;
Processing module 12 generates the corresponding industry of the business to be processed for carrying out configurationization processing to the frame diagram Business logical code.
In a kind of possible design, the acquisition module 11 is specifically used for:
According to the process flow of the business to be processed, the association dependence between the multiple operator node is obtained, The association dependence is used to indicate the triggering relationship between the multiple operator node, wherein the association dependence It is relied on including Dependent Demand and selection, when the Dependent Demand indicates upstream node triggered as normal, executes present node, Yi Jishang It when swimming node exception-triggered or skipping triggering, skips present node and is triggered to downstream node, the selection, which relies on, to be indicated When upstream node is triggered as normal or exception-triggered or skips triggering, present node is executed;
According to the association dependence, the frame diagram is obtained by graphical operation.
In a kind of possible design, the processing module 12 is specifically used for:
According to the frame diagram, the corresponding configuration file of the frame diagram is generated;
According to the business to be processed, the property parameters of each operator node are configured in the configuration file, are obtained new Configuration file;
According to the new configuration file, the corresponding business logic codes of the business to be processed are generated.
In a kind of possible design, the multiple operator node includes initial operator node, terminates operator node, and Independent operator node and/or directed acyclic graph DAG operator node;
The initial operator node is used to receive the request data package of client transmission, and carries out to the request data package Parsing, the end operator node are used to send response data packet to the client, and the independent operator node is for executing A processing step in the multiple processing step, the DAG operator node is for executing in the multiple processing step At least two processing steps.
In a kind of possible design, the initial operator node, the end operator node and the independent operator Node calls a general operator respectively;The DAG operator node calls at least two general operators, wherein the general calculation Son calculates operator for the generalization of the called business for handling different disposal process.
In a kind of possible design, the general operator is provided at least one of lower interface:
Pre-process interface, Processing Interface, post-process interface.
In a kind of possible design, the triggered as normal indicates that the service logic of present node is correct, to downstream node Carry out triggered as normal;The exception-triggered indicates that the service logic of the present node is incorrect, carries out to downstream node abnormal Triggering;It is described skip triggering indicate upstream node exception-triggered when, skip present node, and carry out skipping touching to downstream node Hair.
The code generating unit of the present embodiment can be used for executing the technical solution in above-mentioned each method embodiment, in fact Existing principle is similar with technical effect, and details are not described herein again.
Fig. 7 is the structural schematic diagram for the terminal that one embodiment of the invention provides, as shown in fig. 7, the terminal 20 of the present embodiment It may include: memory 21 and processor 22.Wherein, memory 21 can for example be connect with processor 22 by bus 23.
The memory 21, for storing program code;
The processor 222, for realizing any reality in preceding method embodiment by executing the computer program The code generating method that existing mode provides.
The present invention also provides a kind of computer readable storage mediums, are stored thereon with computer program, the computer journey The code generating method that any implementation provides in preceding method embodiment is realized when sequence is executed by processor.
In several embodiments provided by the present invention, it should be understood that disclosed device and method can pass through it Its mode is realized.For example, apparatus embodiments described above are merely indicative, for example, the division of the module, only Only a kind of logical function partition, there may be another division manner in actual implementation, for example, multiple modules can combine or It is desirably integrated into another system, or some features can be ignored or not executed.Another point, it is shown or discussed it is mutual it Between coupling, direct-coupling or communication connection can be through some interfaces, the INDIRECT COUPLING or communication link of device or module It connects, can be electrical property, mechanical or other forms.
The module as illustrated by the separation member may or may not be physically separated, aobvious as module The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple In network unit.Some or all of the modules therein can be selected to realize the mesh of this embodiment scheme according to the actual needs 's.
It, can also be in addition, each functional module in each embodiment of the present invention can integrate in one processing unit It is that modules physically exist alone, can also be integrated in one unit with two or more modules.Above-mentioned module at Unit both can take the form of hardware realization, can also realize in the form of hardware adds SFU software functional unit.
The above-mentioned integrated module realized in the form of software function module, can store and computer-readable deposit at one In storage media.Above-mentioned software function module is stored in a storage medium, including some instructions are used so that a computer Equipment (can be personal computer, server or the network equipment etc.) or processor (English: processor) execute this Shen Please each embodiment the method part steps.
It should be understood that above-mentioned processor can be central processing unit (English: Central Processing Unit, letter Claim: CPU), can also be other general processors, digital signal processor (English: Digital Signal Processor, Referred to as: DSP), specific integrated circuit (English: Application Specific Integrated Circuit, referred to as: ASIC) etc..General processor can be microprocessor or the processor is also possible to any conventional processor etc..In conjunction with hair The step of bright disclosed method, can be embodied directly in hardware processor and execute completion, or with hardware in processor and soft Part block combiner executes completion.
Memory may include high speed RAM memory, it is also possible to and it further include non-volatile memories NVM, for example, at least one Magnetic disk storage can also be USB flash disk, mobile hard disk, read-only memory, disk or CD etc..
Bus can be industry standard architecture (Industry Standard Architecture, ISA) bus, outer Portion's apparatus interconnection (Peripheral Component, PCI) bus or extended industry-standard architecture (ExtEnded Industry Standard Architecture, EISA) bus etc..Bus can be divided into address bus, data/address bus, control Bus etc..For convenient for indicating, the bus in illustrations does not limit only a bus or a type of bus.
Above-mentioned storage medium can be by any kind of volatibility or non-volatile memory device or their combination It realizes, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable Read-only memory (EPROM), programmable read only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, Disk or CD.Storage medium can be any usable medium that general or specialized computer can access.
A kind of illustrative storage medium is coupled to processor, believes to enable a processor to read from the storage medium Breath, and information can be written to the storage medium.Certainly, storage medium is also possible to the component part of processor.It processor and deposits Storage media can be located at specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC in).Certainly, pocessor and storage media can also be used as discrete assembly and be present in electronic equipment or main control device.
Those of ordinary skill in the art will appreciate that: realize that all or part of the steps of above-mentioned each method embodiment can lead to The relevant hardware of program instruction is crossed to complete.Program above-mentioned can be stored in a computer readable storage medium.The journey When being executed, execution includes the steps that above-mentioned each method embodiment to sequence;And storage medium above-mentioned include: ROM, RAM, magnetic disk or The various media that can store program code such as person's CD.
Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention., rather than its limitations;To the greatest extent Pipe present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that: its according to So be possible to modify the technical solutions described in the foregoing embodiments, or to some or all of the technical features into Row equivalent replacement;And these are modified or replaceed, various embodiments of the present invention technology that it does not separate the essence of the corresponding technical solution The range of scheme.

Claims (10)

1. a kind of code generating method characterized by comprising
The corresponding multiple operator nodes of process flow of business to be processed are obtained, the process flow includes multiple processing steps, Each operator node is used to execute at least one processing step in the multiple processing step;
According to the process flow of the business to be processed, the corresponding frame diagram of the multiple operator node, the frame diagram are obtained Operation is patterned to the multiple operator node to obtain;
Configurationization processing is carried out to the frame diagram, generates the corresponding business logic codes of the business to be processed.
2. the method according to claim 1, wherein the process flow according to the business to be processed, is obtained Take the corresponding frame diagram of the multiple operator node, comprising:
According to the process flow of the business to be processed, the association dependence between the multiple operator node is obtained, it is described Association dependence is used to indicate triggering relationship between the multiple operator node, wherein the association dependence includes Dependent Demand and selection rely on, and when the Dependent Demand indicates upstream node triggered as normal, execute present node and upstream section It when putting exception-triggered or skipping triggering, skips present node and is triggered to downstream node, the selection, which relies on, indicates upstream When node is triggered as normal or exception-triggered or skips triggering, present node is executed;
According to the association dependence, the frame diagram is obtained by graphical operation.
3. being generated the method according to claim 1, wherein described carry out configurationization processing to the frame diagram The corresponding business logic codes of the business to be processed, comprising:
According to the frame diagram, the corresponding configuration file of the frame diagram is generated;
According to the business to be processed, the property parameters of each operator node are configured in the configuration file, obtain new match Set file;
According to the new configuration file, the corresponding business logic codes of the business to be processed are generated.
4. the method according to claim 1, wherein the multiple operator node includes initial operator node, knot Beam operator node, and individually operator node and/or directed acyclic graph DAG operator node;
The initial operator node is used to receive the request data package of client transmission, and solves to the request data package Analysis, the end operator node are used to send response data packet to the client, and the independent operator node is for executing institute A processing step in multiple processing steps is stated, the DAG operator node is for executing in the multiple processing step extremely Few two processing steps.
5. according to the method described in claim 4, it is characterized in that, the initial operator node, the end operator node with And the independent operator node calls a general operator respectively, the DAG operator node calls at least two general operators, In, the general operator is that the generalization of the called business for handling different disposal process calculates operator.
6. according to the method described in claim 5, it is characterized in that, the general operator is provided at least one in lower interface It is a:
Pre-process interface, Processing Interface, post-process interface.
7. according to the method described in claim 2, it is characterized in that, the triggered as normal is indicating the service logic of present node just Really, triggered as normal is carried out to downstream node;The exception-triggered indicates that the service logic of the present node is incorrect, downstream Node carries out exception-triggered;It is described skip triggering indicate upstream node exception-triggered when, skip present node, and to downstream node It carries out skipping triggering.
8. a kind of code generating unit characterized by comprising
Module, the corresponding multiple operator nodes of process flow for obtaining business to be processed are obtained, the process flow includes Multiple processing steps, each operator node are used to execute at least one processing step in the multiple processing step;
The acquisition module is also used to the process flow according to the business to be processed, and it is corresponding to obtain the multiple operator node Frame diagram, the frame diagram to the multiple operator node be patterned operation obtain;
Processing module generates the corresponding service logic of the business to be processed for carrying out configurationization processing to the frame diagram Code.
9. a kind of terminal characterized by comprising memory and processor;
The memory, for storing program code;
The processor, for calling said program code to execute the code building side as described in claim 1-7 any one Method.
10. a kind of readable storage medium storing program for executing, which is characterized in that be stored with computer program on the readable storage medium storing program for executing;The meter Calculation machine program when executed, realizes the code generating method as described in claim 1-7 any one.
CN201910507093.XA 2019-06-12 2019-06-12 Code generating method and device Pending CN110297632A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910507093.XA CN110297632A (en) 2019-06-12 2019-06-12 Code generating method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910507093.XA CN110297632A (en) 2019-06-12 2019-06-12 Code generating method and device

Publications (1)

Publication Number Publication Date
CN110297632A true CN110297632A (en) 2019-10-01

Family

ID=68027909

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910507093.XA Pending CN110297632A (en) 2019-06-12 2019-06-12 Code generating method and device

Country Status (1)

Country Link
CN (1) CN110297632A (en)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110908644A (en) * 2019-10-16 2020-03-24 浙江大搜车软件技术有限公司 Configuration method and device of state node, computer equipment and storage medium
CN111125451A (en) * 2019-12-25 2020-05-08 北京百度网讯科技有限公司 Data production processing method and device, electronic equipment and storage medium
CN111399827A (en) * 2020-03-09 2020-07-10 北京国信会视科技有限公司 Descriptive object code automatic generation method for sensor data processing
CN111488495A (en) * 2020-04-14 2020-08-04 北京字节跳动网络技术有限公司 Information processing method and device
CN112148353A (en) * 2020-09-22 2020-12-29 京东数字科技控股股份有限公司 Data processing method and device
CN112199086A (en) * 2020-09-18 2021-01-08 北京达佳互联信息技术有限公司 Automatic programming control system, method, device, electronic device and storage medium
CN112270413A (en) * 2020-10-22 2021-01-26 北京百度网讯科技有限公司 Operator merging method and device, electronic equipment and storage medium
CN112685154A (en) * 2020-12-25 2021-04-20 北京有竹居网络技术有限公司 Data processing method of task flow engine, device and medium
CN112783614A (en) * 2021-01-20 2021-05-11 北京百度网讯科技有限公司 Object processing method, device, equipment, storage medium and program product
CN112799797A (en) * 2019-11-14 2021-05-14 北京沃东天骏信息技术有限公司 Task management method and device
CN112825525A (en) * 2019-11-20 2021-05-21 北京百度网讯科技有限公司 Method and apparatus for processing transactions
CN113031929A (en) * 2021-04-29 2021-06-25 中国工商银行股份有限公司 Service implementation method and device
CN113760394A (en) * 2020-06-03 2021-12-07 阿里巴巴集团控股有限公司 Data processing method and device, electronic equipment and storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102591654A (en) * 2011-12-28 2012-07-18 方正国际软件有限公司 Code generator based on SSH (secure shell) architecture and method
CN103870260A (en) * 2012-12-14 2014-06-18 腾讯科技(深圳)有限公司 Method and system for service interface development
US20170177312A1 (en) * 2015-12-18 2017-06-22 International Business Machines Corporation Dynamic recompilation techniques for machine learning programs
CN107463595A (en) * 2017-05-12 2017-12-12 中国科学院信息工程研究所 A kind of data processing method and system based on Spark
CN108628605A (en) * 2018-04-28 2018-10-09 百度在线网络技术(北京)有限公司 Stream data processing method, device, server and medium
CN109799991A (en) * 2017-11-16 2019-05-24 中标软件有限公司 Compilation of source code method and system based on MapReduce frame distributed computing environment
CN109814986A (en) * 2017-11-20 2019-05-28 上海寒武纪信息科技有限公司 Task method for parallel processing, storage medium, computer equipment, device and system
CN109857667A (en) * 2019-02-03 2019-06-07 苏州市龙测智能科技有限公司 Automatic interface testing method, test device, test equipment and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102591654A (en) * 2011-12-28 2012-07-18 方正国际软件有限公司 Code generator based on SSH (secure shell) architecture and method
CN103870260A (en) * 2012-12-14 2014-06-18 腾讯科技(深圳)有限公司 Method and system for service interface development
US20170177312A1 (en) * 2015-12-18 2017-06-22 International Business Machines Corporation Dynamic recompilation techniques for machine learning programs
CN107463595A (en) * 2017-05-12 2017-12-12 中国科学院信息工程研究所 A kind of data processing method and system based on Spark
CN109799991A (en) * 2017-11-16 2019-05-24 中标软件有限公司 Compilation of source code method and system based on MapReduce frame distributed computing environment
CN109814986A (en) * 2017-11-20 2019-05-28 上海寒武纪信息科技有限公司 Task method for parallel processing, storage medium, computer equipment, device and system
CN108628605A (en) * 2018-04-28 2018-10-09 百度在线网络技术(北京)有限公司 Stream data processing method, device, server and medium
CN109857667A (en) * 2019-02-03 2019-06-07 苏州市龙测智能科技有限公司 Automatic interface testing method, test device, test equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
周永江: "基于SCA的物联网服务系统中事件处理平台的设计与实现", 《中国优秀硕士学位论文全文数据库信息科技辑》 *

Cited By (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110908644A (en) * 2019-10-16 2020-03-24 浙江大搜车软件技术有限公司 Configuration method and device of state node, computer equipment and storage medium
CN110908644B (en) * 2019-10-16 2023-12-12 浙江大搜车软件技术有限公司 Configuration method and device of state node, computer equipment and storage medium
CN112799797B (en) * 2019-11-14 2024-04-16 北京沃东天骏信息技术有限公司 Task management method and device
CN112799797A (en) * 2019-11-14 2021-05-14 北京沃东天骏信息技术有限公司 Task management method and device
CN112825525A (en) * 2019-11-20 2021-05-21 北京百度网讯科技有限公司 Method and apparatus for processing transactions
CN111125451A (en) * 2019-12-25 2020-05-08 北京百度网讯科技有限公司 Data production processing method and device, electronic equipment and storage medium
CN111399827A (en) * 2020-03-09 2020-07-10 北京国信会视科技有限公司 Descriptive object code automatic generation method for sensor data processing
CN111399827B (en) * 2020-03-09 2023-01-24 北京国信会视科技有限公司 Descriptive object code automatic generation method for sensor data processing
CN111488495A (en) * 2020-04-14 2020-08-04 北京字节跳动网络技术有限公司 Information processing method and device
CN113760394A (en) * 2020-06-03 2021-12-07 阿里巴巴集团控股有限公司 Data processing method and device, electronic equipment and storage medium
CN112199086A (en) * 2020-09-18 2021-01-08 北京达佳互联信息技术有限公司 Automatic programming control system, method, device, electronic device and storage medium
CN112148353A (en) * 2020-09-22 2020-12-29 京东数字科技控股股份有限公司 Data processing method and device
CN112270413B (en) * 2020-10-22 2024-02-27 北京百度网讯科技有限公司 Operator merging method, device, electronic equipment and storage medium
CN112270413A (en) * 2020-10-22 2021-01-26 北京百度网讯科技有限公司 Operator merging method and device, electronic equipment and storage medium
WO2022135079A1 (en) * 2020-12-25 2022-06-30 北京有竹居网络技术有限公司 Data processing method for task flow engine, and task flow engine, device and medium
CN112685154A (en) * 2020-12-25 2021-04-20 北京有竹居网络技术有限公司 Data processing method of task flow engine, device and medium
CN112783614A (en) * 2021-01-20 2021-05-11 北京百度网讯科技有限公司 Object processing method, device, equipment, storage medium and program product
CN113031929A (en) * 2021-04-29 2021-06-25 中国工商银行股份有限公司 Service implementation method and device
CN113031929B (en) * 2021-04-29 2024-04-09 中国工商银行股份有限公司 Service realization method and device

Similar Documents

Publication Publication Date Title
CN110297632A (en) Code generating method and device
CN108415832B (en) Interface automation test method, device, equipment and storage medium
WO2020029375A1 (en) Interface testing method and system, and computer device and storage medium
CN111083225A (en) Data processing method and device in Internet of things platform and Internet of things platform
CN110032511A (en) A kind of interface test method and interface testing equipment
CN108628748B (en) Automatic test management method and automatic test management system
CN111343181B (en) Message processing method and system, data pool and computer readable storage medium
CN104360937A (en) Intelligent parameter checking device
CN110210845B (en) Method, apparatus, medium, and computing device for blockchain data migration
CN106843818B (en) Business model generation method and device
CN112348326A (en) Bank business processing method and system
CN113127108A (en) Service request processing method and device, storage medium and electronic equipment
CN114168190A (en) Interface document generation method and device, computer equipment and storage medium
CN106897060A (en) Based on patterned data processing method and device
CN114217887A (en) Micro-service arranging method, micro-service executing method, micro-service arranging device and micro-service executing server
CN108537534A (en) A kind of universal payment method and system device of adaptation multiple terminals
CN109670952B (en) Collecting and paying transaction platform
CN109816462A (en) A kind of recognition methods of invoice information and device
CN109858874A (en) Payment approval process configuration method and device under a kind of more scenes
CN114201166A (en) Message information generation method and device, electronic equipment and storage medium
CN111953540B (en) Message generation method and device, electronic equipment and storage medium
CN107797793A (en) A kind of method and apparatus for building proxy server framework
CN114500640A (en) Message generation method, message transmission device, electronic equipment and medium
CN108076067B (en) Method and system for authorized crawler configuration simulation login
CN114371866A (en) Version reconfiguration test method, device and equipment of service system

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20191001