Mask data query method, device and equipment

By performing masking rules processing on the query request parameters entered by the user, a query primary key list is generated, and a random mask database is queried, the problem of the inability to query random mask data in the prior art is solved, and an effective matching query for random mask data is realized.

CN112307070BActive Publication Date: 2025-05-13WEBANK (CHINA)
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011320121.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-23
Publication Date
2025-05-13
Estimated Expiration
2040-11-23

AI Technical Summary

Technical Problem

The prior art cannot effectively query the data of the random mask because the fixed mask rule cannot match the mask rule of the random mask data.

Method used

By obtaining the query request parameters entered by the user and the pre-established mask rule set, the query request parameters are processed through the mask rule set, a query primary key list is generated, and the random mask database is used to query the query record.

Benefits of technology

It realizes matching query for random mask data, meets the query requirements of random mask data, and has good applicability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112307070B_ABST
    Figure CN112307070B_ABST
Patent Text Reader

Abstract

The disclosed embodiment provides a method, device and equipment for querying masked data, the method comprising: obtaining at least one query request parameter input by a user; obtaining a pre-established mask rule set, traversing the mask rule set, and processing the at least one query request parameter according to each mask processing rule in the mask rule set to obtain a query primary key; wherein the mask rule set is obtained after performing mask rule processing on multiple random masked data; the query primary keys corresponding to each mask processing rule are formed into a query primary key list; according to the query primary key list, a random mask database constructed according to the multiple random masked data is queried to obtain corresponding query records by matching. This public course embodiment can perform matching queries on random masked data, meet the query requirements of random masked data, and has good applicability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present disclosure relate to the field of financial technology (Finteh), and in particular to a masked data query method, device and equipment. Background Art

[0002] With the development of computer technology, more and more technologies are applied in the financial field. The traditional financial industry is gradually transforming to Fintech (Finteh), and masked data query technology is no exception. However, due to the security and real-time requirements of the financial industry, higher requirements are also placed on masked data query technology.

[0003] In the existing masked data query process, the masking rules of the masked data in the queried database are usually fixed and not random. For example, the middle 4 or 6 digits of the ID card number are masked, and the middle 4 digits of the mobile phone number are masked. At this time, according to the conventional query method, that is, inputting the query parameters with fixed masking rules, the corresponding masked data can be matched.

[0004] However, the inventors have found that the prior art has at least the following technical problems: when the masked data in the queried database is randomly masked data (i.e., the mask starting position is random or the number of mask segments is random), query matching cannot be performed using query parameters with fixed mask rules. Therefore, a method for matching query on randomly masked data is urgently needed. Summary of the invention

[0005] The embodiments of the present disclosure provide a mask data query method, device and equipment, which can perform matching query on randomly masked data, meet the query requirements of randomly masked data, and have good applicability.

[0006] In a first aspect, an embodiment of the present disclosure provides a mask data query method, including:

[0007] Obtain at least one query request parameter input by a user;

[0008] Obtain a pre-established mask rule set, traverse the mask rule set, and process the at least one query request parameter according to each mask processing rule in the mask rule set to obtain a query primary key; wherein the mask rule set is obtained after performing mask rule processing on multiple random mask data;

[0009] The query primary keys corresponding to each mask processing rule are combined into a query primary key list;

[0010] According to the query primary key list, a random mask database constructed according to the plurality of random mask data is queried to obtain corresponding query records through matching.

[0011] In a possible design, the processing of the at least one query request parameter according to each mask processing rule in the mask rule set to obtain the query primary key includes:

[0012] Comparing the mask processing rule with the at least one query request parameter to determine query concatenation parameters corresponding to each query request parameter;

[0013] The query concatenation parameters corresponding to the query request parameters are concatenated to obtain the query primary key.

[0014] In a possible design, each mask processing rule in the mask rule set includes a mapping relationship between a query field name and a mask processing rule;

[0015] Accordingly, comparing the mask processing rule with the at least one query request parameter to determine the query concatenation parameters corresponding to each query request parameter includes:

[0016] If any query request parameter has a corresponding query field name in the mask processing rule, and the corresponding mask processing rule is a null value rule, determining that the first query concatenation parameter corresponding to the query request parameter is an empty string;

[0017] If any query request parameter has a corresponding query field name in the mask processing rule, and the corresponding mask processing rule is a plain text rule, then the parameter plain text corresponding to the query request parameter is determined as the second query splicing parameter;

[0018] If any query request parameter does not have a corresponding query field name in the mask processing rule, and the corresponding mask processing rule does not have a corresponding mask rule, it is determined that the third query concatenation parameter corresponding to the query request parameter is an empty string.

[0019] In one possible design, the mask processing rule is compared with the at least one query request parameter to determine the query splicing parameters corresponding to each query request parameter, and also includes: if any query request parameter has a corresponding query field name in the mask processing rule, and the corresponding mask processing rule is a mask rule, then the mask rule is obtained, wherein the mask rule includes the correspondence between the mask starting position and the mask length of each mask segment; according to the correspondence between the mask starting position and the mask length, the query request parameter is masked to obtain a fourth query splicing parameter.

