CN117008899A - Code generation method, device, computer readable storage medium and electronic equipment - Google Patents

Code generation method, device, computer readable storage medium and electronic equipment Download PDF

Info

Publication number
CN117008899A
CN117008899A CN202310540108.9A CN202310540108A CN117008899A CN 117008899 A CN117008899 A CN 117008899A CN 202310540108 A CN202310540108 A CN 202310540108A CN 117008899 A CN117008899 A CN 117008899A
Authority
CN
China
Prior art keywords
sub
code
scene
target
packet
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
CN202310540108.9A
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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202310540108.9A priority Critical patent/CN117008899A/en
Publication of CN117008899A publication Critical patent/CN117008899A/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/36Software reuse
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/35Creation or generation of source code model driven

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a code generation method, a code generation device, a computer readable storage medium and electronic equipment. Relates to the field of financial science and technology, and the method comprises the following steps: acquiring N sub-scenes; for each sub-scene, determining a code packet matched with the sub-scene and a storage packet according to parameters required to be used in the sub-scene, wherein the code packet is used for completing the operation with an association relation with the parameters, and the storage packet is used for storing real parameter values used in the application of the sub-scene; generating an object code packet in the object service scene according to the first association relationship, the second association relationship, the code packet and the storage packet, wherein the first association relationship is the association relationship among N sub-scenes, and the second association relationship is the association relationship among each sub-scene, the code packet and the storage packet. The invention solves the technical problem of high labor cost in the prior art due to the fact that codes needed to be used in a service scene are generated manually.

Description

