CN111488145B - Micro-service code generation system and method based on service domain data model library - Google Patents

Micro-service code generation system and method based on service domain data model library Download PDF

Info

Publication number
CN111488145B
CN111488145B CN202010363365.6A CN202010363365A CN111488145B CN 111488145 B CN111488145 B CN 111488145B CN 202010363365 A CN202010363365 A CN 202010363365A CN 111488145 B CN111488145 B CN 111488145B
Authority
CN
China
Prior art keywords
mom
business
information
model
entity
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010363365.6A
Other languages
Chinese (zh)
Other versions
CN111488145A (en
Inventor
高丽芳
王智慧
吕鹏鹏
杨会峰
孙辰军
王静
王少影
方蓬勃
连阳阳
李启蒙
肖帆
刘玮
刘迪
王琰洁
刘泽三
高丽娟
郭少勇
陈连栋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
State Grid Corp of China SGCC
State Grid Information and Telecommunication Co Ltd
Information and Telecommunication Branch of State Grid Hebei Electric Power Co Ltd
Original Assignee
State Grid Corp of China SGCC
State Grid Information and Telecommunication Co Ltd
Information and Telecommunication Branch of State Grid Hebei Electric Power Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by State Grid Corp of China SGCC, State Grid Information and Telecommunication Co Ltd, Information and Telecommunication Branch of State Grid Hebei Electric Power Co Ltd filed Critical State Grid Corp of China SGCC
Priority to CN202010363365.6A priority Critical patent/CN111488145B/en
Publication of CN111488145A publication Critical patent/CN111488145A/en
Application granted granted Critical
Publication of CN111488145B publication Critical patent/CN111488145B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/73Program documentation
    • YGENERAL 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
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Library & Information Science (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a micro-service code generation system and method based on a service domain data model base, and relates to the technical field of micro-services; the system comprises a business domain data model building module and a MOM object file building module, wherein the business domain data model building module is used for building a business domain data model base, and the MOM object file building module is used for referring to a business model entity object in the business domain data model base and converting the business model entity object into a MOM object file; the method is that a business model entity object in a business domain data model base is quoted and converted into a MOM object file; the method improves the development efficiency of the micro-service by establishing a business domain data model library module, an MOM object file module and the like.

Description

Micro-service code generation system and method based on service domain data model library
Technical Field
The invention relates to the technical field of micro services, in particular to a micro service code generation system and method based on a service domain data model base.
Background
In recent years, micro-service architecture technology has rapidly developed, and more enterprises adopting the micro-service architecture technology are increasing. The micro-service architecture emphasizes flexible delivery over traditional monolithic application architectures. Micro-services are small and autonomous services which can work cooperatively, and have the advantages of independent deployment, loose coupling, technical isolation, easy expansion and the like. Some micro-service architecture applications are split and converted from single application architecture, and some micro-services are newly developed according to actual business applications. The micro service object model Micro Object Model, hereinafter referred to as MOM.
The following problems are faced in the practice of micro-service architecture applications: in the early stage of micro-service development, software design developers need to carry out a large amount of close communication with business specialists of enterprises, more communication cost is needed to be consumed, and micro-service business domain analysis is carried out, so that the business granularity contained in each micro-service is determined, the granularity of micro-service splitting is controlled by the development designer, in a large number of enterprise micro-service development, the problem of non-uniform splitting standards can be faced in different micro-service design development of the same field of business, and in the micro-service construction of the enterprise, the problems of repeated development, uneven quality and the like of the same type of business can be caused. When the traditional method is used for developing the micro services, the problems of long delivery cycle and the like exist when the number of the micro services is large.
Prior art related patent applications:
(1) A method for micro-server application of monomers, comprising: the patent application name is 2018100240484, and the patent application is based on the developed monomer application, analyzes a business association module in the application according to the starting point and the ending point of all request calls, and needs to be manually corrected to determine the granularity of the micro-service. The technical scheme of the application is analyzed aiming at the existing monomer application system, is not applicable to the granularity analysis of newly developed micro services, and does not relate to the development work of the micro services.
(2) A method and a device for generating micro services: the patent application name is 2017103920714, and the micro service frame code is generated according to the micro service type to be created by providing a basic frame template. The technical proposal of the application does not introduce the content related to the micro service business and does not generate codes related to the logic of the micro service business.
Problems and considerations in the prior art: how to solve the technical problem of low micro-service development efficiency.
Disclosure of Invention
The technical problem to be solved by the invention is to provide a micro-service code generation system and method based on a service domain data model base, which can improve the development efficiency of micro-services by establishing a service domain data model base module, a MOM object file module and the like.
In order to solve the technical problems, the invention adopts the following technical scheme: the micro service code generation system based on the service domain data model library comprises a service domain data model library building module and a MOM object file building module, wherein the service domain data model library building module is used for building a service domain data model library; and establishing a MOM object file module for referring to the business model entity object in the business domain data model library and converting the business model entity object into a MOM object file.
The further technical proposal is that: the micro service code generation module is used for inputting the converted MOM object file into the source code generator, and outputting the generated micro application or micro service source code structure information by analyzing the MOM object file, selecting page style, binding page attribute, matching the pre-generated technical frame and the output source code in the source code generator; the business domain data model base module is also used for storing the data of business model entity objects in the business domain data model base in a database, wherein the business model entity objects are stored in the database by data table structural information, and the structured data tables comprise business major categories, business minor categories, entity basic information, entity structural attributes, entity relation information, entity version information, entity authorization management, entity reference records, entity text attributes and entity history records.
The further technical proposal is that: the MOM object file establishing module comprises a model opening tool module, a model object introducing module, a MOM object converting module, a MOM correcting module and a MOM object storing module, wherein the model opening tool module is used for opening a model tool in a development tool; the introduction model object module is used for introducing a business model entity object through an API interface; the MOM object conversion module is used for converting the introduced business model entity object into an MOM object file by the business model entity converter; the correction model module is used for correcting and perfecting the entity object information of the business model in the model tool according to the business requirements; the MOM object storage module is used for storing the information of the MOM object and forming an MOM object file; and establishing a MOM object file module, and storing information of the MOM object file in an XML format.
The further technical proposal is that: the model opening tool module is also used for opening a local development tool, and configuring service domain data model base information in attribute configuration, including model base addresses, ports and user information; the introduction model object module is also used for opening a business domain data model library through a local development tool menu guide, inputting the inquiry condition of personnel basic information in inquiry conditions, selecting personnel basic information entity objects in inquiry results, and introducing the personnel basic information entity objects into a model tool by clicking an introduction button; the MOM object conversion module is also used for acquiring basic information entity object information of personnel through an interface API service of the service domain data model library when the introduction button is clicked, and converting MOM object files which can be read or maintained by a model tool through a service model entity converter; the correction model module is also used for loading the MOM object file by the model tool after finishing correction and conversion of the MOM object file, displaying the introduced business model entity object information, and adjusting model attribute information according to business requirements, wherein the operation comprises adding business attributes or modifying data types; after the business model entity object information is adjusted, synchronizing the adjusted business model entity object into a business domain data model library by calling a business domain data model library interface API service; the MOM object storage module is also used for storing information of the MOM object file in an XML structure, and converting the information into the XML structure through the business model entity converter for storage in the process of introducing the business model entity object; the XML structure is divided into two parts, wherein the first part is information required by a model tool page and comprises version information, basic information and style information, and the second part is introduced business model entity object information which comprises business domain to which a business model entity object belongs and information of business model entity object attributes; the information of MOM object file and the information of business model entity object are one-to-many relation, and a plurality of business model entity objects are introduced at one time or a plurality of times according to business needs.
The further technical proposal is that: the micro-service code generation module comprises a MOM object file analysis module, a page style selection module, a page attribute binding module, a pre-generated matching technical framework module and an output source code module, wherein the MOM object file analysis module is used for inputting MOM object file information into a source code generator, and the source code generator acquires MOM object file information and analyzes the MOM object file according to XML label definition; the page style selecting module is used for selecting a page display style according to service requirements; the binding page attribute module is used for binding the page attribute with the business model entity object attribute information; the technical framework module is matched and pre-generated and is used for matching the technical framework according to project technical framework requirements; and the output source code module is used for generating service application source code information.
The further technical proposal is that: the MOM object file analysis module is also used for selecting MOM object files in the development tool project catalogue, right clicking a mouse to select conversion source codes in a menu, and inputting information of service names and service catalogue structures in a popped interface; the source code generator obtains MOM object file information, analyzes the MOM object file according to XML label definition and puts the MOM object file into a cache; the page style selecting module is also used for generating a guide according to the source code and selecting a service display interface style; the binding page attribute module is also used for binding the business model entity object attribute extracted by the analysis MOM object file after the interface display style is confirmed; the matching pre-generated technical framework module is also used for matching a source code generation framework according to project technical framework requirements after the business model entity object attribute is bound; and the output source code module is also used for outputting source code structure information through a source code generator.
A micro-service code generation method based on a service domain data model library refers to a service model entity object in the service domain data model library and converts the service model entity object into a MOM object file.
The further technical proposal is that: the method specifically comprises the steps of S1 establishing a business domain data model base and S2 establishing a MOM object file, wherein S1 establishes a business domain data model base, data of business model entity objects in the business domain data model base are stored in the database, the business model entity objects are stored in the database in the form of data table structural information, and the structured data tables comprise business major classes, business minor classes, entity basic information, entity structural attributes, entity relation information, entity version information, entity authorization management, entity reference records, entity text attributes and entity history records; s2, building a MOM object file, referring to a business model entity object in a business domain data model library, and converting the business model entity object into the MOM object file; the information of the MOM object file is stored in XML format.
The further technical proposal is that: the step of establishing the MOM object file in S2 specifically comprises the steps of S201 opening a model tool, S202 introducing the model object, S203 converting the MOM object, S204 modifying the model and S205 storing the MOM object, S201 opening the model tool, and opening the model tool in a development tool; opening a local development tool, and configuring service domain data model library information in attribute configuration, wherein the service domain data model library information comprises model library addresses, ports and user information; s202, introducing a model object, and introducing a business model entity object through an API interface; opening a service domain data model library through a local development tool menu guide, inputting a query condition of basic information of personnel in the query condition, selecting basic information entity objects of the personnel in the query result, and introducing the basic information entity objects of the personnel into a model tool by clicking an introduction button; s203, converting the MOM object, and converting the introduced business model entity object into a MOM object file by a business model entity converter; when the introducing button is clicked, acquiring basic information entity object information of personnel through an interface API service of a service domain data model library, and converting a MOM object file which can be read or maintained by a model tool through a service model entity converter; s204, revising the model, and revising and perfecting entity object information of the business model in a model tool according to the business requirements; after finishing the MOM object file correction and conversion, loading the MOM object file by a model tool, displaying the introduced business model entity object information, and adjusting model attribute information according to business requirements, wherein the operation comprises adding business attributes or modifying data types; after the business model entity object information is adjusted, synchronizing the adjusted business model entity object into a business domain data model library by calling a business domain data model library interface API service; s205, storing the MOM object, storing information of the MOM object and forming a MOM object file; the information of MOM object file is stored in XML structure, and in the process of introducing service model entity object, it is converted into XML structure by service model entity converter for storage; the XML structure is divided into two parts, wherein the first part is information required by a model tool page and comprises version information, basic information and style information, and the second part is introduced business model entity object information which comprises business domain to which a business model entity object belongs and information of business model entity object attributes; the information of MOM object file and the information of business model entity object are one-to-many relation, and a plurality of business model entity objects are introduced at one time or a plurality of times according to business needs.
The further technical proposal is that: s3, generating micro-service codes, inputting the converted MOM object files into a source code generator, and sequentially outputting the generated micro-application or micro-service source code structure information by analyzing the MOM object files, selecting page styles, binding page attributes, matching pre-generated technical frames and outputting source codes in the source code generator; the step of S3 generating the micro-service code specifically comprises the steps of S301 analyzing the MOM object file, S302 selecting page style, S303 binding page attribute, S304 matching the pre-generated technical frame and S305 outputting source code, S301 analyzing the MOM object file, inputting MOM object file information into a source code generator, and the source code generator obtaining MOM object file information and analyzing the MOM object file according to XML label definition; selecting MOM object files in a development tool project catalog, right clicking a mouse to select conversion source codes in a menu, and inputting service names and service catalog structure information in a popped interface; the source code generator obtains MOM object file information, analyzes the MOM object file according to XML label definition and puts the MOM object file into a cache; s302, selecting a page style, and selecting a page display style according to service requirements; generating a guide according to the source code, and selecting a service display interface style; s303, binding page attributes, and binding the page attributes with business model entity object attribute information; after confirming the interface display style, binding the interface display style with the business model entity object attribute extracted by the analysis MOM object file; s304, matching the pre-generated technical framework, and matching the technical framework according to project technical framework requirements; after the business model entity object attribute is bound, matching a source code generation architecture according to project technical architecture requirements; s305, outputting source codes and generating service application source code information; and outputting the source code structure information through a source code generator.
The beneficial effects of adopting above-mentioned technical scheme to produce lie in:
a micro-service code generation system based on a service domain data model base realizes the improvement of the development efficiency of micro-services by establishing a service domain data model base module, a MOM object file module and the like.
A micro-service code generation method based on a service domain data model base realizes the improvement of the development efficiency of micro-services by referring to a service model entity object in the service domain data model base and converting the service model entity object into a MOM object file and the like.
See the description of the detailed description section.
Drawings
FIG. 1 is a schematic block diagram of a module for creating MOM object files in embodiment 1 of the present invention;
FIG. 2 is a functional block diagram of a module for generating micro service code in embodiment 1 of the present invention;
FIG. 3 is a flow chart of embodiment 2 of the present invention;
FIG. 4 is a schematic block diagram of a business domain data model library Web system;
FIG. 5 is a functional block diagram of a business domain data model;
FIG. 6 is a screen shot of a data table structure attribute;
FIG. 7 is a screen shot of a data table in a database;
FIG. 8 is a screen shot of configuration service address, port, and user information;
FIG. 9 is a screen shot of selecting a business model entity object;
FIG. 10 is a screen shot of MOM object File information;
FIG. 11 is a screen shot of adjusting business model entity information;
FIG. 12 is a format diagram of a MOM object file;
FIG. 13 is a detailed format diagram of a MOM object file;
FIG. 14 is a screen shot of generating source code to MOM object file input links based on MOM object files;
FIG. 15 is a screen shot of selecting an interface style;
FIG. 16 is a screen shot of binding data;
FIG. 17 is a screen shot of generating a micro-service source code structure.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. The following description of at least one exemplary embodiment is merely exemplary in nature and is in no way intended to limit the application, its application, or uses. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application, but the present application may be practiced in other ways other than those described herein, and persons skilled in the art will readily appreciate that the present application is not limited to the specific embodiments disclosed below.
Example 1:
as shown in fig. 1 and fig. 2, the invention discloses a micro-service code generation system based on a service domain data model library, which comprises a service domain data model library building module, a MOM object file building module and a micro-service code generation module, wherein the MOM object file building module comprises a model opening tool module, a model object introducing module, a MOM object converting module, a model correcting module and a MOM object storing module, and the micro-service code generation module comprises a MOM object file analyzing module, a page style selecting module, a page attribute binding module, a pre-generated technical frame matching module and an output source code module.
The business domain data model building module is used for building a business domain data model database, data of business model entity objects in the business domain data model database are stored in a database, and the business model entity objects are stored in the database in a data table structural information mode and mainly comprise a structured data table of business major categories, business minor categories, entity basic information, entity structural attributes, entity relation information, entity version information, entity authorization management, entity reference records, entity text attributes and entity historical records.
As shown in fig. 1, a MOM object file module is established for referring to the business model entity object in the business domain data model library, converting it into a MOM object file, and storing the information of the MOM object file in XML format. The MOM object file establishing module comprises a model opening tool module, a model object introducing module, a MOM object converting module, a model correcting module and a MOM object storing module.
And the opening model tool module is used for opening a local development tool and configuring service domain data model library information in attribute configuration, wherein the service domain data model library information comprises a model library address, a port and user information.
The introduction model object module is used for introducing a business model entity object through an API interface; and opening a service domain data model library through a local development tool menu guide, inputting inquiry conditions of personnel basic information in inquiry conditions, selecting personnel basic information entity objects in inquiry results, and introducing the personnel basic information entity objects into a model tool by clicking an introduction button.
The MOM object conversion module is used for converting the introduced business model entity object into an MOM object file by the business model entity converter; when the introducing button is clicked, the basic information entity object information of personnel is obtained through the interface API service of the service domain data model base, and the MOM object file which can be read or maintained by the model tool is converted through the service model entity converter.
The correction model module is used for correcting and perfecting the entity object information of the business model in the model tool according to the business requirements; after finishing the MOM object file correction and conversion, loading the MOM object file by a model tool, displaying the introduced business model entity object information, and adjusting model attribute information according to business requirements, wherein the operation comprises adding business attributes or modifying data types; after the business model entity object information is adjusted, the adjusted business model entity object is synchronized to a business domain data model database by calling a business domain data model database interface API service.
The MOM object storage module is used for storing the information of the MOM object and forming an MOM object file; the information of MOM object file is stored in XML structure, and is converted into XML structure for storage by service model entity converter in the process of introducing service model entity object. The XML structure is divided into two parts, wherein the first part is information required by a model tool page and comprises version information, basic information and style information, and the second part is introduced business model entity object information which comprises business domain to which a business model entity object belongs and information of business model entity object attributes. The information of MOM object file and the information of business model entity object are one-to-many relation, and a plurality of business model entity objects are introduced at one time or a plurality of times according to business needs.
As shown in fig. 2, a micro-service code generation module is configured to input the converted MOM object file into a source code generator, and sequentially analyze the MOM object file, select a page style, bind a page attribute, match a pre-generated technical frame and output source code in the source code generator, and output the generated micro-application or micro-service source code structure information. The micro-service code generation module comprises a MOM object file analysis module, a page style selection module, a page attribute binding module, a technical framework module matched with pre-generation and an output source code module.
The MOM object file analysis module is used for inputting MOM object file information into the source code generator, and the source code generator acquires MOM object file information and analyzes the MOM object file according to XML label definition; selecting MOM object files in a development tool project catalog, right clicking a mouse to select conversion source codes in a menu, and inputting service names and service catalog structure information in a popped interface; and the source code generator acquires MOM object file information, analyzes the MOM object file according to XML tag definition and puts the MOM object file in a cache.
The page style selecting module is used for selecting a page display style according to service requirements; and generating a guide according to the source codes, and selecting a service display interface style.
The binding page attribute module is used for binding the page attribute with the business model entity object attribute information; and after confirming the interface display style, binding the interface display style with the business model entity object attribute extracted by the analysis MOM object file.
The technical framework module is matched and pre-generated and is used for matching the technical framework according to project technical framework requirements; after the business model entity object attribute is bound, the source code generation architecture is matched according to project technical architecture requirements.
The output source code module is used for generating service application source code information; and outputting the source code structure information through a source code generator.
Example 2:
as shown in fig. 3, the invention discloses a method for generating a micro service code based on a service domain data model library, which comprises the following steps:
s1, establishing a business domain data model base
The data of the business model entity object in the business domain data model library is stored in a database, and the business model entity object is stored in the database in the form of data table structural information, mainly comprising a structured data table of business major classes, business minor classes, entity basic information, entity structural attributes, entity relation information, entity version information, entity authorization management, entity reference records, entity text attributes and entity history records.
S2, building MOM object file
And referring to the business model entity object in the business domain data model library, and converting the business model entity object into a MOM object file.
The information of the MOM object file is stored in XML format.
S201 model opening tool
The model tool is opened in the development tool. And opening a local development tool, and configuring service domain data model library information in attribute configuration, wherein the service domain data model library information comprises model library addresses, ports and user information.
S202 importing model objects
The business model entity object is introduced through the API interface. And opening a service domain data model library through a local development tool menu guide, inputting inquiry conditions of personnel basic information in inquiry conditions, selecting personnel basic information entity objects in inquiry results, and introducing the personnel basic information entity objects into a model tool by clicking an introduction button.
S203 converting MOM object
The business model entity converter converts the incoming business model entity object into a MOM object file. When the introducing button is clicked, the basic information entity object information of personnel is obtained through the interface API service of the service domain data model base, and the MOM object file which can be read or maintained by the model tool is converted through the service model entity converter.
S204 correction model
And correcting and perfecting the entity object information of the business model in the model tool according to the business requirements. After finishing the MOM object file correction and conversion, the model tool loads the MOM object file, displays the introduced business model entity object information, and adjusts the model attribute information according to business requirements, including the operation of adding business attributes or modifying data types.
After the business model entity object information is adjusted, the adjusted business model entity object is synchronized to a business domain data model database by calling a business domain data model database interface API service.
S205 storing MOM object
Information of the MOM object is saved and a MOM object file is formed. The information of MOM object file is stored in XML structure, and is converted into XML structure for storage by service model entity converter in the process of introducing service model entity object. The XML structure is divided into two parts, wherein the first part is information required by a model tool page and comprises version information, basic information and style information, and the second part is introduced business model entity object information which comprises business domain to which a business model entity object belongs and information of business model entity object attributes. The information of MOM object file and the information of business model entity object are one-to-many relation, and a plurality of business model entity objects are introduced at one time or a plurality of times according to business needs.
S3, generating micro service code
And inputting the converted MOM object file into a source code generator, and outputting the generated micro-application or micro-service source code structure information in the source code generator by analyzing the MOM object file, selecting page style, binding page attribute, matching the pre-generated technical frame and the output source code. The method specifically comprises the following steps:
s301 parsing MOM object file
And inputting MOM object file information into a source code generator, and obtaining MOM object file information by the source code generator and analyzing the MOM object file according to XML tag definition. In the development tool project catalog, selecting MOM object files, right clicking a mouse to select conversion source codes in a menu, and inputting service names and service catalog structure information in a pop-up interface. And the source code generator acquires MOM object file information, analyzes the MOM object file according to XML tag definition and puts the MOM object file in a cache.
S302 selecting a Page style
And selecting a page display style according to service requirements. According to the source code generation guide, selecting a service display interface style, for example: a tree structure, a multi-Tab structure, or a list structure, clicking on the next step.
S303 binding page attributes
Binding the page attribute with the business model entity object attribute information. After the interface presentation style is confirmed, binding is performed with the service model entity object attribute extracted by the analysis MOM object file, for example: the user name corresponds to the user_name, and the next step is clicked after the binding is completed.
S304 matching pre-generated technical framework
Matching the technical architecture according to project technical architecture requirements. After the business model entity object attribute is bound, matching the source code generation architecture according to project technical architecture requirements, for example: micro services, micro applications or frameworks of monolithic structures.
S305 output source code
And generating service application source code information. And finally, outputting the source code structure information through a source code generator.
The purpose of the present application is:
the communication cost of designers or developers and business specialists is reduced through the standard or multiplexed business domain data model library, the code automatic generation method based on the micro-service object model MOM is provided, and the development efficiency of micro-service is improved.
1. The adopted business domain data model library is converted into identifiable MOM object files: and referring to the model information in the service domain data model library, and converting the model information into MOM object files read and maintained by a model tool. The research and development personnel need to further comb the model attributes, sort the MOM object file attributes identified by the model tools, and formulate MOM object file information which can be read and maintained by the model tools.
2. Generating required micro-service source codes with architectural characteristics according to the MOM object file: and inputting the MOM object file converted by the basic service model entity object into a source code generator, analyzing MOM object file information in the source code generator, matching with a framework template, and generating source codes of architectures required by developers.
The technical contribution of the present application:
the application provides a micro-service code generation system and method based on a service domain data model base, which improves the efficiency of micro-service design and micro-service development.
Firstly, the business domain model library is a business domain model library which is built for adapting to the business development needs of enterprises by combining general domain knowledge, enterprise business domain knowledge and the existing application systems to analyze and comb. In the method, the model object in the service domain model library is mainly cited, the model object is converted into the MOM object, model correction is easy to carry out in a model tool, the problem of accurate correspondence between the service and the service domain model is well solved, communication cost of service specialists and designers is reduced, and communication efficiency is improved.
Secondly, MOM object information is converted into XML mode through a model converter to be stored in the process of introducing the service model object, so that the service model is convenient to enter, expand and maintain. MOM object information and business model object information are in one-to-many relation, and a plurality of business models can be introduced at a time or business model information can be introduced for a plurality of times according to business needs, so that flexibility of generating business scene codes is improved.
Thirdly, the method and the device are flexibly connected into a source code generator through the converted MOM object information and used for rapidly developing service application. Analyzing MOM file in source code generator, selecting page style, binding page attribute, matching pre-generated frame such as micro service, and finally outputting generated micro application or micro service code structure. The developer can choose to generate only the back-end service codes, the codes containing the data access layer and the business logic layer, or generate complete front-end display codes and back-end service codes according to the use scene of the micro-service, wherein the front-end display codes contain the codes of the display layer and the control layer. The flexible code generation mode improves the development quality and reduces the development cost.
The inventive concept of the present application:
the software technology is an industry with very rapid development and change, the software development modes are relatively more, and the existing development modes comprise a page construction mode, a menu guide mode, a model guide mode, a direct coding mode and other development modes. In the prior development methods, a menu guide method is mostly adopted for development, and although a source code structure intended by a developer can be generated, the method plays no promotion role in service standardization and accurate correspondence between services and service domain models. The inventor finds that the MOM object required by the model tool is converted by referring to the model in the service domain data model library, and then the MOM object is input into the source code generator to generate the source code structure required by the developer. The MOM object is maintained in the model tool, and meanwhile, the model in the service domain data model library can be corrected, so that not only is the service more and more standard, but also the problem of accurate correspondence between the service and the service domain model is further solved.
After the application runs for a period of time in a secret way, the feedback of field technicians is beneficial in that:
1. and the micro-service is developed based on the business domain data model base, so that the work of the analysis design stage of the micro-service architecture application is simplified. By using a highly multiplexed business domain data model library, micro-service development designers are relieved from heavy business analysis work, and only need to focus on micro-service development.
2. The business domain data model library is an important resource which can be updated and accumulated for enterprises, so that the problem of accurate correspondence between business and business domain data models is well solved, and further standardized development of the business domain data model library can be promoted in development and construction of micro-services.
3. The visual business domain data model importing tool and the data model designing tool are provided, so that the design efficiency of the MOM model is improved.
4. The method provides a rich code frame template library, supports quick generation of codes of the micro-service architecture, and greatly improves the efficiency of micro-service development.
Description:
1. service domain data model base
The business domain data model base in the application uses the business model entity object driving development as a guiding thought, and mainly combines general domain knowledge, enterprise business domain knowledge and the existing application system to analyze and precipitate, so as to form a business domain data model base which is built for the self business development requirement of the enterprise.
As shown in fig. 4 to 7, the model entity object data in the business domain data model library is stored in a database, such as: and the MySql database is used for adding, modifying and deleting entity data for maintaining the service domain data model database in the service domain data model system function by service personnel or technicians. The business model entity object is stored in a database in the form of data table structured information, and mainly comprises a business major class, a business minor class, entity basic information, entity structured attribute, entity relation information, entity version information, entity authorization management, entity reference record, entity text attribute, entity history record and other structured data tables, wherein the entity basic information is the business model entity object.
2. Conversion of MOM object files based on business model entity objects
According to the method, the system and the device, the business model entity object in the business domain data model library is quoted, the business model entity object is converted into the MOM object file, the business model entity object is easy to correct in a model tool, the problem that business and the business model entity object accurately correspond to each other is well solved, the MOM object file information of the method stores a local working space in an XML format, and platform independence and portability of the method are achieved.
1) As shown in fig. 8, first, a local development tool is opened, such as: eclipse, configuring business domain data model base information in attribute configuration, such as: model library address, port, user information, etc.
2) As shown in fig. 9, next, a business domain data model library is opened through a local development tool menu wizard, and among query conditions, query conditions are input, such as: and the personnel basic information is that personnel basic information entity objects are selected in the query result, and introduced into the model tool by clicking the introduction button.
3) As shown in fig. 10, when the introduce button is clicked, basic information entity object information of personnel is obtained through an interface API service of the business domain data model library, and a MOM object file readable or maintainable by a model tool is converted through a business model entity converter.
4) As shown in fig. 11, after the MOM object file is converted, the model tool loads the MOM object file, displays the introduced business model entity object information, and the designer or technician can adjust the model attribute information according to the business requirement, such as adding business attribute or modifying data type.
5) After the business model entity object information is adjusted, the adjusted business model entity object is synchronized to a business domain data model database by calling a business domain data model database interface API service.
6) And storing MOM object file information.
3. MOM object file storage format
As shown in fig. 12 and 13, the whole MOM object file information is stored in an XML structure, and is converted into the XML structure by the business model entity converter for storage in the process of introducing the business model entity object. The XML structure is wholly divided into two parts, wherein the first part is information required by a model tool page, such as version information, basic information, style information and the like, and the second part is introduced business model entity object information, such as a business domain to which a business model entity object belongs, business model entity object attribute information and the like. The MOM object file information and the business model entity object information are in one-to-many relation, and a plurality of business model entity objects can be introduced at a time or a plurality of times according to business needs. The maintenance system of the business domain data model base can be convenient for inputting, expanding and maintaining business model entity object information.
4. Generating micro-service code based on MOM object files
As shown in fig. 14, after the business model entity object is adjusted according to the business requirement, the MOM object file is transmitted to the source code generator by means of right clicking the menu for quick development of business application. Inputting the converted MOM object file into a source code generator, and sequentially analyzing the MOM object file, selecting page style, binding page attribute and matching a pre-generated technical framework in the source code generator, wherein the technical framework comprises the following steps: and finally outputting the generated micro application or micro service source code structure information by the micro service, wherein the details are as follows:
1) First, in the development tool project catalog, a MOM object file is selected, a right click mouse selects conversion source codes in a menu, and information such as a service name, a service catalog structure and the like is input in a pop-up interface.
2) As shown in fig. 15, next, the source code generator obtains MOM object file information, parses the MOM object file according to XML tag definition, puts the MOM object file into a cache, generates a wizard according to the source code, and selects a service display interface style, such as: a tree structure, a multi-Tab structure, or a list structure, clicking on the next step.
3) As shown in fig. 16, after the interface presentation style is confirmed, binding is performed with the service model entity object attribute extracted by the analysis MOM object file, for example: the user name corresponds to the user_name, and the next step is clicked after the binding is completed.
4) After the business model entity object attribute is bound, matching the source code generation architecture according to project technical architecture requirements, such as: micro services, micro applications, monolithic structures, etc.
5) As shown in fig. 17, the source code structure information is finally output by the source code generator.
And the application code of the micro-service architecture is generated by using the MOM object file converted by the business model entity converter, so that the development efficiency of the micro-service is improved. The code generation engine in the application is based on a template mode, and templates are provided: the micro-service, micro-application and monomer structure provides complete code templates of data access layer, business logic layer, control layer and presentation layer for the developer to select. The developer can choose to generate only the back-end service codes, the codes containing the data access layer and the business logic layer, or generate complete front-end display codes and back-end service codes according to the use scene of the micro-service, wherein the front-end display codes contain the codes of the display layer and the control layer.

