Data query method and device for scene invocation, computer device and medium

By acquiring scenario permission data and converting query tables to construct query statements, the problem of low accuracy and efficiency in data queries across multiple scenarios was solved, enabling customized data query results and improving the data query function of the financial service platform.

CN117033370BActive Publication Date: 2026-01-23CHINA PING AN LIFE INSURANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310835248.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-07
Publication Date
2026-01-23
Estimated Expiration
2043-07-07

AI Technical Summary

Technical Problem

In multiple scenarios, existing data query methods have low accuracy and efficiency, and sharing query interfaces in different scenarios can easily lead to data redundancy and information leakage, consuming a lot of human resources.

Method used

By obtaining the scenario permission data of the caller, determining the field permissions according to the data permission table, converting the query table into query fields and concatenating them into a query statement in sequence, performing data table query and serialization processing, and realizing customized data query results.

Benefits of technology

It improved the accuracy and efficiency of data queries, avoided data redundancy and leakage, reduced reliance on human resources, and enhanced the reliability of the data query function of the financial service platform.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117033370B_ABST
    Figure CN117033370B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of data query, and more particularly to a data query method and device for scene calling, computer equipment and medium. The method obtains the scene to which the calling party belongs, reads the permission data of the scene from a data permission table, determines the field permission of the scene according to the permission data, obtains a query table, converts the query table into query fields, splices the query fields matched with the field permission according to the field permission to obtain a query statement, queries the data table through the query statement to obtain preliminary query results under each data table, serializes all the preliminary query results to obtain data query results, and the query results can be customized for different scenes to avoid data redundancy and data leakage, without additional consumption of human resources for deployment and maintenance of query interfaces, thereby improving the accuracy and efficiency of data query and the reliability of data query function in a financial service platform.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data query technology, and in particular to a data query method, apparatus, computer equipment, and medium for scene invocation. Background Technology

[0002] With the development of science and technology, data query functions have been widely deployed in financial service platforms. These platforms can be insurance systems, banking systems, transaction systems, order systems, etc. They can support functions such as shopping, social networking, interactive games, and resource transfer, and can also have functions such as applying for loans, credit cards, or purchasing insurance and wealth management products.

[0003] Data query functions can include sub-functions such as policy query, wealth management product query, contract query, and transaction query of financial service platforms. However, in data query tasks, the query interface can only return fixed query fields. When facing multiple scenarios, since the required fields differ in different scenarios, the existing method is usually to deploy different query interfaces to correspond to different scenarios, so as to provide customized queries for different scenarios.

[0004] However, with the rapid expansion of the number of scenario types, different scenarios often cannot share the same query interface. Controlling the returned query fields and data security for new query interfaces requires significant human resources. Even if different scenarios share the same query interface, the fixed query fields returned by the interface can lead to data redundancy and information leakage. Therefore, improving the accuracy and efficiency of data queries in multiple scenarios has become an urgent problem to be solved. Summary of the Invention

[0005] In view of this, embodiments of the present invention provide a data query method, apparatus, computer device and medium for scenario invocation, in order to solve the problem of low accuracy and efficiency of data query in multiple scenarios.

[0006] In a first aspect, embodiments of the present invention provide a data query method for scene invocation, the data query method comprising:

[0007] Obtain the scenario to which the caller belongs, read the scenario's permission data from a preset data permission table, and determine the scenario's field permissions based on the permission data;

[0008] Obtain the query form filled in by the caller, convert the query form into at least two query fields, and according to the field permissions, concatenate the query fields that match the field permissions in a preset order to determine the concatenation result as a query statement;

[0009] The query statement is used to query at least one stored data table to obtain preliminary query results in each data table that match the query statement. All preliminary query results are then serialized to determine the serialized result as the data query result corresponding to the scenario.

[0010] Secondly, embodiments of the present invention provide a data query device for scene invocation, the data query device comprising:

[0011] The permission acquisition module is used to obtain the scenario to which the caller belongs, read the permission data of the scenario from the preset data permission table, and determine the field permissions of the scenario based on the permission data;

[0012] The statement construction module is used to obtain the query form filled in by the caller, convert the query form into at least two query fields, and concatenate the query fields that match the field permissions in a preset order according to the field permissions, and determine the concatenation result as a query statement.

[0013] The data query module is used to query at least one stored data table through the query statement, obtain preliminary query results in each data table that match the query statement, serialize all preliminary query results, and determine the serialization result as the data query result corresponding to the scenario.

[0014] Thirdly, embodiments of the present invention provide a computer device, the computer device including a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the data query method as described in the first aspect.

[0015] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the data query method as described in the first aspect.

[0016] The beneficial effects of the embodiments of the present invention compared with the prior art are as follows:

