CN111488145A - Micro-service code generation system and method based on service domain data model base - Google Patents
Micro-service code generation system and method based on service domain data model base Download PDFInfo
- Publication number
- CN111488145A CN111488145A CN202010363365.6A CN202010363365A CN111488145A CN 111488145 A CN111488145 A CN 111488145A CN 202010363365 A CN202010363365 A CN 202010363365A CN 111488145 A CN111488145 A CN 111488145A
- Authority
- CN
- China
- Prior art keywords
- model
- mom
- information
- business
- service
- 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.)
- Granted
Links
Images
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/35—Creation or generation of source code model driven
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/73—Program documentation
-
- 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
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
本发明公开了一种基于业务域数据模型库的微服务代码生成系统及方法,涉及微服务技术领域;系统包括建立业务域数据模型库模块和建立MOM对象文件模块,建立业务域数据模型库模块,用于建立业务域数据模型库,建立MOM对象文件模块,用于引用业务域数据模型库中的业务模型实体对象,将其转换为MOM对象文件;方法为引用业务域数据模型库中的业务模型实体对象将其转换为MOM对象文件;其通过建立业务域数据模型库模块和建立MOM对象文件模块等,实现提高了微服务的开发效率。
The invention discloses a microservice code generation system and method based on a business domain data model library, and relates to the technical field of microservices; the system includes a module for establishing a business domain data model library, a module for establishing a MOM object file, and a module for establishing a business domain data model library , which is used to establish the business domain data model library and the MOM object file module, which is used to refer to the business model entity object in the business domain data model library and convert it into a MOM object file; the method is to refer to the business model in the business domain data model library. The model entity object is converted into a MOM object file; it improves the development efficiency of microservices by establishing a business domain data model library module and a MOM object file module.
Description
技术领域technical field
本发明涉及微服务技术领域,尤其涉及一种基于业务域数据模型库的微服务代码生成系统及方法。The invention relates to the technical field of microservices, in particular to a microservice code generation system and method based on a business domain data model library.
背景技术Background technique
近年来,微服务架构技术迅速发展,采用微服务架构技术的企业越来越多。相比传统单体应用架构,微服务架构更强调灵活的交付。微服务是一些可以协同工作的小而自治的服务,具有独立部署、松散耦合、技术隔离、易于扩展等优点。有些微服务架构应用是从单体应用架构拆分转化而来,有些微服务是根据实际的业务应用新开发的。微服务对象模型Micro Object Model,以下简称MOM。In recent years, microservice architecture technology has developed rapidly, and more and more enterprises have adopted microservice architecture technology. Compared with the traditional monolithic application architecture, the microservice architecture emphasizes flexible delivery. Microservices are small and autonomous services that can work together and have the advantages of independent deployment, loose coupling, technical isolation, and easy expansion. Some microservice architecture applications are split and transformed from the monolithic application architecture, and some microservices are newly developed based on actual business applications. Micro Object Model Micro Object Model, hereinafter referred to as MOM.
在微服务架构应用的实践过程中会面临以下问题:在微服务开发前期,软件设计开发人员需要和企业的业务专家们进行大量的密切交流,需要耗费较多的沟通成本,进行微服务业务域分析,以此决定每个微服务含有的业务粒度,微服务拆分的粒度由开发设计人员把控,在大量的企业微服务开发中,同一领域范围的业务在不同的微服务设计开发中会面临拆分标准不统一的问题,在企业的微服务建设中,会导致同一类型的业务在微服务建设中存在重复开发、质量参差不齐等问题。使用传统方式开发微服务,在微服务数量较多时,存在交付周期长等问题。In the practice process of microservice architecture application, the following problems will be faced: In the early stage of microservice development, software design and developers need to have a lot of close communication with the business experts of the enterprise, which requires a lot of communication costs to carry out the microservice business domain. Analysis is used to determine the business granularity of each microservice. The granularity of microservice splitting is controlled by developers and designers. In the development of a large number of enterprise microservices, businesses in the same field will meet in different microservice design and development. Faced with the problem of inconsistent splitting standards, in the construction of microservices in enterprises, it will lead to repeated development and uneven quality of the same type of business in the construction of microservices. When using traditional methods to develop microservices, when there are a large number of microservices, there are problems such as long delivery cycles.
现有技术相关的专利申请:Patent applications related to the prior art:
(1)一种单体应用微服务化的方法:专利申请名称为一种单体应用微服务化的方法,申请号码为2018100240484,该专利申请是基于已开发完成的单体应用,根据所有请求调用的起点和终点分析出应用中的业务关联模块,并需要通过人工修正以确定微服务的粒度。该申请的技术方案是针对已有单体应用系统进行分析的,对于新开发的微服务粒度分析并不适用,并且该技术方案并不涉及微服务的开发工作。(1) A method for monolithic application microservices: the name of the patent application is a method for monolithic application microservices, the application number is 2018100240484, the patent application is based on the developed monolithic application, according to all requests The starting point and end point of the call analyzes the business related modules in the application, and needs to be corrected manually to determine the granularity of the microservice. The technical solution of this application is to analyze the existing single application system, and is not applicable to the granularity analysis of newly developed microservices, and the technical solution does not involve the development of microservices.
(2)一种微服务生成方法及装置:专利申请名称为一种微服务生成方法及装置,申请号码为2017103920714,该专利申请是通过提供一种基于基础框架模板,根据要创建的微服务类型,生成微服务框架代码。该申请的技术方案并未引入微服务业务相关的内容,并未生成微服务业务逻辑相关的代码。(2) A method and device for generating micro-services: The patent application name is a method and device for generating micro-services, and the application number is 2017103920714. , to generate the microservice framework code. The technical solution of the application does not introduce content related to the microservice business, and does not generate code related to the business logic of the microservice.
现有技术问题及思考:如何解决微服务开发效率低的技术问题。Existing technical problems and thinking: how to solve the technical problem of low efficiency of microservice development.
发明内容SUMMARY OF THE INVENTION
本发明所要解决的技术问题是提供一种基于业务域数据模型库的微服务代码生成系统及方法,其通过建立业务域数据模型库模块和建立MOM对象文件模块等,实现提高了微服务的开发效率。The technical problem to be solved by the present invention is to provide a microservice code generation system and method based on a business domain data model library, which improves the development of microservices by establishing a business domain data model library module and a MOM object file module, etc. efficiency.
为解决上述技术问题,本发明所采取的技术方案是:一种基于业务域数据模型库的微服务代码生成系统包括建立业务域数据模型库模块和建立MOM对象文件模块,建立业务域数据模型库模块,用于建立业务域数据模型库;建立MOM对象文件模块,用于引用业务域数据模型库中的业务模型实体对象,将其转换为MOM对象文件。In order to solve the above-mentioned technical problems, the technical solution adopted by the present invention is: a microservice code generation system based on a business domain data model library includes establishing a business domain data model library module and a MOM object file module, and establishing a business domain data model library. The module is used to establish the business domain data model library; the MOM object file module is established to refer to the business model entity object in the business domain data model library and convert it into a MOM object file.
进一步的技术方案在于:还包括生成微服务代码模块,生成微服务代码模块,用于将转换后的MOM对象文件输入源码生成器中,在源码生成器中先后通过解析MOM对象文件、选择页面风格、绑定页面属性、匹配预生成的技术框架和输出源码,输出生成后的微应用或微服务源码结构信息;建立业务域数据模型库模块,还用于业务域数据模型库中的业务模型实体对象的数据存储在数据库中,业务模型实体对象在数据库中以数据表结构化信息存储,有业务大类、业务细类、实体基本信息、实体结构化属性、实体关系信息、实体版本信息、实体授权管理、实体引用记录、实体文本属性和实体历史记录的结构化数据表。A further technical solution is: it also includes generating a microservice code module, and generating a microservice code module for inputting the converted MOM object file into a source code generator, and in the source code generator, successively by parsing the MOM object file and selecting a page style , Bind page attributes, match the pre-generated technical framework and output source code, and output the generated micro-application or micro-service source code structure information; establish a business domain data model library module, which is also used for business model entities in the business domain data model library The data of the object is stored in the database, and the business model entity object is stored in the database with the structured information of the data table. Structured data tables for authorization management, entity reference records, entity text attributes, and entity history records.
进一步的技术方案在于:所述建立MOM对象文件模块包括打开模型工具模块、引入模型对象模块、转换MOM对象模块、修正模型模块和存储MOM对象,打开模型工具模块,用于在开发工具中打开模型工具;引入模型对象模块,用于通过API接口引入业务模型实体对象;转换MOM对象模块,用于业务模型实体转换器将引入业务模型实体对象转换成MOM对象文件;修正模型模块,用于根据业务需求在模型工具中修正完善业务模型实体对象信息;存储MOM对象模块,用于保存MOM对象的信息并形成MOM对象文件;建立MOM对象文件模块,还用于MOM对象文件的信息以XML格式存储。Further technical scheme is: described establishing MOM object file module comprises opening model tool module, introducing model object module, converting MOM object module, revising model module and storing MOM object, opening model tool module, for opening model in development tool Tool; import model object module, which is used to import business model entity objects through API interface; convert MOM object module, which is used for business model entity converter to convert imported business model entity objects into MOM object files; It is required to modify and improve the entity object information of the business model in the model tool; store the MOM object module, which is used to save the information of the MOM object and form the MOM object file; establish the MOM object file module, which is also used to store the information of the MOM object file in XML format.
进一步的技术方案在于:打开模型工具模块,还用于打开本地开发工具,在属性配置中配置业务域数据模型库信息,包括模型库地址、端口和用户信息;引入模型对象模块,还用于通过本地开发工具菜单向导,打开业务域数据模型库,在查询条件中,输入人员基本信息的查询条件,在查询结果中选择人员基本信息实体对象,通过点击引入按钮,将人员基本信息实体对象引入到模型工具中;转换MOM对象模块,还用于在点击引入按钮时,通过业务域数据模型库的接口API服务,获取人员基本信息实体对象信息,经过业务模型实体转换器转换模型工具可读取或维护的MOM对象文件;修正模型模块,还用于MOM对象文件修正转换完成后,模型工具加载MOM对象文件,展示引入后的业务模型实体对象信息,根据业务需要调整模型属性信息,包括增加业务属性或修改数据类型的操作;调整完业务模型实体对象信息后,通过调用业务域数据模型库接口API服务,将调整后的业务模型实体对象同步到业务域数据模型库中;存储MOM对象模块,还用于MOM对象文件的信息以XML结构存储,在引入业务模型实体对象过程中,通过业务模型实体转换器将其转化为XML结构进行存储;XML结构分两大部分,第一部分为模型工具页面所需要信息,其包括版本信息、基本信息和样式信息,第二部分为引入的业务模型实体对象信息,其包括业务模型实体对象所属业务域和业务模型实体对象属性的信息;MOM对象文件的信息与业务模型实体对象的信息是一对多关系,根据业务需要一次引入多个业务模型实体对象或多次引入业务模型实体对象信息。A further technical solution is: open the model tool module, which is also used to open the local development tool, and configure the business domain data model library information in the attribute configuration, including the model library address, port and user information; The local development tool menu wizard, open the business domain data model library, in the query conditions, enter the query conditions of the basic personnel information, select the basic personnel information entity object in the query result, and click the import button to import the personnel basic information entity object into In the model tool; the MOM object module is converted, and when the import button is clicked, the basic information entity object information of the personnel can be obtained through the interface API service of the business domain data model library, which can be read or Maintained MOM object file; Modification model module, also used for MOM object file modification and conversion, the model tool loads the MOM object file, displays the imported business model entity object information, and adjusts the model attribute information according to business needs, including adding business attributes. Or modify the data type; after adjusting the business model entity object information, synchronize the adjusted business model entity object to the business domain data model library by calling the business domain data model library interface API service; store the MOM object module, and also The information used in the MOM object file is stored in XML structure. During the process of introducing the business model entity object, it is converted into an XML structure for storage through the business model entity converter; the XML structure is divided into two parts, the first part is the model tool page. The required information includes version information, basic information and style information. The second part is the introduced business model entity object information, which includes the business domain to which the business model entity object belongs and the business model entity object attribute information; MOM object file information and The information of business model entity objects is a one-to-many relationship, and according to business needs, multiple business model entity objects are introduced at one time or business model entity object information is introduced multiple times.
进一步的技术方案在于:所述生成微服务代码模块包括解析MOM对象文件模块、选择页面风格模块、绑定页面属性模块、匹配预生成的技术框架模块和输出源码模块,解析MOM对象文件模块,用于将MOM对象文件信息输入源码生成器,源码生成器获取MOM对象文件信息并根据XML标签定义解析MOM对象文件;选择页面风格模块,用于根据业务需要选择页面展示风格;绑定页面属性模块,用于将页面属性与业务模型实体对象属性信息进行绑定;匹配预生成的技术框架模块,用于根据项目技术架构要求匹配技术架构;输出源码模块,用于生成业务应用源码信息。A further technical solution is: the generating microservice code module includes parsing MOM object file module, selecting page style module, binding page attribute module, matching pre-generated technical framework module and output source code module, parsing MOM object file module, using To input the MOM object file information into the source code generator, the source code generator obtains the MOM object file information and parses the MOM object file according to the XML tag definition; selects the page style module, which is used to select the page display style according to business needs; binds the page attribute module, It is used to bind page attributes with business model entity object attribute information; it matches the pre-generated technical framework module, which is used to match the technical framework according to the project technical framework requirements; the output source code module is used to generate business application source code information.
进一步的技术方案在于:解析MOM对象文件模块,还用于在开发工具项目目录中,选择MOM对象文件,右击鼠标在菜单中选择转换源码,在弹出的界面中输入服务名称和服务目录结构的信息;源码生成器将获取MOM对象文件信息,根据XML标签定义解析MOM对象文件放入缓存中;选择页面风格模块,还用于根据源码生成向导,选择业务展示界面风格;绑定页面属性模块,还用于界面展示风格确认后,与解析MOM对象文件提取的业务模型实体对象属性进行绑定;匹配预生成的技术框架模块,还用于业务模型实体对象属性绑定完成后,根据项目技术架构要求,匹配源码生成架构;输出源码模块,还用于通过源码生成器输出源码结构信息。A further technical solution is: parsing the MOM object file module is also used to select the MOM object file in the development tool project directory, right-click the mouse to select the conversion source code in the menu, and enter the service name and the service directory structure in the pop-up interface. information; the source code generator will obtain the MOM object file information, parse the MOM object file according to the XML tag definition and put it into the cache; select the page style module, which is also used to generate the wizard according to the source code, and select the business display interface style; bind the page attribute module, It is also used for binding with the business model entity object attributes extracted by parsing the MOM object file after the interface display style is confirmed; matching the pre-generated technical framework module, and also used for binding the business model entity object attributes according to the project technical framework. Requirements, matching the source code generation structure; outputting the source code module is also used to output the source code structure information through the source code generator.
一种基于业务域数据模型库的微服务代码生成方法为引用业务域数据模型库中的业务模型实体对象,将其转换为MOM对象文件。A microservice code generation method based on a business domain data model library is to refer to a business model entity object in the business domain data model library and convert it into a MOM object file.
进一步的技术方案在于:具体包括S1建立业务域数据模型库和S2建立MOM对象文件的步骤,S1建立业务域数据模型库,业务域数据模型库中的业务模型实体对象的数据存储在数据库中,业务模型实体对象在数据库中以数据表结构化信息存储,有业务大类、业务细类、实体基本信息、实体结构化属性、实体关系信息、实体版本信息、实体授权管理、实体引用记录、实体文本属性和实体历史记录的结构化数据表;S2建立MOM对象文件,引用业务域数据模型库中的业务模型实体对象,将其转换为MOM对象文件;MOM对象文件的信息以XML格式存储。A further technical solution is: specifically comprising the steps of S1 establishing a business domain data model library and S2 establishing a MOM object file, S1 establishing a business domain data model library, and the data of the business model entity objects in the business domain data model library is stored in the database, Business model entity objects are stored in the database with structured information in data tables, including business categories, business sub-categories, entity basic information, entity structured attributes, entity relationship information, entity version information, entity authorization management, entity reference records, entity Structured data table of text attributes and entity history; S2 establishes a MOM object file, refers to the business model entity object in the business domain data model library, and converts it into a MOM object file; the information of the MOM object file is stored in XML format.
进一步的技术方案在于:所述S2建立MOM对象文件的步骤具体包括S201打开模型工具、S202引入模型对象、S203转换MOM对象、S204修正模型和S205存储MOM对象的步骤,S201打开模型工具,在开发工具中打开模型工具;打开本地开发工具,在属性配置中配置业务域数据模型库信息,包括模型库地址、端口和用户信息;S202引入模型对象,通过API接口引入业务模型实体对象;通过本地开发工具菜单向导,打开业务域数据模型库,在查询条件中,输入人员基本信息的查询条件,在查询结果中选择人员基本信息实体对象,通过点击引入按钮,将人员基本信息实体对象引入到模型工具中;S203转换MOM对象,业务模型实体转换器将引入业务模型实体对象转换成MOM对象文件;在点击引入按钮时,通过业务域数据模型库的接口API服务,获取人员基本信息实体对象信息,经过业务模型实体转换器转换模型工具可读取或维护的MOM对象文件;S204修正模型,根据业务需求在模型工具中修正完善业务模型实体对象信息;MOM对象文件修正转换完成后,模型工具加载MOM对象文件,展示引入后的业务模型实体对象信息,根据业务需要调整模型属性信息,包括增加业务属性或修改数据类型的操作;调整完业务模型实体对象信息后,通过调用业务域数据模型库接口API服务,将调整后的业务模型实体对象同步到业务域数据模型库中;S205存储MOM对象,保存MOM对象的信息并形成MOM对象文件;MOM对象文件的信息以XML结构存储,在引入业务模型实体对象过程中,通过业务模型实体转换器将其转化为XML结构进行存储;XML结构分两大部分,第一部分为模型工具页面所需要信息,其包括版本信息、基本信息和样式信息,第二部分为引入的业务模型实体对象信息,其包括业务模型实体对象所属业务域和业务模型实体对象属性的信息;MOM对象文件的信息与业务模型实体对象的信息是一对多关系,根据业务需要一次引入多个业务模型实体对象或多次引入业务模型实体对象信息。Further technical scheme is: the step that described S2 establishes MOM object file specifically comprises the step of S201 opening model tool, S202 introducing model object, S203 converting MOM object, S204 revising model and S205 storing the step of MOM object, S201 opening model tool, in developing. Open the model tool in the tool; open the local development tool, and configure the business domain data model library information in the property configuration, including the model library address, port and user information; S202 introduces the model object, and introduces the business model entity object through the API interface; through the local development Tools menu wizard, open the business domain data model library, in the query conditions, enter the query conditions of the basic personnel information, select the basic personnel information entity object in the query result, and click the import button to import the basic personnel information entity object into the model tool middle; S203 converts the MOM object, and the business model entity converter converts the imported business model entity object into a MOM object file; when the import button is clicked, the basic information entity object information of the personnel is obtained through the interface API service of the business domain data model library. The business model entity converter converts the MOM object file that the model tool can read or maintain; S204 corrects the model, and corrects and improves the business model entity object information in the model tool according to business requirements; after the MOM object file is corrected and converted, the model tool loads the MOM object file to display the imported business model entity object information, adjust model attribute information according to business needs, including operations to add business attributes or modify data types; after adjusting the business model entity object information, call the business domain data model library interface API service , synchronize the adjusted business model entity object into the business domain data model library; S205 store the MOM object, save the information of the MOM object and form a MOM object file; the information of the MOM object file is stored in an XML structure, and when the business model entity object is introduced In the process, the business model entity converter is used to convert it into an XML structure for storage; the XML structure is divided into two parts, the first part is the information required by the model tool page, including version information, basic information and style information, and the second part is The introduced business model entity object information includes information about the business domain to which the business model entity object belongs and the attribute information of the business model entity object; the information of the MOM object file and the information of the business model entity object are in a one-to-many relationship. A business model entity object or the business model entity object information is introduced multiple times.
进一步的技术方案在于:还包括步骤S3生成微服务代码,将转换后的MOM对象文件输入源码生成器中,在源码生成器中先后通过解析MOM对象文件、选择页面风格、绑定页面属性、匹配预生成的技术框架和输出源码,输出生成后的微应用或微服务源码结构信息;所述S3生成微服务代码的步骤具体包括S301解析MOM对象文件、S302选择页面风格、S303绑定页面属性、S304匹配预生成的技术框架和S305输出源码的步骤,S301解析MOM对象文件,将MOM对象文件信息输入源码生成器,源码生成器获取MOM对象文件信息并根据XML标签定义解析MOM对象文件;在开发工具项目目录中,选择MOM对象文件,右击鼠标在菜单中选择转换源码,在弹出的界面中输入服务名称和服务目录结构的信息;源码生成器将获取MOM对象文件信息,根据XML标签定义解析MOM对象文件放入缓存中;S302选择页面风格,根据业务需要选择页面展示风格;根据源码生成向导,选择业务展示界面风格;S303绑定页面属性,将页面属性与业务模型实体对象属性信息进行绑定;界面展示风格确认后,与解析MOM对象文件提取的业务模型实体对象属性进行绑定;S304匹配预生成的技术框架,根据项目技术架构要求匹配技术架构;业务模型实体对象属性绑定完成后,根据项目技术架构要求,匹配源码生成架构;S305输出源码,生成业务应用源码信息;通过源码生成器输出源码结构信息。A further technical solution is: it also includes step S3 to generate the microservice code, input the converted MOM object file into the source code generator, and successively analyze the MOM object file, select the page style, bind the page attributes, and match the source code generator in the source code generator. Pre-generated technical framework and output source code, outputting the generated micro-application or micro-service source code structure information; the step of generating micro-service code in S3 specifically includes S301 parsing the MOM object file, S302 selecting page style, S303 binding page attributes, S304 matches the pre-generated technical framework and S305 outputs the source code, S301 parses the MOM object file, inputs the MOM object file information into the source code generator, and the source code generator obtains the MOM object file information and parses the MOM object file according to the XML tag definition; In the tool project directory, select the MOM object file, right-click the mouse and select Convert Source Code in the menu, and enter the service name and service directory structure information in the pop-up interface; the source code generator will obtain the MOM object file information and parse it according to the XML tag definition The MOM object file is put into the cache; S302 selects the page style, and selects the page display style according to the business needs; according to the source code generation wizard, selects the business display interface style; S303 binds the page attributes, and binds the page attributes to the attribute information of the business model entity object After the interface display style is confirmed, it is bound to the business model entity object attributes extracted by parsing the MOM object file; S304 matches the pre-generated technical framework, and matches the technical framework according to the project technical framework requirements; after the business model entity object attribute binding is completed , and match the source code generation architecture according to the project technical architecture requirements; S305 outputs the source code to generate the business application source code information; outputs the source code structure information through the source code generator.
采用上述技术方案所产生的有益效果在于:The beneficial effects produced by the above technical solutions are:
一种基于业务域数据模型库的微服务代码生成系统,其通过建立业务域数据模型库模块和建立MOM对象文件模块等,实现提高了微服务的开发效率。A microservice code generation system based on a business domain data model library, which improves the development efficiency of microservices by establishing a business domain data model library module and a MOM object file module.
一种基于业务域数据模型库的微服务代码生成方法,其通过引用业务域数据模型库中的业务模型实体对象并将其转换为MOM对象文件等,实现提高了微服务的开发效率。A microservice code generation method based on a business domain data model library, which improves the development efficiency of microservices by referencing business model entity objects in the business domain data model library and converting them into MOM object files.
详见具体实施方式部分描述。For details, please refer to the description in the detailed description.
附图说明Description of drawings
图1是本发明实施例1中建立MOM对象文件模块的原理框图;Fig. 1 is the principle block diagram of establishing MOM object file module in the embodiment of the
图2是本发明实施例1中生成微服务代码模块的原理框图;Fig. 2 is a schematic block diagram of generating a microservice code module in
图3是本发明实施例2的流程图;3 is a flowchart of
图4是业务域数据模型库Web系统的原理框图;Fig. 4 is the principle block diagram of the business domain data model library Web system;
图5是业务域数据模型的原理框图;Fig. 5 is the principle block diagram of the business domain data model;
图6是数据表结构属性的屏幕截图;Figure 6 is a screenshot of the data table structure properties;
图7是数据库中数据表的屏幕截图;Fig. 7 is the screen shot of the data table in the database;
图8是配置服务地址、端口和用户信息的屏幕截图;Figure 8 is a screenshot of configuring service address, port and user information;
图9是选择业务模型实体对象的屏幕截图;Figure 9 is a screen shot of selecting a business model entity object;
图10是MOM对象文件信息的屏幕截图;Figure 10 is a screenshot of the MOM object file information;
图11是调整业务模型实体信息的屏幕截图;Figure 11 is a screen shot of adjusting business model entity information;
图12是MOM对象文件的格式图;Fig. 12 is the format diagram of MOM object file;
图13是MOM对象文件的详细格式图;Figure 13 is a detailed format diagram of the MOM object file;
图14是基于MOM对象文件生成源码至MOM对象文件输入环节的屏幕截图;Fig. 14 is the screen shot of generating source code to MOM object file input link based on MOM object file;
图15是选择界面风格的屏幕截图;Figure 15 is a screenshot of selecting an interface style;
图16是绑定数据的屏幕截图;Figure 16 is a screenshot of binding data;
图17是生成微服务源码结构的屏幕截图。Figure 17 is a screenshot of the generated microservice source code structure.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。以下对至少一个示例性实施例的描述实际上仅仅是说明性的,决不作为对本申请及其应用或使用的任何限制。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all of the embodiments. The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the application, its application, or uses. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
在下面的描述中阐述了很多具体细节以便于充分理解本申请,但是本申请还可以采用其他不同于在此描述的其它方式来实施,本领域技术人员可以在不违背本申请内涵的情况下做类似推广,因此本申请不受下面公开的具体实施例的限制。In the following description, many specific details are set forth to facilitate a full understanding of the present application, but the present application can also be implemented in other ways different from those described herein, and those skilled in the art can do so without departing from the connotation of the present application Similar promotion, therefore, the present application is not limited by the specific embodiments disclosed below.
实施例1:Example 1:
如图1、图2所示,本发明公开了一种基于业务域数据模型库的微服务代码生成系统,包括建立业务域数据模型库模块、建立MOM对象文件模块和生成微服务代码模块,所述建立MOM对象文件模块包括打开模型工具模块、引入模型对象模块、转换MOM对象模块、修正模型模块和存储MOM对象,所述生成微服务代码模块包括解析MOM对象文件模块、选择页面风格模块、绑定页面属性模块、匹配预生成的技术框架模块和输出源码模块。As shown in Figures 1 and 2, the present invention discloses a microservice code generation system based on a business domain data model library, including establishing a business domain data model library module, establishing a MOM object file module and generating a microservice code module. The establishment of MOM object file module includes opening model tool module, introducing model object module, converting MOM object module, revising model module and storing MOM object, and described generating microservice code module includes parsing MOM object file module, selecting page style module, binding Define the page attribute module, match the pre-generated technical framework module and output the source code module.
建立业务域数据模型库模块,用于建立业务域数据模型库,业务域数据模型库中的业务模型实体对象的数据存储在数据库中,业务模型实体对象在数据库中以数据表结构化信息存储,主要有业务大类、业务细类、实体基本信息、实体结构化属性、实体关系信息、实体版本信息、实体授权管理、实体引用记录、实体文本属性和实体历史记录的结构化数据表。The establishment of a business domain data model library module is used to establish a business domain data model library. The data of the business model entity objects in the business domain data model library are stored in the database, and the business model entity objects are stored in the database with data table structured information. There are mainly business categories, business sub-categories, entity basic information, entity structured attributes, entity relationship information, entity version information, entity authorization management, entity reference records, entity text attributes and entity history records.
如图1所示,建立MOM对象文件模块,用于引用业务域数据模型库中的业务模型实体对象,将其转换为MOM对象文件,MOM对象文件的信息以XML格式存储。所述建立MOM对象文件模块包括打开模型工具模块、引入模型对象模块、转换MOM对象模块、修正模型模块和存储MOM对象。As shown in Figure 1, a MOM object file module is established to refer to the business model entity object in the business domain data model library, and convert it into a MOM object file, and the information of the MOM object file is stored in XML format. The building MOM object file module includes opening the model tool module, importing the model object module, converting the MOM object module, revising the model module and storing the MOM object.
打开模型工具模块,用于打开本地开发工具,在属性配置中配置业务域数据模型库信息,包括模型库地址、端口和用户信息。Open the model tool module, which is used to open the local development tool and configure the business domain data model library information in the property configuration, including the model library address, port and user information.
引入模型对象模块,用于通过API接口引入业务模型实体对象;通过本地开发工具菜单向导,打开业务域数据模型库,在查询条件中,输入人员基本信息的查询条件,在查询结果中选择人员基本信息实体对象,通过点击引入按钮,将人员基本信息实体对象引入到模型工具中。Introduce the model object module, which is used to introduce business model entity objects through the API interface; open the business domain data model library through the local development tool menu wizard, enter the query conditions for the basic information of personnel in the query conditions, and select the personnel basic information in the query results. Information entity object, by clicking the import button, import the personnel basic information entity object into the model tool.
转换MOM对象模块,用于业务模型实体转换器将引入业务模型实体对象转换成MOM对象文件;在点击引入按钮时,通过业务域数据模型库的接口API服务,获取人员基本信息实体对象信息,经过业务模型实体转换器转换模型工具可读取或维护的MOM对象文件。Convert MOM object module, used for business model entity converter to convert the imported business model entity object into MOM object file; when clicking the import button, through the interface API service of the business domain data model library, obtain the basic information of personnel information entity object information, through The Business Model Entity Converter converts the MOM object file that the Model Tool can read or maintain.
修正模型模块,用于根据业务需求在模型工具中修正完善业务模型实体对象信息;MOM对象文件修正转换完成后,模型工具加载MOM对象文件,展示引入后的业务模型实体对象信息,根据业务需要调整模型属性信息,包括增加业务属性或修改数据类型的操作;调整完业务模型实体对象信息后,通过调用业务域数据模型库接口API服务,将调整后的业务模型实体对象同步到业务域数据模型库中。The revision model module is used to revise and improve the entity object information of the business model in the model tool according to business requirements; after the revision and conversion of the MOM object file is completed, the model tool loads the MOM object file, displays the imported business model entity object information, and adjusts it according to business needs Model attribute information, including operations to add business attributes or modify data types; after adjusting the business model entity object information, synchronize the adjusted business model entity objects to the business domain data model library by calling the business domain data model library interface API service middle.
存储MOM对象模块,用于保存MOM对象的信息并形成MOM对象文件;MOM对象文件的信息以XML结构存储,在引入业务模型实体对象过程中,通过业务模型实体转换器将其转化为XML结构进行存储。XML结构分两大部分,第一部分为模型工具页面所需要信息,其包括版本信息、基本信息和样式信息,第二部分为引入的业务模型实体对象信息,其包括业务模型实体对象所属业务域和业务模型实体对象属性的信息。MOM对象文件的信息与业务模型实体对象的信息是一对多关系,根据业务需要一次引入多个业务模型实体对象或多次引入业务模型实体对象信息。The MOM object storage module is used to save the information of the MOM object and form the MOM object file; the information of the MOM object file is stored in the XML structure. During the process of introducing the business model entity object, it is converted into the XML structure through the business model entity converter. storage. The XML structure is divided into two parts. The first part is the information required by the model tool page, which includes version information, basic information and style information; the second part is the imported business model entity object information, which includes the business domain to which the business model entity object belongs and Information about business model entity object properties. The information of the MOM object file and the information of the business model entity objects are in a one-to-many relationship. According to business needs, multiple business model entity objects are introduced at one time or business model entity object information is introduced multiple times.
如图2所示,生成微服务代码模块,用于将转换后的MOM对象文件输入源码生成器中,在源码生成器中先后通过解析MOM对象文件、选择页面风格、绑定页面属性、匹配预生成的技术框架和输出源码,输出生成后的微应用或微服务源码结构信息。所述生成微服务代码模块包括解析MOM对象文件模块、选择页面风格模块、绑定页面属性模块、匹配预生成的技术框架模块和输出源码模块。As shown in Figure 2, a microservice code module is generated, which is used to input the converted MOM object file into the source code generator. Generated technical framework and output source code, and output the source code structure information of the generated micro-application or micro-service. The generating microservice code module includes a MOM object file parsing module, a page style selection module, a page attribute binding module, a matching pre-generated technical framework module and an output source code module.
解析MOM对象文件模块,用于将MOM对象文件信息输入源码生成器,源码生成器获取MOM对象文件信息并根据XML标签定义解析MOM对象文件;在开发工具项目目录中,选择MOM对象文件,右击鼠标在菜单中选择转换源码,在弹出的界面中输入服务名称和服务目录结构的信息;源码生成器将获取MOM对象文件信息,根据XML标签定义解析MOM对象文件放入缓存中。The module for parsing MOM object files is used to input the MOM object file information into the source code generator. The source code generator obtains the MOM object file information and parses the MOM object file according to the XML tag definition; in the development tool project directory, select the MOM object file, right-click Select the conversion source code in the menu with the mouse, and enter the service name and service directory structure information in the pop-up interface; the source code generator will obtain the MOM object file information, parse the MOM object file according to the XML tag definition, and put it into the cache.
选择页面风格模块,用于根据业务需要选择页面展示风格;根据源码生成向导,选择业务展示界面风格。Select the page style module, which is used to select the page display style according to business needs; according to the source code generation wizard, select the business display interface style.
绑定页面属性模块,用于将页面属性与业务模型实体对象属性信息进行绑定;界面展示风格确认后,与解析MOM对象文件提取的业务模型实体对象属性进行绑定。The page attribute binding module is used to bind the page attributes with the business model entity object attribute information; after the interface display style is confirmed, it is bound with the business model entity object attributes extracted by parsing the MOM object file.
匹配预生成的技术框架模块,用于根据项目技术架构要求匹配技术架构;业务模型实体对象属性绑定完成后,根据项目技术架构要求,匹配源码生成架构。Matching the pre-generated technical framework module is used to match the technical framework according to the project technical framework requirements; after the business model entity object attribute binding is completed, the source code generation framework is matched according to the project technical framework requirements.
输出源码模块,用于生成业务应用源码信息;通过源码生成器输出源码结构信息。The output source code module is used to generate business application source code information; the source code structure information is output through the source code generator.
实施例2:Example 2:
如图3所示,本发明公开了一种基于业务域数据模型库的微服务代码生成方法包括如下步骤:As shown in FIG. 3 , the present invention discloses a microservice code generation method based on a business domain data model library, comprising the following steps:
S1建立业务域数据模型库S1 establishes the business domain data model library
业务域数据模型库中的业务模型实体对象的数据存储在数据库中,业务模型实体对象在数据库中以数据表结构化信息存储,主要有业务大类、业务细类、实体基本信息、实体结构化属性、实体关系信息、实体版本信息、实体授权管理、实体引用记录、实体文本属性和实体历史记录的结构化数据表。The data of the business model entity objects in the business domain data model library is stored in the database, and the business model entity objects are stored in the database with data table structured information, mainly including business categories, business sub-categories, entity basic information, and entity structured information. Structured data tables for attributes, entity relationship information, entity version information, entity authorization management, entity reference records, entity text attributes, and entity history records.
S2建立MOM对象文件S2 creates a MOM object file
引用业务域数据模型库中的业务模型实体对象,将其转换为MOM对象文件。Refer to the business model entity object in the business domain data model library and convert it into a MOM object file.
MOM对象文件的信息以XML格式存储。The information of the MOM object file is stored in XML format.
S201打开模型工具S201 Open Model Tool
在开发工具中打开模型工具。打开本地开发工具,在属性配置中配置业务域数据模型库信息,包括模型库地址、端口和用户信息。Open the Model tool in Developer Tools. Open the local development tool and configure the business domain data model library information in the property configuration, including the model library address, port and user information.
S202引入模型对象S202 Introduce model objects
通过API接口引入业务模型实体对象。通过本地开发工具菜单向导,打开业务域数据模型库,在查询条件中,输入人员基本信息的查询条件,在查询结果中选择人员基本信息实体对象,通过点击引入按钮,将人员基本信息实体对象引入到模型工具中。Introduce business model entity objects through API interface. Open the business domain data model library through the local development tool menu wizard, enter the query conditions for the basic information of personnel in the query conditions, select the basic personnel information entity object in the query result, and click the import button to import the basic personnel information entity object. into the model tool.
S203转换MOM对象S203 Convert MOM objects
业务模型实体转换器将引入业务模型实体对象转换成MOM对象文件。在点击引入按钮时,通过业务域数据模型库的接口API服务,获取人员基本信息实体对象信息,经过业务模型实体转换器转换模型工具可读取或维护的MOM对象文件。The business model entity converter converts the incoming business model entity objects into MOM object files. When the import button is clicked, the basic information entity object information of personnel is obtained through the interface API service of the business domain data model library, and the MOM object file that can be read or maintained by the model tool is converted through the business model entity converter.
S204修正模型S204 Revised Model
根据业务需求在模型工具中修正完善业务模型实体对象信息。MOM对象文件修正转换完成后,模型工具加载MOM对象文件,展示引入后的业务模型实体对象信息,根据业务需要调整模型属性信息,包括增加业务属性或修改数据类型的操作。Modify and improve the entity object information of the business model in the model tool according to the business requirements. After the MOM object file is corrected and converted, the model tool loads the MOM object file, displays the imported business model entity object information, and adjusts the model attribute information according to business needs, including adding business attributes or modifying data types.
调整完业务模型实体对象信息后,通过调用业务域数据模型库接口API服务,将调整后的业务模型实体对象同步到业务域数据模型库中。After adjusting the business model entity object information, synchronize the adjusted business model entity object to the business domain data model library by calling the business domain data model library interface API service.
S205存储MOM对象S205 stores MOM objects
保存MOM对象的信息并形成MOM对象文件。MOM对象文件的信息以XML结构存储,在引入业务模型实体对象过程中,通过业务模型实体转换器将其转化为XML结构进行存储。XML结构分两大部分,第一部分为模型工具页面所需要信息,其包括版本信息、基本信息和样式信息,第二部分为引入的业务模型实体对象信息,其包括业务模型实体对象所属业务域和业务模型实体对象属性的信息。MOM对象文件的信息与业务模型实体对象的信息是一对多关系,根据业务需要一次引入多个业务模型实体对象或多次引入业务模型实体对象信息。The 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. During the process of introducing business model entity object, it is converted into XML structure for storage through business model entity converter. The XML structure is divided into two parts. The first part is the information required by the model tool page, which includes version information, basic information and style information; the second part is the imported business model entity object information, which includes the business domain to which the business model entity object belongs and Information about business model entity object properties. The information of the MOM object file and the information of the business model entity objects are in a one-to-many relationship. According to business needs, multiple business model entity objects are introduced at one time or business model entity object information is introduced multiple times.
S3生成微服务代码S3 generates microservice code
将转换后的MOM对象文件输入源码生成器中,在源码生成器中先后通过解析MOM对象文件、选择页面风格、绑定页面属性、匹配预生成的技术框架和输出源码,输出生成后的微应用或微服务源码结构信息。具体包括如下步骤:Input the converted MOM object file into the source code generator, and in the source code generator successively analyze the MOM object file, select the page style, bind the page attributes, match the pre-generated technical framework and output the source code, and output the generated micro-application Or microservice source code structure information. Specifically include the following steps:
S301解析MOM对象文件S301 Parse MOM object file
将MOM对象文件信息输入源码生成器,源码生成器获取MOM对象文件信息并根据XML标签定义解析MOM对象文件。在开发工具项目目录中,选择MOM对象文件,右击鼠标在菜单中选择转换源码,在弹出的界面中输入服务名称和服务目录结构的信息。源码生成器将获取MOM对象文件信息,根据XML标签定义解析MOM对象文件放入缓存中。Input the MOM object file information into the source code generator, and the source code generator obtains the MOM object file information and parses the MOM object file according to the XML tag definition. In the development tool project directory, select the MOM object file, right-click the mouse and select Convert Source in the menu, and enter the service name and service directory structure information in the pop-up interface. The source code generator will obtain the MOM object file information, parse the MOM object file according to the XML tag definition, and put it into the cache.
S302选择页面风格S302 Select page style
根据业务需要选择页面展示风格。根据源码生成向导,选择业务展示界面风格,例如:树型结构、多Tab结构或列表表单结构造,点击下一步。Choose the page display style according to your business needs. According to the source code generation wizard, select the business display interface style, such as tree structure, multi-tab structure or list form structure, and click Next.
S303绑定页面属性S303 Binding page properties
将页面属性与业务模型实体对象属性信息进行绑定。界面展示风格确认后,与解析MOM对象文件提取的业务模型实体对象属性进行绑定,例如:用户名对应user_name,绑定完成后点击下一步。Bind page properties to business model entity object property information. After the interface display style is confirmed, it is bound to the business model entity object properties extracted by parsing the MOM object file. For example, the user name corresponds to user_name. After the binding is completed, click Next.
S304匹配预生成的技术框架S304 Matching pre-generated technical frameworks
根据项目技术架构要求匹配技术架构。业务模型实体对象属性绑定完成后,根据项目技术架构要求,匹配源码生成架构,例如:微服务、微应用或者单体结构的框架。Match the technical architecture according to the project technical architecture requirements. After the business model entity object attribute binding is completed, the source code generation architecture is matched according to the project technical architecture requirements, such as the framework of microservices, microapplications or monolithic structures.
S305输出源码S305 output source code
生成业务应用源码信息。最后通过源码生成器输出源码结构信息。Generate business application source code information. Finally, the source code structure information is output through the source code generator.
本申请的目的:Purpose of this application:
本申请通过标准的或复用的业务域数据模型库缩减了设计人员或开发人员与业务专家的沟通成本,并提供了基于微服务对象模型MOM的代码自动生成方法,提高了微服务的开发效率。This application reduces the communication cost between designers or developers and business experts through the standard or reused business domain data model library, and provides an automatic code generation method based on the microservice object model MOM, which improves the development efficiency of microservices .
1、采用的业务域数据模型库转换为可识别的MOM对象文件:引用业务域数据模型库中的模型信息,转换成模型工具读取并维护的MOM对象文件。研发人员需要进一步梳理模型属性,对比模型工具所识别的MOM对象文件属性进行整理,制定模型工具可读取并维护的MOM对象文件信息。1. Convert the adopted business domain data model library into an identifiable MOM object file: refer to the model information in the business domain data model library, and convert it into a MOM object file read and maintained by the model tool. R&D personnel need to further sort out the model attributes, compare the MOM object file attributes identified by the model tool, and formulate the MOM object file information that the model tool can read and maintain.
2、根据MOM对象文件生成所需的具有架构特点的微服务源代码:基本业务模型实体对象转换后的MOM对象文件,输入源码生成器中,在源码生成器中解析MOM对象文件信息,匹配框架模板,生成开发人员所需架构的源代码。2. Generate the required microservice source code with architectural characteristics according to the MOM object file: the MOM object file converted from the basic business model entity object is input into the source code generator, and the MOM object file information is parsed in the source code generator to match the framework. Templates that generate source code for the architecture the developer needs.
本申请的技术贡献:Technical contributions of this application:
本申请提供了一种基于业务域数据模型库的微服务代码生成系统及方法,提高了微服务设计、微服务开发的效率。The present application provides a microservice code generation system and method based on a business domain data model library, which improves the efficiency of microservice design and microservice development.
第一,业务域模型库是结合通用领域知识、企业业务领域知识及已有应用系统进行分析梳理,为适合企业自身业务发展需要而建成的业务域模型库。本申请中主要是引用业务域模型库中模型对象,将其转换为MOM对象,易于在模型工具中进行模型修正,很好的解决了业务与业务域模型的精准对应的问题,减少业务专家和设计人员的沟通成本,提高了沟通效率。First, the business domain model library is a business domain model library built to meet the needs of the enterprise's own business development by combining general domain knowledge, enterprise business domain knowledge and existing application systems for analysis and sorting. This application mainly refers to the model object in the business domain model library, and converts it into a MOM object, which is easy to modify the model in the model tool, which solves the problem of accurate correspondence between business and business domain models, and reduces business experts and business model. The communication cost of designers has been improved, and the communication efficiency has been improved.
第二,本申请的MOM对象信息是在引入业务模型对象过程中通过模型转换器将其转化为XML方式进行存储,便于业务模型的录入、扩展、维护。MOM对象信息与业务模型对象信息是一对多关系,可根据业务需要一次引入多个业务模型或多次引入业务模型信息,提高了业务场景代码生成的灵活性。Second, the MOM object information of the present application is stored in an XML format through a model converter during the process of introducing a business model object, which facilitates the entry, expansion and maintenance of the business model. MOM object information and business model object information have a one-to-many relationship. Multiple business models can be introduced at one time or business model information can be introduced multiple times according to business needs, which improves the flexibility of code generation for business scenarios.
第三,本申请通过转换后的MOM对象信息,灵活的接入到源码生成器中,用于业务应用快速开发。在源码生成器中解析MOM文件、选择页面风格、绑定页面属性、匹配预生成的框架如微服务,最后输出生成后的微应用或微服务代码结构,现提供了完整的数据访问层、业务逻辑层、控制层、展现层代码模板供开发人员选择。开发人员可以选择仅生成后端服务代码,含数据访问层、业务逻辑层的代码,或是根据微服务的使用场景生成完整的前端展示代码和后端服务代码,前端展示代码中含展现层、控制层代码。灵活的代码生成方式,提高了开发质量,减少了开发成本。Third, the present application flexibly accesses the converted MOM object information to the source code generator for rapid development of business applications. In the source code generator, parse the MOM file, select the page style, bind the page attributes, match the pre-generated frameworks such as microservices, and finally output the generated microapplication or microservice code structure, and now provide a complete data access layer, business Logic layer, control layer, and presentation layer code templates are available for developers to choose. Developers can choose to generate only the back-end service code, including the code of the data access layer and business logic layer, or generate the complete front-end display code and back-end service code according to the usage scenario of the microservice. The front-end display code includes the display layer, Control layer code. The flexible code generation method improves the development quality and reduces the development cost.
本申请的发明构思:The inventive concept of this application:
软件技术是一个发展变化非常快的行业,软件开发方式相对较多,现有开发方式有页面构造方式、菜单向导方式、模型向导方式和直接编码等多种开发方式。在以前的开发方式中大多采用菜单向导方式开发,虽然可以生成开发人员想要的源码结构,但是在业务标准化和业务与业务域模型的精准对应问题起不到促进作用。发明人发现,通过引用业务域数据模型库中的模型,转换模型工具所需的MOM对象,再将MOM对象输入源码生成器中,生成开发人员所需要源码结构。在模型工具中维护MOM对象,同时也可以修正业务域数据模型库中的模型,不但业务越来越标准,也进一步解决了业务与业务域模型的精准对应问题。Software technology is an industry with rapid development and changes. There are relatively many software development methods. The existing development methods include page construction method, menu wizard method, model wizard method and direct coding. In the previous development methods, the menu-guided method was mostly used for development. Although the source code structure that the developer wanted could be generated, it could not promote the business standardization and the precise correspondence between the business and the business domain model. The inventor found that by referencing the model in the business domain data model library, the MOM object required by the model tool is converted, 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 the model in the business domain data model library can also be revised. Not only the business becomes more and more standard, it also further solves the problem of accurate correspondence between business and business domain models.
本申请保密运行一段时间后,现场技术人员反馈的有益之处在于:After the application has been run confidentially for a period of time, the benefits of feedback from on-site technicians are:
1、基于业务域数据模型库开发微服务,简化了微服务架构应用的分析设计阶段的工作。通过使用高复用的业务域数据模型库将微服务开发设计人员从繁重的业务分析工作中解脱出来,只需要专注于微服务的开发。1. Develop microservices based on the business domain data model library, which simplifies the analysis and design phase of the application of the microservice architecture. By using a highly reusable business domain data model library, microservice developers and designers are freed from heavy business analysis work, and only need to focus on the development of microservices.
2、业务域数据模型库对于企业而言是可更新可积累的重要资源,很好的解决了业务与业务域数据模型的精准对应问题,在微服务的开发建设中,会促进业务域数据模型库进一步向的标准化发展。2. The business domain data model library is an important resource that can be updated and accumulated for enterprises. It solves the problem of accurate correspondence between business and business domain data models. In the development and construction of microservices, it will promote the business domain data model. The library is further developed towards the standardization.
3、提供可视化的业务域数据模型导入工具和数据模型设计工具,提高了MOM模型的设计效率。3. Provide visual business domain data model import tool and data model design tool, which improves the design efficiency of MOM model.
4、提供丰富的代码框架模板库,支持微服务架构的代码快速生成,极大的提高了微服务开发的效率。4. Provide a rich code framework template library to support the rapid code generation of the microservice architecture, which greatly improves the efficiency of microservice development.
说明:illustrate:
1、业务域数据模型库1. Business domain data model library
本申请中的业务域数据模型库是以业务模型实体对象驱动开发为指导思想,主要结合通用领域知识、企业业务领域知识及已有应用系统进行分析沉淀,形成为企业自身业务发展需要而建成业务域数据模型库。The business domain data model library in this application takes the business model entity object-driven development as the guiding ideology, mainly combines general domain knowledge, enterprise business domain knowledge and existing application systems for analysis and precipitation, and forms a business built for the needs of the enterprise's own business development. Domain data model library.
如图4~图7所示,业务域数据模型库中的模型实体对象数据是存储在数据库中,如:MySql数据库,业务人员或技术人员在业务域数据模型系统功能中,增加、修改、删除维护业务域数据模型库的实体数据。业务模型实体对象在数据库中以数据表结构化信息存储,主要有业务大类、业务细类、实体基本信息、实体结构化属性、实体关系信息、实体版本信息、实体授权管理、实体引用记录、实体文本属性及实体历史记录等结构化数据表,实体基本信息即业务模型实体对象。As shown in Figure 4 to Figure 7, the model entity object data in the business domain data model library is stored in the database, such as: MySql database, business personnel or technical personnel in the business domain data model system functions, add, modify, delete Maintain entity data of the business domain data model repository. Business model entity objects are stored in the database with structured information in data tables, which mainly include business categories, business sub-categories, entity basic information, entity structured attributes, entity relationship information, entity version information, entity authorization management, entity reference records, Structured data tables such as entity text attributes and entity history records, and basic entity information is the business model entity object.
2、基于业务模型实体对象转换MOM对象文件2. Convert MOM object files based on business model entity objects
本申请中引用业务域数据模型库中业务模型实体对象,将其转换为MOM对象文件,易于在模型工具中进行业务模型实体对象修正,很好的解决了业务与业务模型实体对象的精准对应的问题,本申请MOM对象文件信息以XML格式存储本地工作空间,实现了本申请的平台无关性、可移植性。This application refers to the business model entity object in the business domain data model library, and converts it into a MOM object file, which is easy to modify the business model entity object in the model tool, and solves the exact correspondence between the business and the business model entity object. The problem is that the MOM object file information of the present application is stored in the local workspace in XML format, which realizes the platform independence and portability of the present application.
1)如图8所示,首先,打开本地开发工具,如:Eclipse,在属性配置中配置业务域数据模型库信息,如:模型库地址、端口、用户信息等。1) As shown in Figure 8, first, open a local development tool, such as Eclipse, and configure the business domain data model library information in the property configuration, such as: model library address, port, user information, etc.
2)如图9所示,其次,通过本地开发工具菜单向导,打开业务域数据模型库,在查询条件中,输入查询条件,如:人员基本信息,在查询结果中选择人员基本信息实体对象,通过点击引入按钮,将人员基本信息实体对象引入到模型工具中。2) As shown in Figure 9, secondly, through the local development tool menu wizard, open the business domain data model library, in the query conditions, enter the query conditions, such as: personnel basic information, select the personnel basic information entity object in the query result, By clicking the import button, the entity object of the basic information of the person is imported into the model tool.
3)如图10所示,在点击引入按钮时,通过业务域数据模型库的接口API服务,获取人员基本信息实体对象信息,经过业务模型实体转换器转换模型工具可读取或维护的MOM对象文件。3) As shown in Figure 10, when the import button is clicked, the basic information entity object information of personnel is obtained through the interface API service of the business domain data model library, and the MOM object that can be read or maintained by the model tool is converted through the business model entity converter. document.
4)如图11所示,MOM对象文件转换完成后,模型工具会加载MOM对象文件,展示引入后的业务模型实体对象信息,设计人员或技术人员可根据业务需要调整模型属性信息,如增加业务属性或修改数据类型等操作。4) As shown in Figure 11, after the MOM object file conversion is completed, the model tool will load the MOM object file and display the imported business model entity object information. Designers or technicians can adjust the model attribute information according to business needs, such as adding business operations such as properties or modifying data types.
5)调整完业务模型实体对象信息后,通过调用业务域数据模型库接口API服务,将调整后的业务模型实体对象同步到业务域数据模型库中。5) After adjusting the business model entity object information, synchronize the adjusted business model entity object to the business domain data model library by calling the business domain data model library interface API service.
6)保存MOM对象文件信息。6) Save the MOM object file information.
3、MOM对象文件存储格式3. MOM object file storage format
如图12、图13所示,整个MOM对象文件信息是以XML结构存储,在引入业务模型实体对象过程中,通过业务模型实体转换器将其转化为XML结构进行存储。XML结构整体分两大部分,第一部分为模型工具页面所需要信息,如版本信息、基本信息、样式信息等,第二部分为引入的业务模型实体对象信息,如,业务模型实体对象所属业务域、业务模型实体对象属性信息等。MOM对象文件信息与业务模型实体对象信息是一对多关系,可根据业务需要一次引入多个业务模型实体对象或多次引入业务模型实体对象信息。本申请提供了业务域数据模型库的维护系统,可以便于业务模型实体对象信息的录入、扩展、维护。As shown in Figure 12 and Figure 13, the entire MOM object file information is stored in an XML structure. During the process of introducing the business model entity object, it is converted into an XML structure for storage through the business model entity converter. The XML structure is divided into two parts. The first part is the information required by the model tool page, such as version information, basic information, style information, etc., and the second part is the imported business model entity object information, such as the business domain to which the business model entity object belongs. , business model entity object attribute information, etc. The MOM object file information and the business model entity object information have a one-to-many relationship. Multiple business model entity objects can be introduced at one time or business model entity object information can be introduced multiple times according to business needs. The present application provides a maintenance system for the business domain data model library, which can facilitate the entry, expansion and maintenance of business model entity object information.
4、基于MOM对象文件生成微服务代码4. Generate microservice code based on MOM object file
如图14所示,业务模型实体对象根据业务需要调整完成后,将MOM对象文件通过右击菜单的方式传入到源码生成器中,用于业务应用快速开发。将转换后的MOM对象文件输入源码生成器中,在源码生成器中先后通过解析MOM对象文件、选择页面风格、绑定页面属性、匹配预生成的技术框架,如:微服务,最后输出生成后的微应用或微服务源码结构信息,详细如下:As shown in Figure 14, after the business model entity object is adjusted according to business needs, the MOM object file is transferred to the source code generator through the right-click menu for rapid development of business applications. Input the converted MOM object file into the source code generator, in the source code generator successively by parsing the MOM object file, selecting the page style, binding the page attributes, and matching the pre-generated technical framework, such as: microservice, and finally outputting the generated The source code structure information of the micro-application or micro-service is as follows:
1)首先,在开发工具项目目录中,选择MOM对象文件,右击鼠标在菜单中选择转换源码,在弹出的界面中输入服务名称、服务目录结构等信息。1) First, in the development tool project directory, select the MOM object file, right-click the mouse and select Convert Source Code in the menu, and enter the service name, service directory structure and other information in the pop-up interface.
2)如图15所示,其次,源码生成器将获取MOM对象文件信息,根据XML标签定义解析MOM对象文件放入缓存中,根据源码生成向导,选择业务展示界面风格,如:树型结构、多Tab结构或列表表单结构造,点击下一步。2) As shown in Figure 15, secondly, the source code generator will obtain the MOM object file information, parse the MOM object file according to the XML tag definition, put it into the cache, and select the business display interface style according to the source code generation wizard, such as: tree structure, Create a multi-tab structure or a list form structure, click Next.
3)如图16所示,界面展示风格确认后,与解析MOM对象文件提取的业务模型实体对象属性进行绑定,如:用户名对应user_name,绑定完成后点击下一步。3) As shown in Figure 16, after the interface display style is confirmed, it is bound to the business model entity object attributes extracted by parsing the MOM object file, for example: the user name corresponds to user_name, click Next after the binding is completed.
4)业务模型实体对象属性绑定完成后,根据项目技术架构要求,匹配源码生成架构,如:微服务、微应用、单体结构等框架。4) After the business model entity object attribute binding is completed, according to the project technical architecture requirements, match the source code generation architecture, such as: microservices, microapplications, monolithic structures and other frameworks.
5)如图17所示,最后通过源码生成器输出源码结构信息。5) As shown in Figure 17, the source code structure information is finally output through the source code generator.
通过使用业务模型实体转换器转换后的MOM对象文件生成微服务架构的应用代码,提高了微服务的开发效率。本申请中的代码生成引擎是基于模板方式的,提供的模板有:微服务、微应用、单体结构,现提供了完整的数据访问层、业务逻辑层、控制层、展现层代码模板供开发人员选择。开发人员可以选择仅生成后端服务代码,含数据访问层、业务逻辑层的代码,或是根据微服务的使用场景生成完整的前端展示代码和后端服务代码,前端展示代码含展现层、控制层代码。By using the MOM object file converted by the business model entity converter to generate the application code of the microservice architecture, the development efficiency of the microservice is improved. The code generation engine in this application is based on the template method, and the templates provided are: micro-service, micro-application, and monolithic structure. Now, a complete data access layer, business logic layer, control layer, and presentation layer code templates are provided for development. Personnel selection. Developers can choose to generate only the back-end service code, including the code of the data access layer and business logic layer, or generate complete front-end display code and back-end service code according to the usage scenario of the microservice. The front-end display code includes the display layer, control layer code.
Claims (10)
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 true CN111488145A (en) | 2020-08-04 |
CN111488145B 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) |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111913695A (en) * | 2020-08-07 | 2020-11-10 | 国网信息通信产业集团有限公司 | Code conversion method, device and storage medium |
CN112068812A (en) * | 2020-09-02 | 2020-12-11 | 数字广东网络建设有限公司 | 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 |
CN113901022A (en) * | 2021-09-22 | 2022-01-07 | 成都飞机工业(集团)有限责任公司 | Method, device, equipment and storage medium for establishing business and data relation model |
CN114756220A (en) * | 2022-04-15 | 2022-07-15 | 浙江吉利控股集团有限公司 | Microservice code generation method and system |
CN115051904A (en) * | 2022-03-23 | 2022-09-13 | 武汉烽火技术服务有限公司 | Method and device for managing single disk state based on markup language |
CN115098494A (en) * | 2022-05-27 | 2022-09-23 | 国网河北省电力有限公司营销服务中心 | A database architecture of power service center based on mobile operation application and its application |
US11487540B2 (en) | 2021-03-02 | 2022-11-01 | Capital One Services, Llc | Micro-frontend as a service |
CN115756444A (en) * | 2021-09-06 | 2023-03-07 | 上海宝信软件股份有限公司 | Method and system for constructing platform in industrial scene service |
CN115905291A (en) * | 2022-12-12 | 2023-04-04 | 广州南方智能技术有限公司 | Data processing method and device based on graph and storage medium |
WO2023151239A1 (en) * | 2022-02-14 | 2023-08-17 | 华为云计算技术有限公司 | Micro-service creation method and related device |
CN117492721A (en) * | 2023-12-29 | 2024-02-02 | 中建三局信息科技有限公司 | General rapid development method applied to building digital information system |
US12197527B2 (en) | 2021-05-05 | 2025-01-14 | Capital One Services, Llc | Reusable capability component shared by multiple web applications |
Citations (5)
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 |
US20190052549A1 (en) * | 2016-05-06 | 2019-02-14 | Enterpriseweb Llc | Systems and methods for domain-driven design and execution of metamodels |
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 |
CN110737425A (en) * | 2018-07-20 | 2020-01-31 | 网宿科技股份有限公司 | billing platform system application program establishing method and device |
-
2020
- 2020-04-30 CN CN202010363365.6A patent/CN111488145B/en active Active
Patent Citations (5)
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 |
US20190052549A1 (en) * | 2016-05-06 | 2019-02-14 | Enterpriseweb Llc | Systems and methods for domain-driven design and execution of metamodels |
CN110737425A (en) * | 2018-07-20 | 2020-01-31 | 网宿科技股份有限公司 | billing platform system application program establishing method and device |
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 |
Cited By (21)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111913695A (en) * | 2020-08-07 | 2020-11-10 | 国网信息通信产业集团有限公司 | Code conversion method, device and storage medium |
CN112068812A (en) * | 2020-09-02 | 2020-12-11 | 数字广东网络建设有限公司 | Micro-service generation method and device, computer equipment 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 |
CN112612466B (en) * | 2020-12-22 | 2024-09-13 | 成都航盛智行科技有限公司 | Data exchange system and method of automobile display equipment based on IPC model |
US11789728B2 (en) | 2021-03-02 | 2023-10-17 | Capital One Services, Llc | Micro-frontend as a service |
US11487540B2 (en) | 2021-03-02 | 2022-11-01 | Capital One Services, Llc | Micro-frontend as a service |
US12197527B2 (en) | 2021-05-05 | 2025-01-14 | Capital One Services, Llc | Reusable capability component shared by multiple web applications |
CN115756444A (en) * | 2021-09-06 | 2023-03-07 | 上海宝信软件股份有限公司 | Method and system for constructing platform in industrial scene service |
CN113901022A (en) * | 2021-09-22 | 2022-01-07 | 成都飞机工业(集团)有限责任公司 | Method, device, equipment and storage medium for establishing business and data relation model |
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 |
EP4465168A4 (en) * | 2022-02-14 | 2025-05-07 | Huawei Cloud Computing Tech Co Ltd | Microservice generation method and associated device |
CN115051904B (en) * | 2022-03-23 | 2023-09-12 | 武汉烽火技术服务有限公司 | Method and device for managing single disk state based on markup language |
CN115051904A (en) * | 2022-03-23 | 2022-09-13 | 武汉烽火技术服务有限公司 | Method and device for managing single disk state based on markup language |
CN114756220A (en) * | 2022-04-15 | 2022-07-15 | 浙江吉利控股集团有限公司 | Microservice code generation method and system |
CN115098494A (en) * | 2022-05-27 | 2022-09-23 | 国网河北省电力有限公司营销服务中心 | A database architecture of power service center based on mobile operation application and its application |
CN115905291B (en) * | 2022-12-12 | 2024-02-23 | 广州南方智能技术有限公司 | Graph-based data processing method, device and storage medium |
CN115905291A (en) * | 2022-12-12 | 2023-04-04 | 广州南方智能技术有限公司 | Data processing method and device based on graph and storage medium |
CN117492721A (en) * | 2023-12-29 | 2024-02-02 | 中建三局信息科技有限公司 | General rapid development method applied to building digital information system |
CN117492721B (en) * | 2023-12-29 | 2024-04-16 | 中建三局信息科技有限公司 | General rapid development method applied to building digital information system |
Also Published As
Publication number | Publication date |
---|---|
CN111488145B (en) | 2023-05-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111488145B (en) | Micro-service code generation system and method based on service domain data model library | |
CN103198009B (en) | A kind of universal testing method, system and related device | |
KR100633478B1 (en) | Software development system based on professional operating system for business and its development method | |
CN110825369A (en) | Method for automatically generating codes based on java language | |
CN106874244B (en) | Method for constructing automatic document generation model based on work sequence | |
CN111241454A (en) | Method, system and device for generating webpage code | |
US20160299745A1 (en) | Development method for web development system, and web development system | |
CN104484216A (en) | Method and device for generating service interface document and on-line test tool | |
CN112328229A (en) | Method for quickly creating Jenkins assembly line | |
CN103309904A (en) | Method and device for generating data warehouse ETL (Extraction, Transformation and Loading) codes | |
US11995444B2 (en) | Systems and methods for modernizing legacy applications | |
CN114489597B (en) | A method and device for automatically generating code | |
CN105528418A (en) | Design document generation method and apparatus | |
CN112506505A (en) | Method for producing program code by code template engine | |
Martinez et al. | Recovering sequence diagrams from object-oriented code: An ADM approach | |
CN114168121B (en) | Software system, terminal and storage medium based on code factory mode development | |
CN118796180B (en) | A method, device, equipment and medium for automatically generating code | |
CN115510361A (en) | Data chart page generation method based on visual configuration and related equipment | |
CN105279032B (en) | A kind of method and device of sync cap message and javaBean | |
CN118396547A (en) | A process engine system based on personnel system and its file management method | |
WO2024164559A1 (en) | System upgrading method and apparatus, and device and storage medium | |
EP1832975A1 (en) | Automatic generation of source program | |
Eldanasory et al. | Literature Review on Agile Methodologies Quality, eXtreme Programming and SCRUM. | |
CN115373640A (en) | Low-code componentization software development method and system for financial reimbursement receipt machine | |
CN114237574A (en) | Financial transaction production management system, method, apparatus, medium, and program product |
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 |