Claims (6)

1. A micro service code generation system based on a service domain data model base is characterized in that: the system comprises a business domain data model library building module, a MOM object file building module and a micro service code generating module, wherein the business domain data model library building module is used for building a business domain data model library, data of business model entity objects in the business domain data model library are stored in a database, the business model entity objects are stored in the database in data table structural information, and structured data tables of business major classes, business minor classes, entity basic information, entity structural attributes, entity relation information, entity version information, entity authorization management, entity reference records, entity text attributes and entity history records are included; a MOM object file module is established and used for referring to the business model entity objects in the business domain data model library and converting the business model entity objects into MOM object files; the micro-service code generation module is used for inputting the converted MOM object file into a source code generator, and outputting the generated micro-application or micro-service source code structure information by analyzing the MOM object file, selecting page style, binding page attribute, matching the pre-generated technical frame and outputting source code in the source code generator; the micro-service code generation module comprises a MOM object file analysis module, a page style selection module, a page attribute binding module, a pre-generated matching technical framework module and an output source code module, wherein the MOM object file analysis module is used for inputting MOM object file information into a source code generator, and the source code generator acquires MOM object file information and analyzes the MOM object file according to XML label definition; the page style selecting module is used for selecting a page display style according to service requirements; the binding page attribute module is used for binding the page attribute with the business model entity object attribute information; the technical framework module is matched and pre-generated and is used for matching the technical framework according to project technical framework requirements; and the output source code module is used for generating service application source code information.
2. The micro service code generation system based on the business domain data model base according to claim 1, wherein: the MOM object file establishing module comprises a model opening tool module, a model object introducing module, a MOM object converting module, a MOM correcting module and a MOM object storing module, wherein the model opening tool module is used for opening a model tool in a development tool; the introduction model object module is used for introducing a business model entity object through an API interface; the MOM object conversion module is used for converting the introduced business model entity object into an MOM object file by the business model entity converter; the correction model module is used for correcting and perfecting the entity object information of the business model in the model tool according to the business requirements; the MOM object storage module is used for storing the information of the MOM object and forming an MOM object file; and establishing a MOM object file module, and storing information of the MOM object file in an XML format.
3. A micro service code generation system based on a business domain data model base according to claim 2, characterized in that: the model opening tool module is also used for opening a local development tool, and configuring service domain data model base information in attribute configuration, including model base addresses, ports and user information; the introduction model object module is also used for opening a business domain data model library through a local development tool menu guide, inputting the inquiry condition of personnel basic information in inquiry conditions, selecting personnel basic information entity objects in inquiry results, and introducing the personnel basic information entity objects into a model tool by clicking an introduction button; the MOM object conversion module is also used for acquiring basic information entity object information of personnel through an interface API service of the service domain data model library when the introduction button is clicked, and converting MOM object files which can be read or maintained by a model tool through a service model entity converter; the correction model module is also used for loading the MOM object file by the model tool after finishing correction and conversion of the MOM object file, displaying the introduced business model entity object information, and adjusting model attribute information according to business requirements, wherein the operation comprises adding business attributes or modifying data types; after the business model entity object information is adjusted, synchronizing the adjusted business model entity object into a business domain data model library by calling a business domain data model library interface API service; the MOM object storage module is also used for storing information of the MOM object file in an XML structure, and converting the information into the XML structure through the business model entity converter for storage in the process of introducing the business model entity object; the XML structure is divided into two parts, wherein the first part is information required by a model tool page and comprises version information, basic information and style information, and the second part is introduced business model entity object information which comprises business domain to which a business model entity object belongs and information of business model entity object attributes; the information of MOM object file and the information of business model entity object are one-to-many relation, and a plurality of business model entity objects are introduced at one time or a plurality of times according to business needs.
4. The micro service code generation system based on the business domain data model base according to claim 1, wherein: the MOM object file analysis module is also used for selecting MOM object files in the development tool project catalogue, right clicking a mouse to select conversion source codes in a menu, and inputting information of service names and service catalogue structures in a popped interface; the source code generator obtains MOM object file information, analyzes the MOM object file according to XML label definition and puts the MOM object file into a cache; the page style selecting module is also used for generating a guide according to the source code and selecting a service display interface style; the binding page attribute module is also used for binding the business model entity object attribute extracted by the analysis MOM object file after the interface display style is confirmed; the matching pre-generated technical framework module is also used for matching a source code generation framework according to project technical framework requirements after the business model entity object attribute is bound; and the output source code module is also used for outputting source code structure information through a source code generator.
5. A micro-service code generation method based on a service domain data model base is characterized by comprising the following steps of: a business model entity object in a business domain data model library is referenced and converted into a MOM object file; specifically comprises the steps of S1 establishing a business domain data model base, S2 establishing MOM object files and S3 generating micro-service codes,
S1, establishing a business domain data model base
The data of the business model entity object in the business domain data model library is stored in a database, the business model entity object is stored in the database in the form of data table structural information, and the structured data table comprises business major classes, business minor classes, entity basic information, entity structural attributes, entity relation information, entity version information, entity authorization management, entity reference records, entity text attributes and entity history records;
s2, building MOM object file
A business model entity object in a business domain data model library is referenced and converted into a MOM object file;
information of the MOM object file is stored in an XML format;
s3, generating a micro-service code, inputting the converted MOM object file into a source code generator, and outputting the generated micro-application or micro-service source code structure information by analyzing the MOM object file, selecting page styles, binding page attributes, matching a pre-generated technical frame and outputting source codes in the source code generator;
the step of generating the micro service code in S3 specifically includes the steps of S301 parsing the MOM object file, S302 selecting a page style, S303 binding page attributes, S304 matching the pre-generated technical frame and S305 outputting source codes,
S301 parsing MOM object file
Inputting MOM object file information into a source code generator, wherein the source code generator acquires MOM object file information and analyzes the MOM object file according to XML tag definition; selecting MOM object files in a development tool project catalog, right clicking a mouse to select conversion source codes in a menu, and inputting service names and service catalog structure information in a popped interface; the source code generator obtains MOM object file information, analyzes the MOM object file according to XML label definition and puts the MOM object file into a cache;
s302 selecting a Page style
Selecting a page display style according to service requirements; generating a guide according to the source code, and selecting a service display interface style;
s303 binding page attributes
Binding page attributes with business model entity object attribute information; after confirming the interface display style, binding the interface display style with the business model entity object attribute extracted by the analysis MOM object file;
s304 matching pre-generated technical framework
Matching the technical architecture according to project technical architecture requirements; after the business model entity object attribute is bound, matching a source code generation architecture according to project technical architecture requirements;
s305 output source code
Generating service application source code information; and outputting the source code structure information through a source code generator.
6. The method for generating micro service codes based on the service domain data model base according to claim 5, wherein: the step of creating a MOM object file S2 specifically includes the steps of opening a model tool S201, introducing a model object S202, converting a MOM object S203, modifying a model S204, and storing a MOM object S205,
s201 model opening tool
Opening a model tool in a development tool; opening a local development tool, and configuring service domain data model library information in attribute configuration, wherein the service domain data model library information comprises model library addresses, ports and user information;
s202 importing model objects
Introducing a business model entity object through an API interface; opening a service domain data model library through a local development tool menu guide, inputting a query condition of basic information of personnel in the query condition, selecting basic information entity objects of the personnel in the query result, and introducing the basic information entity objects of the personnel into a model tool by clicking an introduction button;
s203 converting MOM object
The business model entity converter converts the introduced business model entity object into a MOM object file; when the introducing button is clicked, acquiring basic information entity object information of personnel through an interface API service of a service domain data model library, and converting a MOM object file which can be read or maintained by a model tool through a service model entity converter;
S204 correction model
Correcting and perfecting business model entity object information in a model tool according to business requirements; after finishing the MOM object file correction and conversion, loading the MOM object file by a model tool, displaying the introduced business model entity object information, and adjusting model attribute information according to business requirements, wherein the operation comprises adding business attributes or modifying data types;
after the business model entity object information is adjusted, synchronizing the adjusted business model entity object into a business domain data model library by calling a business domain data model library interface API service;
s205 storing MOM object
Storing information of the MOM object and forming an MOM object file; the information of MOM object file is stored in XML structure, and in the process of introducing service model entity object, it is converted into XML structure by service model entity converter for storage; the XML structure is divided into two parts, wherein the first part is information required by a model tool page and comprises version information, basic information and style information, and the second part is introduced business model entity object information which comprises business domain to which a business model entity object belongs and information of business model entity object attributes; the information of MOM object file and the information of business model entity object are one-to-many relation, and a plurality of business model entity objects are introduced at one time or a plurality of times according to business needs.
CN202010363365.6A 2020-04-30 2020-04-30 Micro-service code generation system and method based on service domain data model library Active CN111488145B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010363365.6A CN111488145B (en) 2020-04-30 2020-04-30 Micro-service code generation system and method based on service domain data model library

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010363365.6A CN111488145B (en) 2020-04-30 2020-04-30 Micro-service code generation system and method based on service domain data model library