[0020] In a possible design, before obtaining at least one query request parameter input by the user, the method further includes:

[0021] Obtain multiple random mask data and store them in a random mask database;

[0022] Determining a mask processing rule for each piece of random mask data in the random mask database;

[0023] The same mask processing rules among all the mask processing rules are clustered to obtain the mask rule set.

[0024] In a possible design, determining a mask processing rule for each piece of random mask data in the random mask database includes:

[0025] Extracting at least one query field in the target random mask data according to a preset query field name, wherein the target random mask data is any random mask data in the random mask database;

[0026] If any query field is an empty field, the mask processing rule of the query field name corresponding to the query field is recorded as the empty value rule;

[0027] If any query field is not an empty field, determine whether the query field has a mask. If no mask exists, record the mask processing rule of the query field name corresponding to the query field as a plain text rule. If a mask exists, traverse the query field to obtain the mask rule of the corresponding query field name.

[0028] The mapping relationship between the query field name and the mask processing rule corresponding to the query field name is determined as the mask processing rule of the target random mask data.

[0029] In one possible design, if the query field includes only a mask;

[0030] Accordingly, the mask rule of traversing the query field to obtain the corresponding query field name includes:

[0031] Obtaining the length of the query field;

[0032] Determining a mask start position of the query field;

[0033] Flipping the query field, and determining a mask start position of the flipped query field;

[0034] Determining a mask end position of the query field according to the length of the query field and the mask start position of the flipped query field;

[0035] Determining the mask length of the query field according to the mask end position and the mask start position of the query field;

[0036] According to the mask starting position and mask length of the query field, the query field obtains the mask rule of the corresponding query field name.

[0037] In one possible design, if the query field includes a multi-segment mask;

[0038] Accordingly, the mask rule of traversing the query field to obtain the corresponding query field name includes:

[0039] Convert the query field into a character array;

[0040] The starting character position and the number of mask characters of each mask segment in the character array are obtained; and according to the starting character position and the number of mask characters of each mask segment in the character array, the mask rule for obtaining the corresponding query field name is determined for the query field.

[0041] In a possible design, before searching the random mask database constructed according to the plurality of random mask data according to the query primary key list and matching and obtaining corresponding query records, the method further includes:

[0042] Extracting corresponding multiple query fields from each piece of random masked data according to preset query field names;

[0043] Concatenate each query field to obtain the query primary key field;

[0044] Each piece of random mask data and its corresponding query primary key field are stored in the random mask database.

[0045] In a second aspect, an embodiment of the present disclosure provides a mask data query device, including:

[0046] A first acquisition module, used to acquire at least one query request parameter input by a user;

[0047] A first processing module is used to obtain a pre-established mask rule set, traverse the mask rule set, and process the at least one query request parameter according to each mask processing rule in the mask rule set to obtain a query primary key; wherein the mask rule set is obtained after performing mask rule processing on multiple random mask data;

[0048] A generation module, used for forming a query primary key list by combining the query primary keys corresponding to each mask processing rule;

[0049] The query module is used to query the random mask database constructed according to the plurality of random mask data according to the query primary key list, and match and obtain corresponding query records.

[0050] In a third aspect, an embodiment of the present disclosure provides a mask data query device, including: at least one processor and a memory;

[0051] The memory stores computer-executable instructions;

[0052] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the mask data query method described in the first aspect and various possible designs of the first aspect.

[0053] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the mask data query method described in the first aspect and various possible designs of the first aspect is implemented.

[0054] The masked data query method, device and equipment provided by the disclosed embodiment, when a user inputs a query request parameter, the method performs mask processing on the query request parameter according to each mask processing rule in the mask rule set to obtain a query primary key, combines the query primary keys corresponding to each mask processing rule into a query primary key list, queries the random mask database according to each query primary key in the query primary key list, and matches to obtain the corresponding query record. The disclosed embodiment can perform matching query on randomly masked data, meet the query requirements of randomly masked data, and has good applicability. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0056] Figure 1 A schematic diagram of a data query scenario provided by an embodiment of the present disclosure;

[0057] Figure 2 Schematic diagram of the process of the mask data query method provided in the embodiment of the present disclosure Figure 1 ;

[0058] Figure 3 Schematic diagram of the process of the mask data query method provided in the embodiment of the present disclosure Figure 2

[0059] Figure 4 Schematic diagram of the process of the mask data query method provided in the embodiment of the present disclosure Figure 3 ;

[0060] Figure 5 A schematic diagram of the structure of the mask data query device provided in the embodiment of the present disclosure Figure 1 ;

[0061] Figure 6A schematic diagram of the structure of the mask data query device provided in the embodiment of the present disclosure Figure 2

[0062] Figure 7 A schematic diagram of the hardware structure of a mask data query device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0063] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.