Code generation method, device, computer readable storage medium and electronic equipment
Technical Field
The present invention relates to the field of financial science and technology, and in particular, to a code generation method, a code generation device, a computer readable storage medium, and an electronic device.
Background
With the rapid development of information technology, business codes with very high repeatability are increasingly developed, and great pressure is brought to current developers. Based on the continuous optimization of the business scenario and the continuous increase of the scenario development requirements, the staff needs to frequently write codes needed to be used in the new business scenario. In the process, because the level of the developer is uneven, the understanding depth of the code is insufficient, so that a great deal of manpower and time are required, and problems are easy to occur in the code writing process, so that the problem of high labor cost exists.
In view of the above problems, no effective solution has been proposed at present.
Disclosure of Invention
The embodiment of the invention provides a code generation method, a code generation device, a computer readable storage medium and electronic equipment, which at least solve the technical problem of high labor cost due to the fact that codes required to be used in a manual generation business scene in the prior art are relied on.
According to an aspect of an embodiment of the present invention, there is provided a code generation method including: acquiring N sub-scenes, wherein the N sub-scenes are scenes in a target service scene, and N is a positive integer greater than 1; for each sub-scene, determining a code packet matched with the sub-scene and a storage packet according to parameters required to be used in the sub-scene, wherein the code packet is used for completing the operation with an association relation with the parameters, and the storage packet is used for storing real parameter values used in the application of the sub-scene; generating an object code package under the object service scene according to the first association relationship, the second association relationship, the code package and the storage package, wherein the first association relationship is the association relationship among N sub-scenes, the second association relationship is the association relationship among each sub-scene, the code package and the storage package, and the object code package is used for providing services under the object service scene.
Further, the code generation method further includes: acquiring code fragments matched with parameters required to be used in the sub-scene, and combining the code fragments to obtain a code packet matched with the sub-scene; and acquiring parameter information of parameters required to be used in the sub-scene, and generating a storage packet matched with the sub-scene according to the parameter information.
Further, the code generation method further includes: before determining the code packet and the storage packet matched with the sub-scene according to the parameters required to be used in the sub-scene, the method further comprises: generating an entity corresponding to each sub-scene, and generating an initial relation diagram according to the entity corresponding to each sub-scene; responding to the target creation operation of the target object on the relationship between the entities, determining the association relationship between the entities in the initial relationship graph, and updating the initial relationship graph according to the association relationship between the entities to obtain a target relationship graph; after determining the code packet and the storage packet matched with the sub-scene according to the parameters required to be used in the sub-scene, the method further comprises: generating an entity corresponding to the code packet and an entity corresponding to the storage packet in the target relation diagram; and connecting the entity of the code packet with the entity of the sub-scene matched with the code packet in the target relation graph, and connecting the entity of the storage packet with the entity of the sub-scene matched with the code packet to obtain an updated target relation graph, wherein the updated target relation graph is used for determining a first association relation and a second association relation.
Further, the target creation operation includes a first creation operation and a second creation operation, wherein the code generation method further includes: responding to a first creation operation of the target object on the relationship between the entities, and determining the entity with the association relationship in the initial relationship graph; determining target parameters in response to a second creation operation of the target object on the relationship between the entities, wherein the entities with the association relationship generate the association relationship through the target parameters; generating a target connection line between entities with association relations in the initial relation diagram to obtain a first relation diagram; and generating the attribute of the target connection line in the first relation graph according to the target parameter to obtain the target relation graph.
Further, the code generation method further includes: determining a first association relationship and a second association relationship according to the updated target relationship graph; generating a calling code according to the first association relation and the second association relation, wherein the calling code is used for calling a code packet and a storage packet according to a service request under a target service scene; and generating an object code package according to the calling code, the code package and the storage package.
Further, the code generation method further includes: acquiring test code fragments matched with parameters required to be used in the sub-scene, and generating a test code packet matched with the sub-scene according to the test code fragments, wherein the test code packet is used for testing the code packet; and generating an object code packet according to the test code packet, the calling code, the code packet and the storage packet matched with the N sub-scenes.
Further, the code generation method further includes: acquiring N scene information tables matched with N sub scenes, wherein the sub scenes are matched with the scene information tables one by one, each scene information table comprises a plurality of parameters and parameter information of each parameter, and the parameters in the scene information table are used for representing data content with association relation with the sub scenes; and responding to the choosing operation of the target object on the parameters in the N scene information tables, and determining the parameters required to be used in the sub-scenes.
According to another aspect of the embodiment of the present invention, there is also provided a code generating apparatus, including: the first acquisition module is used for acquiring N sub-scenes, wherein the N sub-scenes are scenes in a target service scene, and N is a positive integer greater than 1; the first determining module is used for determining a code packet matched with each sub-scene and a storage packet according to parameters required to be used in the sub-scene, wherein the code packet is used for completing the operation with the association relation with the parameters, and the storage packet is used for storing real parameter values used in the application of the sub-scene; the first generation module is used for generating an object code package under the object service scene according to the first association relationship, the second association relationship, the code package and the storage package, wherein the first association relationship is the association relationship among N sub-scenes, the second association relationship is the association relationship among each sub-scene, the code package and the storage package, and the object code package is used for providing services under the object service scene.
According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium having a computer program stored therein, wherein the computer program is configured to execute the code generation method described above when run.
According to another aspect of an embodiment of the present invention, there is also provided an electronic device including one or more processors; and a memory for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement a method for running the program, wherein the program is configured to perform the code generation method described above when run.
In the embodiment of the invention, a mode of automatically generating a code packet for providing services under a target service scene is adopted, N sub-scenes are obtained, then for each sub-scene, the code packet matched with the sub-scene and a storage packet are determined according to parameters required to be used under the sub-scene, so that the target code packet under the target service scene is generated according to a first association, a second association, the code packet and the storage packet, wherein N sub-scenes are scenes under the target service scene, N is a positive integer larger than 1, the code packet is used for completing operations with the parameters, the storage packet is used for storing real parameter values used when the sub-scenes are applied, the first association is the association between N sub-scenes, the second association is the association between each sub-scene and the code packet and the storage packet, and the target code packet is used for providing services under the target service scene.
In the process, the code package and the storage package matched with the sub-scene are determined according to the parameters required to be used in the sub-scene, so that the automatic construction of the functions required by the sub-scene is realized, and the effective determination of the calling logic of the code package and the storage package is realized by acquiring the first association and the second association relation. Further, by generating the target code package under the target service scene according to the first association relationship, the second association relationship, the code package and the storage package, accurate generation of the target code package is realized, namely, accurate generation of codes required to be used under the service scene is realized, and therefore labor cost is reduced.
Therefore, the scheme provided by the application achieves the purpose of automatically generating the code packet for providing the service under the target service scene, thereby realizing the technical effect of reducing the labor cost, and further solving the technical problem of high labor cost due to the fact that codes required to be used under the manual generation service scene in the prior art are relied on.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute a limitation on the application. In the drawings:
FIG. 1 is a flow chart of an alternative code generation method according to an embodiment of the invention;
FIG. 2 is a schematic diagram of an alternative code generation method according to an embodiment of the invention;
FIG. 3 is a schematic diagram of an alternative code generation apparatus according to an embodiment of the present invention;
fig. 4 is a schematic diagram of an alternative electronic device according to an embodiment of the invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that the code generation method, apparatus, computer readable storage medium and electronic device of the present disclosure may be used in the field of financial science and technology, and may also be used in any field other than the field of financial science and technology, and the application fields of the code generation method, apparatus, computer readable storage medium and electronic device of the present disclosure are not limited.
It should be noted that, the user information (including but not limited to user equipment information, user personal information, etc.) and the data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are information and data authorized by the user or fully authorized by each party, and the collection, use and processing of the related data need to comply with the related laws and regulations and standards of the related country and region, and provide corresponding operation entries for the user to select authorization or rejection.
Example 1
According to an embodiment of the present application, there is provided an embodiment of a code generation method, it being noted that the steps shown in the flowcharts of the drawings may be performed in a computer system such as a set of computer executable instructions, and that although a logical order is shown in the flowcharts, in some cases the steps shown or described may be performed in an order different from that herein.
FIG. 1 is a flow chart of an alternative code generation method according to an embodiment of the present invention, as shown in FIG. 1, comprising the steps of:
step S101, N sub-scenes are obtained, wherein the N sub-scenes are scenes in a target service scene, and N is a positive integer greater than 1.
Optionally, the N sub-scenes may be acquired by an electronic device, an application system, a server, or other devices. In the present embodiment, the target generation system is taken as an execution subject to acquire N sub-scenes.
Optionally, the foregoing N sub-scenes may be selected by a worker from M sub-scenes in advance, where M is a positive integer greater than N, and the N sub-scenes belong to the same target service scene, for example, the target service scene is a credit scene, and one of the N sub-scenes may be a credit scene, and another of the N sub-scenes is a loan scene.
Step S102, for each sub-scene, determining a code packet matched with the sub-scene and a storage packet according to parameters required to be used in the sub-scene, wherein the code packet is used for completing the operation with the association relation with the parameters, and the storage packet is used for storing real parameter values used in the application of the sub-scene.
The staff can set the corresponding relation between the sub-scene and the parameters required to be used in the database in advance, so that the target generation system can directly determine the parameters required to be used in the sub-scene from the database after determining the sub-scene. Optionally, the staff may set the corresponding relation between the sub-scene and the parameters having the association relation with the sub-scene in the database in advance, so that after the sub-scene is determined by the target generating system, the parameters having the association relation with the sub-scene are determined from the database, and then the parameters required to be used by the sub-scene are selected from the parameters by the user for the target generating system to acquire.
Further, after determining the parameters required to be used in the sub-scene, for each parameter, the target generation system may generate corresponding code segments by using a pre-trained neural network according to the operation description of the operation of the parameter with the association relation with the parameter according to the parameter information of the parameter, so as to obtain the code packet by combining. Alternatively, the staff may preset the code segments corresponding to each parameter in the database in advance, so that the corresponding code segments are directly found after the parameters are determined, and the code packages are obtained through combination. In the credit investigation scene, the parameters to be used can be name, age, income, consumption, credit investigation value and the like, and the operation of the association relation with the parameters can be to add, delete and check the parameter value of the parameter income, calculate the credit investigation value according to the name, age, income, consumption and the like.
Still further, the target generation system may generate a storage packet matching the sub-scene according to the parameter information of the parameter. The parameter information includes, but is not limited to, description information of a parameter, a type of a parameter value, etc., where the description information of the parameter may include a name of the parameter, a usage of the parameter (e.g., a corresponding relationship between the parameter and a service request in a sub-scenario), a method for acquiring the parameter value, etc. For example, the table structure required for storing the parameters in the sub-scene is determined according to the names of the parameters, the types of the parameter values (such as discrete or discrete), etc., so that a corresponding storage packet is generated according to the table structure, and the parameter information of the parameters is recorded in the storage packet, wherein it is emphasized that the actual parameter values corresponding to the parameters are stored in the storage packet after the application of the target code packet is obtained later.
It should be noted that, by determining the code packet and the storage packet matched with the sub-scene according to the parameters required to be used in the sub-scene, the automatic construction of the functions required in the sub-scene is realized, and the problem of high labor cost in manually writing codes is avoided. In addition, by separately generating the code package and the storage package, the data storage function and the data processing function are effectively decoupled, so that personnel can realize personalized modification of the two functions in practical application.
Step S103, generating an object code package under the object service scene according to the first association relationship, the second association relationship, the code package and the storage package, wherein the first association relationship is the association relationship among N sub-scenes, the second association relationship is the association relationship among each sub-scene, the code package and the storage package, and the object code package is used for providing services under the object service scene.
In step S103, after determining the code package and the storage package that match each sub-scene, the worker may input the association relationship between the N sub-scenes into the target generation system to cause the target generation system to acquire. And then, the target generation system can determine the calling logic of the code package and the storage package according to the first association relation and the second association relation, and further generate a corresponding calling code, so that the target code package in the target service scene is generated according to the calling code, the code package and the storage package. The second association relation is automatically determined by the target generation system when the code package and the storage package are generated.
It should be noted that, by acquiring the first association relationship and the second association relationship, the effective determination of the calling logic of the code package and the storage package can be realized, and further, by generating the target code package under the target service scene according to the first association relationship, the second association relationship, the code package and the storage package, the accurate generation of the target code package is realized, that is, the accurate generation of the code required to be used under the service scene is realized, thereby reducing the labor cost.
Based on the scheme defined in the steps S101 to S103, it can be known that in the embodiment of the present invention, by adopting a manner of automatically generating a code packet for providing a service in a target service scenario, N sub-scenarios are acquired, then for each sub-scenario, a code packet and a storage packet matched with the sub-scenario are determined according to parameters required to be used in the sub-scenario, so that a target code packet in the target service scenario is generated according to a first association relationship, a second association relationship, the code packet and the storage packet, where N is a scenario in the target service scenario, N is a positive integer greater than 1, the code packet is used for completing an operation with the parameters, the storage packet is used for storing a real parameter value used when the sub-scenario is applied, the first association relationship is an association relationship between N sub-scenarios, the second association relationship is an association relationship between each sub-scenario and the code packet and the storage packet, and the target code packet is used for providing the service in the target service scenario.
It is easy to note that in the above process, by determining the code packet and the storage packet that match the sub-scenario according to the parameters that need to be used in the sub-scenario, automatic construction of the functions that need to be used in the sub-scenario is achieved, and by acquiring the first association and the second association relationship, efficient determination of call logic of the code packet and the storage packet is achieved. Further, by generating the target code package under the target service scene according to the first association relationship, the second association relationship, the code package and the storage package, accurate generation of the target code package is realized, namely, accurate generation of codes required to be used under the service scene is realized, and therefore labor cost is reduced.
Therefore, the scheme provided by the application achieves the purpose of automatically generating the code packet for providing the service under the target service scene, thereby realizing the technical effect of reducing the labor cost, and further solving the technical problem of high labor cost due to the fact that codes required to be used under the manual generation service scene in the prior art are relied on.
In an alternative embodiment, the parameters required to be used in a sub-scenario are determined by: and acquiring N scene information tables matched with the N sub-scenes, and then responding to the operation of the target object for checking the parameters in the N scene information tables to determine the parameters required to be used in the sub-scenes. The sub-scenes are matched with the scene information tables one by one, each scene information table comprises a plurality of parameters and parameter information of each parameter, and the parameters in the scene information table are used for representing data content with association relation with the sub-scenes.
Alternatively, in this embodiment, the staff may configure a scene information table for each sub-scene match in the database in advance. Alternatively, the scenario information table may be automatically generated by the target generation system according to the execution logic of the history service. The scene information table contains a plurality of parameters having an association relationship with the sub-scene and parameter information of each parameter.
Further, fig. 2 is a schematic diagram of an alternative code generating method according to an embodiment of the present application, as shown in fig. 2, after determining a sub-scene, the target generating system may perform information interaction with the database to obtain parameters in the scene information table, display parameters in the scene information table matched with the sub-scene through the sub-scene identifier, and then select the required parameters by a worker as required, so that the target generating system may determine the parameters required to be used in the sub-scene according to the selection result.
It should be noted that, by determining the parameters required to be used in the sub-scene according to the operation of selecting the target object, the applicability of the method provided by the application is improved.
In an alternative embodiment, in determining the code packet and the storage packet matched with the parameters required to be used in the sub-scene according to the parameters required to be used in the sub-scene, the target generating system may acquire the code fragments matched with the parameters required to be used in the sub-scene, combine the code fragments to obtain the code packet matched with the sub-scene, acquire the parameter information of the parameters required to be used in the sub-scene, and generate the storage packet matched with the sub-scene according to the parameter information.
Alternatively, the foregoing code segments may be preset in the database by a worker. The code segments are used for completing the operation of having the association relation with the parameters corresponding to the code segments, so that as shown in fig. 2, after the target generation system searches the code segments matched with each parameter required to be used in the sub-scene from the database, the code segments corresponding to the parameters are combined, and the code package matched with the sub-scene can be obtained. In an alternative embodiment, the aforementioned code packet of the sub-scene matching may be a data Domain module ACS in DDD (Domain-driver Design).
Further, as shown in fig. 2, the target generating system may generate a storage packet matched with the sub-scene according to the parameter information of the parameters in the database. For example, a table structure required for storing parameters in a sub-scene is determined according to names of the parameters, types of parameter values (e.g., discrete or discrete), etc., so that a corresponding storage packet is generated according to the table structure, and parameter information of the parameters is recorded in the storage packet. In an alternative embodiment, the aforementioned sub-scene matching storage package may be a domain driver module BOS in the DDD.
It should be noted that, the code package is obtained by combining the code segments, so that the code segments are effectively multiplexed, on one hand, the labor cost is reduced, and on the other hand, the stability of the code package is improved. In addition, by generating the storage package according to the parameter information, efficient generation of the storage package is achieved.
In an alternative embodiment, before determining the code packet and the storage packet matched with the sub-scene according to the parameters required to be used in the sub-scene, the target generation system may generate an entity corresponding to each sub-scene, generate an initial relationship graph according to the entity corresponding to each sub-scene, then respond to a target creation operation of the target object on the relationship between the entities, determine the association relationship between the entities in the initial relationship graph, and update the initial relationship graph according to the association relationship between the entities to obtain the target relationship graph. In addition, after determining the code packet and the storage packet matched with the sub-scene according to the parameters required to be used in the sub-scene, the target generation system may generate an entity corresponding to the code packet and an entity corresponding to the storage packet in the target relationship graph, then connect the entity of the code packet with the entity of the sub-scene matched with the code packet in the target relationship graph, and connect the entity of the storage packet with the entity of the sub-scene matched with the code packet, thereby obtaining an updated target relationship graph, where the updated target relationship graph is used for determining the first association relationship and the second association relationship.
Optionally, the target generating system may read a scene information table of sub-scene matching in the database, thereby generating an entity corresponding to the sub-scene, and take information recorded in the scene information table as an entity attribute of the entity corresponding to the sub-scene, and may also create an entity identifier in the generated entity. The target generation system may then generate an initial relationship graph from the entities corresponding to each sub-scenario. After the initial relationship diagram is generated, the target generation system displays the initial relationship diagram to the staff, and then responds to the target creation operation of the staff (namely the target object) on the relationship between the entities in the initial entity relationship diagram, so that the target relationship diagram is obtained according to the target creation operation of the staff, and the representation of the first association relationship is realized in the relationship diagram. The foregoing target creation operation may be an instruction to connect two entities, an instruction to add a description to an association relationship between two entities, or the like, and the update method for the initial relationship graph may be a method of creating a connection between two entities, adding an attribute to the created connection, or the like.
Further, after the code package and the storage package are generated, the target generation system may create an entity corresponding to the code package and an entity corresponding to the storage package in the target relationship graph, then connect the entity of the code package and the entity of the sub-scene in the target relationship graph, and connect the entity of the storage package and the entity of the sub-scene, so as to obtain an updated target relationship graph, thereby realizing the representation of the second association relationship in the relationship graph. The updated target relation diagram can be displayed to the staff, so that the staff can conduct personalized adjustment.
It should be noted that, by constructing the first association relationship and the second association relationship in the relationship diagram, on one hand, the user can conveniently and intuitively review the relationship diagram, and on the other hand, the user can more conveniently execute the operation for creating the relationship between the entities.
In an alternative embodiment, the target creation operation includes a first creation operation and a second creation operation, where in the process of responding to the target creation operation of the relationship between the target object and the entities, determining an association relationship between the entities in the initial relationship graph, and updating the initial relationship graph according to the association relationship between the entities, in the process of obtaining the target relationship graph, the target generation system may respond to the first creation operation of the relationship between the target object and the entities, determine the entity having the association relationship in the initial relationship graph, and then respond to the second creation operation of the relationship between the target object and the entities, determine the target parameter, thereby generating a target connection line between the entities having the association relationship in the initial relationship graph, obtaining the first relationship graph, and generate the attribute of the target connection line in the first relationship graph according to the target parameter, so as to obtain the target relationship graph. Wherein, the entities with the association relationship generate the association relationship through the target parameters.
Optionally, the staff may connect the entities having the association relationship in the initial relationship diagram (i.e. the aforementioned first creation operation), so that the target generating system may determine that the connected entity is the entity having the association relationship. For example, in a credit scenario, a credit value of a user in a credit sub-scenario enters a loan sub-scenario when the credit value reaches a certain value, and therefore, an entity corresponding to the credit sub-scenario and an entity corresponding to the loan sub-scenario are entities with an association relationship.
Optionally, the staff may mark a parameter corresponding to an entity in the entities having the association relationship in the initial relationship diagram (i.e. the aforementioned second creation operation), so that the target generation system may determine the checked parameter as a target parameter, for example, the aforementioned credit value is a target parameter between the credit sub-scene and the loan sub-scene. In addition, the staff may add a trigger condition to the marked parameter when marking, where the trigger condition characterizes a condition that needs to be met when the target parameter makes the entities have an association relationship, or a condition that needs to be met when the target parameter makes the entities have no association relationship, for example, the trigger condition may be that the aforementioned "the credit value of the user reaches a certain value".
Then, the initial relationship graph can generate a target connection line between entities with association relationship to obtain a first relationship graph, and then generate the attribute of the target connection line in the first relationship graph according to the target parameter to obtain a target relationship graph, or generate the attribute of the target connection line in the first relationship graph according to the target parameter and the trigger condition to obtain the target relationship graph. Optionally, the target generating system may further set the same service scenario identifier for the entity corresponding to each sub-scenario in the target relationship diagram.
It should be noted that, by associating the entities in the initial relationship graph according to the operation of the target object, the effective construction of the target relationship graph is realized.
In an alternative embodiment, in the process of generating the target code package under the target service scene according to the first association relationship, the second association relationship, the code package and the storage package, the target generation system may determine the first association relationship and the second association relationship according to the updated target relationship graph, and then generate the calling code according to the first association relationship and the second association relationship, so as to generate the target code package according to the calling code, the code package and the storage package. The calling code is used for calling code packets and storage packets according to the service request in the target service scene.
Optionally, the target generating system may directly extract the first association relationship and the second association relationship from the target relationship graph, so as to determine call logic for the code package and the storage package under different service requests according to the first association relationship and the second association relationship, and generate the call code based on the call logic. The target generation system can generate calling codes based on a pre-trained neural network model, and a training sample set adopted by the neural network model can be composed of description languages corresponding to calling logic. Optionally, the staff may preset a template for generating the calling code in the database, and then the target generating system fills the corresponding code package, the calling mode of the storage package and the identifier into the generated template, so as to obtain the calling code.
Further, the target generation system can construct a target code package based on the calling code, the code package and the storage package according to preset first construction logic.
It should be noted that, by generating the calling code according to the first association relationship and the second association relationship, the effective determination of the calling conditions of the code package and the storage package is realized, so that the generated target code package can accurately provide the service under the target service scene.
In an alternative embodiment, in the process of generating the target code package according to the calling code, the code package and the storage package, the target generating system may acquire the test code segments matched by the parameters required to be used in the sub-scenario, and generate the sub-scenario matched test code package according to the test code segments, so as to generate the target code package according to the N sub-scenario matched test code packages, the calling code, the code package and the storage package. The test code package is used for testing the code package.
Alternatively, the test code segments may be pre-stored by the staff member to the database. As shown in fig. 2, in the process of generating the object code package, the object generation system may find out the test code segments matched with the parameters required to be used in the sub-scenario from the database, so as to combine the test code segments in the scenario into the test code package.
And then, the target generation system can construct and obtain a target code packet based on the test code packet, the calling code, the code packet and the storage packet matched with the N sub-scenes according to preset second construction logic.
It should be noted that, by adding the test code segment into the target code packet, an effective test of the generated code packet can be achieved, thereby ensuring the code quality of the target code packet.
Therefore, in the application, the rapid modeling is realized through the service scene, the rapid generation of codes is carried out aiming at specific service demands, and the generation of the code package and the storage package enables the scene multiplexing to be realized while the standardized code output is realized, thereby achieving the purpose of automatically generating the code package for providing the service under the target service scene, further realizing the technical effect of reducing the labor cost, and further solving the technical problem of high labor cost due to the dependence on the codes needed under the manual generation service scene in the prior art.
Example 2
According to an embodiment of the present application, there is provided an embodiment of a code generating apparatus, wherein fig. 3 is a schematic diagram of an alternative code generating apparatus according to an embodiment of the present application, as shown in fig. 3, the apparatus includes:
the first obtaining module 301 is configured to obtain N sub-scenes, where N sub-scenes are scenes in the target service scene, and N is a positive integer greater than 1;
the first determining module 302 is configured to determine, for each sub-scene, a code packet and a storage packet that are matched with the sub-scene according to parameters that need to be used in the sub-scene, where the code packet is used to complete an operation that has an association relationship with the parameters, and the storage packet is used to store real parameter values that are used when the sub-scene is applied;
The first generating module 303 is configured to generate an object code packet in the target service scene according to a first association relationship, a second association relationship, a code packet and a storage packet, where the first association relationship is an association relationship between N sub-scenes, the second association relationship is an association relationship between each sub-scene, the code packet and the storage packet, and the object code packet is used to provide services in the target service scene.
It should be noted that the first obtaining module 301, the first determining module 302, and the first generating module 303 correspond to steps S101 to S103 in the above embodiment, and the three modules are the same as examples and application scenarios implemented by the corresponding steps, but are not limited to those disclosed in the above embodiment 1.
Optionally, the first determining module 302 further includes: the combining sub-module is used for acquiring code fragments matched with parameters required to be used in the sub-scene and combining the code fragments to obtain a code packet matched with the sub-scene; the first generation sub-module is used for acquiring parameter information of parameters required to be used in the sub-scene and generating a storage packet matched with the sub-scene according to the parameter information.
Optionally, the code generating device further includes: the second generation module is used for generating an entity corresponding to each sub-scene before determining a code packet matched with the sub-scene and a storage packet according to parameters required to be used in the sub-scene, and generating an initial relation diagram according to the entity corresponding to each sub-scene; the second determining module is used for responding to the target creation operation of the target object on the relation between the entities, determining the association relation between the entities in the initial relation graph, and updating the initial relation graph according to the association relation between the entities to obtain a target relation graph; the third generation module is used for generating an entity corresponding to the code packet and an entity corresponding to the storage packet in the target relation diagram after determining the code packet and the storage packet matched with the sub-scene according to the parameters required to be used in the sub-scene; the processing module is used for connecting the entity of the code packet with the entity of the sub-scene matched with the code packet in the target relation graph, and connecting the entity of the storage packet with the entity of the sub-scene matched with the code packet to obtain an updated target relation graph, wherein the updated target relation graph is used for determining a first association relation and a second association relation.
Optionally, the target creation operation includes a first creation operation and a second creation operation, where the second determination module further includes: the first determining submodule is used for responding to a first creation operation of the relation between the target object and the entity, and determining the entity with the association relation in the initial relation diagram; the second determining submodule is used for responding to a second creation operation of the relation between the target objects and the entities and determining target parameters, wherein the entities with the association relation generate the association relation through the target parameters; the second generation sub-module is used for generating a target connecting line between entities with association relations in the initial relation diagram to obtain a first relation diagram; and the third generation sub-module is used for generating the attribute of the target connection line in the first relation graph according to the target parameter to obtain the target relation graph.
Optionally, the first generating module 303 further includes: the third determining submodule is used for determining a first association relation and a second association relation according to the updated target relation diagram; a fourth generation sub-module, configured to generate a calling code according to the first association relationship and the second association relationship, where the calling code is configured to call a code packet and a storage packet according to a service request in a target service scenario; and the fifth generation sub-module is used for generating an object code packet according to the calling code, the code packet and the storage packet.
Optionally, the fifth generating sub-module further includes: the acquisition unit is used for acquiring test code fragments matched with parameters required to be used in the sub-scene, and generating a test code packet matched with the sub-scene according to the test code fragments, wherein the test code packet is used for testing the code packet; and the generating unit is used for generating an object code packet according to the test code packet, the calling code, the code packet and the storage packet matched with the N sub-scenes.
Optionally, the code generating device further includes: the second acquisition module is used for acquiring N scene information tables matched with N sub scenes, wherein the sub scenes are matched with the scene information tables one by one, each scene information table comprises a plurality of parameters and parameter information of each parameter, and the parameters in the scene information table are used for representing data content with association relation with the sub scenes; and the third determining module is used for responding to the checking operation of the target object on the parameters in the N scene information tables and determining the parameters required to be used in the sub-scenes.
Example 3
According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium having stored therein a computer program, wherein the computer program is configured to execute the code generation method described above when run.
Example 4
According to another aspect of the embodiments of the present application, there is also provided an electronic device, wherein fig. 4 is a schematic diagram of an alternative electronic device according to an embodiment of the present application, as shown in fig. 4, the electronic device including one or more processors; and a memory for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement a method for running the program, wherein the program is configured to perform the code generation method described above when run.
The foregoing embodiment numbers of the present application are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
In the foregoing embodiments of the present application, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed technology may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and the division of units may be a logic function division, and there may be another division manner in actual implementation, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method of the various embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely a preferred embodiment of the present invention and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present invention, which are intended to be comprehended within the scope of the present invention.