[0017] The system retrieves the scenario to which the caller belongs, reads the scenario's permission data from a preset data permission table, determines the scenario's field permissions based on the permission data, obtains the query form filled in by the caller, converts the query form into at least two query fields, and concatenates the query fields matching the field permissions in a preset order according to the field permissions. The concatenated result is determined as the query statement. The query statement is used to query at least one stored data table to obtain preliminary query results that match the query statement in each data table. All preliminary query results are serialized, and the serialized result is determined as the data query result corresponding to the scenario. For different scenarios, the query results can be customized simply by setting the data permission table, avoiding data redundancy and data leakage. Moreover, multiple scenarios can share the same interface without the need for additional manpower for deploying and maintaining the query interface, thereby improving the accuracy and efficiency of data queries and enhancing the reliability of data query functions in the financial service platform. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a schematic diagram of an application environment for a data query method for scene invocation provided in Embodiment 1 of the present invention;

[0020] Figure 2 This is a flowchart illustrating a data query method for scene invocation provided in Embodiment 1 of the present invention;

[0021] Figure 3 This is a schematic diagram of the structure of a data query device for scene invocation provided in Embodiment 2 of the present invention;

[0022] Figure 4 This is a schematic diagram of the structure of a computer device provided in Embodiment 3 of the present invention. Detailed Implementation

[0023] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of the invention. However, those skilled in the art will understand that the invention can be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods are omitted so as not to obscure the description of the invention with unnecessary detail.

[0024] It should be understood that, when used in this specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.

[0025] It should also be understood that the term “and / or” as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0026] As used in this specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if [described condition or event] is detected" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once [described condition or event] is detected," or "in response to detection of [described condition or event]."

[0027] Furthermore, in the description of this invention and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0028] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of the invention include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0029] It should be understood that the sequence number of each step in the following embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0030] To illustrate the technical solution of the present invention, specific embodiments are described below.

[0031] The data query method for scene invocation provided in Embodiment 1 of this invention can be applied to, for example... Figure 1In this application environment, the client communicates with the server. The client includes, but is not limited to, handheld computers, desktop computers, laptops, ultra-mobile personal computers (UMPCs), netbooks, cloud terminal devices, and personal digital assistants (PDAs). The server can be a standalone server or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0032] The client and server can be deployed in a financial service platform, which can be an insurance system, a banking system, a transaction system, an order system, etc. The financial service platform can support functions such as shopping, social networking, interactive games, and resource transfer. It can also have functions such as applying for loans, credit cards, or purchasing insurance and wealth management products. The data query functions provided by the server can include sub-functions such as policy query, wealth management product query, contract query, and transaction query of the financial service platform.

[0033] See Figure 2 This is a flowchart illustrating a data query method for scene invocation provided in Embodiment 1 of the present invention. The above data query method can be applied to... Figure 1 The server-side component connects to the client's corresponding computer device to obtain information such as the caller's scenario and the query form filled out by the caller. The client's computer device receives input from the caller, including the scenario, the query form, and the query request. The query request instructs the server to initiate a data query service. The server stores a preset data permission table and a data table. The data permission table is used to determine the permission data corresponding to the caller's scenario, and the data table is used for data querying. Figure 2 As shown, this data query method may include the following steps:

[0034] Step S201: Obtain the scenario to which the caller belongs, read the scenario's permission data from the preset data permission table, and determine the scenario's field permissions based on the permission data.

[0035] The caller can be a user who needs to call the data query service, and the scenario can be a variety of business scenarios of the policy, including claims processing, policy data update, policy photo upload, policy cancellation, policy entry, policy analysis, customer service, filing and registration, etc.

[0036] The data permission table can include permission data corresponding to at least one scenario. The permission data can be used to determine the field permissions for different fields in a scenario. Field permissions can refer to the permissions that can be returned for each preset field when querying data in a scenario.

[0037] Specifically, the caller can directly send a data query request through the computer device corresponding to the client. After the server receives the data query request, the caller inputs the scenario to which the data to be queried belongs to the computer device corresponding to the client. Different scenarios correspond to different permission data. For example, if the data to be queried belongs to the customer service scenario, the field permissions correspond to fields such as customer identity, contact information, and historical policies. If the data to be queried belongs to the policy data update scenario, the field permissions correspond to fields such as policy identifier and policy history information.

[0038] Optionally, the data permission table contains permission data corresponding to at least one preset field for each scenario;

[0039] The scene's permission data is read from the preset data permission table, and the scene's field permissions are determined based on the permission data, including:

[0040] Read the permission data corresponding to each preset field from the data permission table. For any preset field, if the permission data corresponding to the preset field is the first preset value, then determine that the field permission corresponding to the preset field in the scenario is granted.

[0041] If the permission data corresponding to the preset field is the second preset value, then the field permission corresponding to the preset field in the scenario is determined to be no permission.

[0042] Iterate through all preset fields to obtain the field permissions corresponding to each preset field for the scene.

