Service code generation method and system based on atomic rule component, terminal and medium

By building atomic rules component library and genetic algorithms to generate business coding, the problems of insufficient flexibility and lack of security in traditional methods are solved, and the effect of flexible adaptation to business needs and improving coding security is achieved.

CN120509380APending Publication Date: 2025-08-19SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510426134.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-07
Publication Date
2025-08-19

AI Technical Summary

Technical Problem

Traditional business number generation methods are not flexible enough, difficult to adapt to complex and changeable business needs, and lack sufficient randomness and security, which is easy to be predicted or copied, increasing the risk of data breaches and business malicious operations.

Method used

Build an atomic rule component library, which contains multiple types of atomic rule components. By receiving business encoding generation requests, extracting the target atomic rule components and configuring the sorting order, generating sub-encoding and fusing it into the final business encoding, using genetic algorithms to process complex constraints, ensuring coding flexibility and security.

Benefits of technology

It improves the flexibility and security of business coding, can quickly adapt to complex and changeable business needs, and the generated encoding is difficult to easily predict and copy, reducing the possibility of data breaches and malicious operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120509380A_ABST
    Figure CN120509380A_ABST
Patent Text Reader

Abstract

The invention belongs to the field of information processing, and particularly relates to a service code generation method and system based on atomic rule components, a terminal and a medium, an atomic rule component library is constructed, the atomic rule component library comprises a plurality of different types of atomic rule components, and each atomic rule component is configured with a unique identifier; receiving a service code generation request; according to the service code generation request, extracting at least one corresponding target atomic rule component from an atomic rule component library, and configuring a sorting sequence of each target atomic rule component; generating each sub-code by using each target atomic rule component; and fusing the sub-codes into a final service code according to the sorting sequence of the target atomic rule components. According to the invention, the flexibility, efficiency and safety of generating service codes are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of information processing, and in particular relates to a method, system, terminal and medium for generating business codes based on atomic rule components. Background Art

[0002] In the current business environment, business number generation is an integral part of various information systems. It not only uniquely identifies data but also plays a key role in tracking and managing business processes. Traditional business number generation methods often rely on fixed rules or simple incrementing sequences. For example, some systems use a simple date + serial number format, or rely solely on the database's auto-incrementing ID. While these methods meet basic needs to a certain extent, they lack flexibility and security. For example, related art methods generate business numbers based on a combination of a timestamp and a fixed-length serial number. This method ensures uniqueness and sequentiality, but its flexibility is insufficient when faced with complex and changing business needs. Traditional methods often struggle to adapt when dynamically adjusting numbering rules based on business scenarios, such as adding organization-specific codes or generating numbers with different prefixes based on user roles. Furthermore, most related art business number generation methods lack sufficient randomness and security, making the numbers easily predictable or replicable, increasing the risk of data leakage and malicious business operations. Summary of the Invention

[0003] To solve the above problems, the present invention provides a method, system, terminal and medium for generating business codes based on atomic rule components, which improve the flexibility, efficiency and security of generating business codes.

[0004] In a first aspect, the technical solution of the present invention provides a method for generating a service code based on an atomic rule component, comprising the following steps: Build an atomic rule component library, which contains multiple different types of atomic rule components. Each atomic rule component is configured with a unique identifier. Receive a request for generating a business code; Generate a request based on the business code, extract at least one corresponding target atomic rule component from the atomic rule component library, and configure the sorting order of each target atomic rule component; Generate each sub-code using each target atomic rule component; The sub-codes are merged into the final business code according to the sorting order of each target atomic rule component.

[0005] In an optional embodiment, according to the business code generation request, extracting at least one corresponding target atomic rule component from the atomic rule component library, and configuring the sorting order of each target atomic rule component specifically includes: Detect the request type of the business code generation request; If the business code generation request is a first-class request that directly includes an atomic rule component combination rule, the atomic rule component combination rule is parsed from the business code generation request, where the atomic rule component combination rule includes at least one target atomic rule component identifier and a component sorting parameter. The corresponding target atomic rule component is extracted from the atomic rule component library according to the target atomic rule component identifier, and the sorting order of each target atomic rule component is configured according to the component sorting parameter. If the business code generation request is a second type of request that includes constraints on generating atomic rule component combination rules, the constraints are parsed from the business code generation request, and the atomic rule component combination rules are obtained through a genetic algorithm based on the constraints. According to the atomic rule component combination rules, at least one corresponding target atomic rule component is extracted from the atomic rule component library, and the sorting order of each target atomic rule component is configured.