Publications (2)

Publication Number Publication Date
CN111488145A CN111488145A (en) 2020-08-04
CN111488145B true CN111488145B (en) 2023-05-30

Family

ID=71794991

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010363365.6A Active CN111488145B (en) 2020-04-30 2020-04-30 Micro-service code generation system and method based on service domain data model library

Country Status (1)

Country Link
CN (1) CN111488145B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111913695A (en) * 2020-08-07 2020-11-10 国网信息通信产业集团有限公司 Code conversion method, device and storage medium
CN112068812B (en) * 2020-09-02 2024-04-02 数字广东网络建设有限公司 Micro-service generation method and device, computer equipment and storage medium
CN112612466A (en) * 2020-12-22 2021-04-06 成都航盛智行科技有限公司 Data exchange system and method of automobile display equipment based on IPC model
US11487540B2 (en) 2021-03-02 2022-11-01 Capital One Services, Llc Micro-frontend as a service
CN113901022B (en) * 2021-09-22 2024-03-15 成都飞机工业(集团)有限责任公司 Method, device, equipment and storage medium for establishing business and data relationship model
WO2023151239A1 (en) * 2022-02-14 2023-08-17 华为云计算技术有限公司 Micro-service creation method and related device
CN115051904B (en) * 2022-03-23 2023-09-12 武汉烽火技术服务有限公司 Method and device for managing single disk state based on markup language
CN115098494B (en) * 2022-05-27 2023-04-18 国网河北省电力有限公司营销服务中心 Mobile operation application-based power service center database architecture and application thereof
CN115905291B (en) * 2022-12-12 2024-02-23 广州南方智能技术有限公司 Graph-based data processing method, device and storage medium
CN117492721B (en) * 2023-12-29 2024-04-16 中建三局信息科技有限公司 General rapid development method applied to building digital information system

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110018822A (en) * 2019-04-16 2019-07-16 山东浪潮通软信息科技有限公司 A kind of method and system automatically generating micro services function
CN110427174A (en) * 2019-08-05 2019-11-08 浪潮云信息技术有限公司 A kind of micro services construction method based on database

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101256492A (en) * 2008-03-31 2008-09-03 宋乃辉 Software development method and system for executing model drive structure
US10985997B2 (en) * 2016-05-06 2021-04-20 Enterpriseweb Llc Systems and methods for domain-driven design and execution of metamodels
CN110737425B (en) * 2018-07-20 2023-05-16 网宿科技股份有限公司 Method and device for establishing application program of charging platform system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110018822A (en) * 2019-04-16 2019-07-16 山东浪潮通软信息科技有限公司 A kind of method and system automatically generating micro services function
CN110427174A (en) * 2019-08-05 2019-11-08 浪潮云信息技术有限公司 A kind of micro services construction method based on database