[0043] Among them, the preset field can refer to the identification field corresponding to the data when it is stored. The identification field can be used to represent the attributes of the corresponding data. The attributes can include the customer's identity, contact information, historical policies, policy identification and historical information, etc.

[0044] The first preset value can be used to indicate that the field permission of the preset field is the first permission, and the second preset value can be used to indicate that the field permission of the preset field is the second permission. The first permission can mean having permission, that is, having the permission to return the query data when executing the data query service in the corresponding scenario. The second permission can mean not having permission, that is, not having the permission to return the query data when executing the data query service in the corresponding scenario.

[0045] Specifically, in this embodiment, the first preset value can be set to 1 and the second preset value can be set to 0. If the permission data corresponding to the preset field is 1, it is determined that the field permission corresponding to the preset field in the scenario is "permitted". If the permission data corresponding to the preset field is 0, it is determined that the field permission corresponding to the preset field in the scenario is "no permission".

[0046] The data permission table can be obtained by horizontal isomorphism based on the stored data table. In this embodiment, the data query service can be applied to the policy scenario, so the stored data table is the policy data. The data permission table can be obtained by horizontal isomorphism based on the stored policy data table. Horizontal isomorphism can mean that the instruction data permission table and the stored data table have the same size and use the attribute information of the stored data table. For a single scenario, in the policy data table, one attribute information corresponds to one policy data, while in its horizontally isomorphic data permission table, one attribute information corresponds to one permission data.

[0047] The data permission table can be of size M*N, where M can refer to the number of attribute information categories and N can refer to the number of scene categories. Each element in the data permission table is the permission data. In this embodiment, each element's value is determined between 0 and 1. That is, the data permission table records the permission data of different scenes under different attribute information at the scene level. When different scenes call the data query service, the field permissions of the corresponding scene can be determined, and then the content corresponding to the preset field that needs to be returned as the query result can be determined.

[0048] In this embodiment, the data permission table is obtained through horizontal isomorphism, which enables the data permission table to be updated along with the data table, improving the convenience of updating the data permission table. Furthermore, when calling data query services in different scenarios, it is possible to flexibly determine the preset fields that need to be returned as query results in different scenarios, which facilitates the subsequent return of customized query results and improves the efficiency and accuracy of data query.

[0049] Optionally, after obtaining the scenario to which the caller belongs, it also includes:

[0050] Based on the scenario, assign a scenario identifier to the caller and determine the interface identifier based on the preset interface accessed by the caller;

[0051] After concatenating the scene identifier and the interface identifier, they are matched against a preset interface permission table. If a match is successful, the permission data of the scene is read from a preset data permission table, and the field permissions of the scene are determined based on the permission data.

[0052] The scenario identifier can be used to distinguish different scenarios, the preset interface can refer to the server interface that receives data query requests sent by the caller, and the interface identifier can be used to distinguish different preset interfaces.

[0053] Concatenation can refer to combining scene identifiers and interface identifiers into a single vector to be matched. The interface permission table can include multiple interface permission vectors composed of scene identifiers and interface identifiers. The interface permission vector can be used to indicate that the scene corresponding to the scene identifier in the interface permission vector can perform data query operations within the preset interface corresponding to the interface identifier in the interface permission vector.

[0054] Matching can refer to comparing the vector to be matched with the interface permission vectors in the interface permission table. The comparison results can include matching results and mismatch results. A successful match means that the vector to be matched exists in the interface permission table.

[0055] Specifically, the comparison method can employ distance metrics such as Euclidean distance calculation and cosine similarity calculation. In this embodiment, Euclidean distance calculation is used for comparison. If the vector to be matched is completely identical to an interface permission vector in the interface permission table, the Euclidean distance calculated between the interface permission vector and the vector to be matched is 0, indicating that the comparison result is consistent. If the vector to be matched is not completely identical to an interface permission vector in the interface permission table, the Euclidean distance calculated between the interface permission vector and the vector to be matched is a value greater than 0, indicating that the comparison result is inconsistent. The vector to be matched is then compared with the interface permissions in the interface permission table. The vectors are compared. If any interface permission vector in the interface permission table matches the vector to be matched, the match is successful. In other words, it is allowed to use the preset interface corresponding to the interface identifier in the vector to query data in the scenario corresponding to the scenario identifier in the vector. Conversely, if every interface permission vector in the interface permission table does not match the vector to be matched, the match fails. In other words, it is not allowed to use the preset interface corresponding to the interface identifier in the vector to query data in the scenario corresponding to the scenario identifier in the vector. In this case, the caller needs to reselect the preset interface to be accessed.

[0056] It should be noted that implementers can add verification processes according to the actual situation. In addition to the above-mentioned interface access permission verification, the verification process can also include parameter security verification, data channel and source permission verification, etc., to ensure data security during the data query process.

[0057] In this embodiment, a whitelist verification is performed on the access permissions of the interfaces under the preset interfaces for the scenario. This ensures that the preset interfaces support the data query requests of the corresponding scenarios, and avoids the data query service failing to find the required content or finding the wrong content under the preset interfaces that do not match the scenario, thereby improving the accuracy and efficiency of data query.

[0058] The steps described above—obtaining the scenario to which the caller belongs, reading the scenario's permission data from the preset data permission table, and determining the scenario's field permissions based on the permission data—allow the data query service to retrieve the content of the preset fields to be returned when calling data in different scenarios. This enables customization of the data returned during data queries for different scenarios. Only the data permission table needs to be maintained, allowing different scenarios to share the same general interface. This eliminates the need for frequent setup and maintenance of the data query service interface, improving the efficiency and accuracy of data queries.

[0059] Step S202: Obtain the query form filled in by the caller, convert the query form into at least two query fields, and according to the field permissions, concatenate the query fields that match the field permissions in a preset order to determine the concatenated result as a query statement.

[0060] The query table can include the content information that the caller wants to query, and the query field can refer to the preset field corresponding to the data that the caller wants to query.

[0061] The query field that matches the field permission can be a query field with the required permission. The preset order can be determined according to the position order in the query table. The query statement can be a request statement used to perform data query services.

[0062] Specifically, the query table can be in image or text form. When the query table is in text form, regularization matching can be used to extract the query fields and convert the query table into query fields. When the query table is in image form, text recognition models such as optical character recognition models can be used to perform text recognition on the image corresponding to the query table, and the query fields obtained from the query table can be determined based on the text recognition results.

[0063] It should be noted that when converting a query table into a query field, if there is only one query field, it is not necessary to perform the step of concatenating the query fields that match the field permissions in a preset order to determine the concatenated result as the query statement. Instead, the query field can be used directly as the query statement.

[0064] In this embodiment, the preset order is determined according to the position order in the query table. Typically, each query field corresponds to a table frame in the query table. The position of the table frame can be represented by two-dimensional coordinates. The sum of the horizontal and vertical coordinates of the two-dimensional coordinates is used as the sorting reference. All query fields in the query table are sorted in ascending order of the sum of the horizontal and vertical coordinates to obtain the sorting result. Correspondingly, when query fields that match the field permissions are concatenated in the preset order, the concatenation order also conforms to the sorting result. The concatenation can be done using a join method.

[0065] Optionally, based on field permissions, query fields matching the field permissions can be concatenated in a preset order, including:

[0066] Based on the field permissions corresponding to each preset field in the scenario, filter out at least one preset field with the permission to be used as the target field;

[0067] The query fields that match the target field are identified as query fields that match the field permissions, and the query fields that match the field permissions are concatenated in a preset order.

[0068] The target field can refer to the preset field that needs to be returned when querying data in the corresponding scenario. When matching the target field and the query field, distance measurement methods such as Euclidean distance calculation and cosine similarity calculation can be used for matching.

[0069] Specifically, the field permissions corresponding to each preset field in the scenario are obtained from the data permission table. In this embodiment, the permission data corresponding to the permission is 1, so all preset fields with permission data of 1 are extracted as target fields.

[0070] For any target field, the distance between each query field and the target field is measured. In this embodiment, Euclidean distance is used for distance measurement. Typically, to improve the calculation efficiency of distance measurement, all target fields and all query fields are mapped through a preset word vector mapping table to obtain target word vectors and query word vectors. The Euclidean distance between the target word vectors and query word vectors is then used as the distance measurement result. The preset word vector mapping table can include the mapping relationship between fields and word vectors.

[0071] When the Euclidean distance calculation result is 0, it means that the query field used for the Euclidean distance calculation is completely consistent with the target, that is, the query field and the target field match. Conversely, when the Euclidean distance calculation result is a value greater than 0, it means that the query field used for the Euclidean distance calculation is not completely consistent with the target, that is, the query field and the target field do not match.

[0072] If a query field matches any target field, then the query field is determined to be a query field that matches the field permissions. All query fields that match the field permissions are then concatenated in a preset order, which can be determined based on the sorting results mentioned above.

[0073] In this embodiment, preset fields are filtered to obtain target fields for field matching. This ensures that the query field is only used to determine subsequent query statements when it matches the target field, which means it is only used to control the return of subsequent data queries. This saves computation and allows subsequent data query services to return query data as needed, improving the efficiency and accuracy of data queries.

[0074] Optionally, query fields matching the field permissions can be concatenated in a preset order to determine the concatenated result as a query statement, including:

[0075] Dynamic SQL technology is used to concatenate query fields that match field permissions in a preset order to obtain the concatenated result;

[0076] The concatenated result is determined to be a query statement, which is used to return data query results on demand.