[0006] In an optional embodiment, the atomic rule component combination rule is obtained by genetic algorithm based on the constraint conditions, specifically including: Multiple atomic rule components are randomly extracted from the atomic rule component library. A dynamic chromosome encoding mechanism adopts a tree-like gene encoding structure to generate parameterized gene fragments for the extracted multiple atomic rule components. The order of the parameterized gene fragments is randomly determined to generate a chromosome. This step is repeated until the number of chromosomes reaches the set initial population size. Each chromosome represents a possible component combination. Perform constraint verification and simulation testing on each chromosome in the population. Based on the constraint verification and simulation test results, calculate the fitness value of each chromosome in the population according to the multi-objective fitness function to evaluate the degree to which the chromosome meets the constraint conditions; According to the fitness value, a selection strategy is used to select some chromosomes as parent chromosomes to generate the next generation of chromosomes; Randomly select two chromosomes from the parent chromosomes as parents, randomly select one or more crossover points, and exchange gene segments of the parent chromosomes at the crossover points to generate two daughter chromosomes; For each daughter chromosome, randomly select one or more gene positions to change the gene value to generate the mutated daughter chromosome; Merge the generated offspring chromosomes and parent chromosomes into a new population and repeat the iteration until the termination condition is met; The chromosome with the highest fitness value is selected from the final population, and the chromosome is decoded into an atomic rule component combination and output as the optimal atomic rule component combination.

[0007] In an optional embodiment, the constraints include grammatical constraints for expressing the order of component arrangement and placeholder length, business constraints for expressing uniqueness requirements, performance constraints for expressing generation speed and storage overhead, and security constraints for expressing the lower limit of entropy value.

[0008] In an optional embodiment, the expression of the multi-objective fitness function is,

[0009] in, is the weight coefficient, satisfying ; Indicates the the degree of violation of class grammar constraints, Indicates the the weight of the grammar-like constraints; Indicates the number of coding collisions generated in the simulation test, Identifies the total number of codes generated; Indicates the average time required to generate a single code; is the attenuation coefficient; represents the actual entropy value of the encoding, Represents the minimum entropy value of the security constraint; Indicates the actual length of the code, Indicates the maximum allowed encoding length.

[0010] In an optional embodiment, when constructing the initial population, diverse candidates are generated through historical template expansion mutation, Monte Carlo random combination, and adversarial network.

[0011] In an optional embodiment, the atomic rule component includes a random sequence number component, a dynamic value component, a serial number component, a timestamp component, a fixed value component, and an organization code component.

[0012] In a second aspect, the technical solution of the present invention provides a service code generation system based on atomic rule components, comprising: Atomic rule component library construction module, used to build an atomic rule component library, which contains multiple atomic rule components of different types, and each atomic rule component is configured with a unique identifier; A code generation request receiving module, used to receive a business code generation request; A component extraction configuration module is used to generate a request according to the business code, extract at least one corresponding target atomic rule component from the atomic rule component library, and configure the sorting order of each target atomic rule component; A sub-code generation module, used for generating each sub-code using each target atomic rule component; The business code generation module is used to merge the sub-codes into the final business code according to the sorting order of each target atomic rule component.

[0013] In a third aspect, the technical solution of the present invention provides a terminal, including: A memory, used for storing a business code generation program based on atomic rule components; A processor is used to implement the steps of the business code generation method based on atomic rule components as described in any of the above items when executing the business code generation program based on atomic rule components.

[0014] In a fourth aspect, the technical solution of the present invention provides a computer-readable storage medium, on which a business coding generation program based on atomic rule components is stored. When the business coding generation program based on atomic rule components is executed by a processor, the steps of the business coding generation method based on atomic rule components as described in any one of the above items are implemented.

[0015] It can be seen from the above technical solutions that the present application has the following advantages: multiple coding rule components are stored in the atomic rule component library, and users select components from the library as needed and configure the order to form a coding component combination, and then generate a business code based on the combination. Different from the traditional business number generation method that relies on fixed rules or simple incremental sequences, the present invention can extract at least one corresponding target atomic rule component from the atomic rule component library based on the business code generation request, and configure its sorting order. When the business needs change, it only needs to flexibly select and adjust the atomic rule components to quickly meet complex and changeable business needs, effectively solving the problem of insufficient flexibility of the traditional method. At the same time, the present invention generates sub-codes through atomic rule components and then merges them into the final business code. Due to the diversity of atomic rule components and the randomness of the combination, the generated business code is difficult to be easily predicted and copied, thereby significantly improving the security of the business code and reducing the possibility of data leakage and malicious operation of the business. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solution of the present application, the following is a brief introduction to the drawings required for the description. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0017] Figure 1 A flowchart of a method for generating a business code based on atomic rule components is provided in an embodiment of the present invention.

[0018] Figure 2 A schematic block diagram of the structure of a service code generation system based on atomic rule components provided by an embodiment of the present invention.

[0019] Figure 3 A schematic diagram of the structure of a terminal provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0020] In order to make the application objectives, features, and advantages of this application more obvious and easy to understand, the technical solutions protected by this application will be clearly and completely described below using specific embodiments and drawings. Obviously, the embodiments described below are only part of the embodiments of this application, not all of them. Based on the embodiments in this patent, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this patent.

[0021] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention.

[0022] Figure 1 A schematic flow chart of a method for generating a business code based on an atomic rule component is provided in an embodiment of the present invention. Figure 1 The execution entity may be a business code generation system based on atomic rule components. The business code generation method based on atomic rule components provided in the embodiments of the present invention is executed by a computer device. Accordingly, the business code generation system based on atomic rule components runs on the computer device. Depending on different requirements, the order of the steps in this flowchart may be changed, and some steps may be omitted.