[0064] The masking rule for a certain piece of random masked data is random, while the mask processing rule analysis is performed for a large number of random masked data, and the mask processing rules can be aggregated and classified to obtain a set of mask processing rules for the random masked data. In order to realize the matching query of random masked data, the present disclosure provides the following technical ideas: obtain a large amount of random masked data, analyze the masking rule of each piece of random masked data, obtain a large number of mask processing rules, cluster the same mask processing rules, and obtain a mask rule set; when the user inputs a query request parameter, mask the query request parameter according to each mask processing rule in the mask rule set to obtain a query primary key, combine the query primary keys corresponding to each mask processing rule into a query primary key list, query the random mask database according to each query primary key in the query primary key list, and match and obtain the corresponding query record.

[0065] Figure 1 A schematic diagram of a data query scenario provided by an embodiment of the present disclosure. Figure 1 As shown, the system provided in this embodiment includes a terminal 101 and a server 102. The terminal 101 may be a mobile phone, a tablet, a personal computer, etc. This embodiment does not impose any particular restrictions on the implementation of the terminal 101, as long as the terminal 101 can interact with the user for input and output.

[0066] When a user performs a data query, the data to be queried may be stored on the terminal 101. The user enters query request parameters on the terminal 101, and the query results are directly matched and output to the user. In addition, the data to be queried may also be stored on the server. The user enters query request parameters on the terminal, and the terminal sends a query request to the server. The server matches the query request to obtain the query results and returns them to the terminal 101, which then outputs them to the user.

[0067] Figure 2 Schematic diagram of the process of the mask data query method provided in the embodiment of the present disclosure Figure 1 , the execution subject of this embodiment can be Figure 1 The terminal in the embodiment shown may also be Figure 1 The server of the embodiment shown in the figure is not particularly limited in this embodiment. Figure 2 As shown, the method includes:

[0068] S201: Acquire at least one query request parameter input by a user.

[0069] In this embodiment, the user may input one or more query request parameters on the terminal through a keyboard, or may input one or more query request parameters through voice.

[0070] In one case, there is an input query box on the query page of the terminal, and each query request parameter in the input query box is separated by a separator, such as by a space or by an underscore "_", and the embodiments disclosed in the present invention do not impose any limitations on this.

[0071] In another case, there is an input query box on the query page of the terminal, each query input box corresponds to a query field name, and the user enters query request parameters in different input query boxes according to the query field name.

[0072] S202: Obtain a pre-established mask rule set, traverse the mask rule set, and process at least one query request parameter according to each mask processing rule in the mask rule set to obtain a query primary key; wherein the mask rule set is obtained after performing mask rule processing on multiple random mask data.

[0073] Specifically, by analyzing the mask processing rule of each piece of random mask data among the multiple pieces of random mask data, the mask processing rule of each piece of random mask data is obtained, and the mask processing rules of the multiple pieces of random mask data are aggregated and classified to obtain a mask rule set.

[0074] In this embodiment, the pre-established mask rule set can be stored in a relational database, and the mask rule set includes multiple mask processing rules, each of which is stored in the form of a table. Each mask processing rule includes a mask processing rule for each query request parameter, and after processing the query request parameter according to the mask processing rule, a query primary key is obtained.

[0075] The query primary key refers to the query primary keyword, which is composed of query request parameters processed according to the mask processing rule.

[0076] S203: The query primary keys corresponding to the mask processing rules are combined into a query primary key list.

[0077] In this embodiment, the query primary key corresponding to each mask processing rule is stored in a pre-established blank list to form a query primary key list.

[0078] S204: According to the query primary key list, a random mask database constructed according to multiple random mask data is queried to obtain corresponding query records through matching.

[0079] In this embodiment, a plurality of random mask data are stored in the random mask database, which may be a relational database.

[0080] Specifically, each query primary key in the query primary key list may be used as an IN keyword of an IN query, and a SQL statement may be used to query and match corresponding query records from the random mask database.

[0081] IN query is used to determine whether the value of a record is in the specified set. If the value of the field is in the set, the condition is met and the record where the field is located will be queried.

[0082] From the description of the above embodiment, it can be seen that when a user inputs a query request parameter, the query request parameter is masked according to each mask processing rule in the mask rule set to obtain a query primary key, and the query primary key corresponding to each mask processing rule is combined into a query primary key list, and the random mask database is queried according to each query primary key in the query primary key list to match and obtain the corresponding query record. This embodiment can perform matching query on randomly masked data, meet the query requirements of randomly masked data, and has good applicability.

[0083] Figure 3 Schematic diagram of the process of the mask data query method provided in the embodiment of the present disclosure Figure 2 In this embodiment, Figure 2 Based on the embodiment, the process of how to establish the mask rule set before step S201 is described in detail. The method includes:

[0084] S301: Acquire multiple random mask data and store them in a random mask database.

[0085] In this embodiment, multiple random mask data are the data to be queried, and the mask segment thereof may be a field of the query index, and the mask segment may be one or more segments. Since the mask rule of the random mask data is random, the data needs to be processed.