[0077] Dynamic SQL technology refers to the technique of flexibly constructing complete SQL statements based on known information, which is the query field that matches the field permissions.

[0078] Specifically, dynamic SQL technology is a feature of the MyBatis framework, which can refer to a persistence layer framework that supports customized SQL, stored procedures, and advanced mapping. It avoids most of the JDBC code and manual parameter setting and result set retrieval. Simple XML or annotations can be used to configure and map native information, mapping interfaces and Java POJOs (Plain Ordinary Java Objects) to records in the database.

[0079] Dynamic SQL technology provides various tags to assist in generating SQL statements, including tags such as if, choose, when, otherwise, trim, where, set, and foreach. In other words, SQL statements are constructed using these tags.

[0080] In this embodiment, the SQL statement for data query is flexibly concatenated using dynamic SQL technology, which avoids the need for manual construction of query statements. This eliminates the need to consider the cumbersome query statement construction format and allows for flexible concatenation of query statements based on the actual query fields. This enables the subsequent data query results to be returned on demand, improving the accuracy and efficiency of data query.

[0081] Optionally, after reading the scene's permission data from a preset data permission table and determining the scene's field permissions based on the permission data, the process also includes:

[0082] Field permissions, scene identifiers, and interface identifiers are concatenated into query permission data according to a preset second order, and the query permission data is stored in a preset distributed cache component;

[0083] Accordingly, based on field permissions, the query fields that meet the field permissions are concatenated to determine the concatenated result as the query statement, which includes:

[0084] The system reads query permission data from the distributed cache component, concatenates the query fields that match the query permission data in a preset first order, and determines the concatenated result as the query statement.

[0085] The preset second order can refer to the concatenation order of the pre-set field permissions, scene identifiers, and interface identifiers. The query permission data can be used to determine the permissions of data queries for scenes, preset interfaces, and preset fields.

[0086] Distributed caching components can be used to improve the read and write capabilities of data query services. The default first order is the same as the above, which uses the sum of the horizontal and vertical coordinates of a two-dimensional coordinate system as the sorting reference. All query fields in the query table are sorted in ascending order of the sum of the horizontal and vertical coordinates to obtain the sorting result.

[0087] Specifically, in this embodiment, the QS library is used for data querying. The QS library can refer to a query parameter serialization and parsing library. The distributed caching component in the QS library can use Redis as the caching middleware and JVM as the local cache. The local cache can be used as a distributed cache degradation solution, that is, a combination of local cache and distributed cache is used for caching. Since Redis is a single instance mode and not a high availability mode, the distributed cache will be unavailable when Redis fails. At this time, the caching mode can be dynamically switched to the local JVM cache to ensure that the data query service can be used normally.

[0088] In this embodiment, the preset second order is set to concatenate the field permissions, scene identifiers, and interface identifiers in the order of field permissions, scene identifiers, and interface identifiers. It should be noted that there are three control dimensions in the query permission data, namely the scene dimension, system dimension, and interface dimension. There is also a hierarchy among the different control dimensions. In this embodiment, the level of the interface dimension is higher than that of the system dimension, and the level of the system dimension is higher than that of the scene dimension. That is, when performing data query control based on the query permission data, the interface dimension is considered first. If the interface dimension meets the permissions, then the system dimension is considered. Similarly, if the system dimension meets the permissions, then the scene dimension is considered.

[0089] It should be noted that, in this embodiment, the data currently cached within the QS library is not business data, but query permission data, and the data cached in Redis does not have an expiration time logic. Therefore, the distributed cache avalanche scenario does not exist. If an expiration time is added to the cached data later, the avalanche problem needs to be considered. In this case, different cache times can be set according to different management dimensions to make the cache times different, so that the cache time of the cached data that is read more frequently is as long as possible, thereby reducing the pressure on the distributed cache.

[0090] At the same time, when adding cache expiration time logic, it is necessary to handle the problem of distributed cache breakdown. In this case, since cache breakdown occurs because a large number of requests access the key-value pairs of cached data within the expiration time, a large number of requests are simultaneously input into the database after the cache data expires, causing excessive pressure on the database. At this time, access counting logic can be added to the key-value pairs of cached data. When the access volume reaches the threshold within the expiration time, the data in the database is asynchronously loaded into the cache, thereby preventing the distributed cache from being broken down by a large number of requests.

[0091] If there are no changes to the access permissions of QS, that is, the data in the scenario is all static data, there is no need to consider the issue of consistency between distributed caching and database data. If there are changes to the access permissions of QS, a preset solution can be used to solve the issue of consistency between distributed caching and database data.

[0092] In this embodiment, the preset solution may be to add a distributed lock to the key-value pair of the cached data when writing the cached data. If there is a read request, the read request needs to queue on the distributed lock and wait for the cached data to be written before reading the data from the cache.

