Service code generation method and device under SOA architecture, equipment and storage medium
By providing service code generation methods under the SOA architecture, the problems of data loss, lagging updates, restricted collaboration, and lack of permissions in SOA service management are solved, and efficient and secure service code generation and management are achieved, improving development efficiency and Security.
Patent Information
- Application Number
- CN202411032817.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-11-08
AI Technical Summary
With the increasing number of automotive communication signals, existing SOA service management has problems such as data loss, untimely update, inability to modify multiple people at the same time, missing permission control, chaotic version control, inability to remote access, and inability to automatically generate code, resulting in development Inefficient.
Provide a method for generating service code under the SOA architecture. By obtaining user-triggered service code generation requests, displaying service lists and code template lists based on the interactive interface, detecting user permissions and generating service codes, ensuring data security and accuracy, and supporting Multi-user and permission management.
It improves the efficiency and accuracy of code generation, reduces the human coding error rate, improves the efficiency and security of service information management, and supports the flexibility of one-click operation and template management.
Smart Images

Figure CN118916010A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device, equipment and storage medium for generating service codes under a SOA architecture. Background Art
[0002] With the intelligentization of automobiles and the popularization of Ethernet, the number of automobile communication signals has increased, and SOA architecture has been widely adopted. However, the current SOA service management, including the traditional CAN matrix management method, generally uses tables to record key information, which has problems such as data loss, untimely updates, inability to modify by multiple people at the same time, lack of permission control, chaotic version control, inability to access remotely, inability to automatically generate code, and inability to ensure security.
[0003] In addition, it is impossible to achieve functions such as uploading and downloading service information with one click and automatically generating code. R&D personnel need to spend a lot of time manually organizing information, and face time-consuming, error-prone, and difficult traceability problems when modifying and merging. With the increase in signals and services and the increase in developers, traditional management methods have seriously restricted the efficiency of automotive software development. Existing patents and solutions have failed to solve these problems, nor have they provided functions such as cloud-based massive service management, automatic code generation in the template background, multi-user and permission management, etc. Summary of the invention
[0004] In view of this, the embodiments of the present invention provide a method, device, equipment and storage medium for generating service code under the SOA architecture to solve the problems of data loss, delayed update, limited collaboration, lack of permissions, version confusion, difficult code generation and lack of one-key operation in SOA service management.
[0005] In a first aspect, an embodiment of the present invention provides a method for generating service code under a SOA architecture, the method comprising:
[0006] Get the service code generation request triggered by the user;
[0007] In response to the service code generation request, a service list and a code template list are displayed based on an interactive interface, wherein the service list and the code template list are configured by the user according to the configuration authority possessed by the user, the service list includes a plurality of pre-configured service information, and the code template list includes a plurality of pre-configured template files;
[0008] Detecting a selection operation on the service list and the code template list in the interactive interface, and determining target service information and target template file according to the selection operation;
[0009] The target service information is used to replace the preset variables in the target template file to generate a corresponding service code.
[0010] In an optional implementation of the present application, before displaying the service list and the code template list based on the interactive interface, the method further includes:
[0011] Receiving a first query request from a user for service information under the SOA architecture;
[0012] Responding to the first query request, and detecting whether the user has a first query authority for service information;
[0013] If the user has the first query authority, loading the service list into the configuration interface;
[0014] A processing request of a user for the service list on the configuration interface is detected, and a processing operation is performed on the service list based on the processing request.
[0015] In an optional implementation manner of the present application, performing a processing operation on the service list based on the processing request includes:
[0016] When the processing request is a first upload request, detecting whether the user has a first upload authority for the service information;
[0017] If the user has the first upload authority, loading the preset data table to the configuration interface;
[0018] Acquire candidate service information input by the user in a preset data table of the configuration interface;
[0019] The service list is updated based on the candidate service information to obtain an updated service list.
[0020] In an optional implementation manner of the present application, performing a processing operation on the service list based on the processing request includes:
[0021] When the processing request is a deletion request, detecting whether the user has the authority to delete the service information;
[0022] If the user has the deletion permission, the service information to be deleted selected by the user on the service list of the configuration interface is obtained, and whether the service information to be deleted matches the deletion permission is detected;
[0023] If the service information to be deleted matches the deletion permission, a corresponding deletion operation is performed on the service information to be deleted, and corresponding deletion reminder information is generated; or, if the service information to be deleted does not match the deletion permission, a command prompt information is sent, and the command input by the user is obtained according to the command prompt information; if the command matches the preset command corresponding to the service information to be deleted, a corresponding deletion operation is performed on the service information to be deleted.
[0024] In an optional implementation manner of the present application, performing a processing operation on the service list based on the processing request includes:
[0025] When the processing request is a modification request, detecting whether the user has the modification authority of the service information;
[0026] If the user has the modification authority, the service information to be modified selected by the user in the service list of the configuration interface is obtained;
[0027] Loading the service information to be modified into the editing page, and obtaining the updated service information submitted by the user on the configuration interface;
[0028] The service list is updated using the updated service information, and corresponding modification reminder information is generated.
[0029] In an optional implementation of the present application, before displaying the service list and the code template list based on the configuration interface, the method further includes:
[0030] Receiving a second query request from a user for a service code template under the SOA architecture;
[0031] Responding to the second query request, and detecting whether the user has a second query permission for the code template list;
[0032] If the user has the second query authority, loading the code template list into the configuration interface;
[0033] The template files in the code template list are filtered in the configuration interface according to preset filtering conditions to obtain filtering results, and the filtering results are loaded into the configuration interface.
[0034] In an optional embodiment of the present application, the method further includes:
[0035] Receiving a second upload request from a user for a service code template under the SOA architecture;
[0036] Responding to the second upload request, and detecting whether the user has a second upload permission for the code template list;
[0037] If the user has the second upload authority, receiving the candidate template file input by the user;
[0038] Compare the file name of the candidate template file with the pre-stored name in the code template list;
[0039] If the file name is consistent with the pre-stored name, the template file corresponding to the pre-stored name is replaced with the candidate template file, and corresponding replacement reminder information is generated; or, if the file name is inconsistent with the pre-stored name, the candidate template file is stored in the code template list.
[0040] In a second aspect, an embodiment of the present invention provides a device for generating service code under a SOA architecture, the device comprising:
[0041] An acquisition module is used to obtain a service code generation request triggered by a user;
[0042] A response module, used to respond to the service code generation request, and display a service list and a code template list based on an interactive interface, wherein the service list and the code template list are configured by the user according to the configuration authority he has, the service list includes a plurality of pre-configured service information, and the code template list includes a plurality of pre-configured template files;
[0043] A detection module, used to detect a selection operation acting on the service list and the code template list in the interactive interface, and determine target service information and target template file according to the selection operation;
[0044] A generation module is used to replace the preset variables in the target template file with the target service information to generate corresponding service codes.
[0045] In a third aspect, an embodiment of the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0046] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the method of the first aspect or any corresponding embodiment thereof.
[0047] The method provided in the embodiment of the present application has the following beneficial effects:
[0048] The method provided in the embodiment of the present application obtains the service code generation request triggered by the user, and displays the service list and code template list based on the interactive interface, so that the user can conveniently select the required service and template. The preset variables in the target template file are replaced with the target service information to automatically generate the corresponding service code, which significantly improves the efficiency and accuracy of code generation and reduces the error rate of manual coding.
[0049] The method provided in the embodiment of the present application ensures the security of data through permission detection when the user queries the service information under the SOA architecture. If the user has the query permission, the service list is loaded to the configuration interface so that the user can easily view and process the service information. This process helps to improve the management efficiency and security of service information. When the user uploads the candidate service information, it is ensured that only users with upload permission can add new service information through permission detection and loading of the preset data table. This helps to maintain the accuracy and update of the service list, while preventing unauthorized data modification. When the user requests to delete the service information, it is ensured that only users with deletion permission can perform the deletion operation through permission detection and matching check between the service information to be deleted and the deletion permission. This helps to prevent accidental deletion and unauthorized data modification and improve the security of service information management. When the user requests to modify the service information, the user can easily update the service information through permission detection and loading of the service information to be modified. The service list is updated by updating the service information, and the modification reminder information is generated, which helps to maintain the accuracy and timeliness of the service information.
[0050] The method provided in the embodiment of the present application ensures the security of data through permission detection when the user queries the service code template under the SOA architecture. If the user has the query permission, the code template list is loaded to the configuration interface, and is filtered according to the preset filtering conditions, so that the user can easily view and process the template files that meet the requirements. This process helps to improve the management efficiency and ease of use of code templates. When the user uploads the candidate template file, the permission detection and the comparison of the file name are used to ensure that only users with upload permissions can add or replace the template file. This helps to maintain the accuracy and updateability of the code template list, while preventing unauthorized data modification. If the file name is consistent, the template file corresponding to the pre-stored name is replaced, and a replacement reminder message is generated; if it is inconsistent, the new template file is stored in the code template list, which increases the flexibility and convenience of template management. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0052] Figure 1 It is a flowchart of a method for generating service code under the SOA architecture according to an embodiment of the present invention;
[0053] Figure 2It is a structural diagram of a system for generating service codes under a SOA architecture according to an embodiment of the present invention;
[0054] Figure 3 is a schematic diagram of a process of user account application and login according to an embodiment of the present invention;
[0055] Figure 4 is a schematic diagram of the process of batch importing SOA service information according to an embodiment of the present invention;
[0056] Figure 5 is a flowchart of SOA service information processing according to an embodiment of the present invention;
[0057] Figure 6 is a flowchart of SOA code template processing according to an embodiment of the present invention;
[0058] Figure 7 is a schematic diagram of a process of generating SOA service code according to an embodiment of the present invention;
[0059] Figure 8 is a structural block diagram of a device for generating service code under a SOA architecture according to an embodiment of the present invention;
[0060] Fig. 9 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0061] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0062] According to an embodiment of the present invention, a method, apparatus, device and storage medium for generating service code under a SOA architecture are provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0063] In this embodiment, a method for generating service code under SOA architecture is provided. Figure 1 is a flow chart of a method for generating service code under a SOA architecture according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0064] Step S11, obtaining a service code generation request triggered by a user.
[0065] In an embodiment of the present application, the initial step of the service code generation process is to obtain a service code generation request triggered by a user through a WEB front-end interface. This request is initiated by the user, and is triggered by clicking a "Generate Code" button or a similar operation on the interface after the user logs in to the system and has the corresponding permissions. When the user triggers this request, the system backend receives the request and prepares for subsequent service code generation operations. This request is that the user wishes to generate the corresponding code file based on the selected SOA service and code template for subsequent compilation and integration.
[0066] Step S12, in response to the service code generation request, a service list and a code template list are displayed based on the interactive interface, wherein the service list and the code template list are configured by the user according to the configuration permissions he has, the service list includes multiple pre-configured service information, and the code template list includes multiple pre-configured template files.
[0067] In an embodiment of the present application, when a user initiates a request for service code generation through an interactive interface (such as a WEB front-end page), the corresponding service list and code template list are displayed based on the user's configuration permissions. Among them, the service list includes multiple pre-configured service information, which are SOA services that the user has defined and configured in the system. The code template list contains multiple pre-configured template files, which are prepared by the user to generate service codes. These lists are filtered and displayed according to the user's permissions to ensure that users can only see the services and templates they have permission to access and operate. After displaying these lists, users can make selections on the interactive interface, such as selecting specific services and templates to generate code.
[0068] Step S13, detecting a selection operation on the service list and the code template list in the interactive interface, and determining target service information and target template file according to the selection operation.
[0069] In the embodiment of the present application, the user will select the target service information in the service list and the target template file in the code template list according to his / her needs. After the system detects the user's selection operation, it determines the target service information and target template file selected by the user according to these operations, and then proceeds to the next step, that is, using the target service information to replace the preset variables in the target template file, thereby generating the corresponding service code.
[0070] Step S14, using the target service information to replace the preset variables in the target template file to generate a corresponding service code.
[0071] In an embodiment of the present application, the target service information selected by the user on the interactive interface is used to replace the preset variables in the target template file. The preset variables are marked in a specific format in the template file, such as {--(variable name)--} or other customized formats, which represent placeholders that need to be replaced with specific service information when generating code. According to the code generation rules specified in the template, all preset variables in the target template file are traversed and replaced one by one with the corresponding target service information. This information may include specific SOA service detailed information such as service name, method name, parameter type, return value, etc. After the replacement is completed, a code file containing the actual service information is generated.
[0072] In the embodiment of the present application, before displaying the service list and the code template list based on the interactive interface, the following steps S21-S24 are included:
[0073] Step S21, receiving a first query request from a user for service information under the SOA architecture.
[0074] In an embodiment of the present application, an initial link for a user to interact with the system is to receive a first query request for service information under the SOA architecture from the user. This request occurs when the user logs into the system and wants to view or operate the SOA service list. The user can trigger this query request by clicking a button or link on the interface. After receiving the request, subsequent processing can be prepared, including verifying the user's query authority, loading the service list, etc.
[0075] Step S22, responding to the first query request, and detecting whether the user has the first query authority for service information.
[0076] In an embodiment of the present application, when responding to the first query request, the user's identity and authority are checked, that is, whether the user is granted the authority to query SOA service information. Verification may include user accounts, roles, groups to which they belong, or specific authority settings. If the user passes the verification, that is, has the query authority, the request is processed and the SOA service list is loaded. If the verification fails, that is, there is no query authority, the request is rejected and an error message is displayed, prompting the user that the authority is insufficient.
[0077] Step S23: if the user has the first query authority, the service list is loaded into the configuration interface.
[0078] In an embodiment of the present application, the backend service is accessed to retrieve the information of the SOA service list from a database (such as MySQL) or a cache (such as REDIS). The information of the SOA service list may include key fields such as the name, description, domain, service ID, method name, parameter type, and return value type of the service. After retrieving this information, it is packaged in an appropriate format (such as JSON) and returned to the front end via an HTTP response. After receiving the response, the front end will parse the JSON data and display the SOA service list on the configuration interface. Users can browse, search, and select the SOA services that they are interested in or need to operate.
[0079] Step S24, detecting a processing request of the user for the service list in the configuration interface, and performing a processing operation on the service list based on the processing request.
[0080] Specifically, the corresponding processing logic is executed according to different user requests (upload, delete, modify, etc.). Specifically, when a user issues an upload request, the upload permission is checked. If the user has permission, the user is allowed to enter the service information and submit, and then the service list is updated. For a delete request, the delete permission is checked. If the permission matches, the delete operation is performed and a reminder is given. If the permission does not match, the user is required to enter a password for verification. For a modification request, the modification permission is checked. If the user has permission, the user is allowed to edit the service information and submit, and then the service list is updated and a reminder is given.
[0081] In an embodiment of the present application, a processing operation is performed on a service list based on a processing request, including: when the processing request is a first upload request, detecting whether the user has the first upload permission for the service information; if the user has the first upload permission, loading a preset data table to a configuration interface; obtaining candidate service information input by the user in the preset data table of the configuration interface; and updating the service list based on the candidate service information to obtain an updated service list.
[0082] Specifically, the user initiates the first upload request through the WEB front end, hoping to add SOA service information to the service list in batches. First, the user's upload permission is verified through the permission management module, and after passing, the preset data table (such as an EXCEL template) is loaded to the front-end configuration interface. After the user fills in and submits the SOA service information, the information is parsed and saved to the database, and the cache (such as REDIS) is updated at the same time. Finally, an updated service list containing the newly added SOA service information of the user is obtained.
[0083] In an embodiment of the present application, a processing operation is performed on a service list based on a processing request, including: when the processing request is a deletion request, detecting whether the user has the authority to delete the service information; if the user has the authority to delete, obtaining the service information to be deleted that the user has checked on the service list of the configuration interface, and detecting whether the service information to be deleted matches the deletion authority; if the service information to be deleted matches the deletion authority, performing a corresponding deletion operation on the service information to be deleted, and generating a corresponding deletion reminder message; or, if the service information to be deleted does not match the deletion authority, sending a secret command prompt message, and obtaining a secret command input by the user according to the secret command prompt message, and if the secret command matches the preset secret command corresponding to the service information to be deleted, performing a corresponding deletion operation on the service information to be deleted.
[0084] Specifically, before a user initiates a deletion request, the permission management module first verifies whether the user has the permission to delete SOA service information. If the verification is successful, the service information to be deleted selected by the user on the WEB front end is obtained, and the information is checked to see if it matches the user's deletion permission. If it matches, the deletion operation is performed and a reminder message is generated. If it does not match, the user is required to enter a specific password for verification, and the deletion operation is performed only after the password matches.
[0085] In an embodiment of the present application, a processing operation is performed on a service list based on a processing request, including: when the processing request is a modification request, detecting whether the user has modification authority for the service information; if the user has modification authority, obtaining the service information to be modified that the user has checked on the service list on the configuration interface; loading the service information to be modified onto the editing page, and obtaining the updated service information submitted by the user on the configuration interface; updating the service list using the updated service information, and generating corresponding modification reminder information.
[0086] Specifically, first, the permission management module is used to detect whether the user has the permission to modify the service information. If the user has the permission, the service information to be modified that the user has checked on the configuration interface is obtained. Subsequently, the information to be modified is loaded into the editing page for the user to edit and update. After the user completes the modification, the updated service information submitted by the user is obtained, and the pre-stored service list is updated with this information. Finally, a modification reminder message is generated to inform the user that the modification operation has been successfully executed.
[0087] In the embodiment of the present application, before displaying the service list and the code template list based on the interactive interface, the following steps S31-S34 are also included:
[0088] Step S31: receiving a second query request from a user for a service code template under the SOA architecture.
[0089] In the embodiment of the present application, the first query request is intended to obtain an overview of SOA services registered or available in the system, including basic information such as name, description, and domain, which is mainly used for service discovery and management. The second query request focuses on viewing or operating code templates related to SOA services, which can be used to generate service codes or as a development starting point, and is mainly related to service development.
[0090] Step S32, responding to the second query request, and detecting whether the user has a second query permission for the code template list.
[0091] In an embodiment of the present application, before responding to the second query request, it is detected whether the user has the authority to query the code template list. Because different users have different permissions, some users can only view specific information, but cannot view or operate other sensitive or restricted information. By detecting the user's permissions, it is ensured that only users with corresponding permissions can query the code template list.
[0092] Step S33: if the user has the second query authority, the code template list is loaded into the configuration interface.
[0093] In an embodiment of the present application, if the user has the second query permission, the data of the code template list is obtained from the code template management module. After the data is obtained, the data is loaded onto the configuration interface so that the user can view and operate the code template list. The user can see the code template list on the configuration interface, including the name, description, creation time and other information of each code template. The user can view, filter, sort and other operations on the code template list as needed.
[0094] Step S34, filtering the template files in the code template list according to the preset filtering conditions on the configuration interface to obtain the filtering results, and loading the filtering results into the configuration interface.
[0095] In an embodiment of the present application, in the configuration interface (i.e., the code template page), a user can select or enter a preset filtering condition. The filtering condition may include template name, creation time, modification time, template type, etc., for filtering template files of interest to the user. According to the filtering condition provided by the user, the template files in the code template list are filtered. The screening process includes querying the code template data in the database and applying the corresponding filtering logic. After the screening is completed, a group of template files that meet the filtering condition are obtained as the screening result. Finally, this group of screening results is loaded into the configuration interface so that the user can view, select or further operate. The user can see the code template list filtered out according to the filtering condition on the configuration interface. The user can view, select, download, delete, and other operations on the screening results to meet their business needs.
[0096] In the embodiment of the present application, the method further includes the following steps D1-D5:
[0097] Step D1, receiving a second upload request from a user for a service code template under the SOA architecture.
[0098] In the embodiment of the present application, the main difference between the first upload request and the second upload request is that the content they upload is different: the first upload request uploads SOA service information, while the second upload request uploads SOA service code template. Both involve permission checking, data verification and storage operations, but the objects and purposes of the operations are different. This allows users to flexibly manage SOA services and code templates in the system, including operations such as adding new services, updating existing services, and uploading and managing code templates.
[0099] Step D2, responding to the second upload request, and detecting whether the user has the second upload permission for the code template list.
[0100] In the embodiment of the present application, after the user logs in to the system, if he has the authority to upload the code template, he can choose to upload the code template on the front-end interface. At this time, the system receives a request to upload the code template (i.e., the second upload request), which contains the code template file to be uploaded by the user, and needs to call the authority management module to check whether the user who initiates the request has the authority to upload the code template.
[0101] Step D3: if the user has the second upload authority, receiving the candidate template file input by the user.
[0102] In an embodiment of the present application, if the user has permission to upload a code template, the user's upload request will continue to be processed, and the candidate template file entered by the user will be received. This file will then be saved in the database, and other related processing (such as updating the cache, recording logs, etc.) will be performed. After receiving the candidate template file, a series of processing operations need to be performed, including verifying the legitimacy of the file, checking whether the file name is unique, saving the file to the database, etc. After the processing operation is completed, a response of successful upload is returned.
[0103] Step D4, comparing the file name of the candidate template file with the pre-stored name in the code template list.
[0104] In an embodiment of the present application, when a user selects a template file and clicks the upload button, the name of the file is obtained and a code template list is accessed, wherein the code template list is a list stored in a database or cache, and contains the names of all uploaded code template files. The name of the candidate template file uploaded by the user is compared with the name in this list. The purpose of the comparison is to ensure that the name of the template file uploaded by the user is unique in the list.
[0105] Step D5, if the file name is consistent with the pre-stored name, the template file corresponding to the pre-stored name is replaced with the candidate template file, and a corresponding replacement reminder message is generated; or, if the file name is inconsistent with the pre-stored name, the candidate template file is stored in the code template list.
[0106] In an embodiment of the present application, when a user tries to upload a new code template file, it is first checked whether the file name already exists in the code template list. If the name of the candidate template file is consistent with a pre-stored name in the code template list, a replacement operation is performed, indicating that the new candidate template file will replace the old file with the same name in the list. At the same time, a replacement reminder message is generated, which may include information such as the name of the replaced file, the replacement time, and the user who performs the replacement. If the name of the candidate template file is inconsistent with all the pre-stored names in the code template list, it is considered to be a new and unique template file, and it is stored in the code template list. During the storage process, a unique identifier (such as an ID) is assigned to the new template file.
[0107] Figure 2 is a schematic diagram of the structure of a system for generating service code under an SOA architecture provided by an optional embodiment of the present invention, such as Figure 2 As shown, the system includes: WEB front-end, NGINX proxy module, VUE or other front-end modules, management module, REDIS cache module, and database;
[0108] The WEB front end is used to provide a user interface, allowing users to apply for an account, log in, manage SOA services (including adding, deleting, modifying, and querying SOA services), manage code templates (including uploading, downloading, and deleting templates), and generate SOA service codes;
[0109] NGINX proxy module, used as a reverse proxy server, receives HTTP requests from the WEB front end, forwards the requests to the corresponding backend service for processing according to the request URL or parameters, and returns the processing results to the WEB front end;
[0110] VUE or other front-end modules are used to implement dynamic interactive WEB interfaces using Vue.js or other front-end frameworks, interact with back-end services, display data, process user input, and trigger corresponding operation requests;
[0111] Management module, which is used to contain multiple sub-modules and jointly handle the business logic of the system;
[0112] REDIS cache module is used as a cache layer to store frequently accessed data, such as user information, permission information, authentication tokens, SOA service lists, etc., to improve the system's response speed and reduce database access pressure;
[0113] The database is used to persistently store all data in the system, including user account information, permission information, SOA service information, code template information, etc., and uses the MySQL database for data storage and management.
[0114] In the embodiment of the present application, the management module includes: SOA service management module, code template management module, user management module, authority management module, and code generation module;
[0115] SOA service management module is used to manage SOA service information, including adding SOA services, importing SOA service information in batches according to Excel tables, deleting SOA services, deleting SOA services in batches, obtaining SOA service lists according to screening conditions, querying SOA service details, modifying SOA service information, etc.;
[0116] The code template management module is used to manage SOA service code templates, including uploading new code template files, downloading existing template files, deleting template files that are no longer needed, and obtaining template lists according to preset conditions;
[0117] The user management module is used to manage user accounts, including user account application, approval, login authentication, permission allocation, password modification, etc. Use JWT to generate and manage user authentication tokens, which are stored in the REDIS cache;
[0118] The permission management module is used to control the user's access rights to system resources, including querying, adding, modifying, and deleting SOA services and code template permission verification;
[0119] The code generation module is used to generate the corresponding SOA service code according to the SOA service and code template selected by the user. Specifically, it obtains the SOA service information and code template selected by the user from the database, replaces the variables in the template, generates the code file, and packages and compresses the generated file for the user to download.
[0120] Figure 3 FIG. 1 is a flow chart of a user account application and login process provided by an optional embodiment of the present invention. Figure 3 As shown, the process includes:
[0121] Process 1: The WEB front end sends the account application request to the NGINX proxy module; the NGINX proxy module forwards the account application request to the user management module; the user management module processes the request, and after the administrator approves it, uses the user information carried in the account application request to write or update the database.
[0122] Process 2: The WEB front end sends the user login request to the NGINX proxy module; the NGINX proxy module forwards the user login request to the user management module; the user management module processes the user login request, verifies the user information, and obtains the permission information; the user management module sends the permission information to the permission management module for further verification; the permission management module verifies according to the data in the database and generates the user's login token; the permission management module writes the login token to the REDIS cache module.
[0123] Figure 4 FIG. 1 is a flow chart of SOA service information batch import provided by an optional embodiment of the present invention. Figure 4 As shown, the process includes:
[0124] Process 3: The WEB front end sends a request to download the SOA service template to the NGINX proxy module; the NGINX proxy module forwards the request to the permission management module for permission verification; the permission management module processes the request, allows the download, and then forwards the request to the SOA service management module; the SOA service management module retrieves the template file from the database and returns it to the WEB front end through the NGINX proxy module.
[0125] Process 4: After the user fills in the EXCEL form of SOA service information, it is uploaded through the WEB front end; the WEB front end sends the upload request to the NGINX proxy module; the NGINX proxy module forwards the request to the permission management module for permission verification; after the permission management module passes the verification, it forwards the request to the SOA service management module; the SOA service management module parses the EXCEL form, verifies the data, and writes or updates the SOA service information to the REDIS cache module and database.
[0126] Figure 5 FIG. 1 is a flow chart of SOA service information processing provided by an optional embodiment of the present invention. Figure 5 As shown, the process includes:
[0127] Process 5: The WEB front end sends a query request to the NGINX proxy module; the NGINX proxy module forwards the request to the permission management module for permission verification; after the permission management module passes the verification, it forwards the request to the SOA service management module; the SOA service management module queries the database, obtains the service list, and returns it to the WEB front end for display through the NGINX proxy module.
[0128] Process 6: The WEB front end sends a request for addition, deletion, modification and query to the NGINX proxy module; the NGINX proxy module forwards the request to the permission management module for permission verification; after the permission management module passes the verification, it forwards it to the SOA service management module according to the request type; the SOA service management module processes the SOA service information in the REDIS cache module and the database according to the request, and updates the REDIS cache module and the database.
[0129] Figure 6 FIG. 1 is a flow chart of SOA code template processing provided by an optional embodiment of the present invention. Figure 6 As shown, the process includes:
[0130] Process 7: After the user writes the template, it is uploaded through the WEB front end; the WEB front end sends a second upload request to the NGINX proxy module; the NGINX proxy module forwards the request to the permission management module for permission verification; if the user has the second upload permission, the permission management module forwards the request to the code template management module; the code template management module inserts / updates the template file into the database.
[0131] Process 8: The WEB front end sends a query / delete request to the NGINX proxy module; the NGINX proxy module forwards the request to the permission management module for permission verification; after the permission management module passes the verification, it forwards the request to the code template management module; the code template management module performs query / delete operations on the code template list in the database according to the request.
[0132] Process 9: The user accesses and edits the existing code template file through the WEB front end; after editing, the user triggers the operation of saving the file, and the WEB front end generates a request to save the file. The request contains the modified template file content and its unique identifier; the WEB front end sends the request to save the file to the NGINX proxy module; the NGINX proxy module forwards the request to the permission management module for permission verification; after the permission management module verifies, it forwards the request to the code template management module, uses the identifier to locate the corresponding template record from the database, and updates the corresponding template record in the database according to the template file in the request.
[0133] Figure 7 FIG. 1 is a flow chart of SOA service code generation provided by an optional embodiment of the present invention. Figure 7 As shown, the process includes:
[0134] Process 10: The WEB front end sends a second query request to the NGINX proxy module; the NGINX proxy module forwards the request to the permission management module for permission verification; after the permission management module passes the verification, the request is forwarded to the code template management module; the code template management module queries the code template list in the database and returns it to the WEB front end for display through the NGINX proxy module.
[0135] Process 11: The WEB front end sends the first query request to the NGINX proxy module; the NGINX proxy module forwards the request to the permission management module for permission verification; after the permission management module passes the verification, the request is forwarded to the SOA service management module; the SOA service management module queries the service list in the database and returns it to the WEB front end for display through the NGINX proxy module.
[0136] Process 12: The user selects the SOA code template and service information through the WEB front end to trigger the generation request; the WEB front end sends the generated request to the NGINX proxy module; the NGINX proxy module forwards the request to the permission management module for permission verification; after the permission management module passes the verification, it forwards the request to the code generation module; the code generation module obtains the corresponding template and service information from the database, generates a code file according to the template, and packages and compresses it; the generated code file is returned to the WEB front end through the NGINX proxy module for the user to download.
[0137] In this embodiment, a device for generating service code under the SOA architecture is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and will not be repeated hereafter. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0138] This embodiment provides a device for generating service code under SOA architecture, such as Figure 8 As shown, including:
[0139] An acquisition module 81 is used to acquire a service code generation request triggered by a user;
[0140] A response module 82 is used to respond to the service code generation request and display a service list and a code template list based on the interactive interface, wherein the service list and the code template list are configured by the user according to the configuration authority he has, the service list includes a plurality of pre-configured service information, and the code template list includes a plurality of pre-configured template files;
[0141] The detection module 83 is used to detect the selection operation acting on the service list and the code template list in the interactive interface, and determine the target service information and the target template file according to the selection operation;
[0142] The generating module 84 is used to replace the preset variables in the target template file with the target service information to generate the corresponding service code.
[0143] In an optional embodiment of the present application, the device also includes: a first processing module, used to receive a first query request from a user for service information under the SOA architecture; respond to the first query request, and detect whether the user has the first query permission for the service information; if the user has the first query permission, load the service list to the configuration interface; detect the user's processing request for the service list in the configuration interface, and perform processing operations on the service list based on the processing request.
[0144] In an optional embodiment of the present application, the first processing module is used to detect whether the user has the first upload permission for the service information when the processing request is a first upload request; if the user has the first upload permission, load the preset data table to the configuration interface; obtain the candidate service information input by the user in the preset data table of the configuration interface; update the service list based on the candidate service information to obtain an updated service list.
[0145] In an optional embodiment of the present application, the first processing module is used to detect whether the user has the authority to delete the service information when the processing request is a deletion request; if the user has the authority to delete, the service information to be deleted that the user checked on the service list of the configuration interface is obtained, and whether the service information to be deleted matches the deletion authority is detected; if the service information to be deleted matches the deletion authority, the corresponding deletion operation is performed on the service information to be deleted, and the corresponding deletion reminder information is generated; or, if the service information to be deleted does not match the deletion authority, a password prompt information is sent, and the password input by the user is obtained according to the password prompt information; if the password matches the preset password corresponding to the service information to be deleted, the corresponding deletion operation is performed on the service information to be deleted.
[0146] In an optional implementation of the present application, the first processing module is used to detect whether the user has the modification permission of the service information when the processing request is a modification request; if the user has the modification permission, obtain the service information to be modified that the user checked on the service list of the configuration interface; load the service information to be modified to the editing page, and obtain the updated service information submitted by the user on the configuration interface; update the service list using the updated service information, and generate corresponding modification reminder information.
[0147] In an optional embodiment of the present application, the second processing module is used to receive a second query request from a user for a service code template under the SOA architecture; respond to the second query request, and detect whether the user has a second query permission for the code template list; if the user has the second query permission, load the code template list to the configuration interface; filter the template files in the code template list according to preset filtering conditions on the configuration interface to obtain filtering results, and load the filtering results to the configuration interface.
[0148] In an optional embodiment of the present application, the second processing module is used to receive a second upload request from a user for a service code template under the SOA architecture; respond to the second upload request, and detect whether the user has the second upload permission for the code template list; if the user has the second upload permission, receive the candidate template file input by the user; compare the file name of the candidate template file with the pre-stored name in the code template list; if the file name is consistent with the pre-stored name, replace the template file corresponding to the pre-stored name with the candidate template file, and generate corresponding replacement reminder information; or, if the file name is inconsistent with the pre-stored name, store the candidate template file in the code template list.
[0149] See also Fig. 9 , Fig. 9 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Fig. 9 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system).
[0150] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0151] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.
[0152] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the use of a computer device based on the presentation of a small program landing page, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0153] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0154] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0155] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0156] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for generating service code under SOA architecture, characterized in that: The method comprises: Get the service code generation request triggered by the user; In response to the service code generation request, a service list and a code template list are displayed based on an interactive interface, wherein the service list and the code template list are configured by the user according to the configuration authority possessed by the user, the service list includes a plurality of pre-configured service information, and the code template list includes a plurality of pre-configured template files; Detecting a selection operation on the service list and the code template list in the interactive interface, and determining target service information and target template file according to the selection operation; The target service information is used to replace the preset variables in the target template file to generate a corresponding service code.
2. The method according to claim 1, characterized in that: Before displaying the service list and the code template list based on the interactive interface, the method further includes: Receiving a first query request from a user for service information under the SOA architecture; Responding to the first query request, and detecting whether the user has a first query authority for service information; If the user has the first query authority, loading the service list into the configuration interface; A processing request of a user for the service list on the configuration interface is detected, and a processing operation is performed on the service list based on the processing request.
3. The method according to claim 2, characterized in that The performing a processing operation on the service list based on the processing request includes: When the processing request is a first upload request, detecting whether the user has a first upload authority for the service information; If the user has the first upload authority, loading the preset data table to the configuration interface; Acquire candidate service information input by the user in a preset data table of the configuration interface; The service list is updated based on the candidate service information to obtain an updated service list.
4. The method according to claim 2, characterized in that: The performing a processing operation on the service list based on the processing request includes: When the processing request is a deletion request, detecting whether the user has the authority to delete the service information; If the user has the deletion permission, the service information to be deleted selected by the user on the service list of the configuration interface is obtained, and whether the service information to be deleted matches the deletion permission is detected; If the service information to be deleted matches the deletion permission, a corresponding deletion operation is performed on the service information to be deleted, and corresponding deletion reminder information is generated; or, if the service information to be deleted does not match the deletion permission, a command prompt information is sent, and the command input by the user is obtained according to the command prompt information; if the command matches the preset command corresponding to the service information to be deleted, a corresponding deletion operation is performed on the service information to be deleted.
5. The method according to claim 2, characterized in that: The performing a processing operation on the service list based on the processing request includes: When the processing request is a modification request, detecting whether the user has the modification authority of the service information; If the user has the modification authority, the service information to be modified selected by the user in the service list of the configuration interface is obtained; Loading the service information to be modified into the editing page, and obtaining the updated service information submitted by the user on the configuration interface; The service list is updated using the updated service information, and corresponding modification reminder information is generated.
6. The method according to claim 1, characterized in that Before displaying the service list and the code template list based on the configuration interface, the method further includes: Receiving a second query request from a user for a service code template under the SOA architecture; Responding to the second query request, and detecting whether the user has a second query permission for the code template list; If the user has the second query authority, loading the code template list into the configuration interface; The template files in the code template list are filtered in the configuration interface according to preset filtering conditions to obtain filtering results, and the filtering results are loaded into the configuration interface.
7. The method according to claim 6, characterized in that The method further comprises: Receiving a second upload request from a user for a service code template under the SOA architecture; Responding to the second upload request, and detecting whether the user has a second upload permission for the code template list; If the user has the second upload authority, receiving the candidate template file input by the user; Compare the file name of the candidate template file with the pre-stored name in the code template list; If the file name is consistent with the pre-stored name, the template file corresponding to the pre-stored name is replaced with the candidate template file, and corresponding replacement reminder information is generated; or, if the file name is inconsistent with the pre-stored name, the candidate template file is stored in the code template list.
8. A device for generating service code under SOA architecture, characterized in that: The device comprises: An acquisition module is used to obtain a service code generation request triggered by a user; A response module, used to respond to the service code generation request, and display a service list and a code template list based on an interactive interface, wherein the service list and the code template list are configured by the user according to the configuration authority he has, the service list includes a plurality of pre-configured service information, and the code template list includes a plurality of pre-configured template files; A detection module, used to detect a selection operation acting on the service list and the code template list in the interactive interface, and determine target service information and target template file according to the selection operation; A generation module is used to replace the preset variables in the target template file with the target service information to generate corresponding service codes.
9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method according to any one of claims 1 to 7 by executing the computer instructions.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method according to any one of claims 1 to 7.