[0023] like Figure 1 As shown, the method includes the following steps.

[0024] S0, build an atomic rule component library, which contains multiple atomic rule components of different types, and each atomic rule component is configured with a unique identifier.

[0025] A pre-built atomic rule component library contains multiple atomic rule components and each atomic rule component is assigned a unique identifier for subsequent extraction. Building the atomic rule component library provides the foundation for subsequent business code generation.

[0026] S1, receiving a request to generate a service code.

[0027] The system receives instructions for generating business codes from users or other systems through specific interfaces or interactive methods. This request can contain various information, and the information varies depending on the request type. Specifically, there are two types of requests: one indicates that the user has specified the combination rules for atomic rule components, and subsequent processing is directly based on these rules; the other indicates that the user has set constraints for generating atomic rule components. Based on these constraints, the combination rules for atomic rule components are automatically generated through a genetic algorithm, providing input for subsequent code generation.

[0028] S2: Generate a request based on the business code, extract at least one corresponding target atomic rule component from the atomic rule component library, and configure the sorting order of each target atomic rule component.

[0029] After receiving the request, the system will parse the request content. If it is a first-class request that directly contains atomic rule component combination rules, the target atomic rule component identifier and component sorting parameters are directly extracted from the request, and then the corresponding components are found from the atomic rule component library and their arrangement order is determined; if it is a second-class request that contains constraints for generating atomic rule component combination rules, the constraints are parsed from the request, and the appropriate atomic rule component combination rules are calculated using a genetic algorithm. Components are then extracted from the component library and the order is configured accordingly. The atomic rule component library contains a variety of basic components, such as random sequence number components, timestamp components, etc., which can meet different coding requirements.

[0030] On the one hand, this approach greatly enhances the flexibility of code generation. Whether it's a simple, clear requirement (first-type request) or complex constraints (second-type request), the system can select and configure components based on the actual situation to meet diverse business scenarios. On the other hand, by using genetic algorithms to handle complex constraints, it can find the optimal or less-optimal solution among numerous possible component combinations, optimizing code generation rules and ensuring that the generated code not only meets business constraints but also has better overall performance.

[0031] S3, uses each target atomic rule component to generate each sub-encoding.

[0032] The system independently generates a corresponding subcode for each target atomic rule component extracted from the atomic rule component library based on its respective rules and characteristics. For example, the random sequence component generates a random number subcode according to a random algorithm, and the timestamp component obtains the current time to generate a time-related subcode.

[0033] The independent encapsulation of atomic rule components ensures that the generated sub-codes have clear functional characteristics. These sub-codes provide rich information fragments for the final business code and are the basic elements for building a complete business code. By combining sub-codes with different functions, the diverse information requirements of business codes can be met.

[0034] S4: Merge each sub-code into the final business code according to the sorting order of each target atomic rule component.

[0035] Following the sorting order of the target atomic rule components determined in step S2, the subcodes are sequentially concatenated or combined in a specific fusion method to form a complete business code. For example, if the sorting order is such that the timestamp component comes first and the random number component comes last, the timestamp subcode and the random number subcode are concatenated in this order to form the final code.

[0036] This fusion approach ensures that the resulting business code has a clear structure and logical sequence, conforming to business process and management requirements. Furthermore, due to the diverse sub-code sources and flexible combination methods, the generated business code not only meets basic identification requirements but also contains rich business information, improving the practicality of the code. Furthermore, the diversity of sub-codes and the randomness of their combination enhance the security of the business code, making it difficult to predict and copy, and reducing the risk of data leakage and malicious operations.

[0037] Furthermore, as a refinement and extension of the specific implementation of the above embodiment, in order to fully illustrate the specific implementation process in this embodiment, another service code generation method based on atomic rule components is provided, which includes the following steps.

[0038] SS0, builds an atomic rule component library.

[0039] The atomic rule component library can be a database, file system or other storage form, and needs to use the corresponding access interface according to its specific implementation method. The atomic rule component library contains multiple different types of atomic rule components, and each atomic rule component is configured with a unique identifier.

[0040] In a specific embodiment, the atomic rule component includes a random sequence number component, a dynamic value component, a serial number component, a timestamp component, a fixed value component, and an organization code component.

[0041] Among them, the random sequence component generates a random number or letter sequence of a specified length; the dynamic value component obtains a dynamic value from the system or external data source according to the value selection rules of the configuration field; the serial number component generates an increasing number sequence, which is usually used for consecutive numbering under the same business type; the timestamp component converts the current time into a string in a specific format; the fixed value component generates a specified unchanging value; and the organization code component obtains the code of the organization to which the currently logged-in user belongs.

[0042] SS1: Receive service code generation request.

[0043] Receive requests for service number generation through user input or system triggers via an interface. The interface supports multiple communication protocols to accommodate different request sources. For example, a user enters the relevant request information on an interface (e.g., a web page or mobile app) and issues a service number generation request to the backend.

[0044] SS2, detects the request type of the service code generation request.

[0045] When the system receives a request to generate a business code, it first reads the request header information. The request header typically contains basic metadata about the request, such as the request source and request type identifier. For example, in an HTTP request, you can view the custom request header fields. If the "Request-Type" field is present, you can obtain a preliminary identification of the request type.

[0046] It should be noted that if the request header does not explicitly include a request type identifier, the request body structure is parsed. Different types of requests have different request body structures and field compositions. The first type of request directly lists the atomic rule component identifiers and component sorting parameters in the request body. Taking JSON format as an example, this is presented as {"components":["timestamp","organization code","serial number"],"order":[0,1,2]}; while the second type of request will include fields related to constraints, such as {"constraints":["length ≤ 20 characters","anti-collision probability < 1e-6","includes irreversible hash"]}. By parsing the request body structure and fields, the request type can be further determined.

[0047] A pre-established request type determination rule base is used to match the extracted request information with the rules in the rule base. If the request contains clear atomic rule component identification and ordering information and meets the structural characteristics of a first-class request, it is considered a first-class request. If the request contains complex business constraints and meets the characteristics of a second-class request, it is considered a second-class request.

[0048] It should be noted that if a request includes a preliminary identifier, subsequent analysis will also utilize the structured form to enhance accuracy. This preliminary identifier is used for preliminary type determination. After receiving a request generated by a business code, the system can use it to quickly narrow down the scope of its determination. For example, for HTTP requests, if the "Request-Type" field in the request header is initially identified as "Custom Rule," the system prioritizes further analysis of the request content based on the characteristics of the first type of request (where the user explicitly specifies the component type and order).

[0049] SS3: If the business coding generation request is a first-class request, parse at least one target atomic rule component identifier and component sorting parameter from the business coding generation request, extract the corresponding target atomic rule component from the atomic rule component library according to the target atomic rule component identifier, and configure the sorting order of each target atomic rule component according to the component sorting parameter.

[0050] SS3.1, parse the business code to generate the request content.

[0051] SS3.1.1, locate key information.

[0052] First, identify the data format of the request content. Then, based on the characteristics of the format, locate the location where the target atomic rule component identifiers and component order parameters are stored. For example, the request is in JSON format and is located by key name, such as "component_ids" to store component identifiers and "component_order" to store component order parameters.

[0053] It should be noted that the first-type request can also include configuration parameters for the target atomic rule component, such as "component_ids_configuration," which stores component configuration parameters. When the autoencode is subsequently generated, the component configuration parameters are retrieved and executed. If the first-type request does not include configuration parameters, the user can be prompted to enter the configuration parameters after the atomic rule component combination rule is generated.

[0054] SS3.1.2, extract the target atomic rule component identifier.

[0055] Extract at least one target atomic rule component identifier from the request content. These identifiers are key information used to find the corresponding component in the atomic rule component library. For example, an atomic rule component identifier might be "timestamp" (a timestamp component) or "random_number" (a random number component).

[0056] SS3.1.3, Extract component sorting parameters.

[0057] Extract the component sorting parameter from the request content. The component sorting parameter specifies the order in which the target atomic rule components are arranged when generating the business code. For example, the sorting parameter is an array, where the element indexes correspond to the order of the component identifiers. For example, [2,0,1] indicates that the third component is ranked first, the first component is ranked second, and the second component is ranked third.

[0058] SS3.2, access the atomic rule component library.

[0059] SS3.2.1, establish a connection with the atomic rule component library.

[0060] This step ensures that the atomic rule component information stored therein can be accessed normally.

[0061] SS3.2.2, search for the target atomic rule component in the atomic rule component library.

[0062] Based on the target atomic rule component identifier obtained by parsing, a search is performed in the atomic rule component library. For each component identifier, the corresponding atomic rule component record is matched in the library.

[0063] SS3.3, configure the sorting order of each target atomic rule component.

[0064] The target atomic rule components extracted from the atomic rule component library are associated according to the component sorting parameters obtained by parsing. That is, the order of each component when generating business codes is determined according to the sorting parameters.

[0065] Based on the association results, a sorted list of target atomic rule components is generated. This list will serve as the basis for subsequent business code generation, ensuring that each sub-code is included in the code generation process in the order specified by the requester.

[0066] SS3.4, store the sorting results.

[0067] The sorted list of target atomic rule components is stored in a temporary storage area of the system (such as memory variables, cache, etc.) so that it can be directly used when generating business codes later. At the same time, the request processing result is fed back to the requester, informing them that the target atomic rule components have been successfully extracted and configured in the specified order, and are ready to enter the business code generation phase.

[0068] SS4, if the business code generation request is a second-class request, the constraints are parsed from the business code generation request, and the atomic rule component combination rules are obtained through the genetic algorithm based on the constraints. According to the atomic rule component combination rules, at least one corresponding target atomic rule component is extracted from the atomic rule component library, and the sorting order of each target atomic rule component is configured.

[0069] SS4.1, parse the constraints in the business code generation request.