Claims (10)

1. A code generation method, comprising:
acquiring N sub-scenes, wherein the N sub-scenes are scenes in a target service scene, and N is a positive integer greater than 1;
for each sub-scene, determining a code packet matched with the sub-scene and a storage packet according to parameters required to be used in the sub-scene, wherein the code packet is used for completing the operation with an association relation with the parameters, and the storage packet is used for storing real parameter values used in the application of the sub-scene;
generating an object code package under the object service scene according to a first association relationship, a second association relationship, the code package and the storage package, wherein the first association relationship is the association relationship among the N sub-scenes, the second association relationship is the association relationship among each sub-scene, the code package and the storage package, and the object code package is used for providing services under the object service scene.
2. The method of claim 1, wherein determining code packets and storage packets matching the sub-scene based on parameters required to be used in the sub-scene comprises:
acquiring code fragments matched with parameters required to be used in the sub-scene, and combining the code fragments to obtain a code packet matched with the sub-scene;
and acquiring parameter information of parameters required to be used in the sub-scene, and generating a storage packet matched with the sub-scene according to the parameter information.
3. The method of claim 1, wherein the step of determining the position of the substrate comprises,
before determining the code packet and the storage packet matched with the sub-scene according to the parameters required to be used in the sub-scene, the method further comprises: generating an entity corresponding to each sub-scene, and generating an initial relation diagram according to the entity corresponding to each sub-scene; responding to a target creation operation of a target object on a relation between entities, determining an association relation between the entities in the initial relation graph, and updating the initial relation graph according to the association relation between the entities to obtain a target relation graph;
after determining the code packet and the storage packet matched with the sub-scene according to the parameters required to be used in the sub-scene, the method further comprises: generating an entity corresponding to the code package and an entity corresponding to the storage package in the target relation diagram; and connecting the entity of the code packet with the entity of the sub-scene matched with the code packet in the target relation graph, and connecting the entity of the storage packet with the entity of the sub-scene matched with the code packet to obtain an updated target relation graph, wherein the updated target relation graph is used for determining the first association relation and the second association relation.
4. The method of claim 3, wherein the target creation operation includes a first creation operation and a second creation operation, wherein determining an association relationship between entities in the initial relationship graph in response to a target creation operation of a relationship between entities by a target object, and updating the initial relationship graph according to the association relationship between entities, and obtaining a target relationship graph includes:
responding to a first creation operation of a target object on the relationship between the entities, and determining the entity with the association relationship in the initial relationship graph;
determining target parameters in response to a second creation operation of the relationship between the target objects to the entities, wherein the entities with the association relationship generate the association relationship through the target parameters;
generating a target connection line between entities with association relations in the initial relation diagram to obtain a first relation diagram;
and generating the attribute of the target connecting line in the first relation diagram according to the target parameter to obtain the target relation diagram.
5. The method of claim 3, wherein generating the target code package in the target business scenario from the first association, the second association, the code package, and the storage package comprises:
Determining the first association relationship and the second association relationship according to the updated target relationship graph;
generating a calling code according to the first association relation and the second association relation, wherein the calling code is used for calling the code package and the storage package according to the service request in the target service scene;
and generating the target code packet according to the calling code, the code packet and the storage packet.
6. The method of claim 5, wherein generating the object code package from the calling code, the code package, and the storage package comprises:
acquiring test code fragments matched with parameters required to be used in the sub-scene, and generating a test code packet matched with the sub-scene according to the test code fragments, wherein the test code packet is used for testing the code packet;
and generating the target code packet according to the test code packet, the calling code, the code packet and the storage packet matched with the N sub-scenes.
7. The method according to claim 1, characterized in that the parameters to be used in the sub-scenario are determined by:
Acquiring N scene information tables matched with the N sub scenes, wherein the sub scenes are matched with the scene information tables one by one, each scene information table comprises a plurality of parameters and parameter information of each parameter, and the parameters in the scene information table are used for representing data content with association relation with the sub scenes;
and responding to the choosing operation of the target object on the parameters in the N scene information tables, and determining the parameters required to be used in the sub-scene.
8. A code generating apparatus, comprising:
the first acquisition module is used for acquiring N sub-scenes, wherein the N sub-scenes are scenes under a target service scene, and N is a positive integer greater than 1;
the first determining module is used for determining a code packet and a storage packet matched with each sub-scene according to parameters required to be used in the sub-scene, wherein the code packet is used for completing the operation with the association relation with the parameters, and the storage packet is used for storing real parameter values used in the application of the sub-scene;
the first generation module is configured to generate a target code packet in the target service scenario according to a first association relationship, a second association relationship, the code packet and the storage packet, where the first association relationship is an association relationship between the N sub-scenarios, the second association relationship is an association relationship between each sub-scenario, the code packet and the storage packet, and the target code packet is configured to provide services in the target service scenario.
9. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein a computer program, wherein the computer program is arranged to execute the code generation method of any of the claims 1 to 7 when run.
10. An electronic device, the electronic device comprising one or more processors; a memory for storing one or more programs that, when executed by the one or more processors, cause the one or more processors to implement a method for running a program, wherein the program is configured to perform the code generation method of any of claims 1 to 7 when run.
CN202310540108.9A 2023-05-12 2023-05-12 Code generation method, device, computer readable storage medium and electronic equipment Pending CN117008899A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310540108.9A CN117008899A (en) 2023-05-12 2023-05-12 Code generation method, device, computer readable storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310540108.9A CN117008899A (en) 2023-05-12 2023-05-12 Code generation method, device, computer readable storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN117008899A true CN117008899A (en) 2023-11-07