[0093] In one implementation, the preset solution may refer to a dual-buffer strategy. If there is a cache data update, the latest cache data is stored in the second cache, and the read request is connected to the second cache. The cache data in the first cache is cleared, and the database data is updated. When new cache data is received later, it is stored in the first cache, and the read request is connected to the first cache. The cache data in the second cache is cleared, and the database data is updated. This process is repeated to ensure that the database data is always consistent with the latest cache data.

[0094] If a brief period of dirty reads is permissible during the data query process between the distributed cache and the database (i.e., the data read from the database is inconsistent with the data in the cache), the data in the database can be updated first, and then the data in the cache can be updated.

[0095] In this embodiment, the use of a distributed caching component to cache and retrieve query permission data improves the reading efficiency during the data query process and ensures that each data table can read the same query permission data during subsequent data queries. This avoids conflicts when the same query permission data is applied to multiple data tables, thereby improving the efficiency and accuracy of data queries.

[0096] The steps described above—obtaining the query form filled in by the caller, converting the query form into at least two query fields, concatenating the query fields that match the field permissions in a preset order, and determining the concatenated result as a query statement—can improve development efficiency. Furthermore, since multiple scenarios can use the same preset interface for data querying, it ensures that the number of preset interfaces will not increase. Only the field permissions of different scenarios need to be controlled to support data querying in multiple scenarios, thereby improving the accuracy and efficiency of data querying.

[0097] Step S203: Query at least one stored data table using a query statement to obtain preliminary query results in each data table that match the query statement. Serialize all preliminary query results and determine the serialized results as the data query results corresponding to the scenario.

[0098] The data table can consist of data to be queried stored on the server. The preliminary query result can refer to the result of querying the data table according to the query statement. Serialization processing can be used to serialize the preliminary query result and return it to reduce the amount of data in the query result. The data query result can refer to the query result returned by the data query service to the caller.

[0099] Optionally, all preliminary query results are serialized to determine the serialized results as the data query results corresponding to the scenario, including:

[0100] The Gson serialization framework is used to serialize all preliminary query results to obtain the serialized results.

[0101] The serialization result is determined to be the data query result corresponding to the scenario.

[0102] Among them, the Gson serialization framework can refer to a Java-based library that can be used to serialize Java objects into JSON classes.

[0103] Specifically, the Gson serialization framework provides default mappings for objects that need to be serialized, so there is no need to create additional mappings. Furthermore, the Gson serialization framework has the characteristics of low memory consumption, high speed, and no dependencies. No dependencies means that the Gson serialization framework only requires JDK library support and does not need to call other libraries.

[0104] In this embodiment, the Gson serialization framework is used to control the serialization and return of the initial query results, thereby reducing the data packet size, reducing the pressure on query result storage and transmission, and thus improving the efficiency of data query.

[0105] The above steps involve querying at least one stored data table using a query statement to obtain preliminary query results in each data table that match the query statement, serializing all preliminary query results, and determining the serialized results as the data query results corresponding to the scenario. This enables customized return of data query results for the corresponding scenario, and the use of serialization processing reduces the size of data packets, thereby avoiding data redundancy and data leakage, and improving the accuracy and efficiency of data query.

[0106] In this embodiment, for different scenarios, the query results can be customized simply by setting the data permission table, avoiding data redundancy and data leakage. Moreover, multiple scenarios can share the same interface, without the need for additional human resources to deploy and maintain the query interface, thereby improving the accuracy and efficiency of data query and enhancing the reliability of the data query function in the financial service platform.

[0107] Corresponding to the data query method for scene invocation in the above embodiment, Figure 3A structural block diagram of a data query device for scene invocation provided in Embodiment 2 of the present invention is shown. This data query device is applied to a server, which is connected to a computer device corresponding to the client to obtain the scene to which the caller belongs, the query form filled out by the caller, etc. The computer device corresponding to the client receives input from the caller, including the scene, the query form, and the query request. The query request instructs the server to initiate a data query service. The server stores a preset data permission table and a data table. The data permission table can be used to determine the permission data corresponding to the caller's scene, and the data table can be used for data querying. For ease of explanation, only the parts related to the embodiments of the present invention are shown.

[0108] See Figure 3 The data query device includes:

[0109] The permission acquisition module 31 is used to obtain the scene to which the caller belongs, read the permission data of the scene from the preset data permission table, and determine the field permissions of the scene based on the permission data;

[0110] The statement construction module 32 is used to obtain the query table filled in by the caller, convert the query table into at least two query fields, and concatenate the query fields that match the field permissions in a preset order according to the field permissions to determine the concatenation result as a query statement.

[0111] The data query module 33 is used to query at least one stored data table through a query statement, obtain preliminary query results in each data table that match the query statement, serialize all preliminary query results, and determine the serialized result as the data query result corresponding to the scenario.

[0112] Optionally, the data permission table contains permission data corresponding to at least one preset field for each scenario;

[0113] The aforementioned permission acquisition module 31 includes:

[0114] The first permission determination unit is used to read the permission data corresponding to each preset field from the data permission table. For any preset field, if the permission data corresponding to the preset field is the first preset value, then the field permission corresponding to the preset field in the scenario is determined to be authorized.

[0115] The second permission determination unit is used to determine that if the permission data corresponding to the preset field is the second preset value, the field permission corresponding to the preset field in the scenario is no permission.

[0116] The field traversal unit is used to traverse all preset fields and obtain the field permissions corresponding to each preset field in the scenario.

[0117] Optionally, the above statement construction module 32 includes:

[0118] The field filtering unit is used to filter out at least one preset field with the permission to be used as the target field based on the field permissions corresponding to each preset field in the scenario.

[0119] The field determination unit is used to determine the query fields that match the target field as query fields that match the field permissions, and to concatenate the query fields that match the field permissions in a preset order.

[0120] Optionally, the above statement construction module 32 includes:

[0121] The dynamic concatenation unit is used to concatenate query fields that match field permissions in a preset order using dynamic SQL technology to obtain the concatenation result;

[0122] The statement determination unit is used to determine whether the concatenated result is a query statement, which is used to return data query results on demand.

[0123] Optionally, the above-mentioned data query device also includes:

[0124] The identifier allocation module is used to assign a scenario identifier to the caller based on the scenario, and to determine the interface identifier based on the preset interface accessed by the caller.

[0125] The identifier splicing module is used to splice the scene identifier and the interface identifier, match them in a preset interface permission table, and after a successful match, execute the steps of reading the scene's permission data from a preset data permission table and determining the scene's field permissions based on the permission data.

[0126] Optionally, the above-mentioned data query device also includes:

[0127] The data caching module is used to concatenate field permissions, scene identifiers, and interface identifiers in a preset second order to form query permission data, and store the query permission data in a preset distributed caching component;

[0128] Accordingly, the above statement construction module 32 includes:

[0129] The cache reading unit is used to read query permission data from the distributed cache component, concatenate the query fields that match the query permission data in a preset first order, and determine the concatenated result as the query statement.

[0130] Optionally, the data query module 33 mentioned above includes:

[0131] The serialization processing unit is used to serialize all preliminary query results using the Gson serialization framework to obtain the serialized result.

[0132] The query result determination unit is used to determine whether the serialization processing result is the data query result corresponding to the scenario.

[0133] It should be noted that the information interaction and execution process between the above modules and units are based on the same concept as the method embodiments of the present invention. For details on their specific functions and technical effects, please refer to the method embodiments section, which will not be repeated here.

[0134] Figure 4 This is a schematic diagram of the structure of a computer device provided in Embodiment 3 of the present invention. Figure 4 As shown, the computer device of this embodiment includes: at least one processor ( Figure 4 Only one is shown in the diagram), a memory, and a computer program stored in the memory and executable on at least one processor, wherein the processor executes the computer program to implement the steps in any of the above-described data query method embodiments.

[0135] This computer device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that... Figure 4 The examples of computer devices are merely examples and do not constitute a limitation on computer devices. Computer devices may include more or fewer components than shown in the illustration, or combinations of certain components, or different components, such as network interfaces, displays, and input devices.

[0136] The processor referred to can be a CPU, but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.

[0137] Memory includes readable storage media, internal memory, etc., wherein internal memory can be the RAM of a computer device, providing an environment for the operation of the operating system and computer-readable instructions stored in the readable storage media. The readable storage media can be the hard drive of a computer device, or in other embodiments, it can be an external storage device of the computer device, such as a plug-in hard drive, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card. Furthermore, memory can include both internal storage units and external storage devices of a computer device. Memory is used to store the operating system, applications, bootloader, data, and other programs, such as program code for computer programs. Memory can also be used to temporarily store data that has been output or will be output.

[0138] Those skilled in the art will understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the functions described above can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this invention. The specific working process of the units and modules in the above device can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here. If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention can implement all or part of the processes in the methods of the above embodiments by instructing related hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the above method embodiments. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. A computer-readable medium can include at least: any entity or device capable of carrying computer program code, a recording medium, a computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.

[0139] The present invention can implement all or part of the processes in the methods of the above embodiments, or it can be accomplished by a computer program product. When the computer program product is run on a computer device, the computer device executes the steps in the above method embodiments.

[0140] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0141] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0142] In the embodiments provided by this invention, it should be understood that the disclosed apparatus / computer devices and methods can be implemented in other ways. For example, the apparatus / computer device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0143] 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 units can be selected to achieve the purpose of this embodiment according to actual needs.

[0144] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. 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. Such 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, and should all be included within the protection scope of the present invention.

Claims

1. A data query method for scene invocation, characterized in that, The data query method includes: Obtain the scenario to which the caller belongs, read the scenario's permission data from a preset data permission table, and determine the scenario's field permissions based on the permission data; Obtain the query form filled in by the caller, convert the query form into at least two query fields, and according to the field permissions, concatenate the query fields that match the field permissions in a preset order to determine the concatenation result as a query statement; The query statement is used to query at least one stored data table to obtain preliminary query results in each data table that match the query statement. All preliminary query results are serialized to determine the serialization result as the data query result corresponding to the scenario. The step of reading permission data for the scenario from a preset data permission table and determining the field permissions for the scenario based on the permission data includes: Read the permission data corresponding to each preset field from the data permission table. For any preset field, if the permission data corresponding to the preset field is a first preset value, then determine that the field permission corresponding to the preset field in the scenario is granted. If the permission data corresponding to the preset field is the second preset value, then the field permission corresponding to the preset field in the scenario is determined to be no permission. Iterate through all preset fields to obtain the field permissions corresponding to each preset field for the given scenario; The step of concatenating query fields matching the field permissions in a preset order includes: Based on the field permissions corresponding to each preset field in the scenario, at least one preset field with the permission is selected as the target field. The query field that matches the target field is determined to be the query field that matches the field permission, and the query fields that match the field permission are concatenated in a preset order; The step of concatenating query fields that match the field permissions in a preset order to determine the concatenated result as a query statement includes: Dynamic SQL technology is used to concatenate query fields that match the field permissions in a preset order to obtain the concatenation result; The concatenated result is determined to be the query statement, which is used to return the data query results on demand.

2. The data query method according to claim 1, characterized in that, The data permission table contains permission data for the scenario corresponding to at least one preset field.

3. The data query method according to claim 1, characterized in that, Following the step of obtaining the scenario to which the caller belongs, the following is also included: Based on the scenario, a scenario identifier is assigned to the caller, and an interface identifier is determined based on the preset interface accessed by the caller; After concatenating the scene identifier and the interface identifier, they are matched in a preset interface permission table. If the match is successful, the step of reading the permission data of the scene from the preset data permission table and determining the field permissions of the scene based on the permission data is executed.

4. The data query method according to claim 3, characterized in that, After reading the permission data of the scene from the preset data permission table and determining the field permissions of the scene based on the permission data, the method further includes: The field permissions, the scene identifier, and the interface identifier are concatenated in a preset second order to form query permission data, and the query permission data is stored in a preset distributed cache component. Accordingly, the step of concatenating query fields that meet the specified field permissions and determining the concatenated result as a query statement includes: The query permission data is read from the distributed cache component, and the query fields that match the query permission data are concatenated in a preset first order to determine the concatenated result as the query statement.

5. The data query method according to any one of claims 1 to 4, characterized in that, The step of serializing all preliminary query results and determining the serialized result as the data query result corresponding to the scenario includes: The Gson serialization framework is used to serialize all preliminary query results to obtain the serialized result. The serialization result is determined to be the data query result corresponding to the scenario.

6. A data query device for scene invocation, characterized in that, The data query device includes: The permission acquisition module is used to obtain the scenario to which the caller belongs, read the permission data of the scenario from the preset data permission table, and determine the field permissions of the scenario based on the permission data; The statement construction module is used to obtain the query form filled in by the caller, convert the query form into at least two query fields, and concatenate the query fields that match the field permissions in a preset order according to the field permissions, and determine the concatenation result as a query statement. The data query module is used to query at least one stored data table through the query statement, obtain preliminary query results in each data table that match the query statement, serialize all preliminary query results, and determine the serialization result as the data query result corresponding to the scenario. The permission acquisition module includes: The first permission determination unit is used to read permission data corresponding to each preset field from the data permission table. For any preset field, if the permission data corresponding to the preset field is a first preset value, then the field permission corresponding to the preset field in the scenario is determined to be authorized. The second permission determination unit is used to determine that the field permission corresponding to the preset field in the scenario is no permission if the permission data corresponding to the preset field is a second preset value. The field traversal unit is used to traverse all preset fields and obtain the field permissions corresponding to each preset field for the scenario. The statement construction module includes: The field filtering unit is used to filter out at least one preset field with permission as the target field based on the field permissions corresponding to each preset field in the scenario. A field determination unit is used to determine the query field that matches the target field as the query field that matches the field permission, and to concatenate the query fields that match the field permission in a preset order; The statement construction module includes: The dynamic concatenation unit is used to use dynamic SQL technology to concatenate query fields that match the field permissions in a preset order to obtain the concatenation result; The statement determination unit is used to determine that the concatenated result is the query statement, which is used to realize the on-demand return of the data query results.

7. A computer device, characterized in that, The computer device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the data query method as described in any one of claims 1 to 5.

8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the data query method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Data query method and device, and service equipment

    CN111984675A

  • Data processing method and device, server and storage medium

    CN113505121A