Data response publishing method, storage medium and electronic equipment
By setting a field mapping information table in the business service system and configuring the mapping relationship between the request ID and the business field, the problem of long data query time in the business service system is solved, and efficient data response and secure data access are achieved.
Patent Information
- Application Number
- CN202510253922.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-05
- Publication Date
- 2025-05-23
AI Technical Summary
In the existing business service system, with the increase of business functions and the increase of business parties, the frequency of data query increases, resulting in a longer data query time and cannot meet the frequent data request needs of business parties.
By setting the field mapping information table, the mapping relationship between the request ID and the service field is configured, and the field values of the required service field are obtained from the current cache and some databases, reducing the number of database queries.
It realizes accurate data response to business parties, reduces the number of database queries, improves the efficiency of data release response, meets the frequent data request needs of multiple business parties, and improves the security of business data.
Smart Images

Figure CN120030049A_ABST
Abstract
Description
Background Art
[0002] In the existing business service system, each business party connected to the system usually needs to obtain different business field data from the system to complete the corresponding business functions. At the same time, different business fields are usually stored in different databases. Therefore, in order to facilitate management, the existing business service system usually provides an API interface for the business party, and uses the API interface to query the cache or database to allow the business party to obtain the corresponding business field content. However, the content returned by the API interface is usually fixed, so in order to ensure that each business party can fully obtain the business field content they need, the API interface is usually set to return the full set of business fields each time, and then the business party can select the business field they need for use.
[0003] However, as business functions increase, the number of business parties connected to the business service system will gradually increase, the frequency of querying business data will increase, the number of databases in the business service system will increase, and the reference chain between databases will become more complex and lengthy. As a result, the existing data publishing method of querying the full database through the API interface will cause the data query time to increase, which will in turn reduce the timeliness of data publishing and fail to meet the frequent data request needs of business parties. Summary of the invention
[0004] In view of the above technical problems, the technical solution adopted by the present invention is:
[0005] According to one aspect of the present invention, a data response publishing method is provided, the method comprising the following steps:
[0006] According to the generation source type corresponding to the request ID, determine the operation type corresponding to the request ID. The operation type includes business request and data update.
[0007] If the operation type is a business request, the first request field set corresponding to the request ID is obtained according to the field mapping information table. The field mapping information table includes mapping configuration information between the request ID and the business field requested by the request ID. The first request field set is a true subset of the corresponding business field set.
[0008] According to each request field included in the first request field set corresponding to the request ID, a field value corresponding to each request field is obtained from the current cache.
[0009] If there is an empty set of field values for any requested field in the current cache, the corresponding field value is obtained from the database to which the requested field belongs.
[0010] The field values obtained from the current cache and the corresponding database are spliced to the corresponding business field positions to form response data, and published to the terminal corresponding to the request ID.
[0011] According to a second aspect of the present invention, there is provided a non-transitory computer-readable storage medium storing a computer program, which implements the above-mentioned data response publishing method when executed by a processor.
[0012] According to a third aspect of the present invention, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned data response publishing method when executing the computer program.
[0013] The present invention has at least the following beneficial effects:
[0014] Since the business fields used by various types of businesses are usually fixed in actual use, this application configures the mapping relationship between the unique identity ID (that is, the request ID) and the corresponding business field for each business request by setting up a field mapping information table. In this way, the required business fields can be configured more accurately and flexibly for each type of business. In addition, when responding to the corresponding business request, it is only necessary to obtain and publish the field values of each business field from the current cache and the corresponding part of the database to meet the actual use requirements of the business.
[0015] Compared with the existing method of querying the full amount of business data through an interface and publishing a response, the solution in this application can more accurately query and obtain some of the business fields required for the request, thereby significantly reducing the number of queries accessing the database to improve the efficiency of data publishing responses, thereby meeting the needs of frequent data requests from multiple business parties in a large service system.
[0016] In addition, in this application, through the control of the field mapping information table, the response data obtained by each business party only contains the business fields that can be viewed within its authority, that is, some business fields configured in advance, and cannot obtain all business field data of the entire business. In this way, the security of business data can be improved to prevent business data from being leaked or stolen. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0018] Figure 1A schematic diagram of the connection structure of the business service system provided by an embodiment of the present invention;
[0019] Figure 2 A schematic diagram of a flow chart of a data response publishing method provided by an embodiment of the present invention;
[0020] Figure 3 A schematic diagram of a flow chart of a dual-channel data consistency maintenance method provided by an embodiment of the present invention;
[0021] Figure 4 A flowchart of a service field updating method provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0022] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0023] Each method disclosed in the present invention is to solve relevant technical problems in the business service system. Specifically, in this embodiment, the business service system can be a comprehensive service system for processing flight-related business information. The system includes a data response publishing module, a cache, multiple business databases, a business dynamic event publishing module, a field mapping configuration module, and a storage update module. The communication connection between the above modules is shown in FIG. Figure 1 As shown. Multiple business databases store and maintain the business field data required for each business respectively, and multiple business databases are connected to the cache for communication. Therefore, during the business operation, the required business data can be temporarily stored in the cache to improve the query acquisition speed of the business party. The data response publishing module is connected to the cache and multiple business databases for responding to the request of the business party to obtain the corresponding business data and publish it. The business dynamic event publishing module is connected to the cache and multiple business databases through the storage update module for generating update information for the cache and business database according to the operation and change content of the business. A field mapping information table is set in the field mapping configuration module, and the field mapping information table is maintained and updated according to the received change information of the field mapping content. The business dynamic event publishing module is connected to the data response publishing module for communication, and the field mapping configuration module is also connected to the data response publishing module for communication, and is used to support related functions that need to rely on the field mapping information table, that is, to provide the latest field mapping information. The storage update module is used to update the data in the cache and multiple business databases to keep the data in the two storage channels as consistent as possible.
[0024] As a possible embodiment of the present invention, Figure 2 As shown, a data response publishing method is provided, which is mainly executed by a data response publishing module. Specifically, the data response publishing method includes the following steps:
[0025] S100: Determine the operation type corresponding to the request ID according to the generation source type corresponding to the request ID. The operation type includes business request and data update.
[0026] In this embodiment, a unique request ID will be configured in advance for each business party to obtain the corresponding business fields, where each business party corresponds to a sub-business in the entire business, such as business party A only corresponds to the boarding pass information sub-business in a complete flight information business. Because the business fields used by various sub-businesses are usually fixed in actual use, such as in the sub-business corresponding to the flight boarding pass, the main business fields required basically include: passenger name, date of boarding, destination, departure place, boarding time, seat number and boarding gate and other business fields. Therefore, this application can fix the mapping relationship between the request ID and the corresponding business field by setting a field mapping information table.
[0027] In addition, in this embodiment, in order to enable the service requests generated during the entire flight service operation process to quickly obtain the corresponding service fields in the cache, the corresponding request ID is configured in advance for the initialization event of each flight in the field mapping information table, and a mapping relationship between all service fields included in the flight service and the request ID is established. As a result, the flight initialization event (that is, the service initialization event) can be triggered at the beginning of the start of any flight service, and all service field data required in the service can be stored in the cache. For details, please refer to the method steps S210 to S230, so that the subsequent related service requests can quickly obtain the corresponding service fields from the cache.
[0028] Based on the above configuration method of the request ID, it can be known that in this application, not only the corresponding request ID is configured for each business party, but also the request ID is configured for the business initialization event generated in the business dynamic event publishing module. Therefore, the generation source corresponding to the received request ID of the data response publishing module has two types (business party type and business dynamic event publishing module type), which can be determined based on the information of the data channel for actually obtaining the request ID. Due to the two types of generation sources, the corresponding operations to be performed are also different, so they need to be distinguished.
[0029] The specific mapping information of the request ID and business fields corresponding to each business party and business initialization event is generated according to the following steps:
[0030] S110: Configure a corresponding unique request ID for each type of service request and preset service event. The preset service event includes a service initialization event. The service request and the preset service event are generated by different terminals.
[0031] S120: If the request ID is an ID corresponding to the service request, select some service fields from the entire set of corresponding service fields according to the service fields required by the service request.
[0032] S130: Generate mapping configuration information between the request ID and the corresponding business field in the field mapping information table according to the selected part of the business fields.
[0033] S140: If the request ID is an ID corresponding to a preset business event, then mapping configuration information between the request ID and the full set of business fields in a field mapping information table is generated according to the full set of corresponding business fields.
[0034] Therefore, by configuring different mapping relationships between request IDs and business fields in different ranges for different types of events, the request ID can be identified in later use to simultaneously respond to business requests and update business data in the cache in advance, thereby improving the response speed of business requests.
[0035] S200: If the operation type is a business request, obtain the first request field set corresponding to the request ID according to the field mapping information table. The field mapping information table includes mapping configuration information between the request ID and the business field requested by the request ID. The first request field set is a true subset of the corresponding business field set.
[0036] S300: According to each request field included in the first request field set corresponding to the request ID, a field value corresponding to each request field is obtained from the current cache.
[0037] S400: If there is any requested field whose field value in the current cache is an empty set, the corresponding field value is obtained from the database to which the requested field belongs.
[0038] S500: The field values obtained from the current cache and the corresponding database are spliced to the corresponding business field positions to form response data, and published to the terminal corresponding to the request ID.
[0039] If the operation type is a business request, it is necessary to quickly and accurately return the field values of the business fields required by the corresponding business party. Therefore, this application configures the mapping relationship between the unique identity ID (that is, the request ID) and the corresponding business field for each sub-business request by setting up a field mapping information table. In this way, the required business fields can be configured more accurately and flexibly for each type of sub-business. In addition, when responding to the business request of the corresponding sub-business, it is only necessary to obtain and publish the field values of each business field from the current cache and the corresponding part of the database to meet the actual use requirements of the sub-business. For a small number of business fields that do not exist in the current cache, the corresponding business database is queried again.
[0040] Compared with the existing method of querying the full amount of business data through an interface and publishing a response, the solution in this application can more accurately query and obtain some of the business fields required for the request, thereby significantly reducing the number of queries accessing the database to improve the efficiency of data publishing responses, thereby meeting the needs of frequent data requests from multiple business parties in a large service system.
[0041] At the same time, in this application, through the control of the field mapping information table, the response data obtained by each business party only contains the business fields that can be viewed within its authority, that is, some business fields configured in advance, and cannot obtain all business field data of the entire business. In this way, the security of business data can be improved to prevent business data from being leaked or stolen.
[0042] In addition, in actual use, the usage frequencies of various sub-services in a complete service are not the same. For example, if a part of the sub-services is used very frequently, the request frequency of the corresponding service field of the sub-service is very high. On the contrary, for some sub-services with lower usage popularity, the request frequency of the corresponding service field is very low. In this embodiment, the mapping relationship between the usage request ID and the service field is used to divide the service fields required by different service requests. Therefore, in later use, the service fields with higher usage frequency will be maintained in the cache, while some service fields with lower usage frequency will be deleted, thereby reducing the occupancy of the cache by useless data.
[0043] S210: If the operation type is data update, then obtain the second request field set corresponding to the request ID according to the field mapping information table. The field mapping information table includes mapping configuration information between the request ID and the business field requested by the request ID. The second request field set is the full set of corresponding business fields.
[0044] S220: According to each request field included in the second request field set corresponding to the request ID, obtain a field value corresponding to each request field from the corresponding database.
[0045] S230: Update and store the acquired field value corresponding to each request field in the current cache.
[0046] S210 to S230 can store all the business field data required in any flight business in the cache at the initial start-up of the business, so that subsequent related business requests can quickly obtain the corresponding business fields from the cache.
[0047] Since passengers may take multiple consecutive flights, such as ABC, during their actual travel, the flight information corresponding to the passenger will include information on the same business fields corresponding to multiple adjacent flights. In some sub-businesses, it is necessary to obtain the same business field information of multiple adjacent flights to perform corresponding business calculations. For example, in the insurance sub-business, it is necessary to know the situation of the previous flight to determine whether the current flight is subject to insurance compensation. Therefore, the business field sets corresponding to each flight obtained by the business request have a high degree of similarity. In the prior art, the business fields are distinguished by adding corresponding flight identifiers to different flight business fields, such as the departure field corresponding to flight A is ACF, the departure field corresponding to flight B is BCF, and the departure field corresponding to flight C is CCF. However, the differences between these business fields are still small, and these similar fields are displayed in the form of data sequences in the returned data. Usually, these similar fields are arranged in a concentrated manner due to their similar meanings. Therefore, when the business party uses data of similar fields, it is very easy to make a wrong selection.
[0048] In order to solve the above technical problem, as another possible embodiment of the present invention, S130: generating mapping configuration information between the request ID and the corresponding business field in the field mapping information table according to the selected part of the business fields, including:
[0049] S131: If at least two similar field sets are requested in any type of service request, a scope identifier corresponding to each similar field set is generated. The two similar field sets are service field sets corresponding to two different sub-services in a type of service, and at least some of the requested fields in the two similar field sets are the same. Different similar field sets correspond to different scope identifiers.
[0050] S132: Generate mapping configuration information between the request ID and the corresponding business field in the field mapping information table according to the corresponding relationship between the request ID and each scope identifier, and the corresponding relationship between each scope identifier and the request field included in the corresponding similar field set.
[0051] In this embodiment, the specific configuration form of the similar field set and the single field set in the field mapping information table is shown in Table 1 below:
[0052] Table 1
[0053]
[0054]
[0055] In the above Table 1, the first three columns may be the styles of the field mapping information table in this embodiment, and the last column is only used to illustrate a possible specific style of the two field sets in this embodiment.
[0056] Correspondingly, S500: splicing the field values obtained from the current cache and the corresponding database to the corresponding business field position to form response data, and publishing it to the terminal corresponding to the request ID, including:
[0057] S501: If there is a mapping relationship between the request ID and at least two scope identifiers in the field mapping information table, a first HashMap is generated according to the mapping information between each scope identifier and the request field included in the corresponding similar field set. The first HashMap includes a first-level key-value pair corresponding to each scope identifier, the key of each first-level key-value pair is the corresponding scope identifier, and the value is a second-level key-value pair corresponding to each request field included in the similar field set corresponding to the scope identifier. The key of each second-level key-value pair is a request field in the similar field set, and the value is the field value of the request field.
[0058] Specifically, a possible arrangement of the key-value pairs of the first HashMap is shown in Table 2:
[0059] Table 2
[0060]
[0061] As can be seen from Table 2 above, the first and fourth rows are the keys of the first-level key-value pairs formed by two scope identifiers, the second and third rows are the values corresponding to the first-level key Influence1, and each column in the value is a corresponding second-level key-value pair. The fifth and sixth rows are the second-level key-value pairs corresponding to Influence2.
[0062] S502: Publish the first-level HashMap to the terminal corresponding to the request ID.
[0063] In the present embodiment, by configuring different scope identifiers for similar field sets in the field mapping information table, when returning business field set data with high similarity, different primary key-value pairs can be formed in HashMap according to the scope identifier, and then the same business fields are placed in the primary key-value pairs formed by different scope identifiers. Since the key in HashMap is unique, when the business party obtains the corresponding data, it is necessary to obtain the corresponding data in the key formed in the corresponding scope, thereby further avoiding the misselection of data. In addition, by performing hierarchical storage in HashMap, the same business fields are distributed in different primary key-value pairs respectively, thereby more obviously distinguishing and displaying, to further reduce the possibility of misselection of data.
[0064] In addition, S130: generating mapping configuration information between the request ID and the corresponding business field in the field mapping information table according to the selected part of the business fields, further comprising:
[0065] S133: If a single field set is requested in any type of service request, a basic domain identifier is obtained. Different single field sets correspond to the same basic domain identifier.
[0066] S134: Generate mapping configuration information between the request ID and the corresponding business field in the field mapping information table according to the corresponding relationship between the request ID, the basic domain identifier and the request fields included in the corresponding single field set. Each request field in the single field set is different.
[0067] Correspondingly, S500: splicing the field values obtained from the current cache and the corresponding database to the corresponding business field position to form response data, and publishing it to the terminal corresponding to the request ID, further comprising:
[0068] S503: If there is a mapping relationship between the request ID and the basic domain identifier in the field mapping information table, a second HashMap is generated according to the mapping information between the basic domain identifier and the request field included in the corresponding single field set. The second HashMap includes a primary key-value pair corresponding to the basic domain identifier, the key of the primary key-value pair is the basic domain identifier, and the value is a secondary key-value pair corresponding to each request field in the single field set. The key of each secondary key-value pair is each request field in the single field set, and the value is the field value of the request field.
[0069] S504: Publish the secondary HashMap to the terminal corresponding to the request ID.
[0070] The style of the secondary HashMap in this embodiment is the same as that shown in Table 2 above, and the specific difference is only the difference in the primary key. Therefore, in this embodiment, different data hierarchical structures are set in the HashMap through scope identifiers, so that similar or identical business fields in adjacent flight businesses can be configured into corresponding primary key-value pairs according to actual corresponding relationships, so that similar data can be stored in different hierarchical structures. When the business party later retrieves values from the returned HashMap object, it is necessary to query in the primary key-value pairs corresponding to the corresponding scope identifier, so as to increase the distinction of similar field sets in the returned data. In addition, in order to further increase the distinction, different scope identifiers can also be set to strings with greater distinction to further improve the distinction, so as to avoid the misselection of the business party when using practical data.
[0071] The method in this embodiment is mainly used to ensure the consistency of business data between the cache and multiple business databases in the business service system of this application. Because the business dynamic event publishing module will generate update information for the cache and the business database respectively according to the received business change events, which is used to update the corresponding data storage channel. However, since the business database often also stores and maintains a large amount of data for other businesses, the business database will usually receive a larger amount of update information. At the same time, the update processing speed of the database is slower than the update processing speed of the cache, so it is easy for update events to accumulate. This will lead to inconsistencies in the business data corresponding to the same business field in the cache and the business database in the same business service system, which will easily lead to data errors, resulting in reduced credibility of the data, affecting usage.
[0072] In order to solve the above problem, as another possible embodiment of the present invention, Figure 3 As shown, a dual-channel data consistency maintenance method is also provided, which is mainly implemented by the storage update module. Specifically, the dual-channel data consistency maintenance method includes the following steps:
[0073] W100: According to the change content included in the cache field change information, the field value corresponding to the changed field in the current cache is updated for the first time. The cache field change information is generated by a business change event, which is a change event generated after the business initialization event occurs. The change content includes the changed field and the changed field value.
[0074] The change content included in the cache field change information can be as shown in the following example. For example, if the cache field change information is that the boarding gate of flight A is changed to 22A, the corresponding change content can be DJK: 22A, where DJK is the change field and 22A is the changed field value.
[0075] Prior to W100, the method also included:
[0076] W110: Determine the business event type corresponding to the business dynamic information based on the acquired business dynamic information.
[0077] W120: If the business event type is a field change event, cache field change information and database field change information corresponding to the business dynamic information are generated at the same time. The cache field change information is used to update the data in the current cache. The database field change information is used to update the data in the corresponding database.
[0078] In this embodiment, steps W110 to W120 may be executed by the business dynamic event publishing module, and the generated cache field change information and database field change information may be sent to the cache update module and the update module corresponding to the business database respectively and simultaneously.
[0079] W130: If the business event type is a business initialization event, then obtain the request ID corresponding to the business initialization event according to the field mapping information table. The occurrence time of the business initialization event in the same business is earlier than the occurrence time of the field change event.
[0080] These business change events include not only events where the content of certain business fields of the business has changed, but also business initialization events. At the same time, since the full amount of business data needs to be pulled for cache preheating when receiving the business initialization event, the business dynamic event publishing module is also used to execute W130 to complete the full amount of initial data pulling.
[0081] Of course, W130 can also be executed by the data response publishing module. Specifically, after the business dynamic event publishing module sends the information corresponding to the business initialization event to the data response publishing module, the data response publishing module can treat the information corresponding to the initialization event as a special business request and perform the same subsequent processing as the business request.
[0082] W200: When the secondary update time T2 is reached, the field value corresponding to each changed field is obtained from the corresponding database according to the changed field included in the cache field change information, and the field value corresponding to the changed field in the current cache is updated for the second time. T2 meets the following conditions: T2 = T1 + t1, where T1 is the completion time of the first update, and t1 is the first preset update interval. Preferably, t1∈[5s,60s].
[0083] In this embodiment, the duration of t1 is set to wait for the database to complete processing of the backlog of update events, so as to ensure that the field value corresponding to the changed field pulled from the database is the updated value as much as possible. In this way, repeated modifications to the cache can also be reduced. Therefore, the duration of t1 is usually determined according to the speed at which the database processes the backlog of data in the specific usage scenario.
[0084] Specifically, the second update includes:
[0085] W201: If the field value corresponding to the changed field obtained from the database is the same as the field value corresponding to the changed field in the current cache, the current cache will not be updated.
[0086] W202: If the field value corresponding to the changed field obtained from the database is different from the field value corresponding to the changed field in the current cache, the field value corresponding to the changed field obtained from the database is used to replace the field value corresponding to the changed field in the current cache. At the same time, an alarm message is sent to the corresponding maintenance terminal to remind the data abnormality.
[0087] In this embodiment, when an update event of a field is obtained, update information will be sent to the cache and the corresponding database at the same time. Usually, since the cached data is updated faster, the cache is updated first first. Correspondingly, when the business party obtains data, it also checks the cache first, and then checks the database if the cache does not have it. Therefore, when the business changes, the first update can ensure that the business party can obtain the latest business field data. At the same time, the information in the corresponding database is obtained after a certain delay, thereby ensuring that the field value obtained from the database is also the updated value. Then a secondary update is performed. The role of the secondary update in this embodiment is more inclined to use the data in the database to compare and verify the data in the cache. If they are consistent, no alarm is issued; if they are inconsistent, since the data in the database is usually more accurate and more reliable, the cache is updated using the data in the database and an alarm is issued.
[0088] In the usage scenario of the present application, due to the increase or change of business during actual use, the sub-business types included in the current business will change in different time periods, or the field types required in the same sub-business will change. As a result, the field mapping corresponding to the business request in the field mapping information table will change frequently, which will cause the full set of business fields determined historically to deviate from the full set of business fields actually requested at present, and thus fail to meet the changed query requirements. As a result, in the subsequent business operation process, the data corresponding to some business fields need to be queried from the database again, which will further increase the database's QPS (Queries Per Second) and increase the pressure on the database.
[0089] In order to solve the above technical problem, as another possible embodiment of the present invention, as Figure 4 As shown, a business field updating method is also provided. The method in this embodiment is mainly used to update the business field set U corresponding to the business initialization event in the field mapping information table as shown in Table 1. The method is mainly executed by the field mapping configuration module. The business field updating method includes the following steps:
[0090] G100: When the field mapping change information corresponding to the target business is obtained, according to the changed field mapping information table, the request ID corresponding to each sub-business currently included in the target business in the field mapping information table is used as the ID to be updated. The field mapping information table includes the mapping configuration information between the request ID and the business field requested by the request ID, and each sub-business corresponds to a unique request ID.
[0091] Before G100, the service field update method also includes:
[0092] G110: When a configuration change operation is obtained for the field mapping information table, field mapping change information is generated.
[0093] Specifically, the configuration change operation includes: adding, deleting or modifying the mapping information in the field mapping information table.
[0094] In the later use process, the field mapping relationship will inevitably be adjusted according to the actual business changes. Specifically, the configuration platform in the field mapping configuration module can be used to add, delete or modify the mapping information in the field mapping information table. According to the above change operations, the current field mapping information table maintained in the field mapping configuration module will be updated accordingly to ensure that the changed sub-business can obtain the latest data when making a request.
[0095] However, since the mapping relationship between initialization events and the full set of business fields is also configured in the field mapping information table, once the above-mentioned change operation is performed, the historical full set of business fields U needs to be updated. Otherwise, the data pulled into the cache by business initialization cannot meet the query requirements of all business requests, and it is necessary to query the corresponding database again to obtain data.
[0096] In step G110, the configuration platform may be monitored, and once a configuration change operation on the field mapping information table is obtained, field mapping change information is generated, thereby triggering step G100 to obtain the ID to be updated from the changed field mapping information table.
[0097] G200: According to the changed field mapping information table, obtain the request field set A1, A2, ..., Ai, ..., Af corresponding to each ID to be updated (m) Where Ai is the requested field set corresponding to the ith ID to be updated, and the requested field set consists of all the fields requested to be obtained corresponding to the ID to be updated. (m) is the total number of request IDs corresponding to the target business in the changed field mapping information table. i = 1, 2, ..., f (m) .
[0098] G300: Generate the complete set of fields to be updated Q corresponding to the target business according to the request field set corresponding to each ID to be updated. Q satisfies the following conditions: Q = A1∪A2∪…∪Ai∪…∪Af (m) ;
[0099] In the present invention, duplicate fields existing in the request field set corresponding to each ID to be updated are removed by obtaining a union, thereby generating a new complete set of business fields, namely, the complete set of fields to be updated Q.
[0100] G400: Use all business fields in Q as business update fields, and update and replace the historical fields in the entire set of business fields.
[0101] G400 includes:
[0102] G401: Replace all business fields corresponding to the request ID corresponding to the business initialization event in the changed field mapping information table with business update fields. The business initialization event is used to update the data corresponding to the full set of business fields into the cache when the target business is started.
[0103] Through the method in this embodiment, the configured mapping relationship between the request ID and the business field in the changed field mapping information table is used to generate the request field set corresponding to each request ID, and then the duplicate business fields can be quickly removed by seeking the union method, thereby obtaining the latest business field set Q. Therefore, the business fields included in Q are all business field data that the sub-business will inevitably request to use during the operation of the corresponding business, and do not include business fields that are not used by the current sub-business. In other words, Q is not all the business fields of a certain business stored in the business database, but only the business field data that all business parties currently connected to this business service system need to use. Therefore, when the initialization event pulls data from the business database, only part of the business database will be queried to reduce the number of request accesses to the business database corresponding to the business fields that are not currently needed, so as to reduce the QPS of the corresponding business database.
[0104] In addition, the latest business field set Q will be used to update the historical field set U, so that when the business is started next time, a more comprehensive and accurate business field set can be pulled from the business database and stored in the cache, so that current business requests can basically obtain data from the cache, thereby reducing the number of data queries when responding to business requests, and ultimately reducing the QPS pressure on the database.
[0105] In addition, although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0106] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0107] In an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.
[0108] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as a system, method or program product. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as a "circuit", "module" or "system".
[0109] The electronic device according to this embodiment of the present invention is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0110] The electronic device is presented in the form of a general-purpose computing device. The components of the electronic device may include, but are not limited to: the at least one processor mentioned above, the at least one storage device mentioned above, and a bus connecting different system components (including storage devices and processors).
[0111] The storage stores program codes, which can be executed by the processor, so that the processor executes the steps according to various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification.
[0112] The memory may include readable media in the form of volatile memory, such as random access memory (RAM) and / or cache memory, and may further include read only memory (ROM).
[0113] The storage may also include a program / utility having a set (at least one) of program modules, such program modules including but not limited to: an operating system, one or more application programs, other program modules and program data, each of which or some combination may include the implementation of a network environment.
[0114] The bus may represent one or more of several types of bus structures including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures.
[0115] The electronic device may also communicate with one or more external devices (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may communicate with one or more devices that enable a user to interact with the electronic device, and / or may communicate with any device (e.g., routers, modems, etc.) that enables the electronic device to communicate with one or more other computing devices. Such communication may be performed through an input / output (I / O) interface. Furthermore, the electronic device may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) through a network adapter. The network adapter communicates with other modules of the electronic device through a bus. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.
[0116] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0117] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present invention may also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of the present specification.
[0118] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0119] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0120] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0121] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0122] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to an exemplary embodiment of the present invention, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0123] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0124] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A data response publishing method, characterized in that: The method comprises the following steps: Determine the operation type corresponding to the request ID according to the generation source type corresponding to the request ID; the operation type includes business request and data update; If the operation type is a business request, obtaining a first request field set corresponding to the request ID according to the field mapping information table; The field mapping information table includes mapping configuration information between the request ID and the business field requested by the request ID; The first request field set is a proper subset of the corresponding business field set; According to each request field included in the first request field set corresponding to the request ID, obtaining a field value corresponding to each request field from the current cache; If there is any requested field whose field value in the current cache is an empty set, then the corresponding field value is obtained from the database to which the requested field belongs; The field values obtained from the current cache and the corresponding database are spliced to the corresponding business field positions to form response data, and published to the terminal corresponding to the request ID.
2. The data response publishing method according to claim 1, characterized in that: After determining the operation type corresponding to the request ID, the method further includes: If the operation type is data update, a second request field set corresponding to the request ID is obtained according to the field mapping information table; the field mapping information table includes mapping configuration information between the request ID and the business field requested by the request ID; the second request field set is a full set of corresponding business fields; According to each request field included in the second request field set corresponding to the request ID, obtaining a field value corresponding to each request field from the corresponding database; Update and store the field value corresponding to each requested field obtained into the current cache.
3. The data response publishing method according to claim 2, characterized in that: Before obtaining the generation source type corresponding to the request ID, the method further includes: A corresponding unique request ID is configured for each type of service request and preset service event; the preset service event includes a service initialization event; the service request and the preset service event are generated by different terminals respectively; If the request ID is an ID corresponding to a business request, then selecting some business fields from the corresponding business field set according to the business fields required by the business request; According to the selected part of the business fields, mapping configuration information between the request ID and the corresponding business fields in the field mapping information table is generated.
4. The data response publishing method according to claim 3, characterized in that: After configuring a corresponding unique request ID for each type of service request and preset service event, the method further includes: If the request ID is an ID corresponding to a preset business event, mapping configuration information between the request ID and the full set of business fields in the field mapping information table is generated according to the full set of corresponding business fields.
5. The data response publishing method according to claim 3, characterized in that: According to the selected part of the business fields, mapping configuration information between the request ID and the corresponding business fields in the field mapping information table is generated, including: If at least two similar field sets are requested in any type of service request, a scope identifier corresponding to each similar field set is generated; the two similar field sets are service field sets corresponding to two different sub-services in a type of service, and at least some of the requested fields in the two similar field sets are the same; different similar field sets correspond to different scope identifiers; According to the correspondence between the request ID and each scope identifier, and the correspondence between each scope identifier and the request field included in the corresponding similar field set, the mapping configuration information between the request ID and the corresponding business field in the field mapping information table is generated.
6. The data response publishing method according to claim 5, characterized in that: The field values obtained from the current cache and the corresponding database are spliced to the corresponding business field positions to form response data, and published to the terminal corresponding to the request ID, including: If there is a mapping relationship between the request ID and at least two scope identifiers in the field mapping information table, a first HashMap is generated according to the mapping information between each scope identifier and the request field included in the corresponding similar field set; wherein the first HashMap includes a first-level key-value pair corresponding to each scope identifier, the key of each first-level key-value pair is the corresponding scope identifier, and the value is a second-level key-value pair corresponding to each request field included in the similar field set corresponding to the scope identifier; the key of each second-level key-value pair is a request field in the similar field set, and the value is the field value of the request field; Publish the first-level HashMap to the terminal corresponding to the request ID.
7. The data response publishing method according to claim 3, characterized in that: According to the selected part of the business fields, mapping configuration information between the request ID and the corresponding business fields in the field mapping information table is generated, including: If a single field set is requested in any type of business request, the basic domain identifier is obtained; different single field sets correspond to the same basic domain identifier; Mapping configuration information between the request ID and the corresponding business field in the field mapping information table is generated according to the correspondence between the request ID, the basic domain identifier and the request fields included in the corresponding single field set; each request field in the single field set is different.
8. The data response publishing method according to claim 7, characterized in that: The field values obtained from the current cache and the corresponding database are spliced to the corresponding business field positions to form response data, and published to the terminal corresponding to the request ID, including: If there is a mapping relationship between the request ID and the basic domain identifier in the field mapping information table, a second HashMap is generated according to the mapping information between the basic domain identifier and the request field included in the corresponding single field set; wherein the second HashMap includes a primary key-value pair corresponding to the basic domain identifier, the key of the primary key-value pair is the basic domain identifier, and the value is a secondary key-value pair corresponding to each request field in the single field set; the key of each secondary key-value pair is each request field in the single field set, and the value is the field value of the request field; The secondary HashMap is published to the terminal corresponding to the request ID.
9. A non-transitory computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the data response publishing method according to any one of claims 1 to 8 is implemented.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the data response publishing method according to any one of claims 1 to 8 is implemented.