CN117032678A - Asset inventory-based component code generation method, device, equipment and medium - Google Patents
Asset inventory-based component code generation method, device, equipment and medium Download PDFInfo
- Publication number
- CN117032678A CN117032678A CN202310835070.8A CN202310835070A CN117032678A CN 117032678 A CN117032678 A CN 117032678A CN 202310835070 A CN202310835070 A CN 202310835070A CN 117032678 A CN117032678 A CN 117032678A
- Authority
- CN
- China
- Prior art keywords
- product
- component
- page
- project
- asset list
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 67
- 230000006870 function Effects 0.000 claims description 79
- 230000002452 interceptive effect Effects 0.000 claims description 62
- 238000004590 computer program Methods 0.000 claims description 18
- 238000013178 mathematical model Methods 0.000 claims description 14
- 238000004422 calculation algorithm Methods 0.000 claims description 6
- 238000012216 screening Methods 0.000 claims description 6
- 238000000605 extraction Methods 0.000 claims description 4
- 238000011161 development Methods 0.000 abstract description 20
- 230000008569 process Effects 0.000 description 17
- 238000013461 design Methods 0.000 description 7
- 238000010586 diagram Methods 0.000 description 6
- 230000000694 effects Effects 0.000 description 6
- 230000003993 interaction Effects 0.000 description 6
- 238000012545 processing Methods 0.000 description 6
- 230000004044 response Effects 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 4
- 238000013507 mapping Methods 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000013499 data model Methods 0.000 description 3
- 238000001514 detection method Methods 0.000 description 3
- 238000007726 management method Methods 0.000 description 3
- 238000006243 chemical reaction Methods 0.000 description 2
- 238000004891 communication Methods 0.000 description 2
- 238000012790 confirmation Methods 0.000 description 2
- 238000010276 construction Methods 0.000 description 2
- 239000000284 extract Substances 0.000 description 2
- 238000012356 Product development Methods 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008901 benefit Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004140 cleaning Methods 0.000 description 1
- 230000009193 crawling Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000013501 data transformation Methods 0.000 description 1
- 238000000354 decomposition reaction Methods 0.000 description 1
- 230000036541 health Effects 0.000 description 1
- 230000008676 import Effects 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 239000000203 mixture Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000007781 pre-processing Methods 0.000 description 1
- 238000009877 rendering Methods 0.000 description 1
- 238000000926 separation method Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/36—Software reuse
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/30—Computing systems specially adapted for manufacturing
Abstract
The present invention relates to the field of computer software technologies, and in particular, to a method, an apparatus, a device, and a medium for generating component codes based on an asset list. In the invention, the function classification is carried out on the product, the product function tree is established, the component asset list is constructed according to the components in the product function tree, the code template generated based on the component asset list is generated, and the complete asset list is generated according to the code template, so that the asset list and the code template are kept all the time, and the generation efficiency of the component code can be improved under the condition of multiplexing the component codes, thereby improving the development efficiency of the front-end page.
Description
Technical Field
The present invention relates to the field of computer software technologies, and in particular, to a method, an apparatus, a device, and a medium for generating component codes based on an asset list.
Background
With the continuous development of internet technology, the demand of internet business is also increasing, and the development efficiency and accuracy are also of great importance. In the front-end development process, it is difficult for developers to accurately and completely understand the whole business process for the business field with high business complexity and strong specialization. If the project lacks the top-level design, problems such as functional redundancy, logic confusion, repeated codes, difficult maintenance and the like can occur.
At present, front-end code multiplexing is required in the development process of the front-end page, and in the development process of the front-end of an enterprise, similar business processing logic may exist in different business projects, and the front-end component or the module management tool kit of the front-end package is generally used for extracting and multiplexing the similar business processing logic. However, in the practical application process, the front-end component or the module management tool package packaged by the front-end extracts the logic for describing the overall operation flow of the page, which results in that the front-end component or the module management tool package can be called to realize multiplexing only when similar overall business logic flows appear in the page development process, so that the applicability is poor, the efficiency of front-end page development is reduced, and therefore, how to improve the efficiency of component code generation under the condition of component code multiplexing becomes a problem to be solved.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a method, apparatus, device, and medium for generating component codes based on an asset inventory, so as to solve the problem that the efficiency of component code generation is low in the case of multiplexing component codes.
A first aspect of an embodiment of the present application provides a component code generating method based on an asset manifest, where the component code generating method includes:
acquiring an interactive product displayed on a front-end page, extracting a page flow of the interactive product, and grading the functions of the interactive product according to the page flow to obtain a product function tree, wherein the product function tree comprises a product component for realizing the functions of the interactive product, a product page to which the product component belongs and a service module to which the product page belongs;
for any product component, determining a component asset list corresponding to the product component according to model layer information, logic layer information and view layer information in the product component and identification information corresponding to the product component;
generating a project asset list corresponding to the product based on the component asset list, a product page to which the product component belongs and a business module to which the product page belongs;
generating a catalog structure according to the logical relation in the product function tree, and generating a corresponding code template for repeated calling of a user by using the project asset list under the project catalog structure.
A second aspect of an embodiment of the present application provides a component code generating apparatus based on an asset manifest, the component code generating apparatus including:
the extraction module is used for obtaining the interactive product displayed on the front-end page, extracting the page flow of the interactive product, grading the functions of the interactive product according to the page flow to obtain a product function tree, wherein the product function tree comprises a product component for realizing the functions of the interactive product, a product page to which the product component belongs and a service module to which the product page belongs;
the component asset list determining module is used for determining a component asset list corresponding to any product component according to model layer information, logic layer information and view layer information in the product component and identification information corresponding to the product component;
the project asset list determining module is used for generating and determining a project asset list corresponding to the product based on the belonging component asset list, the product page to which the product component belongs and the business module of the product page;
and the code template determining module is used for generating a catalog structure according to the logical relation in the product function tree, generating a corresponding code template for the project asset list under the project catalog structure, and the code template is used for repeated calling of a user.
In a third aspect, an embodiment of the present invention provides a computer device, the computer device including a processor, a memory, and a computer program stored in the memory and executable on the processor, the processor implementing the component code generation method according to the first aspect when the computer program is executed.
In a fourth aspect, an embodiment of the present invention provides a computer readable storage medium storing a computer program, which when executed by a processor implements the component code generation method according to the first aspect.
Compared with the prior art, the invention has the beneficial effects that:
the method comprises the steps of obtaining interactive products displayed on a front-end page, extracting page flows of the interactive products, grading functions of the interactive products according to the page flows to obtain a product function tree, wherein the product function tree comprises product components for realizing the functions of the interactive products, product pages to which the product components belong and service modules to which the product pages belong, determining a component asset list corresponding to the product components according to model layer information, logic layer information and view layer information in the product components and identification information corresponding to the product components for any product component, generating a project asset list corresponding to the product based on the component asset list, the service modules of the product pages and the product pages of the product components, generating a catalog structure according to logic relations in the product function tree, and generating a corresponding code template for the project asset list under the project catalog structure, wherein the code template is used for repeated calling of a user. In the invention, the function classification is carried out on the product, the product function tree is established, the component asset list is constructed according to the components in the product function tree, the code template generated based on the component asset list is generated, and the complete asset list is generated according to the code template, so that the asset list and the code template are kept all the time, and the generation efficiency of the component code can be improved under the condition of multiplexing the component codes, thereby improving the development efficiency of the front-end page.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments of the present invention will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic view of an application environment of a component code generation method based on an asset inventory according to an embodiment of the present invention;
FIG. 2 is a flow chart of a method for generating component codes based on asset inventory according to an embodiment of the invention;
FIG. 3 is a flow chart of a method for generating component codes based on asset inventory according to an embodiment of the invention;
FIG. 4 is a schematic diagram of a component code generating device based on an asset inventory according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a computer device according to an embodiment of the present invention
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
As used in the present description and the appended claims, the term "if" may be interpreted as "when..once" or "in response to a determination" or "in response to detection" depending on the context. Similarly, the phrase "if a determination" or "if a [ described condition or event ] is detected" may be interpreted in the context of meaning "upon determination" or "in response to determination" or "upon detection of a [ described condition or event ]" or "in response to detection of a [ described condition or event ]".
Furthermore, the terms "first," "second," "third," and the like in the description of the present specification and in the appended claims, are used for distinguishing between descriptions and not necessarily for indicating or implying a relative importance.
Reference in the specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the invention. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments" unless expressly specified otherwise. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
It should be understood that the sequence numbers of the steps in the following embodiments do not mean the order of execution, and the execution order of the processes should be determined by the functions and the internal logic, and should not be construed as limiting the implementation process of the embodiments of the present invention.
In order to illustrate the technical scheme of the invention, the following description is made by specific examples.
The component code generating method based on the asset list provided by the embodiment of the invention can be applied to an application environment as shown in fig. 1, wherein a client communicates with a server. The clients include, but are not limited to, palm top computers, desktop computers, notebook computers, ultra-mobile personal computer (UMPC), netbooks, personal digital assistants (personal digital assistant, PDA), and the like. The server may be implemented by a stand-alone server or a server cluster formed by a plurality of servers.
Referring to fig. 2, a flowchart of a method for generating component codes based on an asset list according to an embodiment of the present invention may be applied to a server in fig. 1, where the server is connected to a corresponding client, and as shown in fig. 2, the method for generating component codes based on an asset list may include the following steps.
S201: and acquiring the interactive product displayed on the front-end page, extracting the page flow of the interactive product, and grading the functions of the interactive product according to the page flow to obtain a product function tree.
In step S201, the product function tree includes a product component for implementing the function of the interactive product, a product page to which the product component belongs, and a service module to which the product page belongs.
In this embodiment, an interactive product displayed on a front-end page is input into a preset development platform, a server reads information of the interactive product through the development platform, a page flow of the interactive product is extracted from the information of the interactive product, and functions of the interactive product are classified according to the page flow, so that a product function tree is obtained.
The product function tree comprises product components for realizing functions of interactive products, product pages to which the product components belong and service modules to which the product pages belong, for example, the interactive products displayed on a front-end page can be interactive products corresponding to a life insurance sales system, the interactive products can comprise a proposal service module, an insurance application service module, an electronic signature service module and a payment service module, each service module can obtain a corresponding product page, for example, the insurance application service module can comprise a health notification product page, a confirmation insurance application information product page and the like, each product page can obtain corresponding product component information, for example, the confirmation insurance application product information product page can comprise an insurance application bar code product component, an insurance applicant information product component, a product plan product component and the like, and the product function tree is classified according to the function size and is formed in a tree form.
It should be noted that, the product function tree may be stored in each pre-created storage space in the memory key value database Redis to obtain a service module library, a product page library and a product component library, and by pre-constructing the service module library, the product page library and the product component library, the product function tree can be quickly configured in the whole development process of the object, so that quick and flexible configuration is realized, and product development configuration efficiency is greatly improved. Specifically, the service module library can be built to include a corresponding service module, the product page library includes a corresponding product page, the product component library includes corresponding product component information, and the service module library, the product page library and the product component library can be independent of each other or have a containing relationship. And corresponding contents can be directly matched from the service module library, the product page library and the product component library according to specific development requirements aiming at each project product to be developed, so that the multiplexing rate of code development is greatly improved.
Optionally, the interactive product displayed on the front-end page is taken, the page flow of the interactive product is extracted, the functions of the interactive product are classified according to the page flow, and a product function tree is obtained, and the method comprises the following steps:
According to the page flow in the interactive product, a corresponding service module in the interactive product is obtained, a corresponding product page is obtained from the service module, and a corresponding product component is obtained from the product page;
and constructing a product function tree corresponding to the interactive product according to the service module, the product page and the product component.
In this embodiment, the service modules may be modules obtained according to different service division, for example, there are multiple services including service 1, service 2, service 3, service 4, and the like, and correspondingly, the service modules may be service 1 module, service 2 module, service 3 module, and service 4 module. The method comprises the steps of obtaining corresponding product pages according to different business modules, and obtaining corresponding product components from the product pages, wherein the product components can be divided into different components, for example, an original first component can be combed according to the product pages, all minimum components contained in the first component are divided, and a new self-defined second component is developed by utilizing the minimum components, wherein each minimum component can be a button, a Tab column, a cell column, a self-defined keyboard, a benefit line diagram, an Input box, a picker selector, a separation line, a high-filling box and the like. The component identifier may be a shorthand (Minimum-component) mincp+ component file name of the component, e.g., (input) +8-bit random number composition. And constructing a product function tree corresponding to the interactive product according to the service module, the product page and the product component.
S202: and determining a component asset list corresponding to the product component according to the model layer information, the logic layer information and the view layer information in the product component and the identification information corresponding to the product component aiming at any product component.
In step S202, the identification information corresponding to the product component is unique identification information, and the component asset list is a component set of all components.
In this embodiment, the asset list is mainly proposed as a measure of the landing effect of a domain-driven design. The asset inventory defines four layers of elements, namely business elements, functional elements, business processes and business scenes. The service elements are service objects in the field, the functional elements are functions provided by the field objects, the service process is a complete service interaction flow, the service scene is a scene service provided externally, the four layers of elements can be called layer by layer to generate the relation among the elements, and the decomposition speed of the core field and the response speed to service fluctuation can be seen through the multiplexing degree of the core function under different scenes, so that the good and bad of the construction effect of the field driving design field can be reflected through the asset list. The component asset inventory in this embodiment is constructed to determine the interactive relationships between the different elements in any product component. The interaction between different elements can be the interaction of model layer information, logic layer information and view layer information in the product component until now.
It should be noted that the component asset inventory is mainly composed of asset elements, relationships among various asset elements, multiplexed asset elements, and multiplexing rates. There are many asset elements in the code, such as multiple Java classes under one package, and multiple methods under one Java class. From the foregoing, it can be seen that there is an asset relationship between methods (e.g., there is an asset relationship between business scenario element method1 and business process element method3, and there is an asset relationship between business scenario element method2 and business process element method 4).
For any product component, the model layer information in the product component is through object relation mapping (Object Relational Mapping, ORM) technology, and a DB first entity class database with a prior database and then a entity model is realized for the product system. The ORM technology is generated along with the development of an object-oriented software development method and is used for mapping objects represented by an object model into a relational model database structure based on SQL sentences. Thus, when a specific operation entity object is operated, complex SQL sentences are not required to be added or reduced, and the operation difficulty is reduced. The ORM technology provides a bridge between objects and relationships through which object-type data on a display interface and relational data in a database are converted from each other. The logic layer is a service logic layer of the system, can perform data interaction with the model layer, the view layer is a User Interface (UI) implementation layer of the system, can call a service logic method stored in the logic layer and an operation base class of the model layer, and realizes various data interactions with the User Interface, including data binding of the service logic and the User Interface, style rendering and the like.
In order to facilitate the processing of high concurrent access of websites, adapt to the development requirement of large websites and reduce the transmission delay of a network, a model layer is mainly responsible for data requests, data conversion, data storage and the like, and provides data converted into a front-end data model format for a logic layer. The logic layer mainly provides data which can be directly displayed after processing to the view layer and is responsible for arrangement and circulation of business processes, judgment of business logic and execution of business rules.
Optionally, for any product component, determining a component asset list corresponding to the product component according to the model layer information, the logic layer information, the view layer information and the identification information corresponding to the product component in the product component, including:
setting identification information corresponding to the product components according to preset rules;
determining a mathematical model corresponding to a model layer in the product component through a mathematical relationship between data used by business logic of the product component;
and determining a component asset list corresponding to the product component according to the identification information, the mathematical model and the interface information in the product component.
In this embodiment, the component identification information is used to uniquely identify a component, and may be information that can characterize the identity of the component, such as a component name, a number, and the like.
The mathematical relationship between the data used by the business logic of the product component is determined by the mathematical relationship between the data used by the business logic of the product component, when the mathematical relationship between the data used by the business logic is obtained, the product information can be subjected to data cleaning, data integration, data transformation and data preprocessing of data protocol through the product information obtained by crawling or collecting in each network platform, so as to obtain initial data, the initial data is subjected to feature extraction, the feature information is obtained, and the mathematical model corresponding to the model layer in the product component is determined according to the feature information.
When a designer designs a page, the developer can develop a data model layer, a logic layer and a corresponding interface in the architecture until the designer obtains a page design drawing and a dynamic effect file, exports the page design drawing and the dynamic effect file into an xml interface which can be identified by a product system and a dynamic effect layer which is represented by java codes through script conversion, integrates the exported file into the product system, and debugs the interface which is imported into the logic layer.
Optionally, determining the component asset list corresponding to the product component according to the identification information, the mathematical model and the preset interface information in the product component includes:
Setting an external interface for a logic layer and a model layer in the product assembly to obtain a model layer interface and a logic layer interface;
taking the model layer interface and the logic layer interface as interface information in the product component;
and determining a component asset list corresponding to the product component according to the identification information, the mathematical model and preset interface information in the product component.
In this embodiment, an external interface is provided for the logic layer and the model layer in the product component, so that the model layer can provide data converted into a front-end data model format for the logic layer, the logic layer can provide data which can be directly displayed after processing for the view layer, and a component asset list corresponding to the product component is determined according to the identification information, the mathematical model and preset interface information in the product component.
S203: and generating a project asset list corresponding to the determined product based on the component asset list, the product page to which the product component belongs and the business module to which the product page belongs.
In step S203, the project asset inventory is corresponding element information in the entire product.
In this embodiment, a project asset list corresponding to a determined product is generated based on the component asset list, the product page to which the product component belongs, and the service module to which the product page belongs. The project asset inventory includes asset elements that require identification of product system construction for project computation, relationships between the elements, and the number of domain service elements that are multiplexed based on the relationships.
S204: and generating a catalog structure according to the logical relation in the product function tree, and generating a corresponding code template for the project asset list under the project catalog structure.
In step S204, a models folder is generated for storing files in the project asset inventory. The first order traverses the tree structure of the asset inventory to generate folders named with module, page and component names and unique identifications, and under the component folders to generate model, logical, view folders. And generating a corresponding code template for the project asset inventory under the project catalog structure.
In this embodiment, the directory structure is formed in a tree-like graphic form, and the entire item function tree is traversed according to the level division in the item function tree to generate the directory structure, where the directory structure includes a root directory and a subdirectory, for example, when the service module is used as the root directory, the product page and the product component may be used as the subdirectory, and the subdirectory is under the root directory path folder. The directory structure of the root directory can be traversed to obtain a first-level directory structure, wherein the first-level directory structure comprises subfolders under the root directory, the directory structure of the subfolders is traversed until the last layer of subfolders is traversed to obtain the subfolder directory structure, and the directory structures corresponding to the project asset list are generated according to the first-level directory structure and the subfolder directory structure in a collecting mode. The first-level directory structure is a product page folder, the directory structure in the subfolder is a product component folder, and a model, logic and view folder is generated under the component folder. The function of each catalog level in the product can be displayed more intuitively through the catalog structure tree diagram, and the speed of a developer in knowing the product is improved, so that the developer of the new catcher product can quickly catch the product.
After the catalog structure is generated, a corresponding code template is generated according to the component asset list, and if an entity exists in the component asset list, the entity class is data describing objective things in the real world, and can refer to people, such as teachers, students and the like, and also refer to things, such as books, warehouses and the like. Newly adding and storing an entity file in the model file, generating an entity file marked by an entity name, and generating an entity code template based on the entity name, the entity number, the attribute name, the attribute value type, the attribute default value, the attribute description and the like in the asset list; if a model layer or a logic layer interface exists in the component asset list, a corresponding interface file is generated in the model or the logic file, and an interface code template is generated based on the interface name, the interface number, the input parameters, the return value, the interface annotation and the like.
If there are entities in the component asset list, the entities are stored in entity class databases, and the entity class databases comprise operation base classes for various databases, such as write operation base classes, read operation base classes, query operation base classes and the like. Entity class databases may include SQL services (Server) databases, oracle databases, mySQL databases, and the like. After the entity class database is established, a developer can directly check various databases of the entity class mapping in a development tool (such as Visual Studio), and analysis of the developer is facilitated.
The method comprises the steps of setting a model layer in any component, and configuring authority parameters for displaying the product page in a preset entity class database, wherein the authority parameters are used for managing operation authorities for displaying the product page, such as adding, deleting, modifying, checking and the like. The permission parameters may include role information of the user, button access permission corresponding to the role, and the like. The view layer is used for calling the write operation base class in the model layer and sending the write operation base class to the roadbed layer.
Optionally, generating a catalog structure according to the logical relationship in the product function tree, generating a corresponding code template for the project asset inventory under the project catalog structure, including:
traversing the project asset list, and generating a project directory structure corresponding to the project asset list according to a preset folder naming rule;
and adding corresponding entity files and interface files in the component asset list into folders corresponding to the project directory structures according to the component asset list, and generating corresponding entity code templates and interface code templates according to the entity files and the interface files.
In this embodiment, the project asset list is traversed, and a project directory structure corresponding to the project asset list is generated according to a preset folder naming rule, wherein the preset folder naming rule can name according to the module, page and component names and unique identifiers, and generate the project directory structure corresponding to the project asset list,
For example, the folder with the directory structure of the service module is a modules folder, the file under the directory structure corresponding to the service module may include a folder application form corresponding to the application module, the file under the application module may include component folder components under the application module, the file under the component under the application module may include an applicant information component folder client info, the file under the applicant information component may include a logical layer folder controller, and so on. If one class file is an Entity class, then "Entity" is added at the end of the name when naming, and if the class file is a Service class, then "Service" is added at the end of the name when naming.
And adding corresponding entity files and interface files in the component asset list into folders corresponding to the project directory structures according to the component asset list, and generating corresponding entity code templates and interface code templates according to the entity files and the interface files.
In this embodiment, when generating the corresponding entity code template and interface code template according to the entity file and interface file, the component code generating tool may be configured in the development architecture based on the J2EE project development model. The component code generation tool may be used to generate code for each component, thereby enabling further generation of a file corresponding to each component.
It should be noted that, the component code generating tool may receive a compiling instruction input by a developer of the product project, and generate a basic component code and a control layer component code. After generating the two component codes, the base component base. Jar and the control layer component bundle. Jar may be packaged and generated. In this embodiment, the base. Jar includes a corresponding entity class and a data access class for performing operations, where the operations include at least one of adding, deleting, correcting, or querying. The bundle. Jar includes a logical layer interface, a request parameter class, a response parameter class, and a controller class for providing services to the outside.
The method comprises the steps of obtaining interactive products displayed on a front-end page, extracting page flows of the interactive products, grading functions of the interactive products according to the page flows to obtain a product function tree, wherein the product function tree comprises product components for realizing the functions of the interactive products, product pages to which the product components belong and service modules to which the product pages belong, determining a component asset list corresponding to the product components according to model layer information, logic layer information and view layer information in the product components and identification information corresponding to the product components for any product component, generating a project asset list corresponding to the product based on the component asset list, the service modules of the product pages and the product pages of the product components, generating a catalog structure according to logic relations in the product function tree, and generating a corresponding code template for the project asset list under the project catalog structure, wherein the code template is used for repeated calling of a user. In the invention, the function classification is carried out on the product, the product function tree is established, the component asset list is constructed according to the components in the product function tree, the code template generated based on the component asset list is generated, and the complete asset list is generated according to the code template, so that the asset list and the code template are kept all the time, and the generation efficiency of the component code can be improved under the condition of multiplexing the component codes, thereby improving the development efficiency of the front-end page.
Referring to fig. 3, a flowchart of a component code generating method based on an asset list according to an embodiment of the present invention, as shown in fig. 3, the component code generating method based on the asset list may include the following steps:
s301: the method comprises the steps of obtaining an interactive product displayed on a front-end page, extracting a page flow of the interactive product, grading the functions of the interactive product according to the page flow, and obtaining a product function tree, wherein the product function tree comprises a product component for realizing the functions of the interactive product, a product page to which the product component belongs and a service module to which the product page belongs.
S302: and determining a component asset list corresponding to the product component according to the model layer information, the logic layer information and the view layer information in the product component and the identification information corresponding to the product component aiming at any product component.
S303: and generating a project asset list corresponding to the determined product based on the component asset list, the product page of the product component and the business module of the product page.
S304: generating a catalog structure according to the logic relation in the product function tree, and generating a corresponding code template for repeated calling of a user by using the project asset list under the project catalog structure.
The content of the steps S301 to S304 is the same as that of the steps S201 to S204, and reference may be made to the descriptions of the steps S201 to S204, which are not repeated herein.
S305: screening components with equal identification information from the component asset list as multiplexing components, and determining a public directory corresponding to the multiplexing components in the project directory structure according to a preset algorithm;
s306: and moving the code template corresponding to the multiplexing component into the public directory, and updating the project directory structure to obtain an updated project directory structure.
In this embodiment, the nearest public ancestor LCA (Lowest Common Ancestor) algorithm is used to find the public ancestor node of the multiplexing component closest to the component, the directory where the public ancestor node is located is the final position of the component in the project, the component is moved to the public ancestor directory, and the component directory in the original position is deleted, so as to complete the update of the multiplexing component directory.
Determining a multiplexing component according to component identification information, determining a public directory of the multiplexing component according to the multiplexing component, firstly, determining position information of the multiplexing component, judging whether ancestor relations exist between directory structure nodes corresponding to the position information of the multiplexing component, if the ancestor relations exist, acquiring different positions of the top left most bits of the directory structure nodes, and outputting node information in the directory structure corresponding to the nearest public ancestor.
And moving the code template corresponding to the multiplexing component into the public directory, and updating the project directory structure to obtain an updated project directory structure. And traversing folders and files corresponding to the modules in the codes by using an advanced traversing method after the updated project directory structure is obtained, and generating the integral structure of the tree asset list. And reading the attributes, the public methods, the notes and the like in the codes, and completing filling of the asset numbers, the entities, the attributes, the logical layer methods and the model methods in the asset list. And according to the reference relation of the import module in the code, adjusting asset list information corresponding to the entity and the module in the multiplexing component, and outputting a complete asset list to enable the code template to correspond to the complete asset list.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a component code generating device based on an asset list according to an embodiment of the invention. The terminal in this embodiment includes units for performing the steps in the embodiments corresponding to fig. 2 to 3. Please refer to fig. 2 to fig. 3 and the related descriptions in the embodiments corresponding to fig. 2 to fig. 3. For convenience of explanation, only the portions related to the present embodiment are shown. Referring to fig. 4, the component code generating apparatus 40 includes: the extraction module 41, the component asset inventory determination module 42, the project asset inventory determination module 43, the code template determination module 44.
The extracting module 41 is configured to obtain an interactive product displayed on a front-end page, extract a page flow of the interactive product, and rank functions of the interactive product according to the page flow to obtain a product function tree, where the product function tree includes a product component for implementing the functions of the interactive product, a product page to which the product component belongs, and a service module to which the product page belongs.
The component asset list determining module 42 is configured to determine, for any product component, a component asset list corresponding to the product component according to model layer information, logical layer information, view layer information, and identification information corresponding to the product component in the product component.
The project asset list determining module 43 is configured to generate a project asset list corresponding to a determined product based on the component asset list, the product page to which the product component belongs, and the business module to which the product page belongs.
The code template determining module 44 is configured to generate a directory structure according to the logical relationship in the product function tree, and generate a corresponding code template for repeated call of the user from the project asset list under the project directory structure.
Optionally, the component code generating apparatus 40 further includes:
And the screening module is used for screening components with equal identification information from the component asset list to be multiplexing components, and determining the public catalogs corresponding to the multiplexing components in the project catalogue structure according to a preset algorithm.
And the updating module is used for moving the code template corresponding to the multiplexing component into the public directory, updating the project directory structure and obtaining the updated project directory structure.
Optionally, the extracting module 41 includes:
the acquisition unit is used for acquiring the corresponding service module in the interactive product according to the page flow in the interactive product, acquiring the corresponding product page from the service module and acquiring the corresponding product component from the product page.
And the product function tree determining unit is used for constructing a product function tree corresponding to the interactive product according to the service module, the product page and the product component.
Optionally, the component asset inventory determination module 42 includes:
the setting unit is used for setting the identification information corresponding to the product component for the product component according to a preset rule.
And the mathematical model determining unit is used for determining a mathematical model corresponding to the model layer in the product component through mathematical relations among data used by business logic of the product component.
And the component asset list determining unit is used for determining the component asset list corresponding to the product component according to the identification information, the mathematical model and the interface information in the product component.
Optionally, the component asset list determining unit corresponding to the product component includes:
and the interface setting subunit is used for setting an external interface for the logic layer and the model layer in the product assembly to obtain a model layer interface and a logic layer interface.
And the interface information determining subunit is used for taking the model layer interface and the logic layer interface as the interface information in the product assembly.
And the inventory determination subunit is used for determining the component asset inventory corresponding to the product component according to the identification information, the mathematical model and the preset interface information in the product component.
Optionally, the code template determining module 44 includes:
the traversing unit is used for traversing the project asset list and generating a project directory structure corresponding to the project asset list according to a preset folder naming rule.
And the entity code template and interface code template determining unit is used for adding corresponding entity files and interface files in the component asset list into folders corresponding to the project directory structure according to the component asset list, and generating corresponding entity code templates and interface code templates according to the entity files and the interface files.
The code template determining unit is used for forming a code template corresponding to the product component by the entity code template and the interface code template.
It should be noted that, because the content of information interaction and execution process between the above units is based on the same concept as the method embodiment of the present invention, specific functions and technical effects thereof may be referred to in the method embodiment section, and will not be described herein.
Fig. 5 is a schematic structural diagram of a computer device according to an embodiment of the present invention. As shown in fig. 5, the computer device of this embodiment includes: at least one processor (only one shown in fig. 5), a memory, and a computer program stored in the memory and executable on the at least one processor, the processor executing the computer program performing the steps of any of the various asset inventory-based component code generation method embodiments described above.
The computer device may include, but is not limited to, a processor, a memory. It will be appreciated by those skilled in the art that fig. 5 is merely an example of a computer device and is not intended to limit the computer device, and that a computer device may include more or fewer components than shown, or may combine certain components, or different components, such as may also include a network interface, a display screen, an input device, and the like.
The processor may be a CPU, but may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory includes a readable storage medium, an internal memory, etc., where the internal memory may be the memory of the computer device, the internal memory providing an environment for the execution of an operating system and computer-readable instructions in the readable storage medium. The readable storage medium may be a hard disk of a computer device, and in other embodiments may be an external storage device of the computer device, for example, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), etc. that are provided on the computer device. Further, the memory may also include both internal storage units and external storage devices of the computer device. The memory is used to store an operating system, application programs, boot loader (BootLoader), data, and other programs such as program codes of computer programs, and the like. The memory may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment 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, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, the specific names of the functional units and modules are only for distinguishing from each other, and are not used for limiting the protection scope of the present invention. The specific working process of the units and modules in the above device may refer to the corresponding process in the foregoing method embodiment, which is not described herein again. 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 present invention may implement all or part of the flow of the method of the above-described embodiment, and may be implemented by a computer program to instruct related hardware, and the computer program may be stored in a computer readable storage medium, where the computer program, when executed by a processor, may implement the steps of the method embodiment described above. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, executable files or in some intermediate form, etc. The computer readable medium may include at least: any entity or device capable of carrying computer program code, a recording medium, a computer Memory, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), an electrical carrier signal, a telecommunications signal, and a software distribution medium. Such as a U-disk, removable hard disk, magnetic or optical disk, etc. In some jurisdictions, computer readable media may not be electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
The present invention may also be implemented as a computer program product for implementing all or part of the steps of the method embodiments described above, when the computer program product is run on a computer device, causing the computer device to execute the steps of the method embodiments described above.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided by the present invention, it should be understood that the disclosed apparatus/computer device and method may be implemented in other manners. For example, the apparatus/computer device embodiments described above are merely illustrative, e.g., the division of modules or units is merely a logical functional division, and there may be additional divisions when actually implemented, e.g., 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 may be an indirect coupling or communication connection via interfaces, devices or units, which may be in electrical, mechanical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
The above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention, and are intended to be included in the scope of the present invention.
Claims (10)
1. A component code generation method based on an asset inventory, the component code generation method comprising:
acquiring an interactive product displayed on a front-end page, extracting a page flow of the interactive product, and grading the functions of the interactive product according to the page flow to obtain a product function tree, wherein the product function tree comprises a product component for realizing the functions of the interactive product, a product page to which the product component belongs and a service module to which the product page belongs;
For any product component, determining a component asset list corresponding to the product component according to model layer information, logic layer information and view layer information in the product component and identification information corresponding to the product component;
generating a project asset list corresponding to the product based on the component asset list, a product page to which the product component belongs and a business module to which the product page belongs;
generating a catalog structure according to the logical relation in the product function tree, and generating a corresponding code template for repeated calling of a user by using the project asset list under the project catalog structure.
2. The method for generating component code according to claim 1, wherein the step of extracting the interactive product displayed on the front page, extracting the page flow of the interactive product, and grading the functions of the interactive product according to the page flow to obtain the product function tree comprises the steps of:
acquiring a corresponding service module in the interactive product according to the page flow in the interactive product, acquiring a corresponding product page from the service module, and acquiring a corresponding product component from the product page;
And constructing a product function tree corresponding to the interactive product according to the service module, the product page and the product component.
3. The component code generating method according to claim 1, wherein the determining, for any product component, a component asset list corresponding to the product component according to model layer information, logical layer information, and view layer information in the product component, and identification information corresponding to the product component, includes:
setting identification information corresponding to the product component for the product component according to a preset rule;
determining a mathematical model corresponding to a model layer in the product component through a mathematical relationship between data used by business logic of the product component;
and determining a component asset list corresponding to the product component according to the identification information, the mathematical model and the interface information in the product component.
4. The component code generating method according to claim 3, wherein determining the component asset list corresponding to the product component according to the identification information, the mathematical model and the preset interface information in the product component comprises:
setting an external interface for a logic layer and a model layer in the product assembly to obtain a model layer interface and a logic layer interface;
The model layer interface and the logic layer interface are used as interface information in the product component;
and determining a component asset list corresponding to the product component according to the identification information, the mathematical model and preset interface information in the product component.
5. The component code generation method of claim 1, wherein the generating a directory structure from logical relationships in the product function tree, generating the project asset inventory under the project directory structure to generate the corresponding code templates comprises:
traversing the project asset list, and generating a project directory structure corresponding to the project asset list according to a preset folder naming rule;
and adding corresponding entity files and interface files in the component asset list into folders corresponding to the project directory structures according to the component asset list, and generating corresponding entity code templates and interface code templates according to the entity files and the interface files.
The entity code template and the interface code template form a code template corresponding to the product component.
6. The component code generation method of claim 1, wherein the generating a directory structure from the logical relationships in the product function tree, after generating the project asset inventory into the corresponding code templates under the project directory structure, further comprises:
Screening components with equal identification information from the component asset list as multiplexing components, and determining a public directory corresponding to the multiplexing components in the project directory structure according to a preset algorithm;
and moving the code template corresponding to the multiplexing component into the public directory, and updating the project directory structure to obtain an updated project directory structure.
7. A component code generation apparatus based on an asset inventory, the component code generation apparatus comprising:
the extraction module is used for obtaining the interactive product displayed on the front-end page, extracting the page flow of the interactive product, grading the functions of the interactive product according to the page flow to obtain a product function tree, wherein the product function tree comprises a product component for realizing the functions of the interactive product, a product page to which the product component belongs and a service module to which the product page belongs;
the component asset list determining module is used for determining a component asset list corresponding to any product component according to model layer information, logic layer information and view layer information in the product component and identification information corresponding to the product component;
The project asset list determining module is used for generating and determining a project asset list corresponding to the product based on the component asset list, the product page to which the product component belongs and the business module to which the product page belongs;
and the code template determining module is used for generating a catalog structure according to the logical relation in the product function tree, generating a corresponding code template for the project asset list under the project catalog structure, and the code template is used for repeated calling of a user.
8. A component code generation apparatus based on an asset inventory, the component code generation apparatus further comprising:
the screening module is used for screening out components with equal identification information from the component asset list as multiplexing components, and determining the public catalogs corresponding to the multiplexing components in the project catalogue structure according to a preset algorithm;
and the updating module is used for moving the code template corresponding to the multiplexing component into the public directory, updating the project directory structure and obtaining the updated project directory structure.
9. A computer device, characterized in that it comprises a processor, a memory and a computer program stored in the memory and executable on the processor, which processor implements the component code generation method according to any of claims 1 to 6 when executing the computer program.
10. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the component code generation method according to any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310835070.8A CN117032678A (en) | 2023-07-07 | 2023-07-07 | Asset inventory-based component code generation method, device, equipment and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310835070.8A CN117032678A (en) | 2023-07-07 | 2023-07-07 | Asset inventory-based component code generation method, device, equipment and medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117032678A true CN117032678A (en) | 2023-11-10 |
Family
ID=88630709
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310835070.8A Pending CN117032678A (en) | 2023-07-07 | 2023-07-07 | Asset inventory-based component code generation method, device, equipment and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117032678A (en) |
-
2023
- 2023-07-07 CN CN202310835070.8A patent/CN117032678A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8352495B2 (en) | Distributed platform for network analysis | |
WO2021042521A1 (en) | Contract automatic generation method, computer device and computer non-volatile storage medium | |
CN105518658A (en) | Apparatus, systems, and methods for grouping data records | |
CN109815464A (en) | PDF document generation method, device, electronic equipment and storage medium | |
CN109359026A (en) | Log reporting method, device, electronic equipment and computer readable storage medium | |
CN108460068A (en) | Method, apparatus, storage medium and the terminal that report imports and exports | |
US20150161224A1 (en) | Optimized Network Analysis Rendering and User Interfaces | |
CN108345658B (en) | Decomposition processing method of algorithm calculation track, server and storage medium | |
CN115544183A (en) | Data visualization method and device, computer equipment and storage medium | |
CN111435367A (en) | Knowledge graph construction method, system, equipment and storage medium | |
Serbout et al. | From openapi fragments to api pattern primitives and design smells | |
CN112330308B (en) | Case management system and method and electronic device | |
US20210124752A1 (en) | System for Data Collection, Aggregation, Storage, Verification and Analytics with User Interface | |
CN110704635B (en) | Method and device for converting triplet data in knowledge graph | |
CN111061733B (en) | Data processing method, device, electronic equipment and computer readable storage medium | |
US11500840B2 (en) | Contrasting document-embedded structured data and generating summaries thereof | |
US10726178B1 (en) | Functional logic cone signature generation for circuit analysis | |
Chaganti et al. | Amazon SimpleDB developer guide | |
CN115062206B (en) | Webpage element searching method and electronic equipment | |
WO2023093259A1 (en) | Iteratively updating a document structure to resolve disconnected text in element blocks | |
Goel et al. | Data governance for managing data quality in process mining | |
CN113687827B (en) | Data list generation method, device and equipment based on widget and storage medium | |
US10025838B2 (en) | Extract transform load input suggestion | |
CN117032678A (en) | Asset inventory-based component code generation method, device, equipment and medium | |
CN115757174A (en) | Database difference detection method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |