Business code development method and device, computer equipment and storage medium
The method addresses excessive coupling and redundancy in insurance systems by isolating personalized and general services through directional separation and groovy encoding, ensuring system stability and simplifying maintenance.
Patent Information
- Application Number
- CN202411181569.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-27
- Publication Date
- 2024-12-13
AI Technical Summary
The high integration of personalized and general services in insurance systems leads to excessive coupling and redundancy in system code, making maintenance difficult due to improper module division and increased dependencies between modules.
A business code development method involving directional separation processing to obtain general and personalized service code blocks, followed by groovy encoding and configuration combination using business customization requirements to isolate personalized logic in a groovy script, ensuring it does not affect stable business logic.
This method physically isolates personalized logic, maintaining system stability while supporting personalized business development, reducing excessive coupling and redundancy, and simplifying maintenance.
Smart Images

Figure CN119127209A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of system development and financial technology, and to a business code development method, device, computer equipment and storage medium. Background Art
[0002] In the field of financial technology, due to the different risk needs of people from different regions, nationalities, and circles, business personnel often need to customize some personalized services based on the actual situation of customers during the actual development of insurance business systems. These personalized services usually need to be implemented based on general services. With the continuous development of the financial insurance market, the personalized services of insurance systems are increasing, the personalized business codes are increasing, and the coupling degree between personalized business codes and general business codes is getting higher and higher. The internal systems of insurance companies will also accumulate tens of thousands to hundreds of thousands of lines of unused codes, resulting in increasing difficulty in system maintenance and development costs.
[0003] Existing technologies usually use modular code to handle personalized business development of insurance business systems. Through demand analysis, the system is divided into multiple common modules, and several business interfaces are set in the common modules. Each business interface corresponds to a personalized business or a common business. The business interfaces and dependencies between modules are considered to ensure that they can work together.
[0004] However, the traditional modular code approach may lead to improper module division due to the uneven business capabilities of developers, resulting in functionally closely related parts being divided into different modules, causing high dependencies between these modules. Moreover, when multiple modules share the same global variables or states, the coupling between them increases, and modifications to one module may have unexpected effects on other modules. Summary of the invention
[0005] The purpose of the embodiments of the present application is to propose a business code development method, device, computer equipment and storage medium to solve the problem of excessive coupling caused by the high integration of personalized services and general services in the insurance system, resulting in excessive redundancy of system code and being unfavorable for maintenance.
[0006] In order to solve the above technical problems, the embodiment of the present application provides a business code development method, which adopts the following technical solution:
[0007] Obtain original business code and business customization requirement instructions;
[0008] Directed separation processing is performed on the original service code to obtain a general service code block and a personalized service code block;
[0009] Performing groovy coding on the personalized service code block to obtain an executable groovy script;
[0010] Based on the business customization requirement instruction, the executable groovy script and the general business code block are selected for configuration combination to obtain a target business interface;
[0011] Furthermore, the original business code includes multiple business interfaces, each business interface has a corresponding code annotation, and the step of performing directional separation processing on the original business code to obtain a general business code block and a personalized business code block specifically includes:
[0012] Get the business documentation for each business interface;
[0013] Performing text preprocessing on the code comments of the business interface to obtain comment text features;
[0014] Performing word frequency-inverse document frequency processing on the business document based on the annotation text features to obtain a target business interface weight value;
[0015] If the target service interface weight value is greater than a preset weight threshold, the service interface is marked as a general service interface;
[0016] If the target service interface weight value is less than a preset weight threshold, the service interface is marked as a personalized service interface;
[0017] Separating the general service interface from the original service code to obtain the general service code block, and separating the personalized service interface from the original service code to obtain the personalized service code block;
[0018] Furthermore, the step of performing word frequency-inverse document frequency processing on the business document based on the annotation text feature to obtain the target business interface weight value specifically includes:
[0019] Using the annotation text feature to perform the word frequency-inverse document frequency processing on the business documents of each business interface one by one, to obtain a business interface weight value of each business interface;
[0020] Weighting the service interface weight value of each service interface to obtain the target service interface weight value;
[0021] Furthermore, the step of performing groovy encoding processing on the personalized service code block to obtain an executable groovy script specifically includes:
[0022] Performing an abstract syntax tree generation process based on the personalized service code block to obtain an abstract syntax tree of the personalized service logic;
[0023] Traversing and parsing the abstract syntax tree of the personalized business logic to obtain the target personalized business logic;
[0024] Perform groovy coding processing based on the target personalized business logic to obtain a groovy code block;
[0025] Encapsulating the groovy code block into a groovy file to obtain the executable groovy script;
[0026] Furthermore, the business customization requirement instruction includes a business customization requirement solution, and the step of selecting the executable groovy script and the general business code block for configuration combination based on the business customization requirement instruction to obtain the target business interface specifically includes:
[0027] The executable groovy script is configured according to the business customization requirement solution to obtain an initial executable script;
[0028] The general business code block is selected through the business customization requirement solution, and combined with the initial executable script through the groovy engine to obtain the target business interface;
[0029] Furthermore, the step of configuring the executable groovy script through the business customization requirement solution to obtain an initial executable script specifically includes:
[0030] Determine the configurable service components based on the business customization requirement solution;
[0031] Deploy the configured service component in the executable groovy script to obtain the initial executable script;
[0032] Furthermore, after the step of selecting the executable groovy script and the general business code block based on the business customization requirement instruction to configure and combine to obtain the target business interface, the step further includes:
[0033] Obtain the URL address and service request parameters of the target service interface;
[0034] Performing parameter conversion processing on the service request parameters to obtain target service parameters;
[0035] The target service parameters are assigned to the URL address, and the request result is returned.
[0036] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:
[0037] A computer device includes a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the business code development method when executing the computer-readable instructions.
[0038] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:
[0039] A computer-readable storage medium, characterized in that computer-readable instructions are stored on the computer-readable storage medium, and when the computer-readable instructions are executed by a processor, the steps of the business code development method are implemented.
[0040] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0041] This embodiment uses business customization requirement instructions to carry out targeted separation processing on the original business code to obtain a general business code block and a personalized business code block, parses and encapsulates the personalized business code block into an executable groovy script, and then selects the configuration of the executable groovy script according to the business customization requirement instructions. By configuring and combining the executable groovy script with the general business code block, the target business interface is obtained. This embodiment uses the code level to physically isolate the personalized logic in the groovy file, so that the personalized logic will not affect each other or the stable business logic, which not only ensures the stability of the main business, but also supports the development of personalized business, and solves the problem of high integration of personalized business and general business in insurance business, excessive coupling, and excessive redundancy of system code that is not conducive to maintenance. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0043] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;
[0044] Figure 2 A flowchart of an embodiment of a method for developing a business code according to the present application;
[0045] Figure 3 is a structural diagram of an embodiment of a service code development device according to the present application;
[0046] Figure 4It is a structural diagram of an embodiment of a computer device according to the present application. DETAILED DESCRIPTION
[0047] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0048] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0049] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0050] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables.
[0051] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0052] Terminal devices 101, 102, 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 (Moving Picture Experts Group Audio Layer IV) players, laptop computers and desktop computers, etc.
[0053] The server 105 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal devices 101 , 102 , and 103 .
[0054] It should be noted that the service code development method provided in the embodiment of the present application is generally executed by a server / terminal device, and accordingly, the service code development device is generally set in the server / terminal device.
[0055] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0056] Continue to refer Figure 2 , shows a flow chart of an embodiment of a method for developing business code according to the present application. The business code development method comprises the following steps:
[0057] Step S201, obtaining the original business code and business customization requirement instructions.
[0058] In this embodiment, the electronic device (eg Figure 1 The server / terminal device shown in the figure) can obtain the above-mentioned service customization requirement instruction and the original service code through a wired connection method or a wireless connection method. It should be noted that the above-mentioned wireless connection method may include but is not limited to 3G / 4G / 5G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other wireless connection methods currently known or to be developed in the future.
[0059] In this embodiment, the above-mentioned original business code can be encoded in JAVA code, PYTHON code, C++ and other high-level programming languages. The above-mentioned original business code can realize different business functions. For example, in the field of financial technology, the above-mentioned original business code can be the source code of the insurance business system, including business code and configuration parameters. The above-mentioned configuration parameters may include configuration file parameters, database connection objects, environment variables and command line parameters. The above-mentioned business code may be the source code for realizing the business functions in the insurance business system. The source code of the above-mentioned business functions may be insurance business functions, payment business functions, fixed insurance business functions and other insurance businesses. The above-mentioned original business code can be obtained by pulling it directly from the GIT repository of the version control system. Specifically, the above-mentioned original business code can be stored in different repositories in the above-mentioned GIT repository in the form of source files. Each repository contains a unique URL, and developers can execute "gitclone<repository_url> "Command, the above<repository_url> Replace the "repository_url" in with the URL of the repository where the source file of the original business code is stored, so as to obtain the original business code.
[0060] In an embodiment of the present invention, the business customization requirement instruction includes a business customization requirement plan, and the business customization requirement plan can be a customization requirement of the business party for different products or services. For example, in the field of financial technology, in order for the insurance business system to provide better services to older customer groups who are not familiar with the Internet, developers are required to add insurance risk assessment business (i.e., the business customization requirement plan) to the general business model. The general business model can include traditional insurance model, reinsurance model, self-service insurance model and digital insurance model. The digital insurance model can be added to the insurance risk assessment business according to the business customization requirement instruction. The digital insurance model containing the insurance risk assessment business is the same as the conventional digital insurance model in the main body, but there are still subtle differences in requirements.
[0061] Step S202, performing directional separation processing on the original service code to obtain a general service code block and a personalized service code block.
[0062] In this embodiment, the above-mentioned general business code block may include reusable business function codes, algorithms, verification rules, configuration parameters and other business codes with stable business logic. The above-mentioned personalized business code block is a business code with personalized logic customized according to different companies, groups of people and occasions. The above-mentioned personalized business code block will be affected by market and time changes, and the above-mentioned general business code block will not be affected by market and time changes. The number of the above-mentioned general business code blocks and personalized business code blocks can be multiple or single; the personalized business code block needs to be implemented with the general business code block as the main body, that is, the personalized business code block can be an additional business code block or an extended code block of the general business code block.
[0063] In an embodiment of the present invention, the above-mentioned directional separation processing can be a specific implementation process for separating the general business code block and the personalized business code block in the above-mentioned original business code. Regarding the above-mentioned specific implementation process, this application will provide further detailed descriptions of this in subsequent specific embodiments and will not be elaborated on here.
[0064] Step S203: Perform groovy encoding on the personalized service code block to obtain an executable groovy script.
[0065] In this embodiment, the executable groovy script can be a groovy code file having the same general business logic as the general business code block. Specifically, the groovy can be an agile development language based on JVM (Java Virtual Machine), a dynamic language that can be well combined with Java code and can also be used to expand existing code. The groovy combines many powerful features of Python, Ruby and Smalltalk, and can implement programming operations such as script programming, Web development, and test script writing.
[0066] In this embodiment, the above-mentioned groovy encoding processing can be an operation of converting the above-mentioned general business code block into a groovy script. Regarding the specific implementation process of the above-mentioned groovy encoding processing, this application will provide further detailed descriptions in subsequent specific embodiments, which will not be elaborated here.
[0067] Step S204, based on the business customization requirement instruction, an executable groovy script and a common business code block are selected for configuration combination to obtain a target business interface.
[0068] In this embodiment, the target business interface may include multiple executable groovy scripts. Specifically, one business customization requirement instruction may correspond to one executable groovy script, and the number of business customization requirements may be one or more. When there are multiple business customization requirement instructions, multiple executable groovy scripts need to be configured and combined with the general business code block to form the target business interface.
[0069] In this embodiment, the "selection" in "the above-mentioned business customization requirement-based instructions select executable groovy scripts and general business code blocks for configuration combination" can be selecting a suitable general business code block as the main body through the above-mentioned business customization requirement solution, and then selecting a suitable executable groovy script for configuration combination; the above-mentioned configuration combination can be the process of combining the above-mentioned executable groovy script with the business function code, algorithm, verification rules and configuration parameters in the above-mentioned general business code block. Regarding the specific implementation process of the above-mentioned "the above-mentioned business customization requirement-based instructions select executable groovy scripts and general business code blocks for configuration combination", this application will provide further detailed descriptions in subsequent specific embodiments and will not be elaborated on here.
[0070] This embodiment uses business customization requirement instructions to carry out targeted separation processing on the original business code to obtain a general business code block and a personalized business code block, parses and encapsulates the personalized business code block into an executable groovy script, and then selects the configuration of the executable groovy script according to the business customization requirement instructions. By configuring and combining the executable groovy script with the general business code block, the target business interface is obtained. This embodiment uses the code level to physically isolate the personalized logic in the groovy file, so that the personalized logic will not affect each other or the stable business logic, which not only ensures the stability of the main business, but also supports the development of personalized business, and solves the problem of high integration of personalized business and general business in insurance business, excessive coupling, and excessive redundancy of system code that is not conducive to maintenance.
[0071] In some optional implementations of this embodiment, step S202 includes the following steps:
[0072] Get the business documentation for each business interface;
[0073] Perform text preprocessing on the code comments of the business interface to obtain the comment text features;
[0074] Based on the annotation text features, the business documents are processed by word frequency-inverse document frequency to obtain the weight value of the target business interface;
[0075] If the target service interface weight value is greater than the preset weight threshold, the service interface is marked as a general service interface;
[0076] If the target service interface weight value is less than the preset weight threshold, the service interface is marked as a personalized service interface;
[0077] Separating the general business interface from the original business code to obtain a general business code block, and separating the personalized business interface from the original business code to obtain a personalized business code block;
[0078] In this embodiment, the step of performing word frequency-inverse document frequency processing on the business document based on the annotation text feature to obtain the target business interface weight value specifically includes the following steps:
[0079] Using the annotation text features to perform word frequency-inverse document frequency processing on the business documents of each business interface one by one, and obtain the business interface weight value of each business interface;
[0080] The business interface weight value of each business interface is weighted to obtain the target business interface weight value.
[0081] In this embodiment, the above-mentioned original business code may include multiple business interfaces, and the business interfaces are accompanied by corresponding code comments for recording the functions, code structures, algorithms and usage rules of the current interface; the above-mentioned business documents may be code business documents, and the above-mentioned code business documents may record information related to the software development project, such as system architecture, data flow, module design, usage scenarios, algorithm selection and business functions, etc. Each business interface corresponds to a business document.
[0082] In this embodiment, the text preprocessing can be a text keyword extraction process for the code comments of the business interface. Specifically, the text keyword extraction process can be implemented by semantic algorithms such as TextRank, TF-IDF and WordEmbeddings, and the annotation text features can be keywords obtained by the text keyword extraction process; the separation process of "separating the original business code to obtain the general business code block" can be implemented by interface abstraction, dependency injection and modular programming.
[0083] In this embodiment, the target business interface weight value may represent the commonality of the current business interface in the original business code. The larger the target business interface weight value is, the more common the current business interface is in the original business code. The smaller the target business interface weight value is, the less common the current business interface is in the original business code. The target business interface weight value may be obtained by subjecting the business documents of each business interface to word frequency-inverse document frequency processing using annotation text features, and then weighting the business interface weight values. The preset weight threshold may be a judgment threshold for distinguishing business interface types, and may be manually set by a developer. If the target business interface weight value is greater than the preset weight threshold, the business interface is marked as a common business interface, and one common business interface corresponds to one business interface. If the target business interface weight value is less than the preset weight threshold, the business interface is marked as a personalized business interface, and one personalized business interface corresponds to one personalized business interface.
[0084] In a possible embodiment, taking the insurance business system in the field of financial technology as an example, when it comes to scenarios where business interfaces in the insurance business system need to be separated, the above-mentioned insurance business system includes business interfaces such as policy business, insurance business, claims business, premium calculation and settlement business, risk assessment and management business, and insurance event processing business. In the original business code of the insurance business system, each of the above-mentioned business functions corresponds to a business interface, and each business interface has corresponding business documents and code comments. Taking the insurance policy business as an example, first obtain the code comments of the insurance policy business and perform TextRank processing on them to obtain the keywords of the code comments of the insurance policy business interface. The above keywords can be the specific function name of the insurance policy business, the specific usage scenario of the insurance policy business, the restriction conditions of the insurance policy business and other words (that is, the above annotation text features). Take the above keywords as the main body to perform word frequency-inverse document frequency processing on the business documents corresponding to the above insurance policy business to obtain the frequency of occurrence of the keywords in the business documents corresponding to the above insurance policy business (that is, the business interface weight value). Then take the above keywords as the main body to perform word frequency-inverse document frequency processing on the business documents corresponding to the business interfaces such as insurance business, claims business, premium calculation and settlement business, risk assessment and management business, and insurance event processing business to obtain the frequency of occurrence of the above keywords in the business documents of the above business interfaces. Accumulate the weight values of the above keywords in the business documents of all business functions to obtain the code comments of the above insurance policy business in all business documents in the insurance business system. The importance of the file indirectly indicates the commonality of the above-mentioned insurance policy business in the insurance business system (i.e., the target business interface weight value). Since the personalized business code block needs to be developed in conjunction with the common business code block, the business documents corresponding to all personalized business interfaces must contain keywords of the common business code annotation. The higher the frequency of the keywords (annotation text features) of the code annotation of a business interface in the business documents corresponding to other business interfaces, the more common the business interface is for this system (original business code); if the importance of the insurance policy business in the insurance business system exceeds the weight threshold preset by the developer, the insurance policy business is judged to be a common business interface; if the importance of the insurance policy business in the insurance business system is lower than the weight threshold preset by the developer, the insurance policy business is judged to be a common personalized business interface. The insurance policy business is separated from the insurance business system according to the business interface type of the insurance policy business, thereby obtaining a common business code block or a personalized business code block, and saving it in the code source file of the corresponding code type.
[0085] This embodiment obtains the target service interface weight value through code annotation to perform directional separation of the original service code, thereby effectively improving the accuracy and efficiency of separation of personalized service code and general service code in the original service code.
[0086] In some optional implementations of this embodiment, the above step S203 specifically includes:
[0087] Perform abstract syntax tree generation processing based on personalized business code blocks to obtain an abstract syntax tree of personalized business logic;
[0088] Traverse and parse the abstract syntax tree of personalized business logic to obtain the target personalized business logic;
[0089] Perform groovy coding based on the target personalized business logic to obtain a groovy code block;
[0090] Encapsulate the groovy code block into a groovy file to obtain an executable groovy script.
[0091] In this embodiment, the personalized business logic may be the underlying code logic of the personalized business interface in the original business code; the abstract syntax tree (AST) is a tree-like data structure in programming language processing, which is used to represent the abstract structure of the source code. The abstract syntax tree can capture the grammatical structure in the code and remove the grammatical details, and represent the code in a more abstract and easy-to-process form. The abstract syntax tree can be generated by lexical analysis and grammatical analysis. Specifically, the task of the lexical analysis is to convert the source code into a sequence of tokens. Each token represents a basic grammatical unit in the source code, such as a keyword, an operator, an identifier, a constant, etc. The source code can be scanned and decomposed into a series of tokens using methods such as regular expressions or finite automata. The task of the grammatical analysis is to interpret the structure of the source code using grammatical rules based on the tokens obtained by the lexical analysis to form an abstract syntax tree.
[0092] In this embodiment, the encoding process may be a process of coding the personalized business logic in the groovy code format to obtain the groovy code block, and the groovy code block may be a set of groovy code sequences storing the personalized business logic. The encapsulation of the groovy code block into a groovy file may be to save the groovy code block into the groovy file to form an executable groovy script.
[0093] In a possible embodiment, in the field of financial technology, for an insurance business system, when it comes to the situation where business developers need to isolate the life insurance business code block (i.e., the above-mentioned personalized business code block) of the insurance business system into a groovy file, since the code format constituting the life insurance business code block may be a code in a non-groovy format, it is necessary to first analyze the personalized code logic of the life insurance business code block, first input the above-mentioned life insurance business code block into a lexical analyzer, use methods such as regular expressions or finite automata, scan the life insurance business code block, decompose it into a series of tokens, and input the above-mentioned tokens into a syntax analyzer according to BN The F grammar rule creates nodes of an abstract syntax tree, wherein each node represents a grammatical structure in the source code, and an abstract syntax tree of a life insurance business code block is obtained; after obtaining the abstract syntax tree, depth-first traversal and breadth-first traversal are performed through code analysis tools such as ANTLR, Tree-sitter and ESLint to obtain the business logic of the life insurance business (i.e., the above-mentioned target personalized business logic), the business logic of the life insurance business is written into groovy code through a groovy compiler to obtain the above-mentioned groovy code block, the above-mentioned groovy code block is stored in a groovy file, and an executable groovy script is obtained.
[0094] This embodiment parses personalized business code blocks through an abstract syntax tree to obtain personalized business code logic, which can improve the accuracy, efficiency and maintainability of code analysis, promote the improvement of code quality, and support the development of many code-related automation tools.
[0095] In some optional implementations of this embodiment, step S204 includes the following steps:
[0096] The executable groovy script is configured according to the business customization requirement solution to obtain an initial executable script;
[0097] The common business code block is selected through the business customization requirement solution, and combined with the initial executable script through the groovy engine to obtain the target business interface.
[0098] In some optional implementations of this embodiment, the step of configuring the executable groovy script through the business customization requirement solution to obtain the initial executable script specifically includes:
[0099] Determine the configurable service components based on the business customization requirements;
[0100] Deploy the configured service component in the executable groovy script to obtain the initial executable script.
[0101] In an embodiment of the present invention, the groovy engine can be the operating environment and execution engine for executing the initial executable script, and can realize the real-time compilation and execution processing operations of the initial executable script; the configured service component can be a sending mq component, a reading apollo configuration component, a reading and writing redis component, and a circuit breaker and current limiting component, and can also call other services in other clusters through the microservice framework rpc. Specifically, the selection of the configured service component needs to select the configured service component according to the business customization requirement plan, and deploy the selected configured service component in the executable groovy script. An executable groovy script can have multiple configured service components.
[0102] In this embodiment, the initial executable script may be a single executable groovy script or a collection of multiple executable groovy scripts. Specifically, the required executable groovy script is determined according to the business customization requirements. If the number of the required executable groovy scripts is single, the executable groovy script is directly determined as the initial executable script. If the number of the required executable groovy scripts is 2 or more, the multiple executable groovy scripts are connected to form an executable groovy script sequence, and the executable groovy script sequence is determined as the initial executable script.
[0103] In a possible embodiment, in the field of financial technology, in order to achieve the business requirement of improving the reading and writing speed of policy information entry in the insurance claims business without affecting the stable business, the developer can deploy the read and write redis component on the policy business executable groovy script, and combine it with the business interface of the above-mentioned insurance claims business to achieve a significant increase in the reading and writing speed of policy information entry. In order to select the executable groovy script and the general business code block for configuration combination based on the business customization requirement instruction, the developer can import the code source file containing the general business code block as the main file into the configuration management tool, and then drag and drop the configured executable groovy script into the configuration management tool through the visual insurance business generation interface. The executable groovy script can also be directly generated by programming in the configuration management tool, and the executable groovy script and the general business code block are configured and combined through the configuration management tool to obtain the target business interface. The configuration through the visual insurance business generation interface can enable the developer to dynamically configure the system directly without easily changing the stable business logic, thereby simplifying the development difficulty.
[0104] This embodiment determines the configurable service components through the business customization demand solution, which can realize the free selection of corresponding components according to the actual situation, and can respond to business changes and demand adjustments more quickly. It can also simplify the work of developers while providing a high degree of flexibility and customization.
[0105] In some optional implementations of this embodiment, after step S204, the electronic device may further perform the following steps:
[0106] Get the URL address of the target business interface and business request parameters;
[0107] Perform parameter conversion on the business request parameters to obtain target business parameters;
[0108] Specify the target service parameters in the URL address and return the request result.
[0109] In this embodiment, the above-mentioned service request parameters may be parameters required for the above-mentioned target personalized service when the service is connected with the client end system, and the above-mentioned parameter conversion process may be a process of converting one or more parameters from one data type, format or unit to another data type, format or unit. Specifically, for example, in the field of financial technology, there are insurance business parameters such as insured parameters, beneficiary parameters and insurance company parameters in the process of insurance business connection. However, there is a situation where the insurance business parameter settings of non-financial insurance companies and financial insurance companies are not unified. For example, in non-financial insurance companies, the insurance business parameters only have policyholder parameters and insured parameters, and the parameter structure of the above-mentioned insurance business parameters is more than one layer, while in financial insurance companies, the insurance business parameters have policyholder parameters, insured parameters and beneficiary parameters, and the information of the insurance company has only one layer. For such cases, it is necessary to convert the parameter format of the business interface of the non-financial insurance company to obtain the target business parameters with the same parameter format as the business interface of the financial insurance company.
[0110] In this embodiment, the above URL address can be configured with directory path processing, and the above target business interface can be set as the directory path name. Specifically, for the synchronous request interface, the above target executable script can be configured as a first-level directory, and the subsequent directory can be configured with multiple executable groovy scripts. Specifically, for example, in the field of financial technology, the insurance company's insurance business interface (i.e., target business interface) is https: / / www.xx.com.cn / Bytedance / applyPolicy, and the first-level directory of the interface is Bytedance. There are three transactions under the first-level directory: insurance-applyPolicy, payment-getPayUrl, and underwriting-underwrite. At the code level, the above target executable script is used as an interface to point to the above https: / / www.xx.com.cn / Bytedance, and the three executable groovy scripts are used as interfaces to point to insurance-applyPolicy, payment-getPayUrl, and underwriting-underwrite, respectively, to obtain the URL address, which can be used as the request URL address and the response URL address.
[0111] In a possible embodiment, the above-mentioned return request result may include monitoring verification and underwriting verification. Specifically, the above-mentioned monitoring verification may be the connection status, business data and log data returned by the above-mentioned target business interface.
[0112] This embodiment performs parameter conversion processing on the service request parameters to obtain target service parameters, and can extract the parameter conversion logic from the service logic, thereby making the service logic clearer and reducing the coupling between various modules.
[0113] It should be emphasized that in order to further ensure the privacy and security of the above-mentioned original business code, the above-mentioned original business code can also be stored in a node of a blockchain.
[0114] The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0115] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through computer-readable instructions, and the computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0116] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0117] Further references Figure 3 , as a response to the above Figure 2 The present application provides an embodiment of a business code development device, and the device embodiment is similar to Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0118] like Figure 3 As shown, the service code development device 300 described in this embodiment includes: an acquisition module 301, a separation module 302, a processing module 303, a combination module 304 and a processing module 305. Among them:
[0119] The acquisition module 301 is used to obtain the original business code and business customization requirement instructions;
[0120] A separation module 302 is used to perform directional separation processing on the original service code to obtain a general service code block and a personalized service code block;
[0121] The processing module 303 is used to perform groovy coding on the personalized service code block to obtain an executable groovy script;
[0122] A combination module 304 is used to select the executable groovy script and the general business code block for configuration combination based on the business customization requirement instruction to obtain a target business interface;
[0123] This embodiment uses business customization requirement instructions to carry out targeted separation processing on the original business code to obtain a general business code block and a personalized business code block, parses and encapsulates the personalized business code block into an executable groovy script, and then selects the configuration of the executable groovy script according to the business customization requirement instructions. By configuring and combining the executable groovy script with the general business code block, the target business interface is obtained. This embodiment uses the code level to physically isolate the personalized logic in the groovy file, so that the personalized logic will not affect each other or the stable business logic, which not only ensures the stability of the main business, but also supports the development of personalized business, and solves the problem of high integration of personalized business and general business in insurance business, excessive coupling, and excessive redundancy of system code that is not conducive to maintenance.
[0124] In some optional implementations of this embodiment, the separation module 302 includes: a first acquisition submodule, a first processing submodule, a second processing submodule, a first marking submodule, a second marking submodule and a separation submodule, wherein:
[0125] The first acquisition submodule is used to acquire the business document of each business interface;
[0126] A first processing submodule is used to perform text preprocessing on the code annotations of the business interface to obtain annotation text features;
[0127] A second processing submodule is used to perform word frequency-inverse document frequency processing on the business document based on the annotation text feature to obtain a target business interface weight value;
[0128] A first marking submodule, configured to mark the service interface as a general service interface if the target service interface weight value is greater than a preset weight threshold;
[0129] A second marking submodule, configured to mark the service interface as a personalized service interface if the target service interface weight value is less than a preset weight threshold;
[0130] The separation submodule is used to separate the general service interface from the original service code to obtain the general service code block, and to separate the personalized service interface from the original service code to obtain the personalized service code block.
[0131] This embodiment obtains the target service interface weight value through code annotation to perform directional separation of the original service code, thereby effectively improving the accuracy and efficiency of separation of personalized service code and general service code in the original service code.
[0132] In some optional implementations of this embodiment, the second processing submodule includes: a first processing unit and a second processing unit, wherein:
[0133] A first processing unit is used to perform the word frequency-inverse document frequency processing on the business documents of each business interface one by one using the annotation text feature to obtain a business interface weight value of each business interface;
[0134] The second processing unit is used to perform weighted processing on the service interface weight value of each service interface to obtain the target service interface weight value.
[0135] This embodiment obtains the target service interface weight value through code annotation to perform directional separation of the original service code, thereby effectively improving the accuracy and efficiency of separation of personalized service code and general service code in the original service code.
[0136] In some optional implementations of this embodiment, the processing module 303 includes: a generation submodule, a traversal and parsing submodule, an encoding submodule, and an encapsulation submodule, wherein:
[0137] A generating submodule, used for performing an abstract syntax tree generation process based on the personalized service code block to obtain an abstract syntax tree of the personalized service logic;
[0138] A traversal parsing submodule, used to traverse and parse the abstract syntax tree of the personalized business logic to obtain the target personalized business logic;
[0139] The encoding submodule is used to perform groovy encoding processing based on the target personalized business logic to obtain a groovy code block;
[0140] The encapsulation submodule is used to encapsulate the groovy code block into a groovy file to obtain the executable groovy script.
[0141] This embodiment parses personalized business code blocks through an abstract syntax tree to obtain personalized business code logic, which can improve the accuracy, efficiency and maintainability of code analysis, promote the improvement of code quality, and support the development of many code-related automation tools.
[0142] In some optional implementations of this embodiment, the above-mentioned combination module 304 includes: a configuration submodule and a combination submodule, wherein:
[0143] A configuration submodule, configured to configure the executable groovy script according to the business customization requirement solution to obtain an initial executable script;
[0144] The combining submodule is used to select the general business code block according to the business customization requirement solution, and combine it with the initial executable script through the groovy engine to obtain the target business interface.
[0145] This embodiment determines the configurable service components through the business customization demand solution, which can realize the free selection of corresponding components according to actual conditions, can respond to business changes and demand adjustments more quickly, and provides a high degree of flexibility and customization.
[0146] In some optional implementations of this embodiment, the configuration submodule includes: a configuration unit and a processing unit, wherein:
[0147] A configuration unit, configured to determine a configurable service component based on the business customization requirement solution;
[0148] The deployment unit is used to deploy the configured service component in the executable groovy script to obtain the initial executable script.
[0149] This embodiment determines the configurable service components through the business customization demand solution, which can realize the free selection of corresponding components according to actual conditions, can respond to business changes and demand adjustments more quickly, and provides a high degree of flexibility and customization.
[0150] In some optional implementations of this embodiment, the above further includes after the combining module 304: a second acquiring module, a parameter converting module and a specifying module, wherein:
[0151] The second acquisition module is used to obtain the URL address and service request parameters of the target service interface;
[0152] A parameter conversion module, used to perform parameter conversion processing on the service request parameters to obtain target service parameters;
[0153] The specifying module is used to specify the target business parameters to the URL address and return the request result.
[0154] This embodiment performs parameter conversion processing on the service request parameters to obtain target service parameters, and can extract the parameter conversion logic from the service logic, thereby making the service logic clearer and reducing the coupling between various modules.
[0155] To solve the above technical problems, the present application also provides a computer device. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.
[0156] The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are interconnected through a system bus. It should be noted that the figure only shows a computer device 4 with components 41-43, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.
[0157] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.
[0158] The memory 41 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 41 can be an internal storage unit of the computer device 4, such as a hard disk or memory of the computer device 4. In other embodiments, the memory 41 can also be an external storage device of the computer device 4, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), etc. equipped on the computer device 4. Of course, the memory 41 can also include both the internal storage unit of the computer device 4 and its external storage device. In this embodiment, the memory 41 is generally used to store the operating system and various application software installed on the computer device 4, such as computer-readable instructions of the business code development method, etc. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or are to be output.
[0159] The processor 42 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip in some embodiments. The processor 42 is generally used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to run computer-readable instructions stored in the memory 41 or process data, such as computer-readable instructions for running the business code development method.
[0160] The network interface 43 may include a wireless network interface or a wired network interface. The network interface 43 is generally used to establish a communication connection between the computer device 4 and other electronic devices.
[0161] The present application discloses a computer device, which uses business customization requirement instructions to carry out directional separation processing on original business codes to obtain general business code blocks and personalized business code blocks, parses and encapsulates the personalized business code blocks into executable groovy scripts, and then selects the configuration of the executable groovy script according to the business customization requirement instructions, and obtains the target business interface by configuring and combining the executable groovy script with the general business code block. This embodiment uses the code level to physically isolate the personalized logic in the groovy file, so that the personalized logic will not affect each other or the stable business logic, which not only ensures the stability of the main business, but also supports the development of personalized business, and solves the problem that personalized business and general business in insurance business are highly integrated, the coupling is too high, and the system code is too redundant and not conducive to maintenance.
[0162] The present application also provides another implementation, namely, providing a computer-readable storage medium, wherein the computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the business code development method as described above.
[0163] The present application discloses a computer-readable storage medium, which uses business customization requirement instructions to carry out directional separation processing on original business codes to obtain general business code blocks and personalized business code blocks, parses and encapsulates the personalized business code blocks into executable groovy scripts, and then selects the configuration of the executable groovy script according to the business customization requirement instructions, and obtains the target business interface by configuring and combining the executable groovy script with the general business code block. This embodiment uses the code level to physically isolate the personalized logic in the groovy file, so that the personalized logic will not affect each other or the stable business logic, which not only ensures the stability of the main business, but also supports the development of personalized business, and solves the problem that personalized business and general business in insurance business are highly integrated, the coupling is too high, and the system code is too redundant and not conducive to maintenance.
[0164] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0165] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.
Claims
1. A business code development method, characterized in that: The steps include: Obtain original business code and business customization requirement instructions; Directed separation processing is performed on the original service code to obtain a general service code block and a personalized service code block; Performing groovy coding on the personalized service code block to obtain an executable groovy script; Based on the business customization requirement instruction, the executable groovy script and the general business code block are selected for configuration combination to obtain a target business interface.
2. The business code development method according to claim 1, characterized in that: The original service code includes a plurality of service interfaces, each service interface has a corresponding code annotation, and the step of performing directional separation processing on the original service code to obtain a general service code block and a personalized service code block specifically includes: Get the business documentation for each business interface; Performing text preprocessing on the code comments of the business interface to obtain comment text features; Performing word frequency-inverse document frequency processing on the business document based on the annotation text features to obtain a target business interface weight value; If the target service interface weight value is greater than a preset weight threshold, the service interface is marked as a general service interface; If the target service interface weight value is less than a preset weight threshold, the service interface is marked as a personalized service interface; The universal service interface is separated from the original service code to obtain the universal service code block, and the personalized service interface is separated from the original service code to obtain the personalized service code block.
3. The business code development method according to claim 2, characterized in that: The step of performing word frequency-inverse document frequency processing on the business document based on the annotation text feature to obtain the target business interface weight value specifically includes: Using the annotation text feature to perform the word frequency-inverse document frequency processing on the business documents of each business interface one by one, to obtain a business interface weight value of each business interface; The service interface weight value of each service interface is weighted to obtain the target service interface weight value.
4. The business code development method according to claim 1, characterized in that: The step of performing groovy encoding processing on the personalized service code block to obtain an executable groovy script specifically includes: Performing an abstract syntax tree generation process based on the personalized service code block to obtain an abstract syntax tree of the personalized service logic; Traversing and parsing the abstract syntax tree of the personalized business logic to obtain the target personalized business logic; Perform groovy coding processing based on the target personalized business logic to obtain a groovy code block; The groovy code block is encapsulated into a groovy file to obtain the executable groovy script.
5. The business code development method according to claim 1, characterized in that: The business customization requirement instruction includes a business customization requirement solution, and the step of selecting the executable groovy script and the general business code block based on the business customization requirement instruction for configuration combination to obtain the target business interface specifically includes: Configuring the executable groovy script according to the business customization requirement solution to obtain an initial executable script; The general business code block is selected through the business customization requirement solution, and is combined with the initial executable script through the groovy engine to obtain the target business interface.
6. The business code development method according to claim 5, characterized in that: The step of configuring the executable groovy script through the business customization requirement solution to obtain an initial executable script specifically includes: Determine the configurable service components based on the business customization requirement solution; The configured service component is deployed in the executable groovy script to obtain the initial executable script.
7. The business code development method according to claim 1, characterized in that: After the step of selecting the executable groovy script and the general business code block based on the business customization requirement instruction to configure and combine to obtain the target business interface, the step further includes: Obtain the URL address and service request parameters of the target service interface; Performing parameter conversion processing on the service request parameters to obtain target service parameters; The target service parameters are assigned to the URL address, and the request result is returned.
8. A business code development device, characterized in that: include: The acquisition module is used to obtain the original business code and business customization requirement instructions; A separation module, used for performing directional separation processing on the original service code to obtain a general service code block and a personalized service code block; A processing module, used for performing groovy coding processing on the personalized service code block to obtain an executable groovy script; The combination module is used to select the executable groovy script and the general business code block for configuration combination based on the business customization requirement instruction to obtain the target business interface.
9. A computer device, characterized in that: It includes a memory and a processor, wherein the memory stores computer-readable instructions, and when the processor executes the computer-readable instructions, the steps of the business code development method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the business code development method according to any one of claims 1 to 7.
Citation Information
Cited By
Fault monitoring code generation method and device, medium and program product
CN121680835A