[0086] S302: Determine a mask processing rule for each piece of random mask data in the random mask database.

[0087] In one embodiment of the present disclosure, the specific process of determining the mask processing rule for each piece of random mask data in the random mask database may include:

[0088] Step 1: extract at least one query field in the target random mask data according to a preset query field name, wherein the target random mask data is any random mask data in the random mask database.

[0089] Step 2: If any query field is an empty field, the mask processing rule of the query field name corresponding to the query field is recorded as an empty value rule.

[0090] Step 3, if any query field is not an empty field, determine whether the query field has a mask. If no mask exists, record the mask processing rule of the query field name corresponding to the query field as a plain text rule; if a mask exists, traverse the query field to obtain the mask rule of the corresponding query field name.

[0091] Step 4: determine the mapping relationship between the query field name and the mask processing rule corresponding to the query field name as the mask processing rule of the target random mask data.

[0092] In this embodiment, the null value rule means that the field corresponding to the query field name is an empty field, which can be marked as NULL.

[0093] The mask rule means that the field corresponding to the query field name is not empty and has a mask. If there is only one mask segment, it can be expressed as X / L, where X is the starting position of the mask and L is the length of the mask. If there are two masks, it can be expressed as: Xa / La_Xb / Lb, where a and b are mask segments. If there are multiple masks, continue in the same way.

[0094] The plain text rule means that the field corresponding to the query field name is not empty and there is no mask, which can be expressed as 0 / 0.

[0095] Refer to Table 1, which is a specific example of a mask processing rule provided in an embodiment of the present disclosure.

[0096] Table 1

[0097] Field Name Mask processing rules ID Sequence number mask processing rules: null value rules (NULL) ID_NO ID card number mask processing rules: Mask rules (1 / 3) NAME Name mask processing rule: Plain text rule (0 / 0) MOBILE Mobile phone number mask processing rules: Mask rules (2 / 4)

[0098] S303: Clustering identical mask processing rules among all mask processing rules to obtain a mask rule set.

[0099] In this embodiment, all mask processing rules are traversed, and the same mask processing rules are clustered to obtain a set of clustered mask processing rules, which is a mask rule set.

[0100] It should be noted that the mask processing rules provided in the embodiments of the present disclosure may also be maintained by manual entry to generate a mask rule set.

[0101] From the above description, it can be seen that by analyzing the mask rules of each random mask data in a large amount of random mask data, a large number of mask processing rules are obtained, and the same mask processing rules are clustered to obtain a mask rule set, that is, the mask processing rules in the mask rule set change with the change of random mask data. The mask rule set is a dynamically changing set, not a fixed rule, to meet the query matching requirements of various random mask data.

[0102] In one embodiment of the present disclosure, if the query field only includes a mask, the mask rule of the corresponding query field name is obtained by traversing the query field. The specific calculation includes:

[0103] Get the length of the query field;

[0104] Determine the mask start position of the query field;

[0105] Flip the query field and determine the mask start position of the flipped query field;

[0106] Determining the mask end position of the query field according to the length of the query field and the mask start position of the flipped query field;

[0107] Determine the mask length of the query field according to the mask end position and the mask start position of the query field;

[0108] According to the mask starting position and mask length of the query field, the query field obtains the mask rule of the corresponding query field name.

[0109] In this embodiment, if the random mask data only includes a mask segment, such as data such as 13123**123, it can be directly processed by the native string function of Hive, as follows:

[0110] Step 1, case when length(field)==0then NULL else / query field empty field then set mask processing rule to NULL;

[0111] Step 2: Use regular expression to determine whether the query field contains mask characters. If it does not contain mask characters, set the mask processing rule to 0 / 0.

[0112] Step 3: Calculate the mask rule for the masked query field, including:

[0113] 1) Calculate the length of the query field, L = length (FIELD). For example, the query field is 123**, L = 5.

[0114] 2) Calculate the starting position of the mask, X1 = instr(FIELD,'*'). For example, to query the field 123**, X1 = 4.

[0115] 3) Reverse the query field and calculate the mask start position, X2 = instr(reverse(FIELD,'*')). For example, the query field is 123**, X2 = 1.

[0116] 4) Calculate the mask end position of the query field Y=L-X2+1. For example, the query field is 123**, Y=5.

[0117] 5) Calculate the mask length of the query field, ML = Y-X1 + 1. For example, the query field is 123**, ML = 5-4+1 = 2.

[0118] The reason why 1 is added to the two formulas in steps 4) and 5) is because the first position of the instr function is 1.

[0119] 6) Concatenate X1 and ML to get the mask rule of the field contact(X1,' / ',ML). For example, the mask rule of the query field 123** is 4 / 2.

[0120] In another embodiment of the present disclosure, if the query field only includes multiple segments of masks, the query field is traversed to obtain the mask rule of the corresponding query field name, and the specific calculation includes:

[0121] Convert the query field into a character array;