Family

ID=88569831

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310540108.9A Pending CN117008899A (en) 2023-05-12 2023-05-12 Code generation method, device, computer readable storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN117008899A (en)

Similar Documents

Publication Publication Date Title
CN109582550B (en) Method, device and server for acquiring full-service scene fault set
US10623929B1 (en) Method and apparatus for shared mobile device app with unique business function adaptation and rendering
CN110806916A (en) Method and system for realizing individual login page of each tenant of SAAS platform
CN112116325A (en) Examination and approval form control method and device, electronic equipment and readable storage medium
US20060123331A1 (en) Method and system of forms management in a call center
US10922075B2 (en) System and method for creating and validating software development life cycle (SDLC) digital artifacts
CN117008899A (en) Code generation method, device, computer readable storage medium and electronic equipment
US20100114844A1 (en) Method and system for data mashup in commenting layer
US20230195792A1 (en) Database management methods and associated apparatus
KR101178998B1 (en) Method and System for Certificating Data
CN110895463B (en) Label processing method, device, equipment and computer readable storage medium
CN110781191B (en) Processing method of layout data and server
Wollersheim et al. Quality analysis approaches for cloud services-towards a framework along the customer’s activity cycle
CN110347986B (en) Form-based information acquisition method and device
CN110096508B (en) Service configuration method and device, service data acquisition method and electronic equipment
US20100064171A1 (en) Tariff management deployment automation
US20080195453A1 (en) Organisational Representational System
CN110569199B (en) Automatic bill testing method and device
CN114238155B (en) Test method, test platform, test device, server and storage medium
CN111460280B (en) Legal service personnel recommendation method based on public legal service platform
CN116843274A (en) Data processing method, data processing device, computer readable storage medium and electronic equipment
CN110674363B (en) Similarity matching method and device between interface services and electronic equipment
KR20240047843A (en) Semantic correctness testing method for quality assurance of ai learning data and system thereof
CN117909353A (en) Method and device for generating form query page, storage medium and electronic equipment
CN117032646A (en) Index configuration method, index execution method and 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