A client number compression and decompression method and apparatus
By grouping and transcoding the customer number and using binary encoding, combined with a preset end marker, the problem of low customer number compression efficiency in existing technologies is solved, achieving more efficient data compression and storage.
Patent Information
- Application Number
- CN202211324991.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-27
- Publication Date
- 2025-12-30
- Estimated Expiration
- 2042-10-27
AI Technical Summary
Existing Huffman coding-based customer number compression methods cannot adequately compress datasets and have low compression efficiency, especially when the two most frequent characters in the customer number encoding rules have nearly uniform frequencies.
By grouping customer numbers, transcoding is performed using a preset mapping table of province and city codes and a lucky number segment, merging the province and city codes and the lucky number segment, and combining the binary code and the preset end flag to form a grouped compression result.
It reduces the storage space requirements of customer number sets, improves compression efficiency, and supports data transfer and storage in smaller spaces.
Smart Images

Figure CN115603758B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of data processing, and in particular relates to a method and apparatus for compressing and decompressing customer numbers. Background Technology
[0002] Customer data is a company's most important asset. Companies often need to market to a group of customers in their operations, which generates a large amount of data.
[0003] In existing technologies, Huffman coding is used to construct a binary tree based on the frequency of character occurrences. The encoding of the corresponding character is obtained through the constructed binary tree, forming a lossless encoding method.
[0004] However, based on the customer number encoding rules, it can be predicted that the two largest characters should be 1 and 6, and the frequency of other characters is roughly the same. The frequency of the characters to be encoded is close to uniform distribution, so Huffman coding cannot fully compress the dataset and has low compression efficiency. Summary of the Invention
[0005] In view of the above problems, this application proposes a method and apparatus for compressing and decompressing customer numbers. To improve the compression efficiency of customer numbers, the specific solution is as follows:
[0006] A customer number compression method, comprising:
[0007] Obtain a set of customer numbers to be compressed, the set of customer numbers to be compressed includes multiple customer numbers to be compressed, each customer number to be compressed includes a province / city code field, a sequence number field and an auspicious number segment; the sequence number field is nine bytes, the province / city code field is two bytes, and the auspicious number segment is one byte;
[0008] The multiple customer numbers to be compressed are grouped to obtain multiple customer number groups to be compressed; each customer number group to be compressed includes a sequence number field and a sequence set, the sequence set includes at least one sequence, each sequence is composed of the province and city code field and the auspicious number segment in the same customer number to be compressed;
[0009] For each customer number group to be compressed, the customer number group to be compressed is compressed to obtain a group compression result. The group compression result includes a sequence number field compression result, a sequence set compression result, and a preset end flag. The sequence set compression result includes at least one sequence compression result. The sequence number field compression result is four bytes, each sequence compression result is one byte, and the preset end flag is one byte.
[0010] The compression result of the set of customer numbers to be compressed is determined based on the compression results of each group.
[0011] Optionally, compressing the customer number group to be compressed to obtain the group compression result includes:
[0012] The customer number group to be compressed is transcoded based on the preset provincial and municipal code field mapping table and auspicious number segment mapping table. The sequence number field after transcoding is four bytes. Each sequence after transcoding includes a provincial and municipal code field mapping value and an auspicious number segment mapping value. The provincial and municipal code field mapping value is one byte and the auspicious number segment mapping value is one byte.
[0013] The mapping values of the province and city code field and the mapping values of the auspicious number segment in each sequence after transcoding are merged to obtain a merged sequence. The merged sequence is one byte, and the lower six bits of the byte correspond to the mapping value of the province and city code field, and the higher two bits correspond to the mapping value of the auspicious number segment.
[0014] The sequence number field after transcoding and the merged sequence are binary encoded to obtain the binary representation of the customer number group to be compressed;
[0015] A preset end marker is added to the end of the binary representation of the customer number group to be compressed to obtain the group compression result.
[0016] Optionally, obtaining the set of customer numbers to be compressed includes:
[0017] Obtain the original customer number set, which includes multiple original customer numbers. Each original customer number includes a fixed value field, a province / city code field, a sequence number field, a check code field, and a lucky number field.
[0018] Each original customer number in the original customer number set is cleaned to remove the fixed value field and check code field, resulting in a set of customer numbers to be compressed.
[0019] Optionally, grouping the plurality of customer numbers to be compressed to obtain a plurality of customer number groups to be compressed includes:
[0020] For each customer number to be compressed, the key-value pair corresponding to the customer number to be compressed is obtained by using the sequence number field of the customer number to be compressed as the key and the sequence composed of the province and city code field and the auspicious number segment of the customer number to be compressed as the value.
[0021] Among the key-value pairs corresponding to each customer number to be compressed, those key-value pairs with the same key are grouped into the same group, resulting in multiple groups of the customer numbers to be compressed.
[0022] Optionally, determining the compression result of the set of customer numbers to be compressed based on the compression results of each group includes:
[0023] The compression results of each group are combined to obtain the combined compression result.
[0024] The combined compression result is determined as the compression result of the set of customer numbers to be compressed;
[0025] Alternatively, a preset compression algorithm can be used to compress the combined compression result again to obtain the compression result of the set of customer numbers to be compressed.
[0026] A method for decompressing customer numbers, including:
[0027] Obtain compression results, which include multiple group compression results. Each group compression result includes a sequence number field compression result, a sequence set compression result, and a preset end flag. The sequence set compression result includes at least one sequence compression result. The sequence number field compression result is four bytes, each sequence compression result is one byte, and the preset end flag is one byte.
[0028] For each group compression result, the first four bytes of the group compression result are decompressed to obtain a sequence number field, which is nine bytes. Each byte of the remaining bytes after removing the first four bytes and the preset end marker in the group compression result is decompressed to obtain a set of province / city code fields and a lucky number segment, where the province / city code field is two bytes and the lucky number segment is one byte. Each set of province / city code fields and lucky number segment is combined with the sequence number field to obtain the decompressed customer number corresponding to the group compression result.
[0029] Optionally, the decompression of each byte remaining after removing the first four bytes and the preset end marker in the grouped compression result yields a set of province / city code fields and auspicious number segments, including:
[0030] The lower six bits of the byte are converted into the mapping value of the province and city code field, and the higher two bits are converted into the mapping value of the auspicious number field.
[0031] Based on a preset provincial and municipal code field mapping table, the mapping value of the provincial and municipal code field is converted into the provincial and municipal code field.
[0032] Based on a preset auspicious number segment mapping table, the mapping value of the auspicious number segment is converted into an auspicious number segment.
[0033] Optionally, after obtaining the decompressed customer numbers, the following may also be included:
[0034] For each decompressed customer number, a checksum field is determined based on the customer number's sequence number field, province / city code field, and auspicious number segment. Based on a preset field order, the customer number's sequence number field, province / city code field, auspicious number segment, checksum field, and preset fixed value field are combined to obtain the corresponding original customer number.
[0035] A customer number compression device, comprising:
[0036] The acquisition unit is used to acquire a set of customer numbers to be compressed. The set of customer numbers to be compressed includes multiple customer numbers to be compressed. Each customer number to be compressed includes a province / city code field, a sequence number field, and an auspicious number segment. The sequence number field is nine bytes, the province / city code field is two bytes, and the auspicious number segment is one byte.
[0037] A grouping unit is used to group the plurality of customer numbers to be compressed to obtain a plurality of customer number groups to be compressed; each customer number group to be compressed includes a sequence number field and a sequence set, the sequence set includes at least one sequence, each sequence being composed of a province / city code field and an auspicious number segment from the same customer number to be compressed;
[0038] A compression unit is used to compress each customer number group to be compressed to obtain a group compression result. The group compression result includes a sequence number field compression result, a sequence set compression result, and a preset end flag. The sequence set compression result includes at least one sequence compression result. The sequence number field compression result is four bytes, each sequence compression result is one byte, and the preset end flag is one byte.
[0039] The determining unit is used to determine the compression result of the set of customer numbers to be compressed based on the compression results of each group.
[0040] A customer number decompression device, comprising:
[0041] The acquisition unit is used to acquire compression results, which include multiple group compression results. Each group compression result includes a sequence number field compression result, a sequence set compression result, and a preset end flag. The sequence set compression result includes at least one sequence compression result. The sequence number field compression result is four bytes, each sequence compression result is one byte, and the preset end flag is one byte.
[0042] The decompression unit is used to decompress the first four bytes of each group compression result to obtain a sequence number field, which is nine bytes; decompress each byte of the remaining bytes after removing the first four bytes and a preset end marker to obtain a set of province / city code fields and a lucky number segment, where the province / city code field is two bytes and the lucky number segment is one byte; and combine each set of province / city code fields and lucky number segment with the sequence number field to obtain the decompressed customer number corresponding to the group compression result.
[0043] Based on the above technical solution, the present invention provides a customer number compression and decompression method and apparatus. The method involves obtaining a set of customer numbers to be compressed, which includes multiple customer numbers to be compressed. Each customer number to be compressed includes a province / city code field, a sequence number field, and an auspicious number segment. The sequence number field is nine bytes, the province / city code field is two bytes, and the auspicious number segment is one byte. Multiple customer numbers to be compressed are grouped to obtain multiple customer number groups. Each customer number group includes a sequence number field and a sequence set. The sequence set includes at least one sequence, and each sequence is composed of the province / city code field and the auspicious number segment from the same customer number to be compressed, thus eliminating some redundant information. For each customer number to be compressed... The client number grouping process compresses the client number groups to be compressed, resulting in a compressed group. The compressed group is composed of a sequence number field compression result, a sequence set compression result, and a preset end marker. The sequence set compression result includes at least one sequence compression result. The sequence number field compression result is four bytes, each sequence compression result is one byte, and the preset end marker is one byte. This creates a compression and decompression structure based on groups, breaking down very large datasets into smaller datasets for parallel processing. Based on the compression results of each group, the compression result of the client number set to be compressed is determined, reducing the transmitted content of the client number set and allowing it to be stored in less space, thus improving compression efficiency. Attached Figure Description
[0044] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0045] Figure 1 This is a flowchart illustrating a customer number compression method disclosed in an embodiment of the present invention;
[0046] Figure 2This is a flowchart illustrating a method for compressing customer number groups to obtain group compression results, as disclosed in an embodiment of the present invention.
[0047] Figure 3 This is a flowchart illustrating a method for obtaining a set of customer numbers to be compressed, as disclosed in an embodiment of the present invention.
[0048] Figure 4 This is a flowchart illustrating a method for grouping multiple customer numbers to be compressed to obtain multiple customer number groups according to an embodiment of the present invention.
[0049] Figure 5 This is a flowchart illustrating a method for determining the compression result of the set of customer numbers to be compressed based on the compression results of each group, as disclosed in an embodiment of the present invention.
[0050] Figure 6 This is a flowchart illustrating a customer number decompression method disclosed in an embodiment of the present invention;
[0051] Figure 7 This is a flowchart illustrating a method disclosed in an embodiment of the present invention for decompressing each byte of the remaining bytes after removing the first four bytes and a preset end marker from the grouped compression result to obtain a set of provincial and municipal code fields and auspicious number segments;
[0052] Figure 8 This is a schematic diagram of the structure of a customer number compression device disclosed in an embodiment of this application;
[0053] Figure 9 This is a schematic diagram of a customer number decompression device disclosed in an embodiment of this application. Detailed Implementation
[0054] It should be noted that the application testing method and apparatus provided by this invention can be used in the fields of artificial intelligence, blockchain, distributed systems, cloud computing, big data, the Internet of Things, mobile internet, network security, chips, virtual reality, augmented reality, holography, quantum computing, quantum communication, quantum measurement, digital twins, or finance. The above are merely examples and do not limit the application areas of the application testing method and apparatus provided by this invention.
[0055] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0056] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms are interchangeable where appropriate; this is merely a way of distinguishing objects with the same attributes in the description of embodiments of the invention. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, so that a process, method, system, product, or apparatus that comprises a series of units is not necessarily limited to those units, but may include other units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0057] To improve the compression efficiency of customer numbers, this invention provides a customer number compression method. The following detailed description of the customer number compression method provided by this invention is provided in conjunction with the accompanying drawings and specific embodiments.
[0058] Please see the appendix Figure 1 , Figure 1 This is a flowchart illustrating a customer number compression method provided by an embodiment of the present invention. The method may include the following steps:
[0059] Step S101: Obtain the set of customer numbers to be compressed. The set of customer numbers to be compressed includes multiple customer numbers to be compressed. Each customer number to be compressed includes a province / city code field, a sequence number field, and an auspicious number field. The sequence number field is nine bytes, the province / city code field is two bytes, and the auspicious number field is one byte.
[0060] It should be noted that a customer number / customer code is a unique identifier for a customer within a specific domain.
[0061] Step S102: Group the multiple customer numbers to be compressed to obtain multiple customer number groups to be compressed; each customer number group to be compressed includes a sequence number field and a sequence set, the sequence set includes at least one sequence, each sequence is composed of the province and city code field and the auspicious number segment in the same customer number to be compressed.
[0062] In this application, the same sequence number field can be generated in different provinces. For each group of customer numbers to be compressed, the sequence number field can be extracted from the group of customer numbers to be compressed. The customer numbers to be compressed are grouped to obtain a sequence number field and a sequence set. The details will be explained in detail through the following embodiments, and will not be described here.
[0063] Step S103: For each customer number group to be compressed, compress the customer number group to be compressed to obtain the group compression result. The group compression result includes the sequence number field compression result, the sequence set compression result, and the preset end flag. The sequence set compression result includes at least one sequence compression result. The sequence number field compression result is four bytes, each sequence compression result is one byte, and the preset end flag is one byte.
[0064] In this application, for each customer number group to be compressed, the customer number group to be compressed is compressed to obtain the sequence number field compression result, at least one sequence compression result, and a preset end flag, wherein the preset end flag can be 3F, which will be described in detail in the following embodiments and will not be described here.
[0065] Step S104: Determine the compression result of the set of customer numbers to be compressed based on the compression results of each group.
[0066] In this application, the set of customer numbers to be compressed has multiple groups of customer numbers to be compressed. For each group of customer numbers to be compressed, there is a compression result for that group. Therefore, the compression result of the set of customer numbers to be compressed is determined based on the compression results of each group.
[0067] In summary, the customer number compression method provided in this embodiment of the invention obtains a set of customer numbers to be compressed. This set includes multiple customer numbers, each comprising a province / city code field, a sequence number field, and an auspicious number segment. The sequence number field is nine bytes, the province / city code field is two bytes, and the auspicious number segment is one byte. Multiple customer numbers are grouped to obtain multiple customer number groups. Each customer number group includes a sequence number field and a sequence set. The sequence set includes at least one sequence, each sequence consisting of the province / city code field and the auspicious number segment from the same customer number. This eliminates some redundant information. For each customer number to be compressed... The process involves grouping customer number sets into smaller, compressed groups to obtain compressed group results. These results include the compressed sequence number field, the compressed sequence set, and a preset end marker. The compressed sequence set contains at least one compressed sequence. The compressed sequence number field is four bytes, each compressed sequence is one byte, and the preset end marker is one byte. This creates a compression and decompression structure based on groups, breaking down massive datasets into smaller datasets for parallel processing. The compression result of the customer number set to be compressed is determined based on the compressed group results, reducing the transmitted content of the customer number set and allowing it to be stored in less space, thus improving compression efficiency.
[0068] Based on the embodiments disclosed in the present invention above, in another embodiment of the present invention, the specific implementation method of step S103 to compress the customer number group to be compressed and obtain the group compression result is described in detail.
[0069] As one possible implementation method, please refer to the appendix. Figure 2 This is a flowchart illustrating a method for compressing customer number groups to obtain compressed group results, as disclosed in this invention. The method may include the following steps:
[0070] Step S201: Based on the preset provincial and municipal code field mapping table and auspicious number segment mapping table, the customer number group to be compressed is transcoded. The sequence number field after transcoding is four bytes. Each sequence after transcoding includes the provincial and municipal code field mapping value and the auspicious number segment mapping value. The provincial and municipal code field mapping value is one byte and the auspicious number segment mapping value is one byte.
[0071] The preset mapping table for province and city codes is shown in Table 1:
[0072]
[0073]
[0074] Table 1. Mapping Table of Province and City Code Fields
[0075] The preset auspicious number segment mapping table is shown in Table 2:
[0076] Serial Number Original value (character) Mapped value (numerical value) Encoding (8 bits) 1 6 1 00000001 2 8 2 00000010 3 9 3 00000011
[0077] Table 2. Mapping Table of Auspicious Number Segments
[0078] In this application, the sequence number field in the customer number group to be compressed is transcoded. The sequence number field represents a range of 1-999999999, which can be represented by 4 bytes within a 32-bit unsigned integer range. The sequence set in the customer number group to be compressed is transcoded, where there are 34 provincial and municipal code fields, which can be represented by 1 byte within an 8-bit unsigned integer range. There are 3 auspicious number fields, which can be represented by 1 byte within an 8-bit unsigned integer range.
[0079] Step S202: Merge the mapping values of the province and city code field and the auspicious number segment in each sequence after transcoding to obtain a merged sequence. The merged sequence is one byte, with the lower six bits of the byte corresponding to the mapping value of the province and city code field and the higher two bits corresponding to the mapping value of the auspicious number segment.
[0080] In this application, the mapping value of the province and city code field in each sequence after transcoding occupies six bits in one byte, and the mapping value of the auspicious number segment in each sequence after transcoding occupies two bits in one byte. They can be merged to obtain the merged sequence.
[0081] Step S203: Perform binary encoding on the transcoded sequence number field and the merged sequence to obtain the binary representation of the customer number group to be compressed.
[0082] It should be noted that the customer number is stored in binary.
[0083] Step S204: Add a preset end marker to the end of the binary representation of the customer number group to be compressed to obtain the group compression result.
[0084] In this application, it is necessary to determine whether the merged sequence is the last sequence in the customer number group to be compressed. If so, a preset end flag is added to the end of the binary representation of the customer number group to be compressed to obtain the group compression result.
[0085] In summary, the method provided by the embodiments of the present invention for compressing customer number groups to obtain compressed group results reduces the required storage space of the merged sequence, and the preset end marker facilitates decoding.
[0086] Based on the embodiments disclosed in the present invention above, in another embodiment of the present invention, the specific implementation of step S101 of obtaining the set of customer numbers to be compressed is described in detail.
[0087] As one possible implementation method, please refer to the appendix. Figure 3 This is a flowchart illustrating a method for obtaining a set of customer numbers to be compressed, as disclosed in this invention. The method may include the following steps:
[0088] Step S301: Obtain the original customer number set, which includes multiple original customer numbers. Each original customer number includes a fixed value field, a province / city code field, a sequence number field, a check code field, and a lucky number field.
[0089] In this application, according to the customer number encoding rule table, the original customer number includes 5 fields: a fixed value field, a province / city code field, a sequence number field, a check code field, and a lucky number field. The fixed value field is two bytes, the province / city code field is two bytes, the sequence number field is nine bytes, the check code field is two bytes, and the lucky number field is one byte.
[0090] The customer number coding rules are shown in Table 3:
[0091]
[0092]
[0093] Table 3 Customer Number Coding Rules
[0094] Step S302: Clean each original customer number in the original customer number set, eliminating the fixed value field and check code field in each original customer number, to obtain the customer number set to be compressed.
[0095] In this application, according to information theory, a known, unchanging encoded information quantity is 0. Therefore, the fixed value field does not need to be encoded and can be directly restored during decoding. The check code field is obtained from the fixed value field, the sequence number field, and the auspicious number segment using the ISO 7064 Mode 97-10 algorithm. Therefore, the information quantity of this field is the same as that of the fixed value field + sequence number field + auspicious number segment, and it also does not need to be encoded. It can be directly recalculated using the fixed formula during decoding. Therefore, a customer number only has 3 fields with information quantity, namely the sequence number field, the province / city code field, and the auspicious number segment.
[0096] In summary, the method for obtaining a set of customer numbers to be compressed provided by the embodiments of the present invention eliminates fixed value fields and check code fields, reduces redundant information, can be stored in smaller spaces, and improves compression efficiency.
[0097] Based on the embodiments disclosed in the present invention above, in another embodiment of the present invention, the specific implementation method of grouping multiple customer numbers to be compressed in step S102 to obtain multiple customer number groups to be compressed is described in detail.
[0098] As one possible implementation method, please refer to the appendix. Figure 4 This is a flowchart illustrating a method for grouping multiple customer numbers to be compressed, as disclosed in this invention. The method may include the following steps:
[0099] Step S401: For each customer number to be compressed, use the sequence number field of the customer number to be compressed as the key and the sequence composed of the province / city code field and the auspicious number segment of the customer number to be compressed as the value to obtain the key-value pair corresponding to the customer number to be compressed.
[0100] In this application, for example, the customer number of the 100th customer in a certain city can be represented as 11000000100, and the customer number of the 100th customer in a certain province can be represented as 13000000100. Both have the same sequence number field 000000100. The sequence number field is used as the key, and the sequence consisting of the province and city code field and the auspicious number field is used as the value to form a (sequence number, [province and city code, auspicious number]) key-value pair.
[0101] Step S402: Among the key-value pairs corresponding to each client number to be compressed, those with the same key are grouped into the same group, resulting in multiple groups of client numbers to be compressed.
[0102] In summary, the method provided by this invention for grouping multiple customer numbers to be compressed to obtain multiple customer number groups has significant repetition in the sequence number field at the province and city level. This reduces storage space by combining the groups, and also reduces storage space by grouping key-value pairs with the same key into the same group, thereby improving compression efficiency.
[0103] Based on the embodiments disclosed in the present invention above, in another embodiment of the present invention, the specific implementation method of step S104 determining the compression result of the set of customer numbers to be compressed based on each group compression result is described in detail.
[0104] As one possible implementation method, please refer to the appendix. Figure 5 This is a flowchart illustrating a method for determining the compression result of a set of customer numbers to be compressed based on the compression results of each group, as disclosed in this invention. The method may include the following steps:
[0105] Step S501: Combine the compression results of each group to obtain the combined compression result.
[0106] Step S502: Determine the combined compression result as the compression result of the set of customer numbers to be compressed, or use a preset compression algorithm to compress the combined compression result again to obtain the compression result of the set of customer numbers to be compressed.
[0107] In this application, the preset compression algorithm can be a method such as Huffman.
[0108] In summary, the method for determining the compression result of the set of customer numbers to be compressed based on the compression results of each group provided by the embodiments of the present invention, and the use of methods such as Huffman to compress the combined compression result again, can further improve the compression efficiency.
[0109] In response to the above-mentioned customer number compression method, the present invention provides a customer number decompression method. The customer number decompression method provided by the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0110] Please see the appendix Figure 6 , Figure 6 This is a flowchart illustrating a customer number decompression method provided in an embodiment of the present invention. The method may include the following steps:
[0111] Step S601: Obtain the compression result. The compression result includes multiple group compression results. Each group compression result includes the sequence number field compression result, the sequence set compression result, and a preset end marker. The sequence set compression result includes at least one sequence compression result. The sequence number field compression result is four bytes, each sequence compression result is one byte, and the preset end marker is one byte.
[0112] In this application, the obtained compression results are multiple grouped compression results. Each grouped compression result needs to be analyzed separately to obtain the sequence number field compression result, the sequence set compression result, and the preset end flag.
[0113] Step S602: For each group compression result, decompress the first four bytes of the group compression result to obtain the sequence number field, which is nine bytes; decompress each byte of the remaining bytes after removing the first four bytes and the preset end marker in the group compression result to obtain a set of province and city code fields and a lucky number field, where the province and city code field is two bytes and the lucky number field is one byte; combine each set of province and city code fields and lucky number field with the sequence number field to obtain the decompressed customer number corresponding to the group compression result.
[0114] In this application, the sequence number field is compressed to the first four bytes. The first four bytes of the group compression result are represented in decimal to obtain the sequence number field. Each byte of the remaining bytes after removing the first four bytes and the preset end marker in the group compression result is a sequence. Each byte of the remaining bytes after removing the first four bytes and the preset end marker in the group compression result is decompressed to obtain the province / city code field and the auspicious number field. The details will be explained in detail through the following embodiments, and will not be described here.
[0115] In summary, the customer number decompression method provided in this embodiment of the invention corresponds to the customer number compression method provided in the above embodiments, and can restore the customer number while reducing the storage space of the customer number.
[0116] Based on the embodiments disclosed in the present invention above, in another embodiment of the present invention, a detailed description is provided of the specific implementation method of decompressing each byte in the remaining bytes after removing the first four bytes and the preset end marker in the group compression result to obtain a set of provincial and municipal code fields and auspicious number segments.
[0117] As one possible implementation method, please refer to the appendix. Figure 7 This is a flowchart illustrating a method disclosed in this invention for decompressing each byte remaining after removing the first four bytes and a preset end marker from a grouped compression result to obtain a set of province / city code fields and auspicious number segments. The method may include the following steps:
[0118] Step S701: Convert the lower six bits of the byte into the mapping value of the province / city code field, and the higher two bits into the mapping value of the auspicious number field.
[0119] Step S702: Based on the preset province and city code field mapping table, convert the mapping value of the province and city code field into the province and city code field.
[0120] Step S703: Based on the preset auspicious number segment mapping table, convert the mapping value of the auspicious number segment into an auspicious number segment.
[0121] In summary, the method provided by this embodiment of the invention decompresses each byte of the remaining bytes after removing the first four bytes and the preset end marker in the grouped compression result to obtain a set of provincial and municipal code fields and auspicious number segments. The provincial and municipal code fields and auspicious number segments are obtained through the preset provincial and municipal code field mapping table and auspicious number segment mapping table. The decompression process is simple and easy to operate.
[0122] Based on the embodiments disclosed in the present invention above, in another embodiment of the present invention, the specific implementation method after obtaining each decompressed customer number is described in detail.
[0123] As one possible implementation, after obtaining each decompressed customer number, a check digit field can be determined for each decompressed customer number based on the customer number's sequence number field, province / city code field, and auspicious number segment; based on a preset field order, the customer number's sequence number field, province / city code field, auspicious number segment, check digit field, and preset fixed value field are combined to obtain the corresponding original customer number.
[0124] In this application, the check code field of the customer number is determined by the ISO7064Mode 97-10 algorithm based on the sequence number field, the province / city code field, and the auspicious number segment of the customer number. The check code field and the preset fixed value field are then directly recovered to obtain the corresponding original customer number.
[0125] In summary, the alternative customer number decompression method provided by this embodiment of the invention adds a fixed value field and a verification code field, making the customer number data more complete and clear.
[0126] The methods described in the above-disclosed embodiments of the present invention are detailed in terms of their specific implementation. The methods of the present invention can be implemented using various forms of devices. Therefore, the present invention also discloses a customer number compression device, and specific embodiments are given below for detailed description.
[0127] Please see the appendix Figure 8 , Figure 8 This is a schematic diagram of a customer number compression device disclosed in an embodiment of this application. The device includes:
[0128] The acquisition unit 11 is used to acquire a set of customer numbers to be compressed. The set of customer numbers to be compressed includes multiple customer numbers to be compressed. Each customer number to be compressed includes a province / city code field, a sequence number field, and an auspicious number segment. The sequence number field is nine bytes, the province / city code field is two bytes, and the auspicious number segment is one byte.
[0129] Grouping unit 12 is used to group the plurality of customer numbers to be compressed to obtain a plurality of customer number groups to be compressed; each customer number group to be compressed includes a sequence number field and a sequence set, the sequence set includes at least one sequence, each sequence being composed of the province and city code field and the auspicious number segment of the same customer number to be compressed.
[0130] Compression unit 13 is used to compress each customer number group to be compressed to obtain a group compression result. The group compression result includes a sequence number field compression result, a sequence set compression result, and a preset end flag. The sequence set compression result includes at least one sequence compression result. The sequence number field compression result is four bytes, each sequence compression result is one byte, and the preset end flag is one byte.
[0131] The determining unit 14 is used to determine the compression result of the set of customer numbers to be compressed based on the compression results of each group.
[0132] The methods described in the above-disclosed embodiments of the present invention are detailed. The methods of the present invention can be implemented by various forms of devices. Therefore, the present invention also discloses a customer number decompression device. Specific embodiments are given below for detailed description.
[0133] Please see the appendix Figure 9 , Figure 9 This is a schematic diagram of a customer number decompression device disclosed in an embodiment of this application. The device includes:
[0134] The acquisition unit 21 is used to acquire compression results, which include multiple group compression results. Each group compression result includes a sequence number field compression result, a sequence set compression result, and a preset end flag. The sequence set compression result includes at least one sequence compression result. The sequence number field compression result is four bytes, each sequence compression result is one byte, and the preset end flag is one byte.
[0135] The decompression unit 22 is used to decompress the first four bytes of each group compression result to obtain a sequence number field, which is nine bytes; decompress each byte of the remaining bytes after removing the first four bytes and the preset end marker to obtain a set of province / city code fields and a lucky number segment, where the province / city code field is two bytes and the lucky number segment is one byte; and combine each set of province / city code fields and lucky number segment with the sequence number field to obtain the decompressed customer number corresponding to the group compression result.
[0136] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.
[0137] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the device embodiments provided by this invention, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.
[0138] Through the above description of the embodiments, those skilled in the art can clearly understand that the present invention can be implemented by means of software plus necessary general-purpose hardware, and of course, it can also be implemented by special hardware including application-specific integrated circuits, special CPUs, special memory, special components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for the present invention, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, portable hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0139] In summary, 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 above embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the above embodiments, or equivalent substitutions can be made to some of the technical features. These modifications or substitutions do not cause the essence of the corresponding technical solutions to depart from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A client number compression method, characterized by, The method comprises the following steps: obtaining a set of to-be-compressed customer numbers, the set of to-be-compressed customer numbers comprising a plurality of to-be-compressed customer numbers, each to-be-compressed customer number comprising a province-city code field, a sequence number field and a lucky number field; the sequence number field is nine bytes, the province-city code field is two bytes, and the lucky number field is one byte; grouping the plurality of to-be-compressed customer numbers to obtain a plurality of to-be-compressed customer number groups; each to-be-compressed customer number group comprises a sequence number field and a sequence set, and the sequence set comprises at least one sequence, each sequence being composed of the province-city code field and the lucky number field in the same to-be-compressed customer number; compressing each to-be-compressed customer number group to obtain a group compression result, the group compression result comprising a sequence number field compression result, a sequence set compression result and a preset end marker, the sequence set compression result comprising at least one sequence compression result, the sequence number field compression result being four bytes, each sequence compression result being one byte, and the preset end marker being one byte; determining a compression result of the set of to-be-compressed customer numbers based on the group compression results.
2. The method of claim 1, wherein, The method of compressing each to-be-compressed customer number group to obtain a group compression result comprises the following steps: based on a preset province-city code field mapping table and a lucky number field mapping table, transcoding the to-be-compressed customer number group, the transcoded sequence number field being four bytes, each transcoded sequence comprising a province-city code field mapping value and a lucky number field mapping value, the province-city code field mapping value being one byte, and the lucky number field mapping value being one byte; merging the province-city code field mapping value and the lucky number field mapping value in each transcoded sequence to obtain a merged sequence, the merged sequence being one byte, the lower six bits of the byte corresponding to the province-city code field mapping value, and the upper two bits corresponding to the lucky number field mapping value; binary encoding the transcoded sequence number field and the merged sequence to obtain a binary representation of the to-be-compressed customer number group; adding a preset end marker at the end of the binary representation of the to-be-compressed customer number group to obtain a group compression result.
3. The method of claim 1, wherein, The method of obtaining a set of to-be-compressed customer numbers comprises the following steps: obtaining a set of original customer numbers, the set of original customer numbers comprising a plurality of original customer numbers, each original customer number comprising a fixed value field, a province-city code field, a sequence number field, a check code field and a lucky number field; cleaning each original customer number in the set of original customer numbers to eliminate the fixed value field and the check code field in each original customer number, thereby obtaining a set of to-be-compressed customer numbers.
4. The method of claim 1, wherein, The method of grouping the plurality of to-be-compressed customer numbers to obtain a plurality of to-be-compressed customer number groups comprises the following steps: for each to-be-compressed customer number, taking the sequence number field of the to-be-compressed customer number as a key and taking a sequence composed of the province-city code field and the lucky number field of the to-be-compressed customer number as a value to obtain a key-value pair corresponding to the to-be-compressed customer number; The key-value pairs corresponding to each to-be-compressed customer number are divided into groups according to the keys, and a plurality of groups of the to-be-compressed customer numbers are obtained.
5. The method according to any one of claims 1 to 4, characterized in that, The compression result of the set of to-be-compressed customer numbers is determined based on the compression result of each group. The compression results of the groups are combined to obtain a combined compression result. The combined compression result is determined as the compression result of the set of to-be-compressed customer numbers. Alternatively, the combined compression result is compressed again by using a preset compression algorithm to obtain the compression result of the set of to-be-compressed customer numbers.
6. A customer number decompression method characterized by comprising: The method comprises the following steps: obtaining a compression result, wherein the compression result comprises a plurality of group compression results, each group compression result comprises a sequence number field compression result, a sequence set compression result, and a preset end flag, the sequence set compression result comprises at least one sequence compression result, the sequence number field compression result is four bytes, each sequence compression result is one byte, and the preset end flag is one byte; for each group compression result, decompressing the first four bytes in the group compression result to obtain a sequence number field, the sequence number field is nine bytes; decompressing each byte in the remaining bytes in the group compression result after removing the first four bytes and the preset end flag to obtain a group of province and city code fields and auspicious number fields, the province and city code field is two bytes, and the auspicious number field is one byte; and combining each group of province and city code fields and auspicious number fields with the sequence number field to obtain a decompressed customer number corresponding to the group compression result.
7. The method of claim 6, wherein, The decompression of each byte in the remaining bytes in the group compression result after removing the first four bytes and the preset end flag to obtain a group of province and city code fields and auspicious number fields comprises the following steps: converting the lower six bits of the byte to a mapping value of the province and city code field, and converting the upper two bits to a mapping value of the auspicious number field; based on a preset province and city code field mapping table, converting the mapping value of the province and city code field to a province and city code field; based on a preset auspicious number field mapping table, converting the mapping value of the auspicious number field to an auspicious number field.
8. The method according to claim 6 or 7, characterized in that, After obtaining each decompressed customer number, the following steps are further included: for each decompressed customer number, determining a check code field of the customer number based on the sequence number field, the province and city code field, and the auspicious number field of the customer number; and combining the sequence number field, the province and city code field, the auspicious number field, the check code field, and a preset fixed value field of the customer number in a preset field order to obtain a corresponding original customer number.
9. A client number compression apparatus characterized by comprising: The method comprises the following steps: an obtaining unit is configured to obtain a set of to-be-compressed customer numbers, wherein the set of to-be-compressed customer numbers comprises a plurality of to-be-compressed customer numbers, each to-be-compressed customer number comprises a province and city code field, a sequence number field, and an auspicious number field; the sequence number field is nine bytes, the province and city code field is two bytes, and the auspicious number field is one byte; The grouping unit is configured to group the plurality of to-be-compressed customer numbers to obtain a plurality of to-be-compressed customer number groups, each to-be-compressed customer number group including a sequence number field and a sequence set, and each sequence in the sequence set being composed of a province-city code field and a lucky number field in the same to-be-compressed customer number; The compression unit is configured to compress each to-be-compressed customer number group to obtain a group compression result, the group compression result including a sequence number field compression result, a sequence set compression result, and a preset end flag, the sequence set compression result including at least one sequence compression result, the sequence number field compression result being four bytes, each sequence compression result being one byte, and the preset end flag being one byte; The determination unit is configured to determine a compression result of the set of to-be-compressed customer numbers based on each group compression result.
10. A customer number decompression apparatus characterized by comprising: The obtaining unit is configured to obtain a compression result, the compression result including a plurality of group compression results, each group compression result including a sequence number field compression result, a sequence set compression result, and a preset end flag, the sequence set compression result including at least one sequence compression result, the sequence number field compression result being four bytes, each sequence compression result being one byte, and the preset end flag being one byte; The decompression unit is configured to decompress the first four bytes in each group compression result to obtain a sequence number field, the sequence number field being nine bytes; decompress each byte in the remaining bytes in the group compression result after removing the first four bytes and the preset end flag to obtain a group of province-city code fields and lucky number fields, the province-city code field being two bytes, and the lucky number field being one byte; and combine each group of province-city code fields and lucky number fields with the sequence number field to obtain a decompressed customer number corresponding to the group compression result.
Citation Information
Patent Citations
Data compression and decompression method, electronic equipment and computer readable storage medium
CN110442557A
Data compression method, controller, device, medium and program product
CN115145467A