Request response method and device, electronic equipment and medium
By configuring mapping relationships on the server, obtaining the result encoding and description information of the response result, and generating unified response information, the problem of response code expansion is solved, the reuse of response information is realized, and the system maintainability and development efficiency is improved.
Patent Information
- Application Number
- CN202510718235.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-29
- Publication Date
- 2025-07-18
AI Technical Summary
In the prior art, with the expansion of business system function requests, there is a large amount of duplicate content in the response code, which leads to the expansion of the code volume, which is not conducive to system maintenance.
By preconfiguring the mapping relationship on the server, the result encoding and description information of the function response results are obtained, and a unified response information is generated to achieve the multiplexing of the response results in different function requests.
Reduces the inflation of response information code, improves the maintainability and development efficiency of business systems, and reduces the cost of repetitive development of response codes.
Smart Images

Figure CN120343085A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of financial technologies, and in particular, to a request response method, apparatus, electronic device, and medium. Background Art
[0002] At present, with the continuous expansion of the scale of Internet applications, as well as the wide adoption of mobile terminals, front-end frameworks, and microservice architectures, back-end interfaces (server-side interfaces) have become the main communication link between the front end and the server-side business system. In typical server-side implementations such as Java, Spring Boot, and Node.js, in order to support different function requests (such as user login, order query, product management, statistical reports, etc.), developers need to write logic implementation code and response code for each function request. Among them, the logic implementation code is used to respond to the function request and obtain a response result, and the response code is used to send response information to the request side according to the response result.
[0003] However, there may be a large amount of duplicate content in the response codes for different function requests in the business system. For example, the response results of one function are the same as those of another function, and the response information sent to the request side is also the same. As the business continues to expand, every time a new logic implementation code for supporting a function request is added, the corresponding response code needs to be added, resulting in an increase in the amount of code, which is not conducive to the maintenance of the business system. Summary of the Invention
[0004] The main purpose of the embodiments of this application is to propose a request response method, apparatus, electronic device, and medium, aiming to reduce the expansion of the code representing the response information caused by duplicate response results, and to achieve the reuse of the same response information among different types of function requests.
[0005] To achieve the above object, a first aspect of the embodiments of this application proposes a request response method, which is applied to a server, and the method includes:
[0006] Obtain a first function usage request sent by a first client, and perform logic processing corresponding to the target function to obtain a response result of the target function, where the first function usage request is used to request the use of the target function;
[0007] Obtain a result code and description information that match the response result of the target function from a pre-configured mapping relationship, where the mapping relationship includes multiple response results corresponding to each function in the existing functions of the server, a result code corresponding to each response result, and description information, and the existing functions include the target function;
[0008] Generate response information according to the matched result code and description information, and send the response information to the first client.
[0009] In some embodiments, before obtaining the first function usage request sent by the first client, the method further includes:
[0010] Obtaining configuration information, where the configuration information includes multiple response results of the target function;
[0011] For each response result among the multiple response results, in the case where the mapping relationship does not include the response result, configure the response result in the mapping relationship, and configure a result code and description information for the response result.
[0012] In some embodiments, the obtaining the first function usage request sent by the first client includes:
[0013] Obtaining N function usage requests sent by M clients within a first preset duration, where the N function usage requests include the first function usage request, M is a positive integer, N is an integer greater than or equal to M, and the M clients include the first client;
[0014] The generating response information according to the matched result code and description information includes:
[0015] In the case where N is greater than or equal to a preset number threshold, performing a deletion process on the description information of the response result of the target function to obtain blank information;
[0016] Generating the response information corresponding to the first function usage request according to the blank information and the matched result code.
[0017] In some embodiments, in the mapping relationship, in the case where the response result indicates a response failure, the description information corresponding to the response result includes the reason for the response failure.
[0018] In some embodiments, the mapping relationship further includes multiple multimedia information, each multimedia information corresponding to each result code in the mapping relationship, the multimedia information being used to instruct the client to generate a prompt picture and a prompt audio, and output the prompt picture and the prompt audio, the prompt picture and the prompt audio being used to represent the description information of the response result corresponding to the result code of the multimedia information;
[0019] The obtaining the result code and description information matching the response result of the target function from the pre-configured mapping relationship includes:
[0020] Obtaining the result code of the response result of the target function from the mapping relationship;
[0021] Determine the description information and multimedia information corresponding to the response result of the target function according to the result encoding in the mapping relationship;
[0022] Generating a response message according to the matching result encoding and description information includes:
[0023] Generate a response message according to the result encoding, description information and multimedia information of the response result of the target function.
[0024] In some embodiments, the mapping relationship further includes a plurality of interactive component information, and each piece of interactive component information corresponds to each result encoding in the mapping relationship. The interactive component information is used to instruct the client to generate a target interactive component and display the target interactive component, and the target interactive component is used to obtain interactive information input by the user using the client;
[0025] Obtaining the result encoding and description information that match the response result of the target function from the pre-configured mapping relationship includes:
[0026] Obtain the result encoding of the response result of the target function from the mapping relationship;
[0027] Determine the description information and interactive component information corresponding to the response result of the target function according to the result encoding of the response result of the target function in the mapping relationship;
[0028] Generating a response message according to the matching result encoding and description information includes:
[0029] Generate a response message according to the result encoding, description information and interactive component information of the response result of the target function.
[0030] In some embodiments, after sending the response message to the first client, the method further includes:
[0031] Obtain a second function usage request sent by a second client;
[0032] When the second function usage request is used to request to use the target function and the time difference between the first time point and the second time point is less than a preset time difference threshold, send the response information of the first function usage request to the second client;
[0033] Wherein, the first time point is the time point when the first function usage request is obtained, and the second time point is the time point when the second function usage request is obtained.
[0034] To achieve the above object, a second aspect of the embodiments of the present application provides a request response device, which is applied to a server, and the device includes:
[0035] A first acquisition module, configured to acquire a first function usage request sent by a first client, perform logical processing corresponding to the target function, and obtain a response result of the target function, where the first function usage request is used to request to use the target function;
[0036] A second acquisition module, configured to acquire a result code and description information that match the response result of the target function from a pre-configured mapping relationship, where the mapping relationship includes multiple response results corresponding to each function in the existing functions of the server, a result code corresponding to each response result, and description information, and the existing functions include the target function;
[0037] A generation module, configured to generate response information according to the matched result code and description information, and send the response information to the first client.
[0038] To achieve the above object, a third aspect of the embodiments of the present application provides an electronic device, where the electronic device includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, the request response method described in the first aspect above is implemented.
[0039] To achieve the above object, a fourth aspect of the embodiments of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the request response method described in the first aspect above is implemented.
[0040] For the request response method, device, electronic device, and medium provided by the present application, when the server acquires a first function usage request sent by a first client and performs logical processing corresponding to the target function to obtain a response result of the target function, the server acquires a result code and description information that match the response result of the target function from a pre-configured mapping relationship, so that the same response result can be reused in multiple places with only one configuration in different function requests. Specifically, the server has loaded multiple response results, the corresponding result codes, and description information together as the above mapping relationship. When the logical processing is completed and the corresponding result is returned, the response information is directly generated according to the matched result code and description information and sent to the first client.
[0041] Through this unified generation mechanism of "result encoding + description information", the same set of response information can be reused with zero code changes among multiple function requests that request different functions, fundamentally reducing the code bloat of the response information representation caused by repeated response results, significantly reducing the cost of repeated development of response code, and improving the maintainability and development efficiency of the business system. Brief Description of the Drawings
[0042] Figure 1 is a schematic flowchart of the request response method provided by an embodiment of the present application;
[0043] Figure 2 is a schematic diagram of the response information provided by an embodiment of the present application;
[0044] Figure 3 is another schematic flowchart of the request response method provided by an embodiment of the present application;
[0045] Figure 4 is yet another schematic flowchart of the request response method provided by an embodiment of the present application;
[0046] Figure 5 is a schematic structural diagram of the request response device provided by an embodiment of the present application;
[0047] Figure 6 is a schematic hardware structure diagram of the electronic device provided by an embodiment of the present application. Detailed Description of the Embodiments
[0048] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0049] It should be noted that although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order from the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects and do not necessarily need to describe a specific order or sequence.
[0050] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0051] First, several nouns involved in the present application are analyzed:
[0052] Feature Usage Request: A Feature Usage Request is a network request sent by a client (such as a browser, mobile application, or other service) to a server or backend system to trigger a specific business function. It typically follows the HTTP / HTTPS protocol and is sent in a standard message format. When the server receives a "Feature Usage Request", it will call the corresponding business logic (such as user authentication, data query, calculation processing, etc.) according to the function identifier and parameters specified in the request, and finally return the processing result to the client.
[0053] Server: A server generally refers to a collection of computing resources and software components that carry and execute backend logic, manage data storage, and respond to client requests. That is, the server is a collection of system components that receive and parse Feature Usage Requests, execute business logic, interact with databases or middleware, generate and return response messages, including web servers (such as Nginx), application servers (such as Spring Boot or Express.js), database servers, and middleware such as caches and message queues, which jointly undertake responsibilities such as protocol parsing, data processing, security verification, and performance monitoring.
[0054] Currently, with the continuous expansion of the scale of Internet applications, as well as the widespread adoption of mobile terminals, front-end frameworks, and microservice architectures, backend interfaces (server interfaces) have become the main communication link between the front end and the server business system. In typical server implementations such as Java, Spring Boot, and Node.js, in order to support different function requests (such as user login, order query, product management, statistical reports, etc.), developers need to write logic implementation code and response code for each function request. Among them, the logic implementation code is used to respond to the function request and obtain the response result, and the response code is used to send response information to the request side according to the response result.
[0055] However, there may be a large amount of duplicate content in the response codes of the business system for different function requests. For example, the response results of one function are the same as those of another function, and the response information sent to the request side is also the same. As the business continues to expand, every time a new logic implementation code for supporting a function request is added, the corresponding response code needs to be added, resulting in an increase in the amount of code, which is not conducive to the maintenance of the business system.
[0056] Based on this, the embodiments of the present application provide a request response method, device, electronic device, and medium, aiming to reduce the expansion of the code representing response information caused by duplicate response results and realize the reuse of the same response information among different types of function requests.
[0057] The request response method, apparatus, electronic device, and medium provided by the embodiments of the present application will be specifically described through the following embodiments. First, the request response method in the embodiments of the present application will be described.
[0058] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, Artificial Intelligence (AI) is a theory, method, technology, and application system that uses a digital computer or a machine controlled by a digital computer to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to obtain the best results.
[0059] Artificial intelligence basic technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, and mechatronics. Artificial intelligence software technologies mainly include several major directions such as computer vision technology, robotics, biometric technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0060] The request response method provided by the embodiments of the present application relates to the field of artificial intelligence technology. The request response method provided by the embodiments of the present application is applied to the server side and can also be software running on the server side. In some embodiments, the server side can be configured as an independent physical server, or can be configured as a server cluster or distributed system composed of multiple physical servers, or can also be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements the request response method, etc., but is not limited to the above forms.
[0061] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multi-processor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and so on. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in a distributed computing environment, where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0062] It should be noted that in each specific implementation manner of the present application, when it comes to relevant processing based on data related to the user's identity or characteristics, such as user information, user behavior data, user historical data, and user location information, the user's permission or consent will be obtained first. Moreover, the collection, use, and processing of these data will comply with relevant laws, regulations, and standards. In addition, when the embodiments of the present application need to obtain the user's sensitive personal information, the user's separate permission or separate consent will be obtained through methods such as pop-up windows or redirecting to a confirmation page. After clearly obtaining the user's separate permission or separate consent, the necessary user-related data for the normal operation of the embodiments of the present application will be obtained.
[0063] Figure 1 is a schematic flowchart of the request response method provided by the embodiments of the present application. As Figure 1 shown, in the first aspect of the embodiments of the present application, a request response method is provided, which is applied to a server and includes steps S100 - S300.
[0064] Step S100: Obtain a first function usage request sent by a first client, perform logical processing corresponding to a target function, and obtain a response result of the target function, where the first function usage request is used to request the use of the target function.
[0065] In step S100, the server first receives and parses the first function usage request sent by the first client, and this request is used to call a specific target function. The server can deserialize the message into a corresponding business object according to the parameters in the first function usage request, and then layer by layer perform the logical processing corresponding to the target function, including parameter verification, data query, and business rule verification, etc., and finally generate a clear response result.
[0066] Exemplarily, in the business system of the financial insurance industry, there is a function of "claim application". When the policyholder submits a claim application including the policy number, accident time, and supporting materials on the first client, the server will first verify the validity of the policy, then calculate the claimable amount according to the accident type, and finally check whether the uploaded materials are complete; assuming that "the materials are incomplete" is detected this time, the server will use this enumeration result as the response result of the target function;
[0067] Again, by way of example, in the service system of the healthcare management industry, there is a function of "querying medical examination reports". The server first receives and parses a first function usage request sent from the first client, which is used to call the target function of "querying medical examination reports". The server then starts to execute the logical processing corresponding to the "querying medical examination reports" function. The server will, based on information such as the patient ID and medical examination date carried in the request, first verify the user identity and permissions, and then access the database or file storage system to retrieve the corresponding medical examination report records, and determine whether the medical examination report has been generated and whether it is still being processed. Finally, a clear response result is formed. Suppose a patient A submits a request to query the medical examination report at the front end. The server queries in the database and finds that the medical examination record of this patient on May 10, 2025 has generated a complete report file, so the determined response result is "The report has been generated and can be viewed".
[0068] In this way, this step not only ensures the clarity and controllability of the processing flow of each function, but also lays a foundation for the subsequent unified response templatization processing, effectively avoiding the problem of a large number of duplicate response assembly codes in the business logic being scattered everywhere, thereby improving the development efficiency and system stability.
[0069] Step S200: Obtain the result code and description information that match the response result of the target function from the pre-configured mapping relationship, where the mapping relationship includes multiple response results corresponding to each function in the existing functions of the server, the result code corresponding to each response result, and the description information, and the existing functions include the target function.
[0070] In step S200, the server, based on the pre-configured mapping relationship, searches for the result code and description information that match the target function response result obtained in step S100. This mapping relationship covers all existing functions and their possible response results, and pre-defines a unique short code and a text prompt that can be directly fed back to the client for each result.
[0071] By way of example, in the "claim application" scenario of the business system in the financial insurance industry, the mapping relationship may map the response result of "incomplete materials" to the code "CLM-400" and the description information "The materials are incomplete. Please supplement the materials and try again". When the server receives the "incomplete materials" returned in step S100, it can quickly obtain the corresponding code and prompt text without having to write the assembly logic for this scenario again. This not only eliminates the cumbersome process of repeatedly modifying the response codes in multiple places due to the addition or adjustment of business results, but also ensures that the same set of configurations is used for response output in all function scenarios, fundamentally eliminating the maintenance problems brought by the expansion of response codes, and significantly improving the maintainability and consistency of the code;
[0072] Again, by way of example, in the "physical examination report query" scenario of the service system in the medical and health management industry, the server uses the response result of the target function "report has been generated and can be viewed" obtained in step S100 as an index to search for the matching result code and description information from the mapping relationship pre-loaded when the server is started. This mapping relationship contains all possible response results under the function of "querying physical examination report" and their corresponding codes and prompt texts. For example, "report has been generated and can be viewed" is mapped to the result code "REP-200" and the description information "The physical examination report has been generated and can be downloaded and viewed"; if the report has not been completed yet, it is mapped to "REP-201" and "The physical examination report has not been generated yet. Please try again later"; if the patient or physical examination record does not exist at all in the server, it corresponds to "REP-404" and "No relevant physical examination report has been found". Since the server obtained "report has been generated" in step S100, the server only needs to extract the pair of information "REP-200" and "The physical examination report has been generated and can be downloaded and viewed" from the mapping relationship to prepare for generating the response information in the next step.
[0073] Step S300: Generate response information according to the matching result code and description information, and send the response information to the first client.
[0074] The server generates response information from the result code and description information matched in step S200. Specifically, the result code and description information can be filled into a unified response information template, and finally the response information containing the generated response information with the description information is serialized and sent to the first client.
[0075] Figure 2 It is a schematic diagram of the response information provided by the embodiment of the present application. Those skilled in the art can understand that the description information in the response information can include two parts. One part is the description of the response result and the related reasons for generating the response result (such as the reason for response failure - "This user is currently in task processing. Please try again later"); the other part is the related business data packet sent in a supporting manner (response content, such as the specific physical examination report file in the above physical examination report query scenario). If the target function is to search for data, the related data packet can be the data found after the response is successful. The server can also inject business extension fields as needed in this part (such as the link prepared for supplementing materials for claims, or the download link of the physical examination report file).
[0076] Through the above steps S100 - S300, when the server obtains the first function usage request sent by the first client and executes the logic processing corresponding to the target function, and obtains the response result of the target function, the server obtains the result code and description information that match the response result of the target function from the pre - configured mapping relationship, so that the same response result can be reused in multiple places with only one configuration in different function requests. Specifically, the server has loaded multiple response results, along with the corresponding result codes and description information, as the above - mentioned mapping relationship. When the logic processing is completed and the corresponding result is returned, the response information is directly generated according to the matched result code and description information and sent to the first client.
[0077] Through this unified generation mechanism of "result code + description information", the same set of response information can be reused among multiple function requests for different functions with zero code changes, fundamentally reducing the code bloat of the response information caused by repeated response results, significantly reducing the cost of repeated development of response code, and improving the maintainability and development efficiency of the business system.
[0078] Figure 3 It is another flowchart of the request - response method provided by the embodiment of the present application. As Figure 3 shown, in some embodiments, before obtaining the first function usage request sent by the first client (step S100), the method further includes:
[0079] Step S110: Obtain configuration information, where the configuration information includes multiple response results of the target function;
[0080] Step S120: For each response result among the multiple response results, in the case where the mapping relationship does not include the response result, configure the response result in the mapping relationship and configure the result code and description information for the response result.
[0081] In this embodiment, when new response results need to be configured for the mapping relationship, the configuration information will be obtained first. The configuration information clearly lists multiple response results that the target function may generate (such as automatic acceptance, manual review, incomplete materials, policy expiration, etc.); then, the server checks one by one whether these response results have been registered in the mapping relationship. If it is found that a certain response result is not included, the corresponding result code and description information will be configured for this response result in the mapping relationship. Through this pre - configuration process, all response results of the target function, their codes, and prompt texts are uniformly managed and dynamically supplemented, laying a configuration foundation for the subsequent "generating response information according to the matched result code and description information", and new response scenarios can be supported at any time without manually modifying the business code.
[0082] Exemplarily, in the "claims application" function of the business system in the financial insurance industry, the operation and maintenance personnel or system administrators will add the following configuration information to the server:
[0083] Response results: SUCCESS_AUTO, PENDING_MANUAL, DOC_INCOMPLETE, POLICY_EXPIRED;
[0084] When the mapping relationship is updated, check in turn whether the result codes and description information of these four results already exist in the mapping relationship. If a new result FRAUD_SUSPECTED (suspected fraud) is added but the mapping relationship has not been defined, the server will automatically add it and assign it the code CLM-402 and the description information "Suspected fraud, please contact customer service", completing the dynamic expansion of the mapping relationship. In this way, when a subsequent claims request triggers the enumeration of the "suspected fraud" result, the server can transparently obtain the pair of code-description CLM-402 and "Suspected fraud, please contact customer service" and encapsulate it into a unified response message to return to the client without any code-level changes.
[0085] In some embodiments, obtaining a first function usage request sent by a first client includes:
[0086] Obtaining N function usage requests sent by M clients within a first preset duration, where the N function usage requests include the first function usage request, M is a positive integer, N is an integer greater than or equal to M, and the M clients include the first client;
[0087] Generating a response message according to the matched result code and description information, including:
[0088] When N is greater than or equal to a preset number threshold, performing a deletion process on the description information of the response result of the target function to obtain blank information;
[0089] Generating a response message corresponding to the first function usage request according to the blank information and the matched result code.
[0090] In this embodiment, when the server receives and processes a client request, within a fixed time window called a first preset duration (the first preset duration can be a certain time point), if a total of N function usage requests from multiple clients are batch-collected (where these M clients include the first client itself and N is greater than or equal to M), the server performs logical processing on the first function usage request among the N collected requests for the corresponding target function to obtain the response result of the target function.
[0091] Next, the server looks up in the mapping relationship configured in advance for the result code and complete description information that exactly match the response result of the target function. After the result code and description information are found, if N is greater than or equal to the preset number threshold, it is a high-concurrency scenario. To further reduce network bandwidth and serialization overhead in the high-concurrency scenario, the server will perform deletion processing (complete deletion) on the complete description information obtained from the mapping relationship, turning it into blank information and only retaining the result code; if N is less than the threshold, the complete description information can be normally retained.
[0092] Finally, the server generates the response information corresponding to the first function usage request only based on the deleted blank information and the previously matched result code, and sends it to the first client. In this way, the server actually only returns the result code without returning any text description, so as to save the response packet size to the greatest extent and improve the throughput capacity and response performance under high-concurrency conditions. After receiving the response that only contains the code and the message field is empty, the front end can convert the code into a complete description through the locally pre-deployed code-description mapping table and present it to the end user, thus ensuring that the prompt information on the user side is not lost and realizing bandwidth optimization and server performance improvement in the high-concurrency scenario.
[0093] In some embodiments, in the mapping relationship, when the response result indicates a response failure, the description information corresponding to the response result includes the reason for the response failure.
[0094] In this embodiment, the mapping relationship not only maps each response result to the corresponding result code, but also ensures that when a certain response result indicates a response failure, the corresponding description information must include an explanation of the failure reason. That is to say, if the response result of the target function obtained in the logical processing stage (i.e., step S100) represents that the business operation is not successful, the server will find a text description with a detailed failure reason that matches the failure result in the mapping relationship, and then use it together to assemble the response information finally returned to the client. By this approach, when the client receives a "failure" type response, it can not only quickly locate which failure it is through the result code, but also directly know the specific failure reason from the description field, without the need to initiate an additional diagnostic request or consult the document, thus improving the user experience and reducing the number of rounds of front-end and back-end interactions.
[0095] For example, in the "claim application" function of the business system in the financial insurance industry, assume that the server has pre-configured the following entries in the mapping relationship for the response result indicating a response failure:
[0096] When the response result is DOC_INCOMPLETE (incomplete materials), the corresponding result code is CLM-400, and the description information is "The claim settlement materials are incomplete. Please supplement the ID card and accident certificate within 48 hours.";
[0097] When the response result is POLICY_EXPIRED (policy expired), the corresponding result code is CLM-401, and the description information is "The policy expired on April 30, 2024, and claim settlement cannot be submitted.";
[0098] When the response result is EXCEED_LIMIT (exceeding the claim settlement limit), the corresponding result code is CLM-402, and the description information is "The claim settlement amount of ¥20,000 this time exceeds the maximum payable limit of ¥10,000.";
[0099] When it is found during the logical processing stage (S100) of a certain claim settlement request that the uploaded accident photos or medical record materials are incomplete, the response result DOC_INCOMPLETE will be obtained. When constructing the response information, the server retrieves the result code CLM-400 corresponding to DOC_INCOMPLETE and the description information with "Please supplement the ID card and accident certificate within 48 hours" from the mapping relationship, and finally generates a complete response information and sends it to the client.
[0100] In some embodiments, the mapping relationship further includes multiple multimedia information, and each multimedia information corresponds to each result code in the mapping relationship. The multimedia information is used to instruct the client to generate a prompt picture and a prompt audio, and output the prompt picture and the prompt audio. The prompt picture and the prompt audio are used to represent the description information of the response result corresponding to the result code of the multimedia information;
[0101] Obtain the result code and description information that match the response result of the target function from the pre-configured mapping relationship, including:
[0102] Obtain the result code of the response result of the target function from the mapping relationship;
[0103] Determine the description information and multimedia information corresponding to the response result of the target function in the mapping relationship according to the result code of the response result of the target function;
[0104] Generate response information according to the matched result code and description information, including:
[0105] Generate response information according to the result code, description information, and multimedia information of the response result of the target function.
[0106] In this embodiment, the mapping relationship not only stores the result code and description information corresponding to each response result, but also additionally associates multimedia information with each result code to guide the client to generate corresponding prompt pictures and prompt audio. Therefore, when presenting the response result, not only can the description information be fed back in text form, but also the corresponding pictures can be popped up and the corresponding audio can be played to convey the result to the user in a more intuitive and rich way.
[0107] Specifically, when the server obtains the response result of a certain target function during the logic processing stage, it will retrieve the corresponding description information and multimedia information from the mapping relationship according to the result code of the response result. Subsequently, the server will encapsulate the result code, text description, and the corresponding multimedia information into a unified response message and send the encapsulated response message to the client. After receiving the response message, the client can not only identify the result type through the "code" field and obtain the text prompt through the "message" field, but also read the multimedia information carried in the response to generate corresponding prompt pictures (such as icons, emojis, or warning icons) and prompt audio (such as success or failure prompt sounds).
[0108] In this way, once a response result corresponding to a certain result code appears, the client does not need to decide how to present the multimedia content by itself, but automatically renders the corresponding prompt image and plays the corresponding prompt audio according to the instructions predefined in the server mapping relationship, greatly unifying the front-end presentation style and enhancing the user's perception effect of the task status.
[0109] Exemplarily, in the "claim application" function of the business system in the financial insurance industry, it is assumed that the mapping relationship configures corresponding multimedia information for the following several key response results:
[0110] When the response result is "SUCCESS_AUTO", that is, the claim is automatically accepted, the result code is CLM-200, the description information is "The claim application has been accepted, please wait for review", and the multimedia information may include a "green tick" icon (file name such as icon_claim_success.png) and a short "claim acceptance success" prompt audio (file name such as audio_claim_success.mp3);
[0111] When the response result is "DOC_INCOMPLETE", that is, the materials are incomplete, the result code is CLM-400, the description information is "The claim materials are incomplete, please supplement the ID card and accident certificate", and the multimedia information may include a "red exclamation mark" icon (icon_doc_incomplete.png) and an audio prompt for the user to complete the materials (audio_doc_incomplete.mp3);
[0112] When the response result is "POLICY_EXPIRED", that is, the insurance policy has expired, the result code is CLM-401, and the description information is "The insurance policy expired on April 30, 2024, and claims cannot be made". The multimedia information can correspond to a "gray lock" icon (icon_policy_expired.png) and a prompt audio (audio_policy_expired.mp3) informing that "the insurance policy has expired".
[0113] When a certain customer submits a claim application through the front end of the claim service, and the server obtains a response result of "DOC_INCOMPLETE" after the logical processing of this time, the server will locate the result code CLM-400 in the mapping relationship, find out the corresponding description "The claim materials are incomplete. Please supplement the ID card and accident certificate", and at the same time obtain the two multimedia information of icon_doc_incomplete.png and audio_doc_incomplet e.mp3. Subsequently, the server generates the corresponding response information and sends it to the first client.
[0114] After receiving this response, the first client will first confirm with the local coding table according to the code that this is a failure scenario of "incomplete materials", and then display the text "The claim materials are incomplete. Please supplement the ID card and accident certificate" on the page, and automatically load the red exclamation mark icon of icon_doc_incomplete.png, prominently prompt in the user interface, and at the same time play the audio of audio_doc_incomplete.mp3 to quickly direct the user's attention to the core information of "materials need to be supplemented". In this way, the client does not need to create or maintain the correspondence between multimedia files and business results by itself, but directly uses the multimedia information defined by the server in the mapping relationship, thus ensuring a high degree of consistency in the prompt style and content between the front and back ends, and also significantly improving the interaction experience and response efficiency of users in the claim process.
[0115] In some embodiments, the mapping relationship further includes multiple interactive component information, each piece of interactive component information corresponds to each result code in the mapping relationship, and the interactive component information is used to instruct the client to generate a target interactive component and display the target interactive component, and the target interactive component is used to obtain the interactive information input by the user using the client;
[0116] Obtain the result code and description information that match the response result of the target function from the pre-configured mapping relationship, including:
[0117] Obtain the result code of the response result of the target function from the mapping relationship;
[0118] Determine the description information and interaction component information corresponding to the response result of the target function in the mapping relationship according to the result code of the response result of the target function;
[0119] Generate a response message according to the matched result code and description information, including:
[0120] Generate a response message according to the result code, description information and interaction component information of the response result of the target function.
[0121] In this embodiment, the mapping relationship not only configures a result code and description information for each response result, but also additionally includes multiple interaction component information. These interaction component information correspond one by one to each result code in the mapping relationship, and are used to instruct the client to dynamically generate the corresponding target interaction component after receiving the response and display it to the user.
[0122] Specifically, when the server finishes executing the target function and obtains the corresponding result, it will first obtain the corresponding result code according to the result in the mapping relationship, and then find the associated complete description information and the corresponding interaction component information according to the result code. Subsequently, the server will package the result code, description information and interaction component information into the final response message and send it to the client. After receiving the response, the client first identifies the current business scenario through the result code, then displays the necessary text prompts through the description information, and finally generates the corresponding target interaction component (such as a text input box, a drop-down list or a button group) according to the interaction component information, and renders the component on the interface so that the user can directly input or select the subsequent required interaction information in the client, and then drive the subsequent business process through these interaction information.
[0123] Exemplarily, in the "claim application" function of the business system in the financial insurance industry, the mapping relationship may configure the following content for different response results under the "claim application" function: when the response result is PENDING_MANUAL (manual review required), the result code is CLM-201, the description information is "Your claim application has entered the manual review stage. Please upload supplementary instructions or contact customer service for confirmation", and the corresponding interaction component information can instruct the client to generate a file upload component for uploading supplementary instructions (such as a "Upload additional supporting materials" button and a file selection box), and a link button for directly calling or online consulting customer service;
[0124] When the response result is DOC_INCOMPLETE (incomplete materials), the result code is CLM-400, and the description information is "Claim materials are incomplete, please supplement the ID card and accident certificate". The corresponding interactive component information can instruct the client to generate a form containing two required fields "ID card photo upload" and "accident certificate upload", and generate a "Submit Supplementary Materials" button below the form;
[0125] For another example, when the response result is SUCCESS_AUTO (automatically accepted), the result code is CLM-200, and the description information is "The claim application has been accepted, please wait for the review result". At this time, the corresponding interactive component information may be empty or only contain a "View Claim Progress" button so that the user can jump to the query progress page after clicking it.
[0126] Assume that after an insured submits a claim application through the client, the server generates a PENDING_MANUAL response result in the logic processing stage. At this time, the mapping relationship will provide the code CLM-201, the description information "Your claim application has entered the manual review stage, please upload additional instructions or contact customer service for confirmation", and an interactive component information, which instructs the client to generate a file upload area and an online customer service button. The server encapsulates these contents into the response information and sends it to the first client together with the description information and result code.
[0127] After the first client receives this response information, it will first display a text prompt on the interface saying "Your claim application has entered the manual review stage, please upload additional instructions or contact customer service for confirmation", and dynamically generate a file upload component with the label "Upload additional instructions" and a button "Contact customer service" based on the uploadSection information in uiComp onents. When the user selects a file in the component and clicks "Upload", the client will send the additional instructions file together with the previous request identifier back to the server; if the user clicks the "Contact customer service" button, the client will open the online customer service window to communicate directly with the manual customer service.
[0128] Through the above mechanism, the interactive component information in the mapping relationship enables the client to render and obtain user interaction information in a targeted manner under different response results, without the need for the front-end to hard-code all possible components in advance, or to manually modify the client code when adding or adjusting business processes. This ensures the flexible expansion of the response logic and improves the user's operational convenience and experience consistency in the claims process.
[0129] Figure 4 It is another flowchart of the request response method provided in the embodiment of the present application, such as Figure 4As shown, in some embodiments, after sending the response information to the first client, the method further includes:
[0130] Step S400: obtaining a second function use request sent by a second client;
[0131] Step S500: When the second function use request is used to request use of the target function and the time difference between the first time point and the second time point is less than a preset time difference threshold, send response information of the first function use request to the second client;
[0132] The first time point is the time point when the first function use request is obtained, and the second time point is the time point when the second function use request is obtained.
[0133] In this embodiment, after the server sends the response information corresponding to the target function to the first client, when it obtains the second function use request sent by the second client, it will first determine whether the second function use request is also for requesting to use the same target function as the first client, and whether the time difference between the time when the second request arrives (the second time point) and the time when the first client initiates the request (the first time point) is less than the preset time difference threshold. If these two conditions are met, the server will not re-execute the logical processing of the target function, but directly reuse the response information previously generated and sent for the first client, and send the same response information to the second client again.
[0134] In this way, by caching or short-term storage of the response results of the first client, when multiple clients initiate repeated requests for the same target function within a short period of time, the server can skip the repeated operations and directly return the generated response information to the subsequent requester, thereby significantly reducing the server's processing overhead and response delay.
[0135] For example, in the "premium calculation" function of the business system of the financial insurance industry, the first client (such as broker A's page) initiated a premium calculation (first function use request) for policy number 12345 at 10:00:00 am. After receiving the first function use request, the server immediately performs a series of logical processing such as risk assessment, rate query, and preferential policy application, and generates a premium calculation result response information for the policy, which is then sent to broker A's client.
[0136] After that, at 10:00:05 am, Broker B (the second client) also initiated a premium calculation request (a second function usage request) for the same policy number 12345. Since the second function usage request and the first function usage request are both used to request the use of the target function "premium calculation", and the time when Broker B initiated the request (the second time point 10:00:05) is only 5 seconds away from the time when Broker A initiated the request (the first time point 10:00:00), and assuming that the preset time difference threshold of the server is 10 seconds, the condition that "the time difference between the first time point and the second time point is less than the preset time difference threshold" is satisfied.
[0137] At this time, instead of recalculating the premium based on the policy information again, the server directly reuses the response information generated for Broker A just now and sends the same JSON content to Broker B again. In this way, the server avoids repeatedly calling the rate table, calculation engine, and discount module for the same policy within a very short time, saving computing resources and significantly reducing the response delay of Broker B, achieving the technical effects of improving the throughput performance of the server and the user experience.
[0138] Please refer to Figure 5 , the embodiment of the present application also provides a request response device 10, which can implement the above request response method. The device 10 is applied to the server, and the device 10 includes:
[0139] A first acquisition module 11, configured to acquire a first function usage request sent by a first client, execute logical processing corresponding to a target function, and obtain a response result of the target function, where the first function usage request is used to request the use of the target function;
[0140] A second acquisition module 12, configured to acquire a result code and description information that match the response result of the target function from a pre-configured mapping relationship, where the mapping relationship includes multiple response results corresponding to each function in the existing functions of the server, a result code corresponding to each response result, and description information, and the existing functions include the target function;
[0141] A generation module 13, configured to generate response information according to the matched result code and description information, and send the response information to the first client.
[0142] The specific implementation manner of the request response device 10 is basically the same as the specific embodiment of the above request response method, and will not be elaborated here.
[0143] The embodiment of the present application also provides an electronic device. The electronic device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the above request response method is implemented. The electronic device can be any intelligent terminal including a tablet computer, an in-vehicle computer, etc.
[0144] Please refer to Figure 6 , Figure 6 which schematically shows the hardware structure of an electronic device according to another embodiment. The electronic device includes:
[0145] A processor 601, which can be implemented in ways such as a general-purpose CPU (Central Processing Unit), a microprocessor, an Application Specific Integrated Circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0146] A memory 602, which can be implemented in forms such as a Read Only Memory (ROM), a static storage device, a dynamic storage device, or a Random Access Memory (RAM). The memory 602 can store an operating system and other application programs. When implementing the technical solutions provided in the embodiments of this specification through software or firmware, the relevant program codes are stored in the memory 602 and are called by the processor 601 to execute the request response method of the embodiments of the present application;
[0147] An input / output interface 603, which is used to implement information input and output;
[0148] A communication interface 604, which is used to implement communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.);
[0149] A bus 605, which transmits information between various components of the device (such as the processor 601, the memory 602, the input / output interface 603, and the communication interface 604);
[0150] Among them, the processor 601, the memory 602, the input / output interface 603, and the communication interface 604 achieve communication connections with each other inside the device through the bus 605.
[0151] The embodiments of the present application also provide a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned request response method is implemented.
[0152] As a non-transitory computer-readable storage medium, the memory can be used to store non-transitory software programs and non-transitory computer-executable programs. In addition, the memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories can be connected to the processor through a network. Examples of the above networks include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0153] In the request response method, apparatus, electronic device, and medium provided by the embodiments of the present application, when the server obtains a first function usage request sent by a first client and performs logical processing corresponding to the target function to obtain a response result of the target function, the server obtains a result code and description information that match the response result of the target function from a pre-configured mapping relationship, so that the same response result can be reused in multiple places with only one configuration in different function requests. Specifically, the server has loaded a plurality of response results, together with the corresponding result codes and description information, as the above mapping relationship. When the logical processing is completed and a corresponding result is returned, a response message is directly generated according to the matched result code and description information and sent to the first client.
[0154] Through this unified generation mechanism of "result code + description information", the same set of response information can be reused with zero code changes among multiple function requests for different functions, fundamentally reducing the code bloat of the response information caused by repeated response results, significantly reducing the cost of repeated development of response codes, and improving the maintainability and development efficiency of the business system.
[0155] The embodiments described in the embodiments of the present application are for more clearly illustrating the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art will know that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of the present application are equally applicable to similar technical problems.
[0156] Those skilled in the art can understand that the technical solutions shown in the figures do not limit the embodiments of the present application, and may include more or fewer steps than those shown, or combine some steps, or different steps.
[0157] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0158] Those of ordinary skill in the art will understand that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, and their appropriate combinations.
[0159] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of this application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances, so that the embodiments of this application described here can be implemented in an order different from those illustrated or described here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.
[0160] It should be understood that in this application, "at least one (item)" means one or more, and "a plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that there can be three relationships. For example, "A and / or B" can mean: only A exists, only B exists, and both A and B exist at the same time. Among them, A and B can be singular or plural. The character " / " generally means that the associated objects before and after are in an "or" relationship. "At least one (one) of the following" or its similar expression refers to any combination of these items, including any combination of single items (ones) or plural items (ones). For example, at least one (one) of a, b, or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0161] In several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the above-mentioned unit division is only a logical function division. In actual implementation, there can be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces. The indirect coupling or communication connection of devices or units can be in electrical, mechanical, or other forms.
[0162] The units described above as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they may be located in one place or distributed over multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0163] In addition, each functional unit in various embodiments of the present application may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of a software functional unit.
[0164] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes multiple instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in various embodiments of the present application. The foregoing storage medium includes: various media that can store programs such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks, or optical discs.
[0165] The preferred embodiments of the embodiments of the present application have been described above with reference to the drawings, but this does not limit the scope of rights of the embodiments of the present application. Any modifications, equivalent replacements, and improvements made by those skilled in the art without departing from the scope and essence of the embodiments of the present application shall be within the scope of rights of the embodiments of the present application.
Claims
1. A request response method, characterized in that, Applied to the server side, the method includes: Obtain a first function usage request sent by a first client, execute logical processing corresponding to the target function, and obtain a response result of the target function, where the first function usage request is used to request the use of the target function; Obtain a result code and description information that match the response result of the target function from a pre-configured mapping relationship, where the mapping relationship includes multiple response results corresponding to each function in the existing functions of the server side, a result code corresponding to each response result, and description information, and the existing functions include the target function; Generate response information according to the matched result code and description information, and send the response information to the first client.
2. The method according to claim 1, wherein Before obtaining the first function usage request sent by the first client, the method further includes: Obtain configuration information, where the configuration information includes multiple response results of the target function; For each response result in the multiple response results, in the case where the mapping relationship does not include the response result, configure the response result in the mapping relationship, and configure a result code and description information for the response result.
3. The method according to claim 1, wherein The obtaining of the first function usage request sent by the first client includes: Obtain N function usage requests sent by M clients within a first preset duration, where the N function usage requests include the first function usage request, M is a positive integer, N is an integer greater than or equal to M, and the M clients include the first client; The generating of the response information according to the matched result code and description information includes: In the case where N is greater than or equal to a preset number threshold, perform deletion processing on the description information of the response result of the target function to obtain blank information; Generate response information corresponding to the first function usage request according to the blank information and the matched result code.
4. The method according to claim 1, wherein In the mapping relationship, in the case where the response result indicates a response failure, the description information corresponding to the response result includes the reason for the response failure.
5. The method according to claim 1, wherein The mapping relationship further includes multiple multimedia information, each multimedia information corresponds to each result code in the mapping relationship, and the multimedia information is used to instruct the client to generate a prompt picture and a prompt audio, and output the prompt picture and the prompt audio, and the prompt picture and the prompt audio are used to represent the description information of the response result corresponding to the result code of the multimedia information; The obtaining of the result code and description information that match the response result of the target function from the pre-configured mapping relationship includes: Obtain the result code of the response result of the target function from the mapping relationship; Determine the description information and multimedia information corresponding to the response result of the target function in the mapping relationship according to the result code of the response result of the target function; The generating of the response information according to the matched result code and description information includes: Generate response information according to the result code, description information, and multimedia information of the response result of the target function.
6. The method according to claim 1, characterized in that The mapping relationship further includes a plurality of interactive component information, each of the interactive component information corresponding to each result code in the mapping relationship, and the interactive component information is used to instruct the client to generate a target interactive component and display the target interactive component, and the target interactive component is used to obtain interactive information input by the user using the client; The obtaining, from a pre-configured mapping relationship, a result code and description information that match the response result of the target function includes: Obtaining the result code of the response result of the target function from the mapping relationship; Determining, in the mapping relationship, the description information and interactive component information corresponding to the response result of the target function according to the result code of the response result of the target function; The generating response information according to the matched result code and description information includes: Generating response information according to the result code, description information, and interactive component information of the response result of the target function.
7. The method according to claim 1, characterized in that After sending the response information to the first client, the method further includes: Obtaining a second function usage request sent by a second client; When the second function usage request is used to request to use the target function and the time difference between the first time point and the second time point is less than a preset time difference threshold, sending the response information of the first function usage request to the second client; Wherein, the first time point is the time point when the first function usage request is obtained, and the second time point is the time point when the second function usage request is obtained.
8. A request-response device, characterized in that, Applied to a server, the device includes: A first obtaining module, configured to obtain a first function usage request sent by a first client, perform logical processing corresponding to the target function, and obtain a response result of the target function, wherein the first function usage request is used to request to use the target function; A second obtaining module, configured to obtain a result code and description information that match the response result of the target function from a pre-configured mapping relationship, wherein the mapping relationship includes a plurality of response results corresponding to each function in the existing functions of the server, a result code corresponding to each response result, and description information, and the existing functions include the target function; A generating module, configured to generate response information according to the matched result code and description information, and send the response information to the first client.
9. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, the request response method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that When the computer program is executed by the processor, the request response method according to any one of claims 1 to 7 is implemented.