A method and apparatus for acquiring business data
By dynamically encapsulating business interfaces through database configuration tables and SDK clients, the problems of system bloat and high development costs when acquiring different business data are solved, and efficient and unified business data acquisition is achieved.
Patent Information
- Application Number
- CN202210332009.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-30
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2042-03-30
AI Technical Summary
In existing technologies, obtaining different business data requires specific parsing for each business interface, resulting in bloated systems and high development costs.
The system obtains request parameters and return value data uniformly through the database configuration table, and uses the SDK client to dynamically encapsulate business interfaces from the remote database and parse business data based on extraction rules.
It enables unified acquisition of business data under different business scenarios, reducing system complexity and development costs, and improving efficiency.
Smart Images

Figure CN114860716B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method and apparatus for acquiring business data. Background Technology
[0002] In the existing underlying architecture of the operation center, it is necessary to call many interfaces from business parties to obtain business data. However, since the request parameters, return values, and other related configuration information of each business interface are different, specific parsing is required for some businesses to obtain the corresponding business data. If each business is parsed specifically, it will result in system bloat, wasted manpower, and excessively high development costs. Summary of the Invention
[0003] This invention provides a method and apparatus for acquiring business data, which enables the unified acquisition of request parameters and return value data through configuration when different businesses correspond to different request parameters and return value data, thereby enabling the processing of business interfaces and the acquisition of corresponding business data.
[0004] In a first aspect, embodiments of the present invention provide a method for acquiring business data, including:
[0005] Identify the target service and determine the address of the corresponding service interface based on the database configuration table;
[0006] Generate request information for invoking business data based on the request parameters;
[0007] Based on the address of the business interface corresponding to the target business, the request information is sent to the business interface corresponding to the target business to obtain the corresponding return value data;
[0008] Based on the database configuration table, the extraction rules are determined, and the target business data is extracted from the return value data.
[0009] The target service data is encapsulated to generate a data packet, and the data packet is allocated to the target service for consumption.
[0010] According to the business data acquisition method provided in this embodiment of the invention, before determining the target business and determining the address of the business interface corresponding to the target business based on the database configuration table, the method includes:
[0011] The system calls a remote database to obtain configuration information, generates a database configuration table based on the configuration information, and saves it locally. The database configuration table includes a business identifier and the address, request parameters, and extraction rules of the business interface corresponding to the business identifier.
[0012] According to the method for acquiring business data provided in this embodiment of the invention, determining the address of the business interface corresponding to the target business based on the database configuration table includes:
[0013] Based on the database configuration table, the business interface address corresponding to the target business is determined in the remote database through a remote procedure call business interface service.
[0014] According to the method for obtaining business data provided in this embodiment of the invention, the step of generating request information for invoking business data based on the request parameters includes:
[0015] Determine the template corresponding to the request information;
[0016] The request parameters are added to the template to generate the request information.
[0017] According to the method for obtaining business data provided in the embodiments of the present invention, the step of sending the request information to the business interface corresponding to the target business and obtaining the corresponding return value data includes:
[0018] The request information is sent to the business interface corresponding to the target business via the Hypertext Transfer Protocol channel to obtain the corresponding return value data.
[0019] According to the business data acquisition method provided in this embodiment of the invention, the extraction rules include: parsing rules and mapping rules;
[0020] The step of determining extraction rules based on the database configuration table and extracting target business data from the return value data includes:
[0021] Based on the mapping rules, the return value data is deserialized to obtain deserialized data;
[0022] Based on the parsing rules, the deserialized data is filtered to extract the target business data.
[0023] According to the business data acquisition method provided in this embodiment of the invention, the database configuration table further includes: the class corresponding to the return value data;
[0024] The step of encapsulating the target service data to generate a data packet and allocating the data packet to the target service for consumption includes:
[0025] Based on the class corresponding to the return value data, class mapping is performed on the target business data in the return value data to generate the corresponding class data package;
[0026] The data packet is sent to the target service for consumption.
[0027] Secondly, embodiments of the present invention provide a business data acquisition device, comprising: a determining module, a generating module, an acquiring module, an extracting module, and an allocating module. The determining module is used to determine a target business and determine the address of the business interface corresponding to the target business based on a database configuration table; the generating module is used to determine request parameters based on the database configuration table and generate request information for calling business data according to the request parameters; the acquiring module is used to send the request information to the business interface corresponding to the target business according to the address of the business interface corresponding to the target business and obtain corresponding return value data; the extracting module is used to determine extraction rules based on the database configuration table and extract target business data from the return value data; and the allocating module is used to encapsulate the target business data to generate a data packet and allocate the data packet to the target business for consumption.
[0028] Thirdly, an embodiment of the present invention provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, it implements the steps of the business data acquisition method as described in any of the above claims.
[0029] Fourthly, an embodiment of the present invention provides a computer program product, comprising a computer program that, when executed by a processor, implements the steps of the business data acquisition method as described in any of the preceding claims.
[0030] This invention provides a method and apparatus for acquiring business data. The method involves: determining the target business and the address of its corresponding business interface; determining request parameters based on a preset database configuration table; generating request information for calling business data based on the request parameters and the address of the business interface corresponding to the target business; sending the request information to the business interface corresponding to the target business to obtain the corresponding return value data; extracting target business data from the return value data based on rules in the preset database configuration table; performing class mapping on the target business data to generate a corresponding class data packet; and allocating the class data packet to the target business for consumption. This method enables the unified acquisition of request parameters and return value data through configuration, even when different businesses correspond to different request parameters and return value data, thereby allowing for the processing of business interfaces and the acquisition of corresponding business data. Attached Figure Description
[0031] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0032] Figure 1This is a flowchart illustrating a method for acquiring business data according to an embodiment of the present invention;
[0033] Figure 2 This is a schematic diagram illustrating the execution process of a method for acquiring business data provided in an embodiment of the present invention;
[0034] Figure 3 This is a flowchart illustrating a method for acquiring business data according to an embodiment of the present invention;
[0035] Figure 4 This is a schematic diagram of the structure of a business data acquisition device provided in an embodiment of the present invention;
[0036] Figure 5 This is a schematic diagram of the physical structure of an electronic device provided in this disclosure. Detailed Implementation
[0037] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0038] In existing technologies, obtaining business data from different business processes requires calling the corresponding business interfaces for each business. Since the request parameters, return values, and other configuration information of each business interface are different, different parsing is needed for each business to obtain the corresponding business data. This invention provides a pre-packaged SDK client that, when calling a business interface, first retrieves relevant configurations from a remote database, dynamically encapsulates the request parameters and return values of the business interface, and parses out the desired business data based on extraction rules.
[0039] SDK stands for Software Development Kit, a collection of development tools used to build application software for specific software packages, software frameworks, hardware platforms, operating systems, etc. It can provide application programming interface file information for a programming language or configuration information for a business interface for a specific business.
[0040] Reference Figure 1 The above is a flowchart illustrating a method for acquiring business data according to an embodiment of the present invention, including:
[0041] 110. Determine the target business and, based on the database configuration table, determine the address of the business interface corresponding to the target business.
[0042] In this step, the target service is the functional service of the application running on the terminal. Depending on the application scenario, the target service can be any service, such as a service to find a person, a service to find a time, a service to receive a task completion callback, etc.
[0043] The database configuration table is used to store configuration information for relevant business interfaces.
[0044] The address of the service interface refers to the address used to receive access requests for different services sent by the terminal.
[0045] 120. Determine the request parameters based on the database configuration table, and generate request information for calling business data based on the request parameters.
[0046] In this step, the database configuration table is used to store the configuration information of the relevant business interfaces, and the request parameters of the business interface corresponding to the target business are determined based on the configuration information of the business interface in the database configuration table.
[0047] The request information for accessing business data refers to the request information that has been filled with parameters and can directly access the corresponding business interface.
[0048] 130. Based on the address of the business interface corresponding to the target business, send the request information to the business interface corresponding to the target business and obtain the corresponding return value data.
[0049] In this step, the request information, which is filled with parameters and can directly access the business interface, is sent to the business interface corresponding to the target business. The server or terminal will respond to the received request information, and the response will contain return value data, thereby obtaining the corresponding return value data.
[0050] 140. Based on the database configuration table, determine the extraction rules and extract the target business data from the returned value data.
[0051] In this step, the extraction rules refer to the extraction rules for relevant business interfaces in the database configuration table. These extraction rules are used to extract the target business data corresponding to the target business from the obtained return value data.
[0052] 150. Encapsulate the target business data to generate a data packet, and then allocate the data packet to the target business for consumption.
[0053] In this step, encapsulation refers to hiding the object's attributes and implementation details, exposing only the interface to the outside world, and controlling the access level for reading and modifying attributes in the program; combining the abstracted data, behaviors, or functions, that is, combining the data with the source code that operates on the data, to form a whole, and the formed whole is called a data package.
[0054] Correspondingly, allocating data packets to target services for consumption refers to assigning the acquired data packets to the target services so that the target services can access, query, or process the data packets.
[0055] This invention provides a method for acquiring business data, which involves: determining the target business and the address of the corresponding business interface; determining request parameters based on a preset database configuration table; generating request information for calling business data based on the request parameters and the address of the business interface corresponding to the target business; sending the request information to the business interface corresponding to the target business to obtain the corresponding return value data; extracting target business data from the return value data based on rules in the preset database configuration table; performing class mapping on the target business data to generate a corresponding class data package; and allocating the class data package to the target business for consumption. This method enables the unified acquisition of request parameters and return value data through configuration, even when different businesses correspond to different request parameters and return value data, thereby allowing for the processing of business interfaces and the acquisition of corresponding business data.
[0056] Based on any of the above embodiments, the steps preceding step 110 include:
[0057] The system calls a remote database to obtain configuration information, generates a database configuration table based on the configuration information, and saves it locally. The database configuration table includes a business identifier and the address, request parameters, and extraction rules of the business interface corresponding to the business identifier.
[0058] In this step, calling a remote database enables databases to interconnect and interoperate in a network environment. Configuration information is stored in the remote database, and by calling the database, the configuration information can be retrieved.
[0059] Correspondingly, the remote database can be accessed via a GET request from the SDK client.
[0060] Business identifiers, also known as identity identifiers (id, identification), are used to distinguish different businesses. Examples include internal comment business identifiers, notification business identifiers, sharing business identifiers, and messaging business identifiers.
[0061] In one embodiment of the present invention, taking a "find a person" service as an example, the "find a person" service refers to the task center needing to find the corresponding agent when creating a task. The specific process is as follows: A database configuration table is generated, storing relevant configuration information for the "find a person" service, including the address of the corresponding business interface, request parameters, and extraction rules. The request information for calling business data is determined based on the request parameters in the database configuration table; the determined request information is sent to the "find a person" service interface based on the business interface address, and the return value data is obtained; the business data is extracted from the request information according to the extraction rules in the database configuration table, that is, the corresponding agent list data is extracted; the agent list data is encapsulated into a data packet and allocated to the "find a person" service; then, the agent corresponding to the task creation is searched in the agent list, completing the "find a person" service.
[0062] In another embodiment of the present invention, taking the business of finding a time as an example, the business of finding a time refers to the job center needing to find the corresponding scheduled start time of a task when creating a task. The specific process is as follows: A database configuration table is generated, storing relevant configuration information for the business of finding a time, including the address of the corresponding business interface, request parameters, and extraction rules. The request information for calling business data is determined based on the request parameters in the database configuration table; the determined request information is sent to the business interface of finding a time based on the address of the business interface, and the return value data is obtained; the business data, that is, the corresponding scheduled start time data, is extracted from the request information according to the extraction rules in the database configuration table; the scheduled start time data is encapsulated into a data packet and allocated to the business of finding a time; then, the scheduled start time is matched with the task creation time to complete the time finding service.
[0063] Based on any of the above embodiments, step 110 specifically includes:
[0064] Based on the database configuration table, the business interface address corresponding to the target business is determined in the remote database through a remote procedure call business interface service.
[0065] In this step, Remote Procedure Call (RPC) refers to calling business interface services as if they were local services.
[0066] The remote database stores various types of services, each corresponding to a different service interface. Therefore, based on the target service, the corresponding service interface is determined in the remote database, and the relevant service data is obtained through the interface. Based on any of the above embodiments, step 120 specifically includes the following steps S121 to S122:
[0067] S121. Determine the template corresponding to the request information.
[0068] In this step, the template refers to a class with a specific format that can receive request information. This specific format class can be the RestTemplate class.
[0069] Correspondingly, the RestTemplate class is the core class in Spring for accessing RESTful services through clients. It is a template class provided by Spring that can provide highly encapsulated interfaces, making it very convenient to call the interfaces.
[0070] S122. Add the request parameters to the template to generate the request information.
[0071] In this step, the request parameters of the target business are added to the obtained RestTemplate, and the generated request information is the request information for calling the target business data.
[0072] Based on any of the above embodiments, step 130 specifically includes:
[0073] The request information is sent to the business interface corresponding to the target business through the Hypertext Transfer Protocol channel to obtain the corresponding return value data.
[0074] In this step, the Hypertext Transfer Protocol (HTTP) can be used. HTTP is the protocol for transferring hypertext to the local browser. HTTP operates on a client-server architecture; the browser can send requests to the server via HTTP, and the server, based on the received request, sends a response to the client.
[0075] Specifically, the return value data type can be ModeAndView, String, or Void. ModeAndView refers to the view name plus data. String refers to the returned view name, which will be concatenated with the prefix and suffix in the view resolver to form the complete view name. Void refers to situations where, after receiving a request, it is not necessary to return a view in response; in this case, the return value data type is Void.
[0076] Based on any of the above embodiments, the extraction rules include: parsing rules and mapping rules, and step 140 specifically includes the following steps S141 to S142:
[0077] S141. Based on the mapping rules, the return value data is deserialized to obtain deserialized data.
[0078] In this step, the mapping rule refers to a rule for mapping specific fields in the return value data of the business.
[0079] Deserialization refers to the process of restoring returned data into an object. The purpose of deserialization is to reconstruct the object based on the object's state and descriptive information stored in the returned data.
[0080] Specifically, in one embodiment of the present invention, the return value data is deserialized to obtain deserialized data in JSON format.
[0081] S142. Based on the parsing rules, filter the deserialized data and extract the target business data.
[0082] In this step, the parsing rule refers to a rule that filters out a specific set of data from the deserialized data of the business interface.
[0083] Specifically, JsonPath can be used to parse deserialized data and obtain the target business data from the deserialized data.
[0084] The target business data refers to data related to the target business. The deserialized data includes various types of data, not just those related to the target business. Therefore, by executing step S142, the target business-related data can be extracted from the deserialized data and applied to subsequent steps.
[0085] Based on any of the above embodiments, the database configuration table further includes: the class corresponding to the return value data, and step 150 specifically includes the following steps S151 to S152:
[0086] S151. Based on the class corresponding to the return value data, perform class mapping on the target business data in the return value data to generate the corresponding class data package.
[0087] In this step, class mapping can be implemented using the Class class. Specifically, the Class class defines the implementation of a particular class in the Java language. A class definition includes member variables, member methods, and the interfaces that the class implements. The Class class contains multiple objects, which are used to represent classes and interfaces in the currently running Java application.
[0088] In this step, the target business data in the return value data is mapped as an object to the corresponding class, generating the corresponding class data package.
[0089] S152. Send the class data packet to the target business for consumption.
[0090] In this step, consumption refers to allocating the acquired data packets to the target service so that the target service can access, query, or process the data packets.
[0091] Furthermore, this embodiment of the invention also discloses a method for acquiring business data, used in an SDK client, see [link to relevant documentation]. Figure 2 and Figure 3 , Figure 2 This is a schematic diagram illustrating the execution process of a method for acquiring business data provided in an embodiment of the present invention. Figure 3 This is a flowchart illustrating a method for acquiring business data according to an embodiment of the present invention. Figure 2 This includes: database configuration table 210, request parameters 220, request information 230, return value data 240, deserialized data 250, target business data 260, and class data packet 270. (Through...) Figure 3 The specific steps are explained in detail, including:
[0092] 310. Determine the target business and, based on the database configuration table, determine the address of the business interface corresponding to the target business.
[0093] Taking a business whose target business is finding people as an example, the address of the business interface corresponding to the business of finding people is determined based on the database configuration table.
[0094] Before proceeding to step 310, the SDK client needs to call the remote database via the GET method to obtain the relevant configuration information corresponding to the business interface of the person search service. Based on the configuration information, a database configuration table is generated and saved locally. The database configuration table includes the business identifier and the address of the business interface corresponding to the business identifier, request parameters, and extraction rules.
[0095] 320, Determine the template corresponding to the request information.
[0096] A template is a class with a specific format, and the RestTemplate class can be used in this embodiment of the invention.
[0097] 330. Determine the request parameters based on the database configuration table, add the request parameters to the template, and generate request information.
[0098] Add the request parameters for the "Find People" service to the obtained RestTemplate class. The generated request information will be the request information that allows direct access to the "Find People" service interface.
[0099] 340. Based on the address of the business interface corresponding to the person-finding service, send the request information to the business interface corresponding to the person-finding service to obtain the corresponding list of people to be done.
[0100] 350. Based on the mapping rules, the list of people to be done is deserialized to obtain the list of people to be done in JSON format.
[0101] 360 uses parsing rules to filter JSON-formatted to-do list data and extracts agent data corresponding to the person-finding service from the JSON-formatted to-do list data.
[0102] The JSON-formatted to-do list data includes agent data corresponding to various services, not just those related to the "find someone" service. Therefore, by performing step 360, the agent data corresponding to the "find someone" service can be extracted from the JSON-formatted to-do list data and applied to subsequent steps.
[0103] 370. Map the agent data corresponding to the person-finding service as an object to the corresponding Class class to generate a class data package.
[0104] 380, send the data packet to the person-finding service for consumption.
[0105] Consumption refers to the business of finding people and accessing, querying or processing data packets.
[0106] Based on any of the above embodiments, refer to Figure 4 This is a schematic diagram of a business data acquisition device provided in an embodiment of the present invention. The device includes: a determination module 410, a generation module 440, an acquisition module 430, an extraction module 440, and an allocation module 450.
[0107] The determination module 410 is used to determine the target service and to determine the address of the service interface corresponding to the target service based on the database configuration table.
[0108] The generation module 440 is used to generate request information for calling business data based on the request parameters.
[0109] The acquisition module 430 is used to send the request information to the business interface corresponding to the target business based on the address of the business interface corresponding to the target business, and obtain the corresponding return value data.
[0110] Extraction module 440 is used to determine extraction rules based on the database configuration table and extract target business data from the return value data.
[0111] The allocation module 450 is used to encapsulate the target business data into data packets and allocate the data packets to the target business for consumption.
[0112] This invention provides a business data acquisition device that determines the target business and the address of the corresponding business interface; determines request parameters based on a preset database configuration table; generates request information for calling business data based on the request parameters and the address of the business interface corresponding to the target business; sends the request information to the business interface corresponding to the target business to obtain the corresponding return value data; extracts the target business data from the return value data based on rules in the preset database configuration table; performs class mapping on the target business data to generate a corresponding class data packet; and allocates the class data packet to the target business for consumption. This device enables the unified acquisition of request parameters and return value data through configuration when different businesses correspond to different request parameters and return value data, thereby allowing for the processing of business interfaces and the acquisition of corresponding business data.
[0113] Based on any of the above embodiments, before the determining module 410, the device further includes a calling module, which is used to call a remote database, obtain configuration information, generate a database configuration table based on the configuration information and save it locally. The database configuration table includes a service identifier and the address, request parameters and extraction rules of the service interface corresponding to the service identifier.
[0114] Based on any of the above embodiments, the determining module 410 is specifically used for:
[0115] Based on the database configuration table, the business interface address corresponding to the target business is determined in the remote database through a remote procedure call business interface service.
[0116] Based on any of the above embodiments, the generation module 420 is specifically used for:
[0117] Determine the template corresponding to the request information.
[0118] The request parameters are added to the template to generate the request information.
[0119] Based on any of the above embodiments, the acquisition module 430 is specifically used for:
[0120] The request information is sent to the business interface corresponding to the target business via the Hypertext Transfer Protocol channel to obtain the corresponding return value data.
[0121] Based on any of the above embodiments, the extraction rules include: parsing rules and mapping rules.
[0122] The extraction module 440 is specifically used for:
[0123] Based on the mapping rules, the return value data is deserialized to obtain deserialized data.
[0124] Based on the parsing rules, the deserialized data is filtered to extract the target business data.
[0125] Based on any of the above embodiments, the database configuration table also includes: the class corresponding to the return value data.
[0126] The allocation module 450 is specifically used for:
[0127] Based on the class corresponding to the return value data, class mapping is performed on the target business data in the return value data to generate the corresponding class data package.
[0128] The data packet is sent to the target service for consumption.
[0129] Figure 5 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 5 As shown, the electronic device may include a processor 510, a communication interface 520, a memory 530, and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other via the communication bus 540. The processor 510 can call logical instructions in the memory 530 to execute a method for acquiring business data. This method includes: targeting a business; determining the address of the business interface corresponding to the target business based on a database configuration table; determining request parameters based on the database configuration table; generating request information for invoking business data according to the request parameters; sending the request information to the business interface corresponding to the target business based on the address of the business interface corresponding to the target business; obtaining corresponding return value data; determining extraction rules based on the database configuration table; extracting target business data from the return value data; encapsulating the target business data to generate a data packet; and allocating the data packet to the target business for consumption.
[0130] Furthermore, the logical instructions in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of this disclosure, essentially, or the parts that contribute to the prior art, or parts of the technical solutions, can be embodied in the form of software products. These computer software products are stored in a storage medium and include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0131] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute a method for acquiring business data provided by the above methods. The method includes: determining a target business; determining the address of the business interface corresponding to the target business based on a database configuration table; determining request parameters based on the database configuration table; generating request information for calling business data according to the request parameters; sending the request information to the business interface corresponding to the target business according to the address of the business interface corresponding to the target business; obtaining corresponding return value data; determining extraction rules based on the database configuration table; extracting target business data from the return value data; encapsulating the target business data to generate a data packet; and allocating the data packet to the target business for consumption.
[0132] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements a method for acquiring business data provided by the methods described above. This method includes: determining a target business; determining the address of a business interface corresponding to the target business based on a database configuration table; determining request parameters based on the database configuration table; generating request information for calling business data according to the request parameters; sending the request information to the business interface corresponding to the target business according to the address of the business interface corresponding to the target business; obtaining corresponding return value data; determining extraction rules based on the database configuration table; extracting target business data from the return value data; encapsulating the target business data to generate a data packet; and allocating the data packet to the target business for consumption.
[0133] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0134] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0135] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for acquiring business data, characterized in that, include: Identify the target business and determine the address and request parameters of the corresponding business interface based on the database configuration table; Generate request information for invoking business data based on the request parameters; The step of generating request information for calling business data based on the request parameters includes: determining a template corresponding to the request information; adding the request parameters to the template to generate the request information; wherein, the template includes a class capable of receiving request information; Based on the address of the business interface corresponding to the target business, the request information is sent to the business interface corresponding to the target business to obtain the corresponding return value data; Based on the database configuration table, extraction rules are determined, and target business data is extracted from the return value data. The extraction rules include parsing rules and mapping rules. The process of determining the extraction rules based on the database configuration table and extracting target business data from the return value data includes: deserializing the return value data based on the mapping rules to obtain deserialized data (deserialization refers to the process of restoring the return value data to an object); and filtering the deserialized data based on the parsing rules to extract the target business data. The target business data is encapsulated to generate a data packet, and the data packet is allocated to the target business for consumption; the database configuration table also includes: the class corresponding to the return value data; the step of encapsulating the target business data to generate a data packet and allocating the data packet to the target business for consumption includes: according to the class corresponding to the return value data, performing class mapping on the target business data in the return value data to generate a corresponding class data packet; and sending the class data packet to the target business for consumption.
2. The method for acquiring business data according to claim 1, characterized in that, Before determining the target service and the address of the corresponding service interface based on the database configuration table, the process includes: The system calls a remote database to obtain configuration information, generates a database configuration table based on the configuration information, and saves it locally. The database configuration table includes a business identifier and the address, request parameters, and extraction rules of the business interface corresponding to the business identifier.
3. The method for acquiring business data according to claim 2, characterized in that, The step of determining the address of the business interface corresponding to the target business based on the database configuration table includes: Based on the database configuration table, the business interface address corresponding to the target business is determined in the remote database through a remote procedure call business interface service.
4. The method for acquiring business data according to claim 1, characterized in that, The step of sending the request information to the business interface corresponding to the target business and obtaining the corresponding return value data includes: The request information is sent to the business interface corresponding to the target business via the Hypertext Transfer Protocol channel to obtain the corresponding return value data.
5. A device for acquiring business data, characterized in that, include: The determination module is used to determine the target service and to determine the address of the service interface corresponding to the target service based on the database configuration table; The generation module is used to determine the request parameters based on the database configuration table and generate request information for calling business data according to the request parameters. The step of generating request information for calling business data based on the request parameters includes: determining a template corresponding to the request information; adding the request parameters to the template to generate the request information; wherein, the template includes a class capable of receiving request information; The acquisition module is used to send the request information to the business interface corresponding to the target business according to the address of the business interface corresponding to the target business, and obtain the corresponding return value data; An extraction module is used to determine extraction rules based on the database configuration table and extract target business data from the return value data. The extraction rules include parsing rules and mapping rules. Determining the extraction rules based on the database configuration table and extracting target business data from the return value data includes: performing deserialization processing on the return value data based on the mapping rules to obtain deserialized data; deserialization refers to the process of restoring the return value data into an object; and filtering the deserialized data based on the parsing rules to extract the target business data. The allocation module is used to encapsulate the target business data to generate a data packet and allocate the data packet to the target business for consumption. The database configuration table also includes: the class corresponding to the return value data. Encapsulating the target business data to generate a data packet and allocating the data packet to the target business for consumption includes: performing class mapping on the target business data in the return value data according to the class corresponding to the return value data to generate a corresponding class data packet; and sending the class data packet to the target business for consumption.
6. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the business data acquisition method as described in any one of claims 1 to 4.
7. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the business data acquisition method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Server, message processing method, and computer readable storage medium
CN109194495A
Service data processing method, server and storage medium
CN111026797A