[0122] Get the starting character position and number of mask characters of each mask in the character array;

[0123] According to the starting character position of each mask segment in the character array and the number of mask characters, a mask rule for obtaining the corresponding query field name by the query field is determined.

[0124] In this embodiment, if the random mask data includes data of multiple mask segments, such as data of 123**1232**, it can be processed by the written UDF function as follows:

[0125] Step 1, if (field == null or field == '') return NULL / If the query field is empty, set the mask processing rule to NULL.

[0126] Step 2, if (!field.contians('*'))return 0 / 0 / does not contain the mask, set the mask processing rule to 0 / 0.

[0127] Step 3: Convert the field into a character array, determine the position of the first occurrence of the mask character, and then determine the number of consecutive occurrences of the mask character to generate the first segment of mask rule X / Y. If there are remaining characters, and they are not mask characters, it means there is a second segment of mask, and continue to take the first occurrence position and the number of consecutive occurrences.

[0128] In one embodiment of the present disclosure, before querying the random mask database constructed according to the plurality of random mask data according to the query primary key list in step S204 and matching and obtaining the corresponding query record, the method further includes:

[0129] Extracting corresponding multiple query fields from each piece of random masked data according to preset query field names;

[0130] Concatenate each query field to obtain the query primary key field;

[0131] Each piece of random mask data and its corresponding query primary key field are taken as processed random mask data and stored in the random mask database.

[0132] In this embodiment, the query fields may be concatenated by separators to obtain the query primary key field, wherein the separator may be a space symbol or an underscore "_".

[0133] For example, Table 2 is an example of the data structure of the original random mask data. Figure 3 An instance of the data structure for the processed random mask data.

[0134] Table 2

[0135] Field Name describe Whether to query conditions Is it possible to be masked? ID_NO ID number yes yes NAME Name yes yes MOBILE Phone number yes yes FIELDX Field X no no

[0136] Table 3

[0137] Field Name describe Whether to query conditions Is it possible to be masked? QUERY_KEY Query primary key field yes yes ID_NO ID number no yes NAME Name no yes MOBILE Phone number no yes FIELDX Field X no no

[0138] From the description of the above embodiment, it can be seen that by processing the original random mask data into random mask data containing the query primary key field, when the user queries, a quick match can be achieved by querying the primary key field, and there is no need to match the random mask data itself, which is convenient for user query.

[0139] Figure 4 Schematic diagram of the process of the mask data query method provided in the embodiment of the present disclosure Figure 3 In this embodiment, Figure 2 or Figure 3Based on the embodiment, the specific implementation process of obtaining the query primary key by processing at least one query request parameter according to each mask processing rule in the mask rule set in the above embodiment S202 is described in detail as follows:

[0140] S401: Compare the mask processing rule with at least one query request parameter to determine query concatenation parameters corresponding to each query request parameter.

[0141] In this embodiment, it is determined whether each query parameter exists in the mapping relationship between the query field name of the mask processing rule and the mask processing rule, and the mask processing rule corresponding to each query parameter is determined.

[0142] In one embodiment of the present disclosure, each mask processing rule in the mask rule set includes a mapping relationship between a query field name and a mask processing rule. Specifically, step S401 may include:

[0143] S4011: If any query request parameter has a corresponding query field name in the mask processing rule, and the corresponding mask processing rule is a null value rule, determine that the first query concatenation parameter corresponding to the query request parameter is an empty string.

[0144] In this embodiment, the null value rule refers to the query field name corresponding to the query request parameter does not have a corresponding rule. There is no need to specifically process the query request parameter, and its corresponding query concatenation parameter is an empty string, which matches the empty field of the random mask data in the final query process.

[0145] S4012: If any query request parameter has a corresponding query field name in the mask processing rule, and the corresponding mask processing rule is a plain text rule, the parameter plain text corresponding to the query request parameter is determined as the second query concatenation parameter.

[0146] In this embodiment, the plain text rule means that the query request parameters are not masked or otherwise processed, and the plain text of the query request parameters (the parameters themselves) are directly used as the query concatenation parameters.

[0147] For example, the mask rule is 1 / 4, which means that the mask length is 4 characters starting from the first character.

[0148] S4013: If any query request parameter does not have a corresponding query field name in the mask processing rule, and the corresponding mask processing rule does not have a corresponding mask rule, determine that the third query concatenation parameter corresponding to the query request parameter is an empty string.

[0149] In this embodiment, for query request parameters that do not have corresponding query field names and mask rules, an empty string is also used as a query concatenation parameter, so that the query concatenation parameter matches the empty field of the random mask data in the final query process.

[0150] S4014: If any query request parameter has a corresponding query field name in the mask processing rule, and the corresponding mask processing rule is a mask rule, the query request parameter is masked according to the mask rule to obtain a fourth query concatenation parameter.

[0151] Specifically, a mask rule is obtained, wherein the mask rule includes a correspondence between a mask starting position and a mask length of each mask segment; and according to the correspondence between the mask starting position and the mask length, the query request parameter is masked to obtain a fourth query concatenation parameter.