[0070] Identify the data format of the request generated by the business code and, based on the format's characteristics, use appropriate parsing methods to extract the constraint content. This includes extracting fields and data related to the constraint conditions from the request content. For example, if the request is in JSON format, the request contains a field named "constraints," whose value is an array containing various constraints, such as ["length ≤ 20 characters", "anti-collision probability < 1e-6", "contains irreversible hash"].

[0071] The extracted constraints are converted into a format that the system can recognize and process. The constraints are also validated to check for syntax errors, conflicting constraints, and other issues. For example, the system checks whether the "length ≤ 20 characters" statement complies with syntax specifications and whether the value in "anti-collision probability < 1e-6" is within a reasonable range. If invalid constraints are found, the system records the error information and provides feedback to the requesting party, requesting a correction to the request.

[0072] In some optional implementations, the constraints include grammatical constraints for expressing the order of component arrangement and placeholder length, business constraints for expressing uniqueness requirements, performance constraints for expressing generation speed and storage overhead, and security constraints for expressing the lower limit of entropy value.

[0073] SS4.2, obtains atomic rule component combination rules based on genetic algorithm.

[0074] SS4.2.1, randomly extract multiple atomic rule components from the atomic rule component library.

[0075] Multiple atomic rule components are randomly extracted from the atomic rule component library. These components will serve as the basis for constructing the initial population. In some optional embodiments, atomic rule components are randomly extracted from the atomic rule component library to construct the chromosome. The extraction process follows certain randomness principles. The probability of each component being selected can be the same, or different weights can be set according to business needs. For example, to increase the probability of certain commonly used components being selected, these components can be given higher weights.

[0076] SS4.2.2, uses a dynamic chromosome encoding mechanism to adopt a tree-like gene encoding structure to generate parameterized gene fragments for each extracted atomic rule component.

