AI code generation system based on domain-driven design
By using an AI code generation system based on domain-driven design, scientific aggregation partitioning is performed using predicted lifetime and available capacity, and connection code is generated according to the intensity of business disturbances. This solves the problems of unreasonable aggregation design and insufficient adaptability in existing technologies, and achieves efficient code generation and system stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HUANENG ZHAOCAI DIGITAL TECHNOLOGY CO LTD
- Filing Date
- 2025-12-03
- Publication Date
- 2026-04-28
AI Technical Summary
Existing code generation systems lack objective aggregation classification standards, resulting in inconsistent aggregation design quality, inability to adapt to changes in the business environment, and low efficiency.
An AI code generation system based on domain-driven design is adopted. The system acquires structured data through the recognition unit, performs aggregation and code generation through the central control unit, and performs self-checks through the detection unit. It uses predicted lifetime and occupied capacity to perform scientific aggregation and division, and dynamically generates connection codes based on the intensity of business disturbances.
It achieves rationality and stability in aggregate design, improves system resilience and reliability, reduces the need for code modification, and maintains a clean and efficient architecture.
Smart Images

Figure CN121934828A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of programming aids technology, and in particular to an AI code generation system based on domain-driven design. Background Technology
[0002] Code generation systems are tools that use automation to convert design models, configurations, or templates into executable code, aiming to improve development efficiency, reduce repetitive work, and minimize human error. Their core principles include template engines, rule engines, and metadata-driven approaches, supporting code generation from database structures, API definitions, or domain models.
[0003] Existing code generation systems suffer from the following technical shortcomings: First, there is a lack of objective standards for aggregation delineation. Current technologies primarily rely on developers' experience to determine aggregation boundaries, lacking a systematic and quantitative basis for division, leading to inconsistent aggregation design quality. The semantic differences of the same business concept in different business scenarios are difficult to accurately identify and express, affecting the accuracy of aggregation design. Second, the system lacks adaptability. It cannot adjust and optimize itself based on changes in the business environment, the lifespan and emergence of aggregations, or to modify the current code as little as possible to adapt to business changes. This necessitates manual intervention to redesign and generate code, resulting in low efficiency. Summary of the Invention
[0004] To address the aforementioned technical issues, this application provides an AI code generation system based on domain-driven design, aiming to achieve an accurate and reasonable aggregation of data, thereby reducing modifications to the original code during code generation to adapt to new business requirements.
[0005] In some embodiments of this application, an AI code generation system based on domain-driven design is provided, characterized by comprising:
[0006] An identification unit is used to acquire business data and convert the business data into structured data.
[0007] The central control unit is used to generate corresponding codes for the structured data based on the hierarchical code structure.
[0008] The central control unit includes:
[0009] The first processing module is used to obtain the predicted lifetime and occupied capacity of structured data, and to perform aggregated partitioning.
[0010] The second processing module is used to generate the predicted lifetime of each aggregate and generate the internal code of each aggregate based on the partitioning of the aggregates.
[0011] The third processing module is used to obtain business disturbance data between various aggregations;
[0012] The fourth processing module is used to generate connection codes between various aggregates based on the business disturbance data;
[0013] The detection unit is used to obtain the predicted lifetime of each aggregation and perform code self-checking on the internal code based on the predicted lifetime.
[0014] In some embodiments of this application, obtaining the predicted lifetime and occupied capacity of structured data includes:
[0015] Extract data units from structured data;
[0016] The data unit is divided into single-lead data units and multi-lead data units;
[0017] Based on a pre-defined semantic graph, the various data units are linked together;
[0018] For a single-key data unit, each concatenated data unit is set as a multiple aggregate, and the aggregate is set as a single aggregate;
[0019] For multi-key data units, the multi-key data unit is set as a data unit to be allocated;
[0020] Based on the occupied capacity, the data units to be allocated are assigned to the first aggregation to obtain the second aggregation;
[0021] The secondary polymerization was detected.
[0022] In some embodiments of this application, the step of allocating the data unit to be allocated into a primary aggregation to obtain a secondary aggregation includes:
[0023] Get the capacity occupied by one aggregation corresponding to each data unit to be allocated;
[0024] Construct a sequence R of the first-order aggregation capacity of the m-th data unit to be allocated, Rm=(Rm1,Rm2…Rmi…Rmn), where R1 is the first first-order aggregation corresponding to the m-th data unit to be allocated; Ri is the i-th first-order aggregation corresponding to the m-th data unit to be allocated; and n is the total number of first-order aggregations corresponding to the m-th data unit to be allocated.
[0025] Get the capacity occupied by each aggregation in R;
[0026] The m-th data unit to be allocated is assigned to the first aggregation corresponding to the minimum occupied capacity in the sequence R, thus obtaining the second aggregation.
[0027] In some embodiments of this application, the detection of secondary polymerization includes:
[0028] Get the occupied capacity of each secondary aggregation;
[0029] Each secondary aggregation that exceeds the first capacity threshold is set as an aggregation to be split;
[0030] Obtain the business scenarios corresponding to each structured data to be split and aggregated;
[0031] Based on the aforementioned business scenario, each aggregation to be split is split and set as a tertiary aggregation with the unsplit secondary aggregation.
[0032] In some embodiments of this application, generating the predicted lifetime of each aggregate includes:
[0033] Obtain the structured data for each tertiary aggregation and its corresponding aggregation root;
[0034] When there are no multi-reference data units in the three aggregations, the predicted lifetime of the aggregation root is set to the predicted lifetime of the corresponding three aggregations.
[0035] When multiple data units exist in the three aggregations, a predicted lifetime sequence M is constructed, M=(M1,M2…Mi…Mn,Mn). 根 ), where M1 is the predicted lifetime corresponding to the first structured data in the three aggregations; M2 is the predicted lifetime corresponding to the second structured data in the three aggregations; Mi is the predicted lifetime corresponding to the i-th structured data in the three aggregations; n is the total number of structured data in the three aggregations; M 根 The predicted lifetime of the polymer root in the three polymerization processes;
[0036] The maximum value in sequence M is selected, and the predicted lifetime is set as the predicted lifetime of the three-fold aggregation.
[0037] In some embodiments of this application, the step of generating the internal code of each aggregate based on the aggregate partitioning includes:
[0038] Obtain the predicted lifetime of each tertiary aggregation and divide the tertiary aggregation into multiple levels;
[0039] Retrieve the code database corresponding to each level of aggregation;
[0040] Extract entities from the three aggregations, compare them with the code database, and generate the corresponding internal code.
[0041] In some embodiments of this application, the third processing module is further configured to:
[0042] Obtain the call frequency, call data volume, and call failure rate among the three aggregations;
[0043] Calculate the business disturbance intensity data Q between the two aggregations;
[0044] Q=(1-S 失 )*(P*S 数 );
[0045] Among them, S 失 For call failure rate; S 数 P represents the amount of data called; Q represents the call frequency; and Q represents the intensity of business disturbance.
[0046] In some embodiments of this application, the fourth processing module is further configured to:
[0047] When Q is less than the first perturbation threshold, it is set as the first perturbation scenario;
[0048] When Q is greater than the first perturbation threshold and less than the second perturbation threshold, it is set as the second perturbation scenario;
[0049] When Q is greater than the second perturbation threshold, it is set to the third perturbation scenario;
[0050] For the first disturbance scenario, the code is directly called from the preset code library;
[0051] For the second perturbation scenario, asynchronous processing code is generated based on each of the three-dimensional aggregations;
[0052] For the third disturbance scenario, corresponding code is generated based on the circuit breaker pattern.
[0053] In some embodiments of this application, the step of performing a code self-check on the internal code based on the predicted lifetime includes:
[0054] Obtain the predicted lifetime for each cubic aggregation;
[0055] When the predicted lifetime of the three-stage aggregation is detected to have expired, if there are no multi-reference data units in the three-stage aggregation, the three-stage aggregation and its corresponding code are eliminated; if there are multi-reference data units in the three-stage aggregation, the first strategy is executed.
[0056] In some embodiments of this application, the first strategy includes:
[0057] Based on the preset semantic graph, the number of times each multi-reference data unit in the three aggregations is called in other three aggregations is identified;
[0058] Based on the number of calls, the multi-reference data unit is reassigned to three aggregations where the number of calls is greater than the threshold for the first call.
[0059] Compared with existing technologies, the AI code generation system based on domain-driven design in this application has the following advantages:
[0060] A scientific aggregation partitioning system has been constructed, using both predicted lifetime and available capacity as indicators to ensure the rationality and stability of aggregation design. When partitioning aggregations, the system not only considers the semantic relevance of business operations but also uses quantitative indicators to ensure the balance and maintainability of aggregations. This prevents aggregations from being too small, leading to resource waste, or too large, requiring the processing of large amounts of irrelevant data when modifying a single aggregation, thus avoiding resource waste.
[0061] Simultaneously, intelligent code generation and connection strategies were implemented. The system dynamically generates connection code between aggregates based on the intensity of business disturbances, and adopts different connection strategies for different disturbance scenarios, significantly improving the system's resilience and reliability. Through a periodic self-checking mechanism, the system can automatically detect and handle expired aggregates, maintaining a clean and efficient architecture.
[0062] Furthermore, by rationally dividing aggregations, we can minimize code modifications when the business environment changes. Attached Figure Description
[0063] Figure 1 This is a schematic diagram of the structure of an AI code generation system based on domain-driven design in an embodiment of this application. Detailed Implementation
[0064] The specific embodiments of this application will be described in further detail below with reference to the accompanying drawings and examples. The following examples are used to illustrate this application, but are not intended to limit the scope of this application.
[0065] In the description of this application, it should be understood that the terms "center", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this application.
[0066] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, unless otherwise stated, "a plurality of" means two or more.
[0067] In the description of this application, it should be noted that, unless otherwise expressly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection between two components. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.
[0068] like Figure 1 As shown in the figure, an AI code generation system based on domain-driven design according to an embodiment of this application includes:
[0069] The identification unit is used to acquire business data and transform it into structured data.
[0070] The central control unit is used to generate corresponding codes for structured data based on the hierarchical code structure.
[0071] The central control unit includes:
[0072] The first processing module is used to obtain the predicted lifetime and occupied capacity of structured data, and to perform aggregated partitioning.
[0073] The second processing module is used to generate the predicted lifetime of each aggregate and generate the internal code of each aggregate based on the partitioning of the aggregates.
[0074] The third processing module is used to obtain business disturbance data between various aggregations;
[0075] The fourth processing module is used to generate connection codes between various aggregates based on business disturbance data;
[0076] The detection unit is used to obtain the predicted lifetime of each aggregation and perform code self-checks on the internal code based on the predicted lifetime.
[0077] Specifically, business data refers to various unstructured text documents generated during daily operations, including but not limited to meeting minutes, bidding documents, requirement documents, and product manuals. This data contains a wealth of business knowledge but lacks a unified format and structure.
[0078] Specifically, structured data includes business data, aggregated data, and other processed semantic information data and semantic structure data. Examples include: the individual semantic units within an aggregate, the relationships between semantic units, rules, meanings, the position of each semantic unit, the aggregate root of each aggregate, different bounded contexts, the amount of data exchanged between aggregates, and the data exchange format.
[0079] Specifically, an aggregation refers to a collection of semantic units with strong business relationships. When you need to modify information, you need to enter from the unique aggregation root and make the modification to ensure the consistency of the entire aggregation.
[0080] Specifically, the hierarchical code structure consists of two layers. The first layer obtains the predicted lifetime of the structured data, and then obtains the occupied capacity of each structured data to ensure that the size of each aggregation does not deviate too much.
[0081] Specifically, the occupied capacity is the number of data units within the aggregation.
[0082] Specifically, the predicted lifetime of structured data refers to the predicted lifetime of the data units within the structured data. If the lifetime can be obtained from business information, it is determined accordingly. For example, if the creation and end times of an entity are known, these two data points are set as the predicted lifetime data. If the lifetime cannot be obtained from business information, it is determined from similar historical data. For instance, if historical data shows that the average duration of bidding projects in this field is three months, this time period is set as the predicted lifetime.
[0083] Specifically, the internal code is the code within each aggregate. Due to the strong cohesion of the aggregates, this part of the code is highly replaceable and repetitive.
[0084] Specifically, business disturbance data refers to the interaction between data units of different aggregates. Specifically, it is data used to quantify the stability and strength of the interaction between aggregates, including but not limited to call frequency, call data volume and call failure rate.
[0085] In some embodiments of this application, obtaining the predicted lifetime and occupied capacity of structured data includes:
[0086] Extract data units from structured data;
[0087] The data unit is divided into single-entry data units and multi-entry data units;
[0088] Based on a pre-defined semantic graph, the various data units are linked together;
[0089] For a single-key data unit, each concatenated data unit is set as a multiple aggregate, and the aggregate is set as a single aggregate;
[0090] For multi-reference data units, set the multi-reference data unit as the data unit to be allocated;
[0091] Based on the occupied capacity, the data units to be allocated are assigned to the first aggregation to obtain the second aggregation;
[0092] The secondary polymerization was detected.
[0093] Specifically, a data unit is the smallest business concept unit in structured data, such as "user," "order," and "product." Each data unit contains complete business semantics and attribute definitions.
[0094] Specifically, a single-index data unit is a business concept that has an independent lifecycle in terms of business semantics and can exist independently. This type of data unit is usually considered as a candidate for aggregate root.
[0095] Specifically, a multi-referenced data unit is a business concept that depends on other data units in terms of business semantics and cannot exist independently, or a data unit that is referenced by other data units. These data units are typically entities or value objects within an aggregate.
[0096] Specifically, the preset semantic graph is a pre-built business knowledge graph that includes relationships between data units, constraints on data units, and concepts of data units. The semantic graph is constructed by experts in this field.
[0097] Specifically, a single aggregation consists of all aggregations containing only single-quote data units.
[0098] Specifically, secondary aggregation is aggregation optimized by capacity balancing. It is formed by rationally allocating multi-reference data units into primary aggregation.
[0099] In some embodiments of this application, the data units to be allocated are assigned to a primary aggregation to obtain a secondary aggregation, including:
[0100] Get the capacity occupied by one aggregation corresponding to each data unit to be allocated;
[0101] Construct a sequence R of the first-order aggregation capacity of the m-th data unit to be allocated, Rm=(Rm1,Rm2…Rmi…Rmn), where R1 is the first first-order aggregation corresponding to the m-th data unit to be allocated; Ri is the i-th first-order aggregation corresponding to the m-th data unit to be allocated; and n is the total number of first-order aggregations corresponding to the m-th data unit to be allocated.
[0102] Get the capacity occupied by each aggregation in R;
[0103] The m-th data unit to be allocated is assigned to the first aggregation corresponding to the minimum occupied capacity in the sequence R, thus obtaining the second aggregation.
[0104] Specifically, the capacity occupied by an aggregation is obtained by summing up the capacity occupied by all aggregates within the aggregation.
[0105] In some embodiments of this application, the detection of secondary polymerization includes:
[0106] Get the occupied capacity of each secondary aggregation;
[0107] Each secondary aggregation that exceeds the first capacity threshold is set as an aggregation to be split;
[0108] Obtain the business scenarios corresponding to each structured data to be split and aggregated;
[0109] Based on the business scenario, each aggregation to be split is split and set as a tertiary aggregation with the unsplit secondary aggregation.
[0110] Specifically, the first capacity threshold is when the resources consumed by a single aggregation exceed the normal operating limit. Preferably, the memory usage of a single aggregation does not exceed 100MB or the transaction load of a single aggregation does not exceed 1000 TPS.
[0111] Specifically, the third aggregation is the sum of the aggregations that corrected the aggregations that did not meet the capacity condition and the aggregations that met the capacity condition, which is the aggregation that completed the final partition.
[0112] Specifically, the aggregation to be split is a substandard secondary aggregation.
[0113] In some embodiments of this application, the predicted lifetime of each aggregate is generated, including:
[0114] Obtain the structured data for each tertiary aggregation and its corresponding aggregation root;
[0115] When there are no multi-reference data units in the third aggregation, the predicted lifetime of the aggregation root is set to the predicted lifetime of the corresponding third aggregation.
[0116] When multiple data units exist in the three aggregations, construct the predicted lifetime sequence M, M=(M1,M2…Mi…Mn,Mn). 根 ), where M1 is the predicted lifetime corresponding to the first structured data in the three aggregations; M2 is the predicted lifetime corresponding to the second structured data in the three aggregations; Mi is the predicted lifetime corresponding to the i-th structured data in the three aggregations; n is the total number of structured data in the three aggregations; M 根 The predicted lifetime of the polymer root in the tertiary polymerization;
[0117] Select the maximum value in sequence M and set the predicted lifetime to the predicted lifetime of the triple aggregation.
[0118] Specifically, the aggregate root is the entry point and manager of the aggregate, responsible for maintaining the consistency and integrity within the aggregate. The aggregate root is typically a core concept with an independent lifecycle in terms of business logic.
[0119] In some embodiments of this application, internal code for each aggregate is generated based on the aggregate division, including:
[0120] Obtain the predicted lifetime of each tertiary aggregation and divide the tertiary aggregation into multiple levels;
[0121] Retrieve the code database corresponding to each level of aggregation;
[0122] Extract entities from the three aggregations, compare them with the code database, and generate the corresponding internal code.
[0123] Specifically, aggregation levels are classified according to the length of the predicted lifetime, including short-term aggregation (predicted lifetime less than 3 months), medium-term aggregation (predicted lifetime of 3 months to 1 year), and long-term aggregation (predicted lifetime greater than 1 year).
[0124] Specifically, the code database is a pre-built library of code templates containing typical code structures, design patterns, and best practices at different levels of aggregation.
[0125] In some embodiments of this application, the third processing module is further configured to:
[0126] Get the call frequency, call data volume, and call failure rate among the three aggregations;
[0127] Calculate the business disturbance intensity data Q between the two aggregations;
[0128] Q=(1-S 失 )*(P*S 数 );
[0129] Among them, S 失 For call failure rate; S 数 P represents the amount of data called; Q represents the call frequency; and Q represents the intensity of business disturbance.
[0130] Specifically, the call frequency is the number of interactions between aggregates within a unit of time, reflecting the activity level of the business process.
[0131] Specifically, the data volume called refers to the scale of data transmitted in a single interaction between aggregates, reflecting the complexity of the business process.
[0132] Specifically, the call failure rate is the proportion of failed interactions between aggregates, reflecting the stability of the business process.
[0133] Specifically, the intensity of business disturbance is a quantitative indicator that measures the uncertainty and risk of the interaction environment between aggregations. The higher the disturbance intensity, the more unstable the interaction environment, and the stronger the fault tolerance mechanism required.
[0134] In some embodiments of this application, the fourth processing module is further configured to:
[0135] When Q is less than the first perturbation threshold, it is set as the first perturbation scenario;
[0136] When Q is greater than the first perturbation threshold and less than the second perturbation threshold, it is set as the second perturbation scenario;
[0137] When Q is greater than the second perturbation threshold, it is set to the third perturbation scenario;
[0138] For the first disturbance scenario, the code is directly called from the preset code library;
[0139] For the second perturbation scenario, asynchronous processing code is generated based on each of the three-dimensional aggregations;
[0140] For the third disturbance scenario, corresponding code is generated based on the circuit breaker pattern.
[0141] Specifically, the first perturbation threshold is the upper limit of the low-perturbation scenario, preferably 0.3. When Q < 0.3, the interaction environment is considered stable, and a simple synchronous call method is adopted.
[0142] Specifically, the second perturbation threshold is the upper limit of the medium perturbation scenario, preferably 0.7. When 0.3 ≤ Q < 0.7, it is considered that there is a certain degree of uncertainty, and asynchronous processing is adopted to improve the system resilience.
[0143] Specifically, the third disturbance scenario is a high-disturbance environment. When Q≥0.7, the interaction environment is considered highly unstable and requires advanced fault tolerance mechanisms such as circuit breaker mode.
[0144] Specifically, asynchronous processing code carries a higher risk when direct, immediate synchronous calls are used when the interaction between two aggregates (or services) is deemed a moderate disturbance. For example, after an order aggregate is created, it needs to notify an inventory aggregate to deduct inventory. The first step is to generate a DomainEvent class. This is the "carrier" of asynchronous communication, defining the business facts of what happened. Generation location: In the module or project where the order aggregate resides. Code form: A simple, immutable data class. Included information: Unique event ID: Used for tracking and deduplication. Aggregate root ID: The order ID (orderId) that triggered this event. Occurrence timestamp: The time the event was created. Event payload: All business data required to process this event. For example, a List... <orderitem>This includes the product ID and purchase quantity. The second step is to register domain events within the aggregate root. When a significant change occurs in the aggregate's business state, it needs to record this fact so that it can later "inform" the outside world. Generation location: Inside the order aggregate root (Order class). Implementation mechanism: Maintaining a List inside the aggregate root. <domainevent>This field is used to temporarily store all events generated during this operation. In the command method that changes the state, after the business logic has finished executing, the newly created event objects are added to this list.
[0145] Specifically, the circuit breaker mode generation code generates a state machine for each data unit, strictly adhering to three states: closed, open, and half-open, and explicitly defining the transition conditions between states. These transition conditions are determined based on the internal state of the circuit breaker. For example, in a scenario where an "e-commerce payment service" calls an unstable "external payment gateway," which is considered a high-disturbance scenario, the core generation process involves creating a circuit breaker instance named `paymentService`, configured to trip if the failure rate exceeds 50%, and enter a half-open state after 10 seconds of being open. AI selects a generation queue strategy.
[0146] In some embodiments of this application, internal code self-checks are performed based on predicted lifetime, including:
[0147] Obtain the predicted lifetime for each cubic aggregation;
[0148] When the predicted lifetime of the third aggregation is detected to have expired, if there are no multi-reference data units in the third aggregation, the third aggregation and its corresponding code are eliminated; if there are multi-reference data units in the third aggregation, the first strategy is executed.
[0149] Specifically, the self-check time of the code self-check is determined by the predicted lifetime of each aggregate. The predicted lifetime of each aggregate is obtained, and a self-check time point is set when each predicted lifetime is reached. When the predicted lifetime of an aggregate is reached, the aggregate is checked.
[0150] Specifically, the predicted lifespan expiration indicates that the business concept corresponding to the aggregation is no longer active and needs to be archived or deleted to maintain the simplicity of the system.
[0151] In some embodiments of this application, the first strategy includes:
[0152] Based on a pre-defined semantic graph, the number of times each multi-reference data unit in the three-stage aggregation is called in other three-stage aggregations is identified;
[0153] Based on the number of calls, multi-reference data units are redistributed to three aggregations where the number of calls exceeds the threshold for the first call.
[0154] Specifically, the first threshold is used as the criterion for judging the migration of multi-reference data units, preferably 10 times per day. When the number of calls to a multi-reference data unit and a certain aggregate exceeds this threshold, it is considered to migrate it to that aggregate.
[0155] Specifically, the data unit migration process includes steps such as data migration and relationship updates, all of which are completed automatically by the system to ensure the security and correctness of the migration process.
[0156] The above are merely preferred embodiments of this application. It should be noted that, for those skilled in the art, several improvements and substitutions can be made without departing from the technical principles of this application, and these improvements and substitutions should also be considered within the scope of protection of this application.< / domainevent> < / orderitem>
Claims
1. An AI code generation system based on domain-driven design, characterized in that, include: An identification unit is used to acquire business data and convert the business data into structured data. The central control unit is used to generate corresponding codes for the structured data based on the hierarchical code structure. The central control unit includes: The first processing module is used to obtain the predicted lifetime and occupied capacity of structured data, and to perform aggregated partitioning. The second processing module is used to generate the predicted lifetime of each aggregate and generate the internal code of each aggregate based on the partitioning of the aggregates. The third processing module is used to obtain business disturbance data between various aggregations; The fourth processing module is used to generate connection codes between various aggregates based on the business disturbance data; The detection unit is used to obtain the predicted lifetime of each aggregation and perform code self-checking on the internal code based on the predicted lifetime.
2. The AI code generation system based on domain-driven design as described in claim 1, characterized in that, The acquisition of the predicted lifetime and occupied capacity of structured data includes: Extract data units from structured data; The data unit is divided into single-lead data units and multi-lead data units; Based on a pre-defined semantic graph, the various data units are linked together; For a single-key data unit, each concatenated data unit is set as a multiple aggregate, and the aggregate is set as a single aggregate; For multi-key data units, the multi-key data unit is set as a data unit to be allocated; Based on the occupied capacity, the data units to be allocated are assigned to the first aggregation to obtain the second aggregation; The secondary polymerization was detected.
3. The AI code generation system based on domain-driven design as described in claim 2, characterized in that, The step of allocating the data units to be allocated into a primary aggregation to obtain a secondary aggregation includes: Get the capacity occupied by one aggregation corresponding to each data unit to be allocated; Construct a sequence R of the first-order aggregation capacity of the m-th data unit to be allocated, Rm=(Rm1,Rm2…Rmi…Rmn), where R1 is the first first-order aggregation corresponding to the m-th data unit to be allocated; Ri is the i-th first-order aggregation corresponding to the m-th data unit to be allocated; and n is the total number of first-order aggregations corresponding to the m-th data unit to be allocated. Get the capacity occupied by each aggregation in R; The m-th data unit to be allocated is assigned to the first aggregation corresponding to the minimum occupied capacity in the sequence R, thus obtaining the second aggregation.
4. The AI code generation system based on domain-driven design as described in claim 3, characterized in that, The detection of secondary polymerization includes: Get the occupied capacity of each secondary aggregation; Each secondary aggregation that exceeds the first capacity threshold is set as an aggregation to be split; Obtain the business scenarios corresponding to each structured data to be split and aggregated; Based on the aforementioned business scenario, each aggregation to be split is split and set as a tertiary aggregation with the unsplit secondary aggregation.
5. The AI code generation system based on domain-driven design as described in claim 4, characterized in that, The generation of the predicted lifetimes for each aggregation includes: Obtain the structured data for each tertiary aggregation and its corresponding aggregation root; When there are no multi-reference data units in the three aggregations, the predicted lifetime of the aggregation root is set to the predicted lifetime of the corresponding three aggregations. When multiple data units exist in the three aggregations, a predicted lifetime sequence M is constructed, M=(M1,M2…Mi…Mn,Mn). 根 ), where M1 is the predicted lifetime corresponding to the first structured data in the three aggregations; M2 is the predicted lifetime corresponding to the second structured data in the three aggregations; Mi is the predicted lifetime corresponding to the i-th structured data in the three aggregations; n is the total number of structured data in the three aggregations; M 根 The predicted lifetime of the polymer root in the three polymerization processes; The maximum value in sequence M is selected, and the predicted lifetime is set as the predicted lifetime of the three-fold aggregation.
6. The AI code generation system based on domain-driven design as described in claim 5, characterized in that, The internal code for generating each aggregation includes: Obtain the predicted lifetime of each tertiary aggregation and divide the tertiary aggregation into multiple levels; Retrieve the code database corresponding to each level of aggregation; Extract entities from the three aggregations, compare them with the code database, and generate the corresponding internal code.
7. The AI code generation system based on domain-driven design as described in claim 6, characterized in that, The third processing module is also used for: Obtain the call frequency, call data volume, and call failure rate among the three aggregations; Calculate the business disturbance intensity data Q between the two aggregations; Q=(1-S 失 )*(P*S 数 ); Among them, S 失 For call failure rate; S 数 P represents the amount of data called; Q represents the call frequency; and Q represents the intensity of business disturbance.
8. The AI code generation system based on domain-driven design as described in claim 7, characterized in that, The fourth processing module is also used for: When Q is less than the first perturbation threshold, it is set as the first perturbation scenario; When Q is greater than the first perturbation threshold and less than the second perturbation threshold, it is set as the second perturbation scenario; When Q is greater than the second perturbation threshold, it is set to the third perturbation scenario; For the first disturbance scenario, the code is directly called from the preset code library; For the second perturbation scenario, asynchronous processing code is generated based on each of the three-dimensional aggregations; For the third disturbance scenario, corresponding code is generated based on the circuit breaker pattern.
9. The AI code generation system based on domain-driven design as described in claim 8, characterized in that, The step of performing a code self-check on the internal code based on the predicted lifetime includes: Obtain the predicted lifetime for each cubic aggregation; When the predicted lifetime of the three-stage aggregation is detected to have expired, if there are no multi-reference data units in the three-stage aggregation, the three-stage aggregation and its corresponding code are eliminated; if there are multi-reference data units in the three-stage aggregation, the first strategy is executed.
10. The AI code generation system based on domain-driven design as described in claim 9, characterized in that, The first strategy includes: Based on the preset semantic graph, the number of times each multi-reference data unit in the three aggregations is called in other three aggregations is identified; Based on the number of calls, the multi-reference data unit is reassigned to three aggregations where the number of calls is greater than the threshold for the first call.