[0152] It should be noted that if any query field name of the mask processing rule does not have a corresponding query request parameter, and the query field name has a corresponding mask processing rule, the corresponding query concatenation parameter will not be generated.

[0153] In one implementation of the present disclosure, the specific implementation process of comparing the mask processing rule with at least one query request parameter to determine the query concatenation parameter corresponding to each query request parameter can be implemented by the following code flow:

[0154] for(String maskRule:maskRuleList){ / / Poll rule set

[0155] if(field is not null){ / / If the field has content

[0156] if(maskRule is not null){ / / and the rule exists

[0157] String[] rules = maskRule.split("_"); / / parse out multiple rule contents

[0158] for(String rule:rules){ / / Poll multiple rule contents of this rule

[0159] int start = rule.split(" / ")[0]; / / Get the starting position of the mask

[0160] int length = rule.split(" / ")[1]; / / Get the mask length

[0161] maskStr=maskStr+field.mask(start,length); / / Mask field with length characters starting from start and concatenate the previous content.

[0162] }else{

[0163] maskStr=”; / / The rule does not exist, indicating that the corresponding data is empty, so the mask result is assigned an empty value

[0164] }

[0165] }else{ / / Field does not exist

[0166] if(maskRule is not null){ / / and the rule does not exist

[0167] maskStr = "; / / Assign empty value,

[0168] }else{

[0169] continue; / / The rule exists, indicating that there is data in the database, but no parameters are entered, so it is ignored

[0170] }

[0171] }

[0172] S402: Concatenate the query concatenation parameters corresponding to the query request parameters to obtain a query primary key.

[0173] Specifically, the first query splicing parameter, the second query splicing parameter, the third query splicing parameter, and the fourth query splicing parameter are spliced ​​to obtain the query primary key.

[0174] In this embodiment, the first query concatenation parameter, the second query concatenation parameter, the third query concatenation parameter and the fourth query concatenation parameter may be concatenated by separators, such as spaces or underscores “_”, and the disclosed embodiments of the present invention do not impose any limitation on this.

[0175] Figure 5 A schematic diagram of the structure of the mask data query device provided in the embodiment of the present disclosure Figure 1 .like Figure 5 As shown, the mask data query device 50 includes: a first acquisition module 501 , a first processing module 502 , a generation module 503 and a query module 504 .

[0176] The first acquisition module 501 is used to acquire at least one query request parameter input by the user;

[0177] The first processing module 502 is used to obtain a pre-established mask rule set, traverse the mask rule set, and process the at least one query request parameter according to each mask processing rule in the mask rule set to obtain a query primary key; wherein the mask rule set is obtained after performing mask rule processing on multiple random mask data;

[0178] A generating module 503, used for forming a query primary key list by combining the query primary keys corresponding to each mask processing rule;

[0179] The query module 504 is used to query the random mask database constructed according to the plurality of random mask data according to the query primary key list, and obtain corresponding query records by matching.

[0180] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.

[0181] In one embodiment of the present disclosure, the first processing module 502 is specifically used to compare the mask processing rule with the at least one query request parameter to determine the query splicing parameters corresponding to each query request parameter; and splice the query splicing parameters corresponding to each query request parameter to obtain the query primary key.

[0182] In one embodiment of the present disclosure, each mask processing rule in the mask rule set includes a mapping relationship between a query field name and a mask processing rule; the first processing module 502 is specifically used to determine that the first query splicing parameter corresponding to the query request parameter is an empty string if any query request parameter has a corresponding query field name in the mask processing rule and the corresponding mask processing rule is an empty value rule; if any query request parameter has a corresponding query field name in the mask processing rule and the corresponding mask processing rule is a plain text rule, the parameter corresponding to the query request parameter is plain text determined as the second query splicing parameter; if any query request parameter does not have a corresponding query field name in the mask processing rule and there is no corresponding mask rule in the corresponding mask processing rule, then determine that the third query splicing parameter corresponding to the query request parameter is an empty string.

[0183] In one embodiment of the present disclosure, the first processing module 502 is also used to obtain the mask rule if any query request parameter has a corresponding query field name in the mask processing rule and the corresponding mask processing rule is a mask rule, wherein the mask rule includes the corresponding relationship between the mask starting position and the mask length of each mask segment; according to the corresponding relationship between the mask starting position and the mask length, the query request parameter is masked to obtain a fourth query splicing parameter.

[0184] Figure 6 A schematic diagram of the structure of the mask data query device provided in the embodiment of the present disclosure Figure 2 .like Figure 6 As shown, in this embodiment Figure 5 Based on the embodiment, it further includes: a second acquisition module 505 , a second processing module 506 and a clustering module 507 .

[0185] The second acquisition module 505 is used to acquire multiple random mask data and store them in a random mask database;

[0186] A second processing module 506, configured to determine a mask processing rule for each piece of random mask data in the random mask database;

[0187] The clustering module 507 is used to cluster the same mask processing rules among all the mask processing rules to obtain the mask rule set.

[0188] In one embodiment of the present disclosure, the second processing module 506 includes:

[0189] an extraction unit, configured to extract at least one query field in the target random mask data according to a preset query field name, wherein the target random mask data is any random mask data in the random mask database;

[0190] A first processing unit, configured to record, if any query field is an empty field, a mask processing rule of the query field name corresponding to the query field as an empty value rule;

[0191] The second processing unit is used to determine whether a mask exists in any query field if any query field is not an empty field, and if no mask exists, record the mask processing rule of the query field name corresponding to the query field as a plain text rule; if a mask exists, traverse the query field to obtain the mask rule of the corresponding query field name;

[0192] The third processing unit is used to determine the mapping relationship between the query field name and the mask processing rule corresponding to the query field name as the mask processing rule of the target random mask data.

[0193] In one embodiment of the present disclosure, if the query field only includes a mask; the second processing unit is specifically used to obtain the length of the query field; determine the mask starting position of the query field; flip the query field to determine the mask starting position of the flipped query field; determine the mask ending position of the query field based on the length of the query field and the mask starting position of the flipped query field; determine the mask length of the query field based on the mask ending position and the mask starting position of the query field; based on the mask starting position and the mask length of the query field, the query field obtains the mask rule of the corresponding query field name.

[0194] In one embodiment of the present disclosure, if the query field includes multiple mask segments; the second processing unit is specifically used to convert the query field into a character array; obtain the starting character position and the number of mask characters of each mask segment appearing in the character array; and determine the mask rule for obtaining the corresponding query field name based on the starting character position and the number of mask characters of each mask segment appearing in the character array.

[0195] In one embodiment of the present disclosure, the device also includes: a data processing module, which is used to extract corresponding multiple query fields from each random mask data according to a preset query field name; splicing each query field to obtain a query primary key field; and storing each random mask data and its corresponding query primary key field in the random mask database.

[0196] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.

[0197] Figure 7 Schematic diagram of the hardware structure of the mask data query device provided by the embodiment of the present disclosure. Figure 7 As shown, the mask data query device 70 of this embodiment includes: a processor 701 and a memory 702;

[0198] Memory 702, used to store computer-executable instructions;

[0199] The processor 701 is used to execute the computer-executable instructions stored in the memory to implement the various steps executed by the terminal or server in the above embodiment. For details, please refer to the relevant description in the above method embodiment.

[0200] Optionally, the memory 702 may be independent or integrated with the processor 701 .

[0201] When the memory 702 is independently provided, the mask data query device further includes a bus 703 for connecting the memory 702 and the processor 701 .

[0202] The embodiment of the present disclosure further provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the mask data query method as described above is implemented.

[0203] In the several embodiments provided in the present disclosure, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.

[0204] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to implement the solution of this embodiment.

[0205] In addition, each functional module in each embodiment of the present disclosure may be integrated into one processing unit, each module may exist physically separately, or two or more modules may be integrated into one unit. The above modules may be implemented in the form of hardware or hardware plus software functional units.

[0206] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the method described in each embodiment of the present application.

[0207] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be implemented by a combination of hardware and software modules in the processor.

[0208] The memory may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk, etc.

[0209] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.

[0210] The above storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The storage medium can be any available medium that can be accessed by a general or special purpose computer.

[0211] An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the storage medium can also exist as discrete components in an electronic device or a main control device.

[0212] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0213] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present disclosure.

Claims

1. A mask data query method, characterized in that: include: Obtain multiple random mask data and store them in a random mask database; Determine the mask processing rule for each random mask data in the random mask database: extract at least one query field in the target random mask data according to the preset query field name, wherein the target random mask data is any random mask data in the random mask database; if any query field is an empty field, record the mask processing rule of the query field name corresponding to the query field as an empty value rule; if any query field is not an empty field, determine whether the query field has a mask, if no mask exists, record the mask processing rule of the query field name corresponding to the query field as a plain text rule; if a mask exists, traverse the query field to obtain the mask rule of the corresponding query field name; record the query field name and the mask processing rule corresponding to the query field name as a plain text rule. A mapping relationship is determined to be a mask processing rule for the target random mask data; wherein, if the query field only includes a mask segment, then the traversal of the query field to obtain the mask rule of the corresponding query field name includes: obtaining the length of the query field; determining the mask starting position of the query field; flipping the query field to determine the mask starting position of the flipped query field; determining the mask ending position of the query field according to the length of the query field and the mask starting position of the flipped query field; determining the mask length of the query field according to the mask ending position and the mask starting position of the query field; according to the mask starting position and the mask length of the query field, the query field obtains the mask rule of the corresponding query field name; Clustering the same mask processing rules among all mask processing rules to obtain a mask rule set; Obtain at least one query request parameter input by a user; Traversing the mask rule set, and processing the at least one query request parameter according to each mask processing rule in the mask rule set to obtain a query primary key; wherein the mask rule set is obtained after performing mask rule processing on a plurality of random mask data; The query primary keys corresponding to each mask processing rule are combined into a query primary key list; According to the query primary key list, a random mask database constructed according to the plurality of random mask data is queried to obtain corresponding query records through matching.

2. The method according to claim 1, characterized in that The step of processing the at least one query request parameter according to each mask processing rule in the mask rule set to obtain a query primary key includes: Comparing the mask processing rule with the at least one query request parameter to determine query concatenation parameters corresponding to each query request parameter; The query concatenation parameters corresponding to the query request parameters are concatenated to obtain the query primary key.

3. The method according to claim 2, characterized in that Each mask processing rule in the mask rule set includes a mapping relationship between a query field name and a mask processing rule; Accordingly, comparing the mask processing rule with the at least one query request parameter to determine the query concatenation parameters corresponding to each query request parameter includes: If any query request parameter has a corresponding query field name in the mask processing rule, and the corresponding mask processing rule is a null value rule, determining that the first query concatenation parameter corresponding to the query request parameter is an empty string; If any query request parameter has a corresponding query field name in the mask processing rule, and the corresponding mask processing rule is a plain text rule, then the parameter plain text corresponding to the query request parameter is determined as the second query splicing parameter; If any query request parameter does not have a corresponding query field name in the mask processing rule, and the corresponding mask processing rule does not have a corresponding mask rule, it is determined that the third query concatenation parameter corresponding to the query request parameter is an empty string.

4. The method according to claim 3, characterized in that: The step of comparing the mask processing rule with the at least one query request parameter to determine the query concatenation parameters corresponding to the query request parameters further includes: If any query request parameter has a corresponding query field name in the mask processing rule, and the corresponding mask processing rule is a mask rule, then the mask rule is obtained, wherein the mask rule includes a corresponding relationship between a mask starting position and a mask length of each mask segment; According to the correspondence between the mask start position and the mask length, the query request parameter is masked to obtain a fourth query concatenation parameter.

5. The method according to claim 1, characterized in that If the query field includes a multi-segment mask; Accordingly, the mask rule of traversing the query field to obtain the corresponding query field name includes: Convert the query field into a character array; Get the starting character position and the number of mask characters of each mask segment in the character array; According to the starting character position of each mask segment in the character array and the number of mask characters, a mask rule for obtaining a corresponding query field name by the query field is determined.

6. The method according to any one of claims 1 to 4, characterized in that: Before the querying of the random mask database constructed according to the plurality of random mask data according to the query primary key list and matching to obtain corresponding query records, the method further includes: Extracting corresponding multiple query fields from each piece of random masked data according to preset query field names; Concatenate each query field to obtain the query primary key field; Each piece of random mask data and its corresponding query primary key field are stored in the random mask database.

7. A mask data query device, characterized in that: include: A first acquisition module is used to acquire multiple random mask data and store them in a random mask database; The first processing module is used to determine the mask processing rule of each random mask data in the random mask database, and is specifically used to: extract at least one query field in the target random mask data according to a preset query field name, wherein the target random mask data is any random mask data in the random mask database; if any query field is an empty field, the mask processing rule of the query field name corresponding to the query field is recorded as a null value rule; if any query field is not an empty field, it is determined whether the query field has a mask, and if no mask exists, the mask processing rule of the query field name corresponding to the query field is recorded as a plain text rule; if a mask exists, the query field is traversed to obtain the mask rule of the corresponding query field name; the query field name and the mask processing rule corresponding to the query field name are recorded as a plain text rule. The mapping relationship is determined to be the mask processing rule of the target random mask data; wherein, if the query field only includes a segment of mask, then the first processing module is used to traverse the query field to obtain the mask rule of the corresponding query field name, specifically for: obtaining the length of the query field; determining the mask starting position of the query field; flipping the query field to determine the mask starting position of the flipped query field; determining the mask ending position of the query field according to the length of the query field and the mask starting position of the flipped query field; determining the mask length of the query field according to the mask ending position and the mask starting position of the query field; according to the mask starting position and the mask length of the query field, the query field obtains the mask rule of the corresponding query field name; The first processing module is further used to cluster the same mask processing rules among all the mask processing rules to obtain a mask rule set; The first acquisition module is further used to acquire at least one query request parameter input by the user; The first processing module is further used to traverse the mask rule set, and process the at least one query request parameter according to each mask processing rule in the mask rule set to obtain a query primary key; wherein the mask rule set is obtained after performing mask rule processing on multiple random mask data; A generation module, used for forming a query primary key list by combining the query primary keys corresponding to each mask processing rule; The query module is used to query the random mask database constructed according to the plurality of random mask data according to the query primary key list, and match and obtain corresponding query records.

8. A mask data query device, characterized in that: include: at least one processor and memory; The memory stores computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the mask data query method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the mask data query method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Data querying method and system

    CN106776809A