[0077] Using a dynamic chromosome encoding mechanism, a tree-like gene encoding structure is employed to generate parameterized gene segments for the extracted atomic rule components. Multiple gene segments constitute individuals (chromosomes) in the initial population. For example, a chromosome might be represented as [timestamp component (parameter 1), random sequence component (parameter 2), where the parameters for the components are in parentheses.

[0078] For each selected atomic rule component, parameters are randomly generated or determined according to specific rules. For example, for the timestamp component, the time format can be randomly selected (e.g., "yyyy-MM-ddHH:mm:ss" or "yyMMddHHmm"). For the random sequence number component, its length (e.g., 4 digits, 6 digits, etc.) and value range (e.g., 0-9999, AZ, etc.) are randomly determined.

[0079] SS4.2.3, randomly determine the arrangement order of the parameterized gene segments to generate a chromosome; repeat steps SS4.2.1 to SS4.2.3 until the number of chromosomes reaches the set initial population size.

[0080] Randomly determine the order of the selected components within the chromosome. Different component orders can affect the generation logic and characteristics of the final business code. For example, the timestamp component, random sequence component, and organization code component selected above might generate an order of [random sequence component (4 digits, 0-9999), timestamp component ("yyyy-MM-ddHH:mm:ss"), organization code component ("ORG001")], which constitutes a chromosome.

[0081] The number of chromosomes in the initial population is predetermined, and the initial population size is recorded. The user can then set it based on specific needs. Repeat the above steps to generate a new chromosome each time until the number of chromosomes generated reaches the set initial population size. During the generation process, the detailed information of each chromosome, including component type, component parameters, and component order, is recorded to form the initial population list.

[0082] In some optional implementations, a diverse generation strategy is employed, including generating diverse candidates through historical template expansion and mutation, Monte Carlo random combination, and adversarial networks, to enrich the diversity of the initial population. For example, 30% of the population may be expanded based on historically excellent rules, 50% may be generated by Monte Carlo random combination, and 20% may be generated by a generative adversarial network.

[0083] SS4.2.4, perform constraint verification and simulation testing on each chromosome in the population. Based on the constraint verification and simulation test results, calculate the fitness value of each chromosome in the population according to the multi-objective fitness function to evaluate the degree to which the chromosome meets the constraints.

[0084] Constraint verification involves checking each chromosome (component combination scheme) in the population to see if it satisfies various constraints, such as syntax constraints (component order, placeholder length, etc.), business constraints (uniqueness requirements, etc.), performance constraints (generation speed, storage overhead, etc.), and security constraints (entropy minimums, etc.). For chromosomes that do not meet their constraints, the type and number of violations are recorded.

[0085] Simulation testing involves generating a large number of samples (e.g., 10^6) and verifying the collision rate and performance indicators of component combinations through simulation testing. For example, this involves simulating code generation in actual business scenarios, counting the number of code collisions, and testing the average time required to generate a single code.

[0086] Then the fitness value of each chromosome in the population is calculated according to the multi-objective fitness function. The expression of the multi-objective fitness function is:

[0087] in, is the weight coefficient, satisfying ; Indicates the the degree of violation of class grammar constraints, Indicates the the weight of the grammar-like constraints; Indicates the number of coding collisions generated in the simulation test, Identifies the total number of codes generated; Indicates the average time required to generate a single code; is the attenuation coefficient; represents the actual entropy value of the encoding, Represents the minimum entropy value of the security constraint; Indicates the actual length of the code, Indicates the maximum allowed encoding length.

[0088] In the above formula, the first term represents a grammatical constraint, which is used to penalize rules that violate the order of component arrangement or the length limit of placeholders. For example, if a rule violates the order constraint of "timestamp must be before serial number", then ; If the placeholder length exceeds the limit of 3 characters, then The higher the violation, the lower the score, and the item reaches its maximum value when the constraint is satisfied.

[0089] The second item represents the uniqueness item, which quantifies the uniqueness of the code. The lower the collision rate, the higher the score. 6 If there are 50 collisions in the code, the score is Full points will be awarded for this item if there is no collision at all. .

[0090] The third item represents the generation speed item, which encourages rules with fast generation speed. The shorter the time, the higher the score.

[0091] The fourth item is the security entropy value item, which ensures that the randomness of the code meets the minimum security requirements. If the entropy value exceeds the threshold, full points will be awarded. , otherwise points will be deducted proportionally.

[0092] The fifth term is the storage overhead term, which penalizes rules with excessively long encoding lengths and encourages compact encoding designs. A square term is used to strengthen the penalty for rules approaching the upper limit of the length.

[0093] SS4.2.5, based on the fitness value, adopts a selection strategy to select some chromosomes as parent chromosomes to generate the next generation chromosomes.

[0094] In some optional implementations, a strategy such as tournament selection is employed based on fitness values to select a subset of chromosomes as parent chromosomes for use in generating the next generation of chromosomes. For example, tournament selection randomly selects a certain number of individuals (e.g., 5) from the population each time, selects the individuals with the highest fitness to form the parent set, and retains the top 20% of individuals to ensure that excellent component combinations are passed on to the next generation.

[0095] SS4.2.6, randomly select two chromosomes from the parent chromosomes as parents, randomly select one or more crossover points, and exchange gene segments of the parent chromosomes at the crossover points to generate two daughter chromosomes.

[0096] Two chromosomes are randomly selected from the parent chromosome as parents. One or more crossover points are randomly selected, and gene segments from the parent chromosomes are exchanged at these crossover points to generate two daughter chromosomes. The crossover rate is set to 60% to promote population diversity and evolution. For example, if parent chromosome A is [component 1, component 2, component 3] and parent chromosome B is [component 4, component 5, component 6], after crossover at crossover point 1, the daughter chromosomes may be [component 4, component 2, component 3] and [component 1, component 5, component 6].

[0097] SS4.2.7, for each daughter chromosome, randomly select one or more gene positions and change the gene value to generate the mutated daughter chromosome.

[0098] Each daughter chromosome undergoes a mutation operation with a certain probability. Mutation methods include parameter perturbation (15% probability), component replacement (10% probability), and structural adjustment (5% probability). For example, parameter perturbation might adjust the length of the serial number component from 4 to 6 digits; component replacement might replace the random serial number component with a timestamp component; and structural adjustment might change the hierarchical relationship of components in the combination.

[0099] SS4.2.8, merge the generated offspring chromosomes and parent chromosomes into a new population and repeat the iteration until the termination condition is met.

[0100] The resulting offspring chromosomes are merged with the parent chromosomes into a new population, and the fitness evaluation and genetic evolution operations are repeated until the termination condition is met. For example, the termination condition is that the fitness of the optimal solution improves by less than 1% for 10 consecutive generations and the number of constraint violations is 0, at which point the algorithm is considered to have converged.

[0101] SS4.2.9, select the chromosome with the highest fitness value from the final population, and decode the chromosome into an atomic rule component combination, which is output as the optimal atomic rule component combination.

[0102] The chromosome with the highest fitness value is selected from the finally converged population, and the chromosome is decoded into an atomic rule component combination rule and output as the optimal atomic rule component combination that meets the constraints.

[0103] SS4.3, extract target atomic rule components and configure sorting order First, a connection is established with the atomic rule component library to ensure access to the component information. Then, based on the atomic rule component combination rule derived from the genetic algorithm, at least one target atomic rule component is extracted from the atomic rule component library. For example, if the combination rule is [timestamp component, 3-digit random component, dynamic value component, organizational code component], the corresponding component instance is found in the library.

[0104] Configure the sorting order of each target atomic rule component according to the order specified in the atomic rule component combination rules. Store the extracted and sorted target atomic rule component information in the system's temporary storage area for subsequent use in generating business codes. Simultaneously, feedback is provided to the requester that the target atomic rule component has been successfully acquired and configured, and that business code generation is ready.

[0105] SS5,generates each sub-code using each target atomic rule component.

[0106] According to the previously determined target atomic rule component list, each component is processed in turn.

[0107] Timestamp component: Obtains the time format requirement from the component parameters, such as "yyyyMMddHHmmss".

[0108] Gets the current system time and formats it according to the specified time format to generate the corresponding timestamp subcode. For example, if the current time is 10:30:15 on March 20, 2025, the subcode generated according to the above format is "20250320103015".

[0109] Random number component: The range and length of the random number are determined based on the component parameters. For example, the range is 1-1000 and the length is 4 digits (if less than 4 digits, leading zeros are added).

[0110] Generates a random number within the specified range using a random number generation algorithm, formats it according to the required length, and generates a random subcode. For example, if the generated random number is 23, the formatted subcode is "0023."

[0111] Serial Number Component: Gets the current serial number value from a database or other storage medium. Adds 1 to the serial number value to get a new serial number.

[0112] Format the new serial number according to the component parameters and generate a serial number subcode. For example, if the serial number length is 5 digits, the current serial number is 123, and the new serial number is 124, the formatted subcode is "00124".

[0113] Fixed value component: The subcode is obtained directly from the component parameter. For example, if the fixed value is "ABC", the subcode is "ABC".

[0114] Organization code component: Query the corresponding organization code from the login information based on business rules and component parameters.

[0115] The organization code found is used as the sub-code. For example, if the organization code found is "ORG001", the sub-code is "ORG001".

[0116] SS6, merges each sub-code into the final business code according to the sorting order of each target atomic rule component.

[0117] Obtain the sorting order information for each target atomic rule component from the previous step. Based on the sorting order, extract the corresponding subcodes from the temporarily stored data structure. Concatenate the extracted subcodes in order to form the final business code. For example, if the sorting order is timestamp component, random sequence component, and organization code component, and the corresponding subcodes are "20250320103015," "0023," and "ORG001," the fused business code is "202503201030150023ORG001."

[0118] The above describes in detail an embodiment of a method for generating business codes based on atomic rule components. Based on the method for generating business codes based on atomic rule components described in the above embodiment, an embodiment of the present invention also provides a device for generating business codes based on atomic rule components corresponding to the method.

[0119] Figure 2 This is a schematic block diagram of the structure of a business code generation system based on atomic rule components, provided in an embodiment of the present invention. In this embodiment, the business code generation system 200 based on atomic rule components can be divided into multiple functional modules according to the functions they perform. A module, as referred to in the present invention, refers to a series of computer program segments that can be executed by at least one processor and can perform fixed functions, and is stored in a memory.

[0120] The atomic rule component library construction module 210 is used to construct an atomic rule component library, which includes multiple atomic rule components of different types, and each atomic rule component is configured with a unique identifier.

[0121] The code generation request receiving module 220 is used to receive a service code generation request.

[0122] The component extraction configuration module 230 is used to generate a request according to the business code, extract at least one corresponding target atomic rule component from the atomic rule component library, and configure the sorting order of each target atomic rule component.

[0123] The sub-code generation module 240 is configured to generate each sub-code using each target atomic rule component.

[0124] The service code generation module 250 is used to merge the sub-codes into a final service code according to the sorting order of the target atomic rule components.

[0125] The business coding generation device based on atomic rule components of this embodiment is used to implement the aforementioned business coding generation method based on atomic rule components. Therefore, the specific implementation method of the device can be seen in the embodiment part of the business coding generation method based on atomic rule components in the previous text. Therefore, its specific implementation method can refer to the description of the corresponding embodiments of each part, and will not be elaborated here.

[0126] In addition, since the service code generation device based on atomic rule components in this embodiment is used to implement the aforementioned service code generation method based on atomic rule components, its function corresponds to that of the aforementioned method and will not be repeated here.

[0127] Figure 3 A schematic diagram of the structure of a terminal 300 provided in an embodiment of the present invention includes: a processor 310, a memory 320, and a communication unit 330. The processor 310 is configured to implement the following steps when executing the service code generation program based on the atomic rule component stored in the memory 320: Build an atomic rule component library, which contains multiple different types of atomic rule components. Each atomic rule component is configured with a unique identifier. Receive a request for generating a business code; Generate a request based on the business code, extract at least one corresponding target atomic rule component from the atomic rule component library, and configure the sorting order of each target atomic rule component; Generate each sub-code using each target atomic rule component; The sub-codes are merged into the final business code according to the sorting order of each target atomic rule component.

[0128] The present invention also provides a computer storage medium, wherein the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM).

[0129] The computer storage medium stores a business code generation program based on atomic rule components. When the business code generation program based on atomic rule components is executed by a processor, the following steps are implemented: Build an atomic rule component library, which contains multiple different types of atomic rule components. Each atomic rule component is configured with a unique identifier. Receive a request for generating a business code; Generate a request based on the business code, extract at least one corresponding target atomic rule component from the atomic rule component library, and configure the sorting order of each target atomic rule component; Generate each sub-code using each target atomic rule component; The sub-codes are merged into the final business code according to the sorting order of each target atomic rule component.

[0130] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention is not limited to the embodiments shown herein but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for generating business codes based on atomic rule components, characterized in that: The following steps are involved: Build an atomic rule component library, which contains multiple different types of atomic rule components. Each atomic rule component is configured with a unique identifier. Receive a request for generating a business code; Generate a request based on the business code, extract at least one corresponding target atomic rule component from the atomic rule component library, and configure the sorting order of each target atomic rule component; Generate each sub-code using each target atomic rule component; The sub-codes are merged into the final business code according to the sorting order of each target atomic rule component.

2. The method for generating a business code based on an atomic rule component according to claim 1, characterized in that: Generate a request based on the business code, extract at least one corresponding target atomic rule component from the atomic rule component library, and configure the sorting order of each target atomic rule component, specifically including: Detect the request type of the business code generation request; If the business code generation request is a first-class request that directly includes an atomic rule component combination rule, the atomic rule component combination rule is parsed from the business code generation request, where the atomic rule component combination rule includes at least one target atomic rule component identifier and a component sorting parameter. The corresponding target atomic rule component is extracted from the atomic rule component library according to the target atomic rule component identifier, and the sorting order of each target atomic rule component is configured according to the component sorting parameter. If the business code generation request is a second type of request that includes constraints on generating atomic rule component combination rules, the constraints are parsed from the business code generation request, and the atomic rule component combination rules are obtained through a genetic algorithm based on the constraints. According to the atomic rule component combination rules, at least one corresponding target atomic rule component is extracted from the atomic rule component library, and the sorting order of each target atomic rule component is configured.

3. The method for generating a business code based on an atomic rule component according to claim 2, characterized in that: Based on the constraints, the combination rules of atomic rule components are obtained through genetic algorithms, including: Multiple atomic rule components are randomly extracted from the atomic rule component library. A dynamic chromosome encoding mechanism adopts a tree-like gene encoding structure to generate parameterized gene fragments for each extracted atomic rule component. The order of the parameterized gene fragments is randomly determined to generate a chromosome. This step is repeated until the number of chromosomes reaches the set initial population size. Each chromosome represents a possible component combination. Perform constraint verification and simulation testing on each chromosome in the population. Based on the constraint verification and simulation test results, calculate the fitness value of each chromosome in the population according to the multi-objective fitness function to evaluate the degree to which the chromosome meets the constraint conditions; According to the fitness value, a selection strategy is used to select some chromosomes as parent chromosomes to generate the next generation of chromosomes; Randomly select two chromosomes from the parent chromosomes as parents, randomly select one or more crossover points, and exchange gene segments of the parent chromosomes at the crossover points to generate two daughter chromosomes; For each daughter chromosome, randomly select one or more gene positions to change the gene value to generate the mutated daughter chromosome; Merge the generated offspring chromosomes and parent chromosomes into a new population and repeat the iteration until the termination condition is met; The chromosome with the highest fitness value is selected from the final population, and the chromosome is decoded into an atomic rule component combination and output as the optimal atomic rule component combination.

4. The method for generating a business code based on an atomic rule component according to claim 3, characterized in that: Constraints include syntax constraints for expressing component arrangement order and placeholder length, business constraints for expressing uniqueness requirements, performance constraints for expressing generation speed and storage overhead, and security constraints for expressing the lower limit of entropy value.

5. The method for generating a business code based on an atomic rule component according to claim 4, characterized in that: The expression of the multi-objective fitness function is: in, is the weight coefficient, satisfying ; Indicates the the degree of violation of class grammar constraints, Indicates the the weight of the grammar-like constraints; Indicates the number of coding collisions generated in the simulation test, Identifies the total number of codes generated; Indicates the average time required to generate a single code; is the attenuation coefficient; represents the actual entropy value of the code, Represents the minimum entropy value of the security constraint; Indicates the actual length of the code, Indicates the maximum allowed encoding length.

6. The method for generating a business code based on atomic rule components according to claim 5, characterized in that: When constructing the initial population, diverse candidates are generated through historical template expansion mutation, Monte Carlo random combination, and adversarial network.

7. The method for generating a service code based on an atomic rule component according to any one of claims 1 to 6, characterized in that: The atomic rule components include random sequence number component, dynamic value component, serial number component, timestamp component, fixed value component, and organization coding component.

8. A business code generation system based on atomic rule components, characterized in that: include: Atomic rule component library construction module, used to build an atomic rule component library, which contains multiple atomic rule components of different types, and each atomic rule component is configured with a unique identifier; A code generation request receiving module, used to receive a business code generation request; A component extraction configuration module is used to generate a request according to the business code, extract at least one corresponding target atomic rule component from the atomic rule component library, and configure the sorting order of each target atomic rule component; A sub-code generation module, used for generating each sub-code using each target atomic rule component; The business code generation module is used to merge the sub-codes into the final business code according to the sorting order of each target atomic rule component.

9. A terminal, characterized in that: include: A memory, used for storing a business code generation program based on atomic rule components; A processor is used to implement the steps of the business code generation method based on atomic rule components as described in any one of claims 1 to 7 when executing the business code generation program based on atomic rule components.

10. A computer-readable storage medium, characterized in that The readable storage medium stores a business coding generation program based on atomic rule components. When the business coding generation program based on atomic rule components is executed by a processor, the steps of the business coding generation method based on atomic rule components as described in any one of claims 1 to 7 are implemented.