Also Published As

Publication number Publication date
CN111488145A (en) 2020-08-04

Similar Documents

Publication Publication Date Title
CN111488145B (en) Micro-service code generation system and method based on service domain data model library
CN111241454B (en) Method, system and device for generating webpage codes
CN106775770B (en) Search method for constructing query statement based on class information
KR100633478B1 (en) System and its method for developing software based on business operating system
CN110825369A (en) Method for automatically generating codes based on java language
CN102163223A (en) Self-service query method and device thereof for background data
US20120110030A1 (en) Software database system and process of building and operating the same
CA2548334A1 (en) An apparatus for migration and conversion of software code from any source platform to any target platform
CN103294475A (en) Automatic service generating system and automatic service generating method both of which are based on imaging service scene and field template
CN106648587A (en) Annotation-based Web application code generation method
CN111104106A (en) Visual development method, system and medium for integrating business process and communication message
CN108762743A (en) Data table operation code generation method and device
US20120124550A1 (en) Facilitating database application code translation from a first application language to a second application language
US11669332B1 (en) Systems and methods for modernizing legacy applications
CN108647147A (en) It is a kind of to execute automatic test machine people and its application method using atlas analysis
US20060047723A1 (en) Custom database system and method of building the same
CN112328229A (en) Method for quickly creating Jenkins assembly line
CN110750553A (en) Method for self-defining export of data in service management system
CN106383734A (en) Method for extracting detailed design from codes
CN109062816A (en) A kind of method, device and equipment of software test
CN115469849B (en) Service processing system, method, electronic equipment and storage medium
CN108132802B (en) Application method of configuration model in system development
CN111552459B (en) Service arrangement flow management system and method
CN108763066A (en) A kind of natural language test script edit methods of word slot design and test machine people
US20080022258A1 (en) Custom database system and method of building and operating the same

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant