WO2024037094A1 - 设备订单数据的存储方法、查询方法及装置 - Google Patents

设备订单数据的存储方法、查询方法及装置 Download PDF

Info

Publication number
WO2024037094A1
WO2024037094A1 PCT/CN2023/096592 CN2023096592W WO2024037094A1 WO 2024037094 A1 WO2024037094 A1 WO 2024037094A1 CN 2023096592 W CN2023096592 W CN 2023096592W WO 2024037094 A1 WO2024037094 A1 WO 2024037094A1
Authority
WO
WIPO (PCT)
Prior art keywords
information
target
identification
server
current
Prior art date
Application number
PCT/CN2023/096592
Other languages
English (en)
French (fr)
Inventor
蒋永鑫
袁镒文
廖其龙
Original Assignee
深圳市星卡软件技术开发有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市星卡软件技术开发有限公司 filed Critical 深圳市星卡软件技术开发有限公司
Publication of WO2024037094A1 publication Critical patent/WO2024037094A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2255Hash tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9537Spatial or temporal dependent retrieval, e.g. spatiotemporal queries
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Definitions

  • the present disclosure relates to the field of data processing technology, and in particular, to a storage method, query method and device for equipment order data.
  • Big data is a product of this high-tech era and a product of a huge population base. Big data is both a resource and a lifeblood.
  • Big data is a resource, and data analysis is particularly important. At this point, the problem is exposed. As the data files to be analyzed become larger and larger, data reading becomes more and more difficult. It is impossible to meet the increasing amount of data reading by infinitely increasing the hardware cost. A breakup is imminent.
  • Data attributes include data generation date, data source, data type, etc.; for example, splitting according to data generation date, such as generating a data table every month or every week. , or split according to data sources, such as data from different data sources stored in different data tables. Storing data according to the above data classification storage method cannot deal with data bottlenecks well, and will cause great inconvenience during data query, and cannot meet the needs of timely data query.
  • the purpose of this disclosure is to provide a storage method, query method and device for equipment order data, which not only can cope with data bottlenecks, but also does not affect the demand for data statistics, and is conducive to subsequent expansion.
  • embodiments of the present disclosure provide a method for storing equipment order data.
  • the method includes: obtaining target equipment order data; the target equipment order data includes: target user identification, target equipment identification, equipment order information, and software detail information; respectively Use the device order information and software details information as the current information, and perform the following storage steps: perform the first hash modulus operation based on the target user ID to locate the target server; obtain the current timestamp and target server The server identification; based on the server identification, current timestamp, target device identification and snowflake algorithm, randomly generate the information identification corresponding to the current information; the information identification is decimal encoding; perform the second hash modulus operation on the specified digits in the information identification , locate the target database in the target server; locate the target information table corresponding to the target month from the multiple information tables of the target database according to the category of the current information and the current timestamp; identify the current information and the information corresponding to the current information Stored in the target information table; the target user identification, the first information identification corresponding to the
  • the above-mentioned step of performing a first hash modulus operation based on the target user ID to locate the target server includes: obtaining the ASCll code value corresponding to each character in the target user ID; based on multiple characters The corresponding ASCll code values are subjected to the first hash operation to obtain the first decimal hash value; the first decimal hash value is used to perform the first modulo operation on the number of servers to obtain the server positioning information; according to Server location information determines the target server.
  • Y n+1 represents the first decimal hash value after the nth character operation
  • Y n represents the decimal hash value after the n-1th character operation
  • X n represents the ASCll corresponding to the nth character.
  • the above-mentioned step of randomly generating an information identifier corresponding to the current information based on the server identifier, current timestamp, target device identifier, and snowflake algorithm includes: using the target device identifier as a fixed serial number, based on the server The identification, current timestamp and fixed sequence number are randomly generated with a specified number of binary codes through the snowflake algorithm; the binary code is converted into a decimal code to obtain the information identification corresponding to the current information.
  • the above-mentioned step of performing a second hash modulus operation on the designated digits in the information identification and locating the target database includes: obtaining the ASC11 code values corresponding to the designated digits in the information identification. ; Perform a second hash operation based on the ASCll code values corresponding to the multiple numbers to obtain a 20-digit hash value; use the 2-digit hash value to perform a second modulus on the number of databases in the target server Compute to obtain the database positioning information; determine the target database in the target server based on the database positioning information.
  • the above-mentioned step of locating the target information table corresponding to the target month from the multiple information tables corresponding to the target database based on the category of the current information and the current timestamp includes: based on the current timestamp, Determine the target month; determine multiple information tables corresponding to the target month from the multiple information tables corresponding to the target database; determine the target information table from the multiple information tables corresponding to the target month according to the category of the current information.
  • embodiments of the present disclosure also provide a method for querying equipment order data, and the method is applied to a server;
  • the server stores data stored through the storage method of equipment order data as described in the first aspect; the method includes: obtaining a query request for the target equipment order data; the query request carries the target user identification; according to the target user identification, from Search the first information identifier corresponding to the equipment order information associated with the target user identifier in the specified database, and the second information identifier corresponding to the software details information; use the first information identifier and the second information identifier as the current identifiers respectively, and perform inversion based on the current identifiers.
  • Solution Determine the information table corresponding to the target month in the target database in the target server; read the information corresponding to the current identifier from the information table corresponding to the target month.
  • the above-mentioned step of performing reverse decryption based on the current identification to determine the information table corresponding to the target month in the target database in the target server includes: decrypting the current identification to obtain the target server identification and Target timestamp; determine the target server corresponding to the target server ID; perform a hash modulo operation on the specified digits in the current ID to determine the target database in the target server; based on the target timestamp, obtain multiple information tables corresponding to the target database , locate the information table corresponding to the target month.
  • inventions of the present disclosure also provide a storage device for equipment order data.
  • the device includes: a data acquisition module for obtaining target equipment order data; the target equipment order data includes: target user identification, target equipment identification, equipment order Information and software details information; the first data storage module is used to respectively use the device order information and software details information as current information, and perform the following storage steps: through the first hash modulus module, perform the first hash according to the target user identification Modulo operation is used to locate the target server; through the information identification generation module, the current timestamp and the server identification of the target server are obtained; based on the server identification, current timestamp, target device identification and snowflake algorithm, the information identification corresponding to the current information is randomly generated; information The identification is decimal encoding; through the second hash modulus module, the second hash modulus operation is performed on the specified digits in the information identification to locate the target database in the target server; through the information table positioning module, according to the category of the current information and the current timestamp, locate the target information
  • embodiments of the present disclosure also provide a device for querying equipment order data, which is applied to a server; the server stores data stored by the method for storing equipment order data as described in the first aspect; the device includes: The request acquisition module is used to obtain the query request for the target device order data; the query request carries the target user ID; the ID search module is used to find the device order information associated with the target user ID from the specified database based on the target user ID.
  • the first information identifier corresponds to the second information identifier of the software details information; the data reading module is used to respectively use the first information identifier and the second information identifier as the current identifier, perform inverse analysis according to the current identifier, and determine the target server.
  • the information table corresponding to the target month in the target database read the information corresponding to the current identifier from the information table corresponding to the target month.
  • embodiments of the present disclosure also provide an electronic device, including a processor and a memory, and the memory stores Computer-executable instructions that can be executed by the processor.
  • the processor executes the computer-executable instructions to implement the method described in the first aspect.
  • embodiments of the present disclosure also provide a computer-readable storage medium.
  • the computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by the processor, the computer-executable instructions cause the processor to Implement the method described in the first aspect above.
  • the target equipment order data is first obtained;
  • the target equipment order data includes: target user identification, target equipment identification, equipment order information and software details information; respectively Use the device order information and software details as the current information, and perform the following storage steps: perform the first hash modulus operation based on the target user ID to locate the target server; then use the target server's server ID, current timestamp, and target
  • the device identification and snowflake algorithm randomly generate the decimal information identification corresponding to the current information; then perform a second hash modulo operation on the specified digits in the information identification to locate the target database in the target server; and then use the current information to category and current timestamp, locate the target information table corresponding to the target month from multiple information tables in the target database; finally, store the current information and the information identification corresponding to the current information in the target information table; and store the target user identification, device
  • the target location where the two types of information in the equipment order data should be stored is finally located, that is, in the target server.
  • the target information table in the target database through this data storage method, can alleviate the database storage bottleneck problem in the existing technology, and can meet the needs of data statistics, and is conducive to subsequent data storage expansion.
  • Figure 1 is a flow chart of a method for storing equipment order data provided by an embodiment of the present disclosure
  • Figure 2 is a flow chart of a target server determination process in a method for storing equipment order data provided by an embodiment of the present disclosure
  • Figure 3 is a flow chart of a target database determination process in a method for storing equipment order data provided by an embodiment of the present disclosure
  • Figure 4 is a schematic diagram of hierarchical storage in a method for storing equipment order data provided by an embodiment of the present disclosure
  • Figure 5 is a flow chart of a method for querying equipment order data provided by an embodiment of the present disclosure
  • Figure 6 is a structural block diagram of a device for storing equipment order data provided by an embodiment of the present disclosure
  • Figure 7 is a structural block diagram of a device for querying equipment order data provided by an embodiment of the present disclosure.
  • FIG. 8 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
  • Data attributes include data generation date, data source, data type, etc.; for example, splitting data by date: such as the data storage of mobile phone number SMS records in April.
  • mobile_mess_4 the data in May is stored in mobile_mess_5.
  • Another example is splitting data by data source: For example, the text message records of mobile phone numbers belong to the friends in the address book and are stored in mobile_mess_friends, and the text messages that are not in the address book are stored in the mobile_mess_stranger table. It is very convenient to query the text messages of friends in the address book and those in the non-address book. Text messages are also very convenient, but to query all text messages in a certain time period, you need to summarize the data from two tables. Therefore, storing data according to the above data classification storage method cannot deal with data bottlenecks well, and will cause great inconvenience during data query, and cannot meet the needs of timely data query.
  • embodiments of the present disclosure provide a storage method, query method and device for equipment order data, which can not only cope with data bottlenecks, but also do not affect the demand for data statistics, and are conducive to subsequent expansion.
  • a method for storing equipment order data disclosed in this embodiment of the present disclosure is first introduced in detail.
  • embodiments of the present disclosure provide a storage method for equipment order data to alleviate the database storage bottleneck problem when large amounts of data are stored, meet the needs of data statistics, and facilitate subsequent data storage expansion.
  • the method specifically includes the following steps:
  • Step S102 Obtain target device order data; where the target device order data includes: target user identification, target device identification, equipment order information, and software detail information.
  • the application scenario in this embodiment is: a user purchases a software product for a certain device; therefore, the above target device
  • the order data may include: target user identification, target device identification, device order information and software details.
  • the device order information includes: the quantity of software purchased for the device, the message amount, software type, etc.; the software details include: detailed information of each software purchased, such as usage method, validity period, etc.
  • Step S104 use the equipment order information and software details information as current information respectively, and perform the following storage steps:
  • Step S1041 Perform a first hash modulus operation based on the target user identification to locate the target server.
  • the above target user ID can be a string composed of any characters, and the characters can be letters, numbers, special symbols, etc.
  • the first hash modulus operation is further performed on the ID to locate the target server.
  • the hash modulo operation involves hashing the identifier and modulo the hashed value by the number of servers. It should be noted that the number of servers mentioned above is the number of servers that can currently store data. If the number of servers changes, the number of servers will be updated in real time.
  • Step S1042 Obtain the current timestamp and the server identification of the target server; randomly generate an information identification corresponding to the current information based on the server identification, current timestamp, target device identification and snowflake algorithm; the information identification is decimal encoding.
  • a 64-bit binary number is usually generated (for example: 00010011 00000100 01100011 01010111 00000110 01100100 01100101 00101000), which is converted into a decimal number, for example: 13046355706646528.
  • Step S1043 Perform a second hash modulus operation on the specified digit in the information identifier to locate the target database in the target server.
  • the above specified digits can be the last few digits of the information identifier, the first few digits, the middle digits, or a string of numbers obtained by taking every digit.
  • the second hash modulo operation is similar to the first hash modulo operation mentioned above. The difference is that in the first hash modulo operation, the target user ID and the number of servers are used; in the second hash modulo operation, What is received is the above information identification and the number of databases in the target server. The specific operation process is detailed later.
  • Step S1044 Locate the target information table corresponding to the target month from multiple information tables in the target database according to the category of the current information and the current timestamp.
  • the above current timestamp can be directly converted into a specific time, and the corresponding month can be determined, thereby further determining the information table corresponding to the month in the target database.
  • the information table in a month will be divided according to the information category. are multiple tables. In this embodiment, they include: an order table and a details table.
  • the order table is used to store equipment orders. Single information, the details table is used to store software detailed information. Based on the category of the current information, you can determine which table under the target month the current information is to be stored in.
  • Step S1045 Store the current information and the information identifier corresponding to the current information in the target information table.
  • the equipment order information and software details information can be stored in the corresponding target information table respectively, and the corresponding information identification can be stored at the same time.
  • Step S106 associate and store the target user identification, the first information identification corresponding to the equipment order information, and the second information identification corresponding to the software details information in the designated database.
  • the target user identification In order to facilitate data query, it is also necessary to associate and store the above target user identification, the first information identification corresponding to the equipment order information, and the second information identification corresponding to the software details information, which can be stored in an intermediate table of the designated database. In this way, if the target user ID is known, the first information ID corresponding to the equipment order information and the second information ID corresponding to the software details information can be directly found. By back-decoding the first information identifier and the second information identifier, the specific storage location of the equipment order information and software details information can be determined.
  • the target equipment order data is first obtained; the target equipment order data includes: target user identification, target equipment identification, equipment order information and software details information; respectively, the equipment order information and The software details information is used as the current information and the following storage steps are performed: perform the first hash modulus operation based on the target user ID to locate the target server; then use the target server's server ID, current timestamp, target device ID, and snowflake algorithm to locate the target server.
  • the target location where the two types of information in the equipment order data should be stored is finally located, that is, in the target server.
  • the target information table in the target database through this data storage method, can alleviate the database storage bottleneck problem in the existing technology, and can meet the needs of data statistics, and is conducive to subsequent data storage expansion.
  • embodiments of the present disclosure also provide a method for storing equipment order data. This method is implemented on the basis of the previous embodiment. This embodiment focuses on describing the hash modulo operation process and the final storage location determination process. .
  • the above-mentioned first hash modulus operation is performed based on the target user ID to locate the target server, which specifically includes the following steps:
  • Step S202 obtain the ASCll code value corresponding to each character in the target user ID
  • Step S204 Perform a first hash operation based on the ASCll code values corresponding to the plurality of characters to obtain a first decimal hash value;
  • Y n+1 represents the first decimal hash value after the nth character operation
  • Y n represents the decimal hash value after the n-1th character operation
  • X n represents the ASCll corresponding to the nth character.
  • the above target user ID is 123
  • the ASCll code values corresponding to the ID 123 are 49, 50, and 51 respectively
  • the decimal hash value is 48690.
  • the above target user ID is abc: the ASCll code values corresponding to abc are 97, 98, and 99 respectively;
  • the decimal hash value is 96354.
  • Step S206 Use the first decimal hash value to perform a first modulo operation on the number of servers to obtain server positioning information.
  • Step S208 Determine the target server according to the server location information.
  • the above target user ID is 123 as an example.
  • the above-mentioned steps of randomly generating the information identification corresponding to the current information based on the server identification, current timestamp, target device identification and snowflake algorithm include the following steps:
  • a binary code with specified digits is randomly generated; the binary code is converted into a decimal code to obtain the information identification corresponding to the current information.
  • the principle of the snowflake algorithm is to generate a 64-bit long type unique ID.
  • the highest 1 bit has a fixed value of 0, Because the generated ID is a positive integer, if it is 1, it is a negative number.
  • the last 12 bits store the serial number.
  • the 5-digit machine ID and the 5-digit service ID are determined by the above-mentioned target server identification; the 12-digit storage serial number is determined by the target device identification.
  • the above-mentioned step of performing a second hash modulo operation on the designated digits in the information identifier to locate the target database is shown in Figure 3, and specifically includes the following steps:
  • Step S302 obtain the ASC11 code values corresponding to the specified digits in the information identification
  • Step S304 Perform a second hash operation based on the ASCll code values corresponding to the plurality of numbers to obtain a second decimal hash value;
  • Step S306 Apply the second decimal hash value to perform a second modulo operation on the number of databases in the target server to obtain database positioning information;
  • Step S308 Determine the target database in the target server according to the database positioning information.
  • This process is similar to the aforementioned method of locating the target server and will not be described again here.
  • the above-mentioned step of locating the target information table corresponding to the target month from the multiple information tables corresponding to the target database based on the category of the current information and the current timestamp includes:
  • equipment order data includes equipment order information (such as quantity, amount, time, etc.), software details (such as software expiration time, software installation method, software product R&D company, etc.), a complete equipment order
  • equipment order information such as quantity, amount, time, etc.
  • software details such as software expiration time, software installation method, software product R&D company, etc.
  • a complete equipment order The data contains more than ten or twenty data, so the data needs to be split when saving the data.
  • the above equipment order data contains the target user ID.
  • the target user ID is the user name that purchased the software for the target device, such as abc. If the target user ID is a Chinese name, such as Xiaoming, it can be converted into Pinyin XiaoMing first, and then processed.
  • each server contains two databases.
  • Each database contains information tables divided by month, such as order tables and details tables (for clear display, the database in server 2 Information Sheet (not shown, actually the same as in servers 1 and 3), assuming that the data to be stored is the software details in the equipment order data, the user ID is abc, a hash operation is performed based on the user ID abc, and 96354 is obtained, and Taking the modulo number of servers 3, the remainder is 0 (remainder 0 corresponds to the first server, remainder 1 corresponds to the second server, remainder 2 corresponds to the third server), then the first server among the three servers, that is Server 1 is used as the target server; then the server 1's identification, current timestamp and fixed sequence number determined by the target device identification are obtained, and an initial information ID is generated through the snowflake algorithm.
  • the initial information ID is a 64-bit binary code, and then Convert it to decimal encoding to obtain the first information identification ID1 corresponding to the software details information; then perform a hash operation on the last 5 digits of the above decimal encoding, and the obtained hash value is then 2 (that is, the number of databases in server 1) Take the modulus, assuming that 1 is obtained, then use the second database in server 1, that is, database 2, as the target database; further, determine the current month based on the current timestamp, assuming it is September, and store it in the details table corresponding to September The above software detailed information and the first information identifier ID1.
  • the storage location corresponding to the equipment order information can also be determined.
  • the process is similar to the above and will not be described again here.
  • the target user identification abc it is also necessary to store the above-mentioned target user identification abc, the first information identification ID1 corresponding to the software details information, and the second information identification ID2 corresponding to the equipment order information in the intermediate table under other databases.
  • the size of an ID is 20 bytes, a piece of equipment order data corresponds to 60 bytes, and a million pieces of data are only about 6M; this can facilitate subsequent business query data.
  • the order data storage method provided by the embodiment of the present disclosure uses multiple hash modulus operations to determine the storage location and prevent malicious crawling of data in order to make the data evenly split and distributed on each server.
  • the snowflake algorithm is used and time is added. Poke randomly generates ID.
  • the target location where the two types of information in the equipment order data should be stored is finally located, that is, in the target server.
  • the target information table in the target database through this data storage method, can alleviate the database storage bottleneck problem in the existing technology, and can meet the needs of data statistics, and is conducive to subsequent data storage expansion.
  • the messy equipment order data is split and evenly stored in multiple servers, multiple databases, and multiple tables.
  • the database storage bottleneck problem can be effectively solved.
  • For storage on a server as the volume of subsequent orders increases, the time required for the system to search for information will also increase, which will lead to downtime, and the losses caused by the downtime are immeasurable.
  • Using this method for split storage reduces the risk of downtime, facilitates information management and search, and avoids malicious crawling of order information.
  • embodiments of the present disclosure also provide a query method of equipment order data, which method is applied to the server; the server stores the storage of equipment order data as described in the first aspect.
  • the data stored by the method see Figure 5.
  • the method specifically includes the following steps:
  • Step S502 Obtain a query request for the target device order data; the query request carries the target user identification;
  • Step S504 according to the target user identification, search the first information identification corresponding to the equipment order information associated with the target user identification and the second information identification corresponding to the software details information from the designated database;
  • Step S506 Use the first information identifier and the second information identifier as current identifiers, perform inverse analysis according to the current identifiers, and determine the information table corresponding to the target month in the target database in the target server.
  • the hash modulo operation is the same as the second hash modulus operation in the aforementioned storage method, that is, the second modulo operation is performed on the number of databases in the target server, so that the determined target database will be consistent with the target database during storage. of.
  • Step S508 Read the information corresponding to the current identifier from the information table corresponding to the target month.
  • ID1 can be decrypted to obtain the target server identification and target Timestamp
  • the target server can be determined through the target server identification, such as server 1, and then the last five digits in ID1 are used to perform a hash modulo operation to determine the target database in server 1, such as database 2, and then based on the above target
  • the timestamp can determine the target month, for example, September.
  • the equipment order information corresponding to the first information identifier ID1 can be read from the order table corresponding to September.
  • the query request carries the target user identification
  • first the first information identification ID1 and the second information identification ID2 associated with the target user identification are found from the above-mentioned intermediate table; and then the first information identification ID1 is searched respectively according to the above process.
  • the messy equipment order data is split and evenly stored in multiple tables on multiple servers, multiple databases, and convenient for users to perform data queries.
  • the device includes:
  • the data acquisition module 72 is used to obtain target device order data;
  • the target device order data includes: target user identification, target device identification, equipment order information and software details information;
  • the first data storage module 74 is used to respectively use the equipment order information and software details information as current information, and perform the following storage steps: through the first hash modulus module 741, perform a first hash modulus operation according to the target user identification, Locate the target server; obtain the current timestamp and the server identification of the target server through the information identification generation module 742; randomly generate the information identification corresponding to the current information based on the server identification, current timestamp, target device identification and snowflake algorithm; the information identification is decimal Encoding; through the second hash modulus module 743, perform a second hash modulus operation on the designated digits in the information identification to locate the target database in the target server; through the information table positioning module 744, according to the category and number of the current information The current timestamp is used to locate the target information table corresponding to the target month from multiple information tables in the target database; through the data storage sub-module 745, the current information and the information identifier corresponding to the current information are stored in the target information table;
  • the second data storage module 76 is configured to associate and store the target user identification, the first information identification corresponding to the equipment order information, and the second information identification corresponding to the software details information in the designated database.
  • the above-mentioned first hash modulus module 741 is used to obtain the ASCll code value corresponding to each character in the target user identification; perform the first hash based on the ASCll code values corresponding to the multiple characters.
  • Hash operation is performed to obtain the first decimal hash value; the first decimal hash value is used to perform the first modulo operation on the number of servers to obtain server location information; the target server is determined based on the server location information.
  • Y n+1 represents the first decimal hash value after the nth character operation
  • Y n represents the decimal hash value after the n-1th character operation
  • X n represents the ASCll corresponding to the nth character.
  • the above-mentioned information identification generation module 742 is used to use the target device identification as a fixed serial number, and use the snowflake algorithm to randomly generate a binary number of specified digits based on the server identification, the current timestamp and the fixed serial number. Coding; convert binary coding into decimal coding to obtain the information identification corresponding to the current information.
  • the above-mentioned second hash modulo module 743 is used to obtain the ASC11 code values corresponding to the specified digits in the information identifier; perform the second step based on the ASC11 code values corresponding to the multiple digits.
  • the above-mentioned information table positioning module 744 is used to determine the target month according to the current timestamp; determine multiple information tables corresponding to the target month from the multiple information tables corresponding to the target database; according to The category of the current information determines the target information table from the multiple information tables corresponding to the target month.
  • the storage device for equipment order data provided by the embodiments of the present disclosure, its implementation principle and the technical effects produced are the same as those mentioned above.
  • the storage method embodiments of equipment order data are the same.
  • for parts not mentioned in the embodiments of the equipment order data storage device refer to the corresponding content in the aforementioned storage method embodiments of equipment order data.
  • embodiments of the present disclosure also provide a device for querying equipment order data, which device is applied to a server; the server stores data stored by the aforementioned method for storing equipment order data.
  • the device includes: a request acquisition module 82, used to obtain a query request for target equipment order data; the query request carries a target user identification; an identification search module 84, used to obtain a query request from a designated database according to the target user identification; Find the first information identifier corresponding to the equipment order information associated with the target user identifier, and the second information identifier corresponding to the software details information; the data reading module 86 is used to use the first information identifier and the second information identifier as the current identifier respectively. , perform inverse solution according to the current identification, and determine the information table corresponding to the target month in the target database in the target server; read the information corresponding to the current identification from the information table corresponding to the target month.
  • the above-mentioned data reading module 86 is used to decrypt the current identification to obtain the target server identification and target timestamp; determine the target server corresponding to the target server identification; and specify the current identification. Perform a hash modulo operation on the digit number to determine the target database in the target server; based on the target timestamp, locate the information table corresponding to the target month from among the multiple information tables corresponding to the target database.
  • the implementation principle and technical effects of the device for querying equipment order data provided by the embodiments of the present disclosure are the same as those of the aforementioned query method embodiments for equipment order data.
  • the embodiments of the device for querying equipment order data are not mentioned.
  • the embodiment of the present disclosure also provides an electronic device.
  • FIG. 8 which is a schematic structural diagram of the electronic device, the electronic device includes a processor 91 and a memory 90 .
  • the memory 90 stores information that can be used by the processor 91
  • the processor 91 executes the computer-executable instructions to implement the above method.
  • the electronic device also includes a bus 92 and a communication interface 93 , wherein the processor 91 , the communication interface 93 and the memory 90 are connected through the bus 92 .
  • the memory 90 may include high-speed random access memory (RAM), or may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
  • the communication connection between the system network element and at least one other network element is realized through at least one communication interface 93 (which can be wired or wireless), and the Internet, wide area network, local network, metropolitan area network, etc. can be used.
  • the bus 92 may be an ISA (Industry Standard Architecture, Industrial Standard Architecture) bus, a PCI (Peripheral Component Interconnect, Peripheral Component Interconnect Standard) bus or an EISA (Extended Industry Standard Architecture, Extended Industry Standard Architecture) bus, etc.
  • the bus 92 can be divided into an address bus, a data bus, a control bus, etc. For ease of presentation, only one bidirectional arrow is used in Figure 8, but it does not mean that there is only one bus or one type of bus.
  • the processor 91 may be an integrated circuit chip with signal processing capabilities. During the implementation process, each step of the above method can be completed by instructions in the form of hardware integrated logic circuits or software in the processor 91 .
  • the above-mentioned processor 91 can be a general-purpose processor, including a central processing unit (Central Processing Unit, referred to as CPU), a network processor (Network Processor, referred to as NP), etc.; it can also be a digital signal processor (Digital Signal Processor, referred to as DSP). ), Application Specific Integrated Circuit (ASIC for short), Field-Programmable Gate Array (FPGA for short) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.
  • CPU Central Processing Unit
  • NP Network Processor
  • DSP Digital Signal Processor
  • ASIC Application Specific Integrated Circuit
  • FPGA Field-Programmable Gate Array
  • a general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
  • the steps of the method disclosed in conjunction with the embodiments of the present disclosure can be directly implemented by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers and other mature storage media in this field.
  • the storage medium is located in the memory.
  • the processor 91 reads the information in the memory and completes the steps of the method in the aforementioned embodiment in combination with its hardware.
  • Embodiments of the present disclosure also provide a computer-readable storage medium that stores computer-executable instructions.
  • the computer-executable instructions When the computer-executable instructions are called and executed by the processor, the computer-executable instructions cause the processor to To implement the above method, please refer to the foregoing method embodiments for specific implementation, which will not be described again here.
  • the computer program products of the methods, devices and electronic equipment provided by the embodiments of the present disclosure include computer-readable storage media storing program codes.
  • the instructions included in the program codes can be used to execute the methods described in the previous method embodiments, For specific implementation, please refer to the method embodiments and will not be described again here.
  • the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor.
  • the technical solution of the present disclosure is essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product.
  • the computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present disclosure.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program code. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本公开提供了一种设备订单数据的存储方法、查询方法及装置,方法包括:获取目标设备订单数据对应的目标用户标识、目标设备标识、设备订单信息和软件详情信息;分别针对设备订单信息和软件详情信息,根据目标用户标识进行第一哈希取模运算,定位目标服务器;根据服务器标识、当前时间戳、目标设备标识和雪花算法,生成当前信息对应的信息标识;对信息标识中的指定位数字进行第二哈希取模运算,定位目标数据库;根据当前信息的类别和当前时间戳,从目标数据库的多个信息表中,定位目标月份对应的目标信息表进行信息存储;并将上述多种标识关联存储于指定数据库。本公开不仅能够应对数据瓶颈,而且不影响数据统计的需求,并且有利于后续扩展。

Description

设备订单数据的存储方法、查询方法及装置
相关申请的交叉引用
本公开要求于2022年08月15日提交中国国家知识产权局的申请号为202210971708.6、名称为“设备订单数据的存储方法、查询方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本公开中。
技术领域
本公开涉及数据处理技术领域,尤其是涉及一种设备订单数据的存储方法、查询方法及装置。
背景技术
随着社会高速的发展,科技越来越发达,信息流通越来越便利,人与人之间的交流越来越密切。大数据是这个高科技时代的产物,是庞大人口基数下的产物,大数据既是资源,也是命脉。
大数据作为资源,数据分析尤为重要。此时问题就暴露出来了,随着要分析的数据文件越来越大,数据读取变的越来越困难,总不能通过无限增加硬件成本来满足越来越大的数据量读取,数据拆分迫在眉睫。
生活中,处处可见数据拆分的例子。超市按不同品类将商品分开摆放、快递取件点按日期和快递公司分开存放。在程序员眼里,数据的存储都是放在一张张表里,表所能存储的数据都是存在瓶颈的,当预知某个业务涉及到的表可能会达到瓶颈时候就要考虑对表进行拆分,也就是对数据进行拆分。
目前的数据存储方式大多还是按照数据属性进行分类存储,数据属性包括数据产生日期、数据来源、数据类型等;比如,按照数据产生日期进行拆分,如每个月或者每周生成一张数据表,或者按照数据来源进行拆分,如不同数据来源的数据存储在不同的数据表中。按上述数据分类存储方式对数据进行存储,不能很好地应对数据瓶颈,而且在数据查询时会带来很大的不便,不能满足及时数据查询需求。
发明内容
本公开的目的在于提供一种设备订单数据的存储方法、查询方法及装置,不仅能够应对数据瓶颈,而且不影响数据统计的需求,并且有利于后续扩展。
第一方面,本公开实施例提供一种设备订单数据的存储方法,方法包括:获取目标设备订单数据;目标设备订单数据包括:目标用户标识、目标设备标识、设备订单信息和软件详情信息;分别将设备订单信息和软件详情信息作为当前信息,执行以下存储步骤:根据目标用户标识进行第一哈希取模运算,定位目标服务器;获取当前时间戳和目标服务器 的服务器标识;根据服务器标识、当前时间戳、目标设备标识和雪花算法,随机生成当前信息对应的信息标识;信息标识为十进制编码;对信息标识中的指定位数字进行第二哈希取模运算,定位所述目标服务器中的目标数据库;根据当前信息的类别和当前时间戳,从目标数据库的多个信息表中,定位目标月份对应的目标信息表;将当前信息和当前信息对应的信息标识存储于目标信息表;将目标用户标识、设备订单信息对应的第一信息标识、以及软件详情信息对应的第二信息标识均关联存储于指定数据库。
在本公开较佳的实施方式中,上述根据目标用户标识进行第一哈希取模运算,定位目标服务器的步骤,包括:获取目标用户标识中每个字符对应的ASCll码值;基于多个字符分别对应的ASCll码值进行第一哈希运算,得到第一十进制哈希数值;应用第一十进制哈希数值对服务器的个数进行第一取模运算,得到服务器定位信息;根据服务器定位信息确定目标服务器。
在本公开较佳的实施方式中,上述基于多个字符分别对应的ASCll码值进行第一哈希运算,得到第一十进制哈希数值的步骤,包括:根据以下算式计算得到第一十进制哈希数值:
Yn+1=K×Yn+Xn
其中,Yn+1表示第n个字符运算后的第一十进制哈希数值;Yn表示第n-1个字符运算后的十进制哈希数值;Xn表示第n个字符对应的ASCll码值;Y1=0;K表示常数系数;n=1、2、3…N;N表示字符总个数。
在本公开较佳的实施方式中,上述根据服务器标识、当前时间戳、目标设备标识和雪花算法,随机生成当前信息对应的信息标识的步骤,包括:以目标设备标识为固定序列号,基于服务器标识、当前时间戳和固定序列号通过雪花算法,随机生成指定位数的二进制编码;将二进制编码转换为十进制编码,得到当前信息对应的信息标识。
在本公开较佳的实施方式中,上述对信息标识中的指定位数字进行第二哈希取模运算,定位目标数据库的步骤,包括:获取信息标识中的指定位数字分别对应的ASCll码值;基于多个数字分别对应的ASCll码值进行第二哈希运算,得到第二十进制哈希数值;应用第二十进制哈希数值对目标服务器中数据库的个数进行第二取模运算,得到数据库定位信息;根据数据库定位信息确定目标服务器中的目标数据库。
在本公开较佳的实施方式中,上述根据当前信息的类别和当前时间戳,从目标数据库对应的多个信息表中,定位目标月份对应的目标信息表的步骤,包括:根据当前时间戳,确定目标月份;从目标数据库对应的多个信息表中,确定目标月份对应的多个信息表;根据当前信息的类别,从目标月份对应的多个信息表中,确定目标信息表。
第二方面,本公开实施例还提供一种设备订单数据的查询方法,方法应用于服务器; 服务器中存储有通过如第一方面所述的设备订单数据的存储方法所存储的数据;方法包括:获取目标设备订单数据的查询请求;查询请求中携带有目标用户标识;根据目标用户标识,从指定数据库中查找目标用户标识关联的设备订单信息对应的第一信息标识,和软件详情信息对应的第二信息标识;分别以第一信息标识和第二信息标识作为当前标识,根据当前标识进行反解,确定目标服务器中的目标数据库中的目标月份对应的信息表;从目标月份对应的信息表中读取当前标识对应的信息。
在本公开较佳的实施方式中,上述根据当前标识进行反解,确定目标服务器中的目标数据库中的目标月份对应的信息表的步骤,包括:对当前标识进行解密处理,得到目标服务器标识和目标时间戳;确定目标服务器标识对应的目标服务器;对当前标识中的指定位数字进行哈希取模运算,确定目标服务器中的目标数据库;根据目标时间戳,从目标数据库对应的多个信息表中,定位目标月份对应的信息表。
第三方面,本公开实施例还提供一种设备订单数据的存储装置,装置包括:数据获取模块,用于获取目标设备订单数据;目标设备订单数据包括:目标用户标识、目标设备标识、设备订单信息和软件详情信息;第一数据存储模块,用于分别将设备订单信息和软件详情信息作为当前信息,执行以下存储步骤:通过第一哈希取模模块,根据目标用户标识进行第一哈希取模运算,定位目标服务器;通过信息标识生成模块,获取当前时间戳和目标服务器的服务器标识;根据服务器标识、当前时间戳、目标设备标识和雪花算法,随机生成当前信息对应的信息标识;信息标识为十进制编码;通过第二哈希取模模块,对信息标识中的指定位数字进行第二哈希取模运算,定位目标服务器中的目标数据库;通过信息表定位模块,根据当前信息的类别和当前时间戳,从目标数据库的多个信息表中,定位目标月份对应的目标信息表;通过数据存储子模块,将当前信息和当前信息对应的信息标识存储于目标信息表;通过第二数据存储模块,将目标用户标识、设备订单信息对应的第一信息标识、以及软件详情信息对应的第二信息标识均关联存储于指定数据库。
第四方面,本公开实施例还提供一种设备订单数据的查询装置,装置应用于服务器;服务器中存储有通过如第一方面所述的设备订单数据的存储方法所存储的数据;装置包括:请求获取模块,用于获取目标设备订单数据的查询请求;查询请求中携带有目标用户标识;标识查找模块,用于根据目标用户标识,从指定数据库中查找目标用户标识关联的设备订单信息对应的第一信息标识,和软件详情信息对应的第二信息标识;数据读取模块,用于分别以第一信息标识和第二信息标识作为当前标识,根据当前标识进行反解,确定目标服务器中的目标数据库中的目标月份对应的信息表;从目标月份对应的信息表中读取当前标识对应的信息。
第五方面,本公开实施例还提供一种电子设备,包括处理器和存储器,存储器存储有 能够被处理器执行的计算机可执行指令,处理器执行计算机可执行指令以实现上述第一方面所述的方法。
第六方面,本公开实施例还提供一种计算机可读存储介质,计算机可读存储介质存储有计算机可执行指令,计算机可执行指令在被处理器调用和执行时,计算机可执行指令促使处理器实现上述第一方面所述的方法。
本公开实施例提供的设备订单数据的存储方法、查询方法及装置中,首先获取目标设备订单数据;该目标设备订单数据包括:目标用户标识、目标设备标识、设备订单信息和软件详情信息;分别将设备订单信息和软件详情信息作为当前信息,执行以下存储步骤:根据目标用户标识进行第一次哈希取模运算,定位到目标服务器;然后再根据目标服务器的服务器标识、当前时间戳、目标设备标识和雪花算法,随机生成当前信息对应的十进制信息标识;然后再对信息标识中的指定位数字进行第二次哈希取模运算,定位到目标服务器中的目标数据库;然后再根据当前信息的类别和当前时间戳,从目标数据库的多个信息表中,定位目标月份对应的目标信息表;最后将当前信息和当前信息对应的信息标识存储于目标信息表;并将目标用户标识、设备订单信息对应的第一信息标识、以及软件详情信息对应的第二信息标识均关联存储于指定数据库。本公开实施例中,结合用户标识、设备标识、时间戳,通过两次哈希取模运算、一次雪花算法,最终定位到设备订单数据中的两种信息应该存放的目标位置,即目标服务器中目标数据库中的目标信息表,通过这种数据存储方式,可以缓解现有技术中数据库存储瓶颈问题,而且能够满足数据统计的需求,并且有利于后续数据存储扩展。
附图说明
为了更清楚地说明本公开具体实施方式或现有技术中的技术方案,下面将对具体实施方式或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本公开的一些实施方式,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本公开实施例提供的一种设备订单数据的存储方法的流程图;
图2为本公开实施例提供的一种设备订单数据的存储方法中目标服务器确定过程的流程图;
图3为本公开实施例提供的一种设备订单数据的存储方法中目标数据库确定过程的流程图;
图4为本公开实施例提供的一种设备订单数据的存储方法中分级存储示意图;
图5为本公开实施例提供的一种设备订单数据的查询方法的流程图;
图6为本公开实施例提供的一种设备订单数据的存储装置的结构框图;
图7为本公开实施例提供的一种设备订单数据的查询装置的结构框图;
图8为本公开实施例提供的一种电子设备的结构示意图。
具体实施方式
下面将结合实施例对本公开的技术方案进行清楚、完整地描述,显然,所描述的实施例是本公开一部分实施例,而不是全部的实施例。基于本公开中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本公开保护的范围。
现有技术中,数据存储方式往往是按照数据属性进行分类存储,数据属性包括数据产生日期、数据来源、数据类型等;比如,按日期拆分数据:如手机号码的短信记录4月份的数据存放于mobile_mess_4,5月份的数据存放于mobile_mess_5,虽然一定程度上可以解决数据表的存储瓶颈问题,但还是会存在某个月份信息量过大导致数据表存储瓶颈的问题,而且如果想要查询某个手机号的所有短信记录,就很困难。再比如,按数据来源拆分数据:如手机号码的短信记录属于通讯录好友的短信存放于mobile_mess_friends,非通讯录的短信存放于mobile_mess_stranger表,查询通讯录好友的短信很方便,查询非通讯录的短信也很方便,但是要查询某个时间段所有短信就需要汇总两个表的数据。因此,按上述数据分类存储方式对数据进行存储,不能很好地应对数据瓶颈,而且在数据查询时会带来很大的不便,不能满足及时数据查询需求。
基于此,本公开实施例提供一种设备订单数据的存储方法、查询方法及装置,不仅能够应对数据瓶颈,而且不影响数据统计的需求,并且有利于后续扩展。为便于对本实施例进行理解,首先对本公开实施例所公开的一种设备订单数据的存储方法进行详细介绍。
在一些公司业务中,有百万个甚至更多数量的设备,对应有几百万个用户数据和订单数据以及各自对应的商品数据,这里的商品数据可以是每个设备对应某个用户为其购买的软件产品数据。所以在设备订单数据储存时会有千万条数据同时进行,非常不易于管理和扩展,由于数据量太多,在查找时需要大量时间去比对查找。基于此,本公开实施例提供一种设备订单数据的存储方法,以缓解大量数据进行存储时数据库存储瓶颈问题,满足数据统计的需求,并且有利于后续数据存储扩展。
参见图1所示的本公开实施例提供的一种设备订单数据的存储方法的流程图,该方法具体包括以下步骤:
步骤S102,获取目标设备订单数据;其中,目标设备订单数据包括:目标用户标识、目标设备标识、设备订单信息和软件详情信息。
本实施例中的应用场景为:某个用户为某台设备购买软件产品;因此,上述目标设备 订单数据可以包括:目标用户标识、目标设备标识、设备订单信息和软件详情信息。其中,设备订单信息包括:该设备对应购买的软件数量、消息金额、软件类型等;软件详情信息包括:所购买的每个软件的详细信息,如使用方法、有效期等。
针对上述设备订单信息和软件详情信息,本实施例中需要对这两种信息进行分别存储,具体的存储过程如下:
步骤S104,分别将设备订单信息和软件详情信息作为当前信息,执行以下存储步骤:
步骤S1041,根据目标用户标识进行第一哈希取模运算,定位目标服务器。
上述目标用户标识可以是任意字符组成的字符串,字符可以是字母、数字、特殊符号等。比如,目标用户标识为XiaoMing,则进一步对该标识进行第一哈希取模运算,可以定位到目标服务器。哈希取模运算包括,对标识进行哈希运算,以及以服务器数量对哈希运算后的数值进行取模运算。需要说明的是,上述服务器数量是当前可以存储数据的服务器的数量,如果服务器的数量有变化,服务器数量会进行实时更新。
步骤S1042,获取当前时间戳和目标服务器的服务器标识;根据服务器标识、当前时间戳、目标设备标识和雪花算法,随机生成当前信息对应的信息标识;信息标识为十进制编码。
在定位到目标服务器后,进一步,获取该服务器的标识,并获取当前时间戳,以方便进行后续雪花算法。
使用雪花算法,通常生成的是64位的二进制编号(例如:00010011 00000100 01100011 01010111 00000110 01100100 01100101 00101000),将其转换为十进制编号,例如:13046355706646528。
步骤S1043,对信息标识中的指定位数字进行第二哈希取模运算,定位目标服务器中的目标数据库。
上述指定位数字,可以是信息标识的最后几位数字,也可以是开头的几位数字,也可以是中间的几位数字,或者也可以是每隔几位取一个数字得到的数字串。第二哈希取模运算类似于前述第一哈希取模运算,区别在于第一哈希取模运算中,用到的是目标用户标识和服务器数量;第二哈希取模运算中,用到的是上述信息标识和目标服务器中数据库的数量。具体运算过程在后面详述。
步骤S1044,根据当前信息的类别和当前时间戳,从目标数据库的多个信息表中,定位目标月份对应的目标信息表。
将上述当前时间戳可以直接转换为具体的时间,也就可以确定出对应的月份,从而进一步确定出目标数据库中对应的该月份对应的信息表,通常一个月份中的信息表会按照信息类别分为多个表,在本实施例中,包括:订单表和详情表两种,订单表用于存储设备订 单信息,详情表用于存储软件详情信息。根据当前信息的类别,可以确定当前信息要存储于目标月份下的哪个表中。
步骤S1045,将当前信息和当前信息对应的信息标识存储于目标信息表。通过上述几个步骤,可以分别将设备订单信息和软件详情信息存储于对应的目标信息表中,而且同时存储对应的信息标识。
步骤S106,将目标用户标识、设备订单信息对应的第一信息标识、以及软件详情信息对应的第二信息标识均关联存储于指定数据库。
为了方便数据查询,还需要对上述目标用户标识、设备订单信息对应的第一信息标识、以及软件详情信息对应的第二信息标识进行关联存储,可存储于指定数据库的中间表中。这样,如果知识了目标用户标识,就可以直接查找到设备订单信息对应的第一信息标识、以及软件详情信息对应的第二信息标识。通过第一信息标识和第二信息标识进行反解,即可确定出设备订单信息和软件详情信息的具体存储位置。
本公开实施例提供的设备订单数据的存储方法中,首先获取目标设备订单数据;该目标设备订单数据包括:目标用户标识、目标设备标识、设备订单信息和软件详情信息;分别将设备订单信息和软件详情信息作为当前信息,执行以下存储步骤:根据目标用户标识进行第一次哈希取模运算,定位到目标服务器;然后再根据目标服务器的服务器标识、当前时间戳、目标设备标识和雪花算法,随机生成当前信息对应的十进制信息标识;然后再对信息标识中的指定位数字进行第二次哈希取模运算,定位到目标服务器中的目标数据库;然后再根据当前信息的类别和当前时间戳,从目标数据库的多个信息表中,定位目标月份对应的目标信息表;最后将当前信息和当前信息对应的信息标识存储于目标信息表;并将目标用户标识、设备订单信息对应的第一信息标识、以及软件详情信息对应的第二信息标识均关联存储于指定数据库。本公开实施例中,结合用户标识、设备标识、时间戳,通过两次哈希取模运算、一次雪花算法,最终定位到设备订单数据中的两种信息应该存放的目标位置,即目标服务器中目标数据库中的目标信息表,通过这种数据存储方式,可以缓解现有技术中数据库存储瓶颈问题,而且能够满足数据统计的需求,并且有利于后续数据存储扩展。
基于上述方法实施例,本公开实施例还提供一种设备订单数据的存储方法,该方法在上一实施例的基础上实现,本实施例重点描述哈希取模运算过程、最终存储位置确定过程。
参见图2所示,上述根据目标用户标识进行第一哈希取模运算,定位目标服务器,具体包括以下步骤:
步骤S202,获取目标用户标识中每个字符对应的ASCll码值;
步骤S204,基于多个字符分别对应的ASCll码值进行第一哈希运算,得到第一十进制哈希数值;
具体的,根据以下算式计算得到第一十进制哈希数值:
Yn+1=K×Yn+Xn
其中,Yn+1表示第n个字符运算后的第一十进制哈希数值;Yn表示第n-1个字符运算后的十进制哈希数值;Xn表示第n个字符对应的ASCll码值;Y1=0;K表示常数系数;n=1、2、3…N;N表示字符总个数。
下面列举两个具体的例子:
比如,上述目标用户标识为123,该标识123对应的ASCll码值分别为49、50、51;以上述常数系数K为31为例进行说明:
第一步运算:31*0+49=49;
第二步运算:31*49+50=1569;
第三步运算:31*1569+51=48690。
也就是说,对目标用户标识123进行哈希运算后,得到十进制哈希数值为48690。
再比如,上述目标用户标识为abc:abc对应的ASCll码值分别为97、98、99;
第一步运算:31*0+97=97;
第二步运算:31*97+98=3105;
第三步运算:31*3105+99=96354。
也就是说,对目标用户标识abc进行哈希运算后,得到十进制哈希数值为96354。
步骤S206,应用第一十进制哈希数值对服务器的个数进行第一取模运算,得到服务器定位信息。
步骤S208,根据服务器定位信息确定目标服务器。
还以上述目标用户标识为123为例进行说明,123进行哈希运算后,得到十进制哈希数值48690;假设服务器的个数为8个,那么可能的余数有0-7八个数,分别对应8个服务器;用48690除以8的余数为2,则将2作为服务器定位信息。也就是将8个服务器中的第2+1=3个作为目标服务器。
上述根据服务器标识、当前时间戳、目标设备标识和雪花算法,随机生成当前信息对应的信息标识的步骤,具体包括以下步骤:
以目标设备标识为固定序列号,基于服务器标识、当前时间戳和固定序列号通过雪花算法,随机生成指定位数的二进制编码;将二进制编码转换为十进制编码,得到当前信息对应的信息标识。
雪花算法的原理就是生成一个的64位比特的long类型的唯一ID。最高1位固定值0, 因为生成的ID是正整数,如果是1就是负数了。接下来41位存储毫秒级时间戳,2^41/(1000*60*60*24*365)=69,大概可以使用69年。再接下10位存储机器码,包括5位机器ID和5位服务ID。最多可以部署2^10=1024台机器。最后12位存储序列号。同一毫秒时间戳时,通过这个递增的序列号来区分。即对于同一台机器而言,同一毫秒时间戳下,可以生成2^12=4096个不重复ID。
对于每一个雪花算法服务,需要先指定10位的机器码,这个根据自身业务进行设定即可。例如机房号+机器号,机器号+服务号,或者是其他可区别标识的10位比特位的整数值都行。本实施例中,由上述目标服务器标识确定5位机器ID和5位服务ID;由目标设备标识确定12位存储序列号。
在本公开较佳的实施方式中,上述对信息标识中的指定位数字进行第二哈希取模运算,定位目标数据库的步骤,参见图3所示,具体包括以下步骤:
步骤S302,获取信息标识中的指定位数字分别对应的ASCll码值;
步骤S304,基于多个数字分别对应的ASCll码值进行第二哈希运算,得到第二十进制哈希数值;
步骤S306,应用第二十进制哈希数值对目标服务器中数据库的个数进行第二取模运算,得到数据库定位信息;
步骤S308,根据数据库定位信息确定目标服务器中的目标数据库。
该过程与前述定位目标服务器的方式类似,在此不再赘述。
在本公开较佳的实施方式中,上述根据当前信息的类别和当前时间戳,从目标数据库对应的多个信息表中,定位目标月份对应的目标信息表的步骤,包括:
(1)根据当前时间戳,确定目标月份;
(2)从目标数据库对应的多个信息表中,确定目标月份对应的多个信息表;
(3)根据当前信息的类别,从目标月份对应的多个信息表中,确定目标信息表。
由于设备订单数据中包括设备订单信息(如个数、金额、时间等等)、软件详情信息(如软件失效时间、软件安装方法、软件产品的研发公司等等),一整条完整的设备订单数据包含十几或二十多个数据,所以在数据保存时需要进行数据拆分。
上述设备订单数据包含有目标用户标识,目标用户标识也就是为目标设备购买软件的用户名,比如abc,如果目标用户标识为中文名称,如小明,可以先转成拼音XiaoMing,再进行后续处理。
以确定软件详情信息对应的存储位置为例进行说明:
参见图4所示,服务器数量为3,每个服务器中包含两个数据库,每个数据库中包含按月份划分的信息表,如订单表和详情表(为了清楚显示,服务器2中的数据库里的信息表 并未示出,实际与服务器1和3中的相同),假设要存储的数据为设备订单数据中的软件详情信息,用户标识为abc,基于该用户标识abc进行哈希运算,得到96354,并以服务器数量3取模,得到余数为0(余数0对应第1个服务器,余数1对应第2个服务器,余数2对应第3个服务器),则将3个服务器中的第1个服务器,即服务器1作为目标服务器;然后再获取该服务器1的标识、当前时间戳和以目标设备标识确定的固定序列号,通过雪花算法生成一个初始信息ID,该初始信息ID为64位的二进制编码,再将其转换为十进制编码,得到软件详情信息对应的第一信息标识ID1;然后上述十进制编码中的最后5位进行哈希运算,得到的哈希值再以2(即服务器1中数据库的数量)进行取模,假设得到1,则将服务器1中的第2个数据库,即数据库2作为目标数据库;进一步,根据当前时间戳确定当前月份,假设为9月,在9月对应的详情表中存储上述软件详情信息和第一信息标识ID1。
同理,也可以确定出设备订单信息对应的存储位置,过程与上述内容类似,在此不再赘述。
此外,还需要在其它数据库下的中间表中,存放上述目标用户标识abc、软件详情信息对应的第一信息标识ID1,和设备订单信息对应的第二信息标识ID2,通过三者的关联存储,一个ID大小20字节,一条设备订单数据对应60bytes,百万条数据只有大概6M;可以方便后续业务查询数据。
本公开实施例提供的订单数据的存储方法,为了使数据均匀拆分分布在各服务器上,使用多次哈希取模运算来判定存储位置,并防止恶意爬取数据,使用雪花算法并加入时间戳随机生成ID。本公开实施例中,结合用户标识、设备标识、时间戳,通过两次哈希取模运算、一次雪花算法,最终定位到设备订单数据中的两种信息应该存放的目标位置,即目标服务器中目标数据库中的目标信息表,通过这种数据存储方式,可以缓解现有技术中数据库存储瓶颈问题,而且能够满足数据统计的需求,并且有利于后续数据存储扩展。
本实施例中,将杂乱的设备订单数据进行拆分均匀存放在多个服务器多个数据库多张表上,相比于存放在一台服务器上一张表上,可以有效解决数据库存储瓶颈问题,对于存放在一台服务器的情况,随着后续订单量越来越大,***查找信息时所需时间也会越来越大,进而导致宕机,宕机后产生的损失不可估量。而使用此本方法来进行拆分存放,降低宕机风险易于信息管理和查找,也避免了恶意爬取订单信息。
基于上述设备订单数据的存储方法的实施例,本公开实施例还提供一种设备订单数据的查询方法,该方法应用于服务器;服务器中存储有通过如第一方面所述的设备订单数据的存储方法所存储的数据;参见图5所示,该方法具体包括以下步骤:
步骤S502,获取目标设备订单数据的查询请求;查询请求中携带有目标用户标识;
步骤S504,根据目标用户标识,从指定数据库中查找目标用户标识关联的设备订单信息对应的第一信息标识,和软件详情信息对应的第二信息标识;
步骤S506,分别以第一信息标识和第二信息标识作为当前标识,根据当前标识进行反解,确定目标服务器中的目标数据库中的目标月份对应的信息表。
具体的,通过以下步骤实现:
(1)对当前标识进行解密处理,得到目标服务器标识和目标时间戳;
(2)确定目标服务器标识对应的目标服务器;
(3)对当前标识中的指定位数字进行哈希取模运算,确定目标服务器中的目标数据库。
需要说明的是,这里的指定位数字的确定方式与之前实施例中的指定位数字的确定方式是一致的。哈希取模运算同前述存储方法中的第二哈希取模运算,即对目标服务器中的数据库数量进行第二取模运算,这样确定出的目标数据库才会和存储时的目标数据库是一致的。
(4)根据目标时间戳,从目标数据库对应的多个信息表中,定位目标月份对应的信息表。
步骤S508,从目标月份对应的信息表中读取当前标识对应的信息。
下面列举一个查询设备订单数据中的设备订单信息的例子,参见图4所示,当使用第一信息标识ID1来获取用户的设备订单信息时,可将ID1进行解密,获取到目标服务器标识和目标时间戳,通过目标服务器标识可以确定目标服务器,比如服务器1,再以ID1中的后五位数字进行哈希取模运算,可以确定出服务器1中的目标数据库,比如数据库2,再根据上述目标时间戳可以确定出目标月份,比如,9月份,最后可以从9月份对应的订单表中读取第一信息标识ID1对应的设备订单信息。
再比如,查询请求中携带有目标用户标识,首先从上述中间表中查找到与目标用户标识关联的第一信息标识ID1和第二信息标识ID2;然后再按照上述过程分别查找第一信息标识ID1对应的设备订单信息和第二信息标识ID2对应的软件详情信息。
本公开实施例提供的设备订单数据的查询方法中,在将杂乱的设备订单数据进行拆分均匀存放在多个服务器多个数据库多张表上的情况,方便用户进行数据查询。
基于上述设备订单数据的存储方法,本公开实施例还提供一种设备订单数据的存储装置,参见图6所示,该装置包括:
数据获取模块72,用于获取目标设备订单数据;目标设备订单数据包括:目标用户标识、目标设备标识、设备订单信息和软件详情信息;
第一数据存储模块74,用于分别将设备订单信息和软件详情信息作为当前信息,执行以下存储步骤:通过第一哈希取模模块741,根据目标用户标识进行第一哈希取模运算,定位目标服务器;通过信息标识生成模块742,获取当前时间戳和目标服务器的服务器标识;根据服务器标识、当前时间戳、目标设备标识和雪花算法,随机生成当前信息对应的信息标识;信息标识为十进制编码;通过第二哈希取模模块743,对信息标识中的指定位数字进行第二哈希取模运算,定位目标服务器中的目标数据库;通过信息表定位模块744,根据当前信息的类别和当前时间戳,从目标数据库的多个信息表中,定位目标月份对应的目标信息表;通过数据存储子模块745,将当前信息和当前信息对应的信息标识存储于目标信息表;
第二数据存储模块76,用于将目标用户标识、设备订单信息对应的第一信息标识、以及软件详情信息对应的第二信息标识均关联存储于指定数据库。
在本公开较佳的实施方式中,上述第一哈希取模模块741,用于获取目标用户标识中每个字符对应的ASCll码值;基于多个字符分别对应的ASCll码值进行第一哈希运算,得到第一十进制哈希数值;应用第一十进制哈希数值对服务器的个数进行第一取模运算,得到服务器定位信息;根据服务器定位信息确定目标服务器。
在本公开较佳的实施方式中,上述第一哈希取模模块741,用于根据以下算式计算得到第一十进制哈希数值:
Yn+1=K×Yn+Xn
其中,Yn+1表示第n个字符运算后的第一十进制哈希数值;Yn表示第n-1个字符运算后的十进制哈希数值;Xn表示第n个字符对应的ASCll码值;Y1=0;K表示常数系数;n=1、2、3…N;N表示字符总个数。
在本公开较佳的实施方式中,上述信息标识生成模块742,用于以目标设备标识为固定序列号,基于服务器标识、当前时间戳和固定序列号通过雪花算法,随机生成指定位数的二进制编码;将二进制编码转换为十进制编码,得到当前信息对应的信息标识。
在本公开较佳的实施方式中,上述第二哈希取模模块743,用于获取信息标识中的指定位数字分别对应的ASCll码值;基于多个数字分别对应的ASCll码值进行第二哈希运算,得到第二十进制哈希数值;应用第二十进制哈希数值对目标服务器中数据库的个数进行第二取模运算,得到数据库定位信息;根据数据库定位信息确定目标服务器中的目标数据库。
在本公开较佳的实施方式中,上述信息表定位模块744,用于根据当前时间戳,确定目标月份;从目标数据库对应的多个信息表中,确定目标月份对应的多个信息表;根据当前信息的类别,从目标月份对应的多个信息表中,确定目标信息表。
本公开实施例提供的设备订单数据的存储装置,其实现原理及产生的技术效果和前述 设备订单数据的存储方法实施例相同,为简要描述,设备订单数据的存储装置的实施例部分未提及之处,可参考前述设备订单数据的存储方法实施例中相应内容。
基于上述设备订单数据的查询方法的实施例,本公开实施例还提供一种设备订单数据的查询装置,该装置应用于服务器;服务器中存储有通过如前述设备订单数据的存储方法所存储的数据;参见图7所示,装置包括:请求获取模块82,用于获取目标设备订单数据的查询请求;查询请求中携带有目标用户标识;标识查找模块84,用于根据目标用户标识,从指定数据库中查找目标用户标识关联的设备订单信息对应的第一信息标识,和软件详情信息对应的第二信息标识;数据读取模块86,用于分别以第一信息标识和第二信息标识作为当前标识,根据当前标识进行反解,确定目标服务器中的目标数据库中的目标月份对应的信息表;从目标月份对应的信息表中读取当前标识对应的信息。
在本公开较佳的实施方式中,上述数据读取模块86,用于对当前标识进行解密处理,得到目标服务器标识和目标时间戳;确定目标服务器标识对应的目标服务器;对当前标识中的指定位数字进行哈希取模运算,确定目标服务器中的目标数据库;根据目标时间戳,从目标数据库对应的多个信息表中,定位目标月份对应的信息表。
本公开实施例提供的设备订单数据的查询装置,其实现原理及产生的技术效果和前述设备订单数据的查询方法实施例相同,为简要描述,设备订单数据的查询装置的实施例部分未提及之处,可参考前述设备订单数据的查询方法实施例中相应内容。
本公开实施例还提供了一种电子设备,如图8所示,为该电子设备的结构示意图,其中,该电子设备包括处理器91和存储器90,该存储器90存储有能够被该处理器91执行的计算机可执行指令,该处理器91执行该计算机可执行指令以实现上述方法。
在图8示出的实施方式中,该电子设备还包括总线92和通信接口93,其中,处理器91、通信接口93和存储器90通过总线92连接。
其中,存储器90可能包含高速随机存取存储器(RAM,Random Access Memory),也可能还包括非不稳定的存储器(non-volatile memory),例如至少一个磁盘存储器。通过至少一个通信接口93(可以是有线或者无线)实现该***网元与至少一个其他网元之间的通信连接,可以使用互联网,广域网,本地网,城域网等。总线92可以是ISA(Industry Standard Architecture,工业标准体系结构)总线、PCI(Peripheral Component Interconnect,外设部件互连标准)总线或EISA(Extended Industry Standard Architecture,扩展工业标准结构)总线等。所述总线92可以分为地址总线、数据总线、控制总线等。为便于表示,图8中仅用一个双向箭头表示,但并不表示仅有一根总线或一种类型的总线。
处理器91可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器91中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器91可以是通用处理器,包括中央处理器(Central Processing Unit,简称CPU)、网络处理器(Network Processor,简称NP)等;还可以是数字信号处理器(Digital Signal Processor,简称DSP)、专用集成电路(Application Specific Integrated Circuit,简称ASIC)、现场可编程门阵列(Field-Programmable Gate Array,简称FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本公开实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器,处理器91读取存储器中的信息,结合其硬件完成前述实施例的方法的步骤。
本公开实施例还提供了一种计算机可读存储介质,该计算机可读存储介质存储有计算机可执行指令,该计算机可执行指令在被处理器调用和执行时,该计算机可执行指令促使处理器实现上述方法,具体实现可参见前述方法实施例,在此不再赘述。
本公开实施例所提供的方法、装置和电子设备的计算机程序产品,包括存储了程序代码的计算机可读存储介质,所述程序代码包括的指令可用于执行前面方法实施例中所述的方法,具体实现可参见方法实施例,在此不再赘述。
除非另外具体说明,否则在这些实施例中阐述的部件和步骤的相对步骤、数字表达式和数值并不限制本公开的范围。
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个处理器可执行的非易失的计算机可读取存储介质中。基于这样的理解,本公开的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本公开各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
在本公开的描述中,需要说明的是,术语“中心”、“上”、“下”、“左”、“右”、“竖直”、“水平”、“内”、“外”等指示的方位或位置关系为基于附图所示的方位或位置关系,仅是为了便于描述本公开和简化描述,而不是指示或暗示所指的装置或元件必须具有特定的方位、以特定的方位构造和操作,因此不能理解为对本公开的限制。此外,术语“第一”、“第二”、 “第三”仅用于描述目的,而不能理解为指示或暗示相对重要性。
最后应说明的是:以上所述实施例,仅为本公开的具体实施方式,用以说明本公开的技术方案,而非对其限制,本公开的保护范围并不局限于此,尽管参照前述实施例对本公开进行了详细的说明,本领域的普通技术人员应当理解:任何熟悉本技术领域的技术人员在本公开揭露的技术范围内,其依然可以对前述实施例所记载的技术方案进行修改或可轻易想到变化,或者对其中部分技术特征进行等同替换;而这些修改、变化或者替换,并不使相应技术方案的本质脱离本公开实施例技术方案的精神和范围,都应涵盖在本公开的保护范围之内。因此,本公开的保护范围应所述以权利要求的保护范围为准。

Claims (10)

  1. 一种设备订单数据的存储方法,其特征在于,所述方法包括:
    获取目标设备订单数据;所述目标设备订单数据包括:目标用户标识、目标设备标识、设备订单信息和软件详情信息;
    分别将所述设备订单信息和所述软件详情信息作为当前信息,执行以下存储步骤:
    根据所述目标用户标识进行第一哈希取模运算,定位目标服务器;
    获取当前时间戳和所述目标服务器的服务器标识;
    根据所述服务器标识、所述当前时间戳、所述目标设备标识和雪花算法,随机生成所述当前信息对应的信息标识;所述信息标识为十进制编码;
    对所述信息标识中的指定位数字进行第二哈希取模运算,定位所述目标服务器中的目标数据库;
    根据所述当前信息的类别和所述当前时间戳,从所述目标数据库的多个信息表中,定位目标月份对应的目标信息表;
    将所述当前信息和所述当前信息对应的信息标识存储于所述目标信息表;
    将所述目标用户标识、所述设备订单信息对应的第一信息标识、以及所述软件详情信息对应的第二信息标识均关联存储于指定数据库。
  2. 根据权利要求1所述的方法,其特征在于,根据所述目标用户标识进行第一哈希取模运算,定位目标服务器的步骤,包括:
    获取所述目标用户标识中每个字符对应的ASCll码值;
    基于多个字符分别对应的ASCll码值进行第一哈希运算,得到第一十进制哈希数值;
    应用所述第一十进制哈希数值对服务器的个数进行第一取模运算,得到服务器定位信息;
    根据所述服务器定位信息确定目标服务器。
  3. 根据权利要求2所述的方法,其特征在于,基于多个字符分别对应的ASCll码值进行第一哈希运算,得到第一十进制哈希数值的步骤,包括:
    根据以下算式计算得到第一十进制哈希数值:
    Yn+1=K×Yn+Xn
    其中,Yn+1表示第n个字符运算后的第一十进制哈希数值;Yn表示第n-1个字符运算后的十进制哈希数值;Xn表示第n个字符对应的ASCll码值;Y1=0;K表示常数系数;n=1、2、3…N;N表示字符总个数。
  4. 根据权利要求1所述的方法,其特征在于,根据所述服务器标识、所述当前时间戳、 所述目标设备标识和雪花算法,随机生成所述当前信息对应的信息标识的步骤,包括:
    以所述目标设备标识为固定序列号,基于所述服务器标识、所述当前时间戳和所述固定序列号通过所述雪花算法,随机生成指定位数的二进制编码;
    将所述二进制编码转换为十进制编码,得到所述当前信息对应的信息标识。
  5. 根据权利要求1所述的方法,其特征在于,对所述信息标识中的指定位数字进行第二哈希取模运算,定位目标数据库的步骤,包括:
    获取所述信息标识中的指定位数字分别对应的ASCll码值;
    基于多个数字分别对应的ASCll码值进行第二哈希运算,得到第二十进制哈希数值;
    应用所述第二十进制哈希数值对所述目标服务器中数据库的个数进行第二取模运算,得到数据库定位信息;
    根据所述数据库定位信息确定所述目标服务器中的目标数据库。
  6. 根据权利要求1所述的方法,其特征在于,根据所述当前信息的类别和所述当前时间戳,从所述目标数据库对应的多个信息表中,定位目标月份对应的目标信息表的步骤,包括:
    根据所述当前时间戳,确定目标月份;
    从所述目标数据库对应的多个信息表中,确定所述目标月份对应的多个信息表;
    根据所述当前信息的类别,从所述目标月份对应的多个信息表中,确定目标信息表。
  7. 一种设备订单数据的查询方法,其特征在于,所述方法应用于服务器;所述服务器中存储有通过如权利要求1-6任一项所述的设备订单数据的存储方法所存储的数据;所述方法包括:
    获取目标设备订单数据的查询请求;所述查询请求中携带有目标用户标识;
    根据所述目标用户标识,从指定数据库中查找所述目标用户标识关联的设备订单信息对应的第一信息标识,和软件详情信息对应的第二信息标识;
    分别以所述第一信息标识和所述第二信息标识作为当前标识,根据所述当前标识进行反解,确定目标服务器中的目标数据库中的目标月份对应的信息表;从所述目标月份对应的信息表中读取所述当前标识对应的信息。
  8. 根据权利要求7所述的方法,其特征在于,根据所述当前标识进行反解,确定目标服务器中的目标数据库中的目标月份对应的信息表的步骤,包括:
    对所述当前标识进行解密处理,得到目标服务器标识和目标时间戳;
    确定所述目标服务器标识对应的目标服务器;
    对所述当前标识中的指定位数字进行哈希取模运算,确定所述目标服务器中的目标数据库;
    根据所述目标时间戳,从所述目标数据库对应的多个信息表中,定位目标月份对应的信息表。
  9. 一种设备订单数据的存储装置,其特征在于,所述装置包括:
    数据获取模块,用于获取目标设备订单数据;所述目标设备订单数据包括:目标用户标识、目标设备标识、设备订单信息和软件详情信息;
    第一数据存储模块,用于分别将所述设备订单信息和所述软件详情信息作为当前信息,执行以下存储步骤:
    通过第一哈希取模模块,根据所述目标用户标识进行第一哈希取模运算,定位目标服务器;
    通过信息标识生成模块,获取当前时间戳和所述目标服务器的服务器标识;根据所述服务器标识、所述当前时间戳、所述目标设备标识和雪花算法,随机生成所述当前信息对应的信息标识;所述信息标识为十进制编码;
    通过第二哈希取模模块,对所述信息标识中的指定位数字进行第二哈希取模运算,定位所述目标服务器中的目标数据库;
    通过信息表定位模块,根据所述当前信息的类别和所述当前时间戳,从所述目标数据库的多个信息表中,定位目标月份对应的目标信息表;
    通过数据存储子模块,将所述当前信息和所述当前信息对应的信息标识存储于所述目标信息表;
    通过第二数据存储模块,将所述目标用户标识、所述设备订单信息对应的第一信息标识、以及所述软件详情信息对应的第二信息标识均关联存储于指定数据库。
  10. 一种设备订单数据的查询装置,其特征在于,所述装置应用于服务器;所述服务器中存储有通过如权利要求1-6任一项所述的设备订单数据的存储方法所存储的数据;所述装置包括:
    请求获取模块,用于获取目标设备订单数据的查询请求;所述查询请求中携带有目标用户标识;
    标识查找模块,用于根据所述目标用户标识,从指定数据库中查找所述目标用户标识关联的设备订单信息对应的第一信息标识,和软件详情信息对应的第二信息标识;
    数据读取模块,用于分别以所述第一信息标识和所述第二信息标识作为当前标识,根据所述当前标识进行反解,确定目标服务器中的目标数据库中的目标月份对应的信息表;从所述目标月份对应的信息表中读取所述当前标识对应的信息。
PCT/CN2023/096592 2022-08-15 2023-05-26 设备订单数据的存储方法、查询方法及装置 WO2024037094A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210971708.6 2022-08-15
CN202210971708.6A CN115033577B (zh) 2022-08-15 2022-08-15 设备订单数据的存储方法、查询方法及装置

Publications (1)

Publication Number Publication Date
WO2024037094A1 true WO2024037094A1 (zh) 2024-02-22

Family

ID=83130411

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/096592 WO2024037094A1 (zh) 2022-08-15 2023-05-26 设备订单数据的存储方法、查询方法及装置

Country Status (2)

Country Link
CN (1) CN115033577B (zh)
WO (1) WO2024037094A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115033577B (zh) * 2022-08-15 2022-11-01 深圳市星卡软件技术开发有限公司 设备订单数据的存储方法、查询方法及装置
CN115982176A (zh) * 2023-03-17 2023-04-18 苏州阿基米德网络科技有限公司 一种基于Sharding-JDBC的数据库存储方法及***
CN117909394A (zh) * 2023-12-21 2024-04-19 中企云服科技(南京)有限公司 一种基于客户管理***的客户数据存储方法、装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107622079A (zh) * 2017-07-28 2018-01-23 阿里巴巴集团控股有限公司 数据存储、查询方法及装置
CN112965818A (zh) * 2021-02-26 2021-06-15 平安普惠企业管理有限公司 一种服务集群单元化分组方法、装置、设备以及介质
CN113449488A (zh) * 2020-03-27 2021-09-28 北京京东拓先科技有限公司 唯一标识的生成方法和装置
CN115033577A (zh) * 2022-08-15 2022-09-09 深圳市星卡软件技术开发有限公司 设备订单数据的存储方法、查询方法及装置

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107967284B (zh) * 2016-10-20 2022-07-05 北京京东尚科信息技术有限公司 用于存储、查询订单信息的方法和装置
CN110750506A (zh) * 2019-09-17 2020-02-04 苏宁云计算有限公司 数据对象标识生成方法、装置、计算机设备和存储介质
CN113127231B (zh) * 2021-04-15 2023-08-29 北京奇艺世纪科技有限公司 订单处理、订单查询方法、装置、***及电子设备
CN113986995A (zh) * 2021-11-08 2022-01-28 挂号网(杭州)科技有限公司 请求分发方法、装置、存储介质及电子设备
CN114493799A (zh) * 2022-02-16 2022-05-13 广州宸祺出行科技有限公司 一种分库分表管理专车订单数据的方法及***

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107622079A (zh) * 2017-07-28 2018-01-23 阿里巴巴集团控股有限公司 数据存储、查询方法及装置
CN113449488A (zh) * 2020-03-27 2021-09-28 北京京东拓先科技有限公司 唯一标识的生成方法和装置
CN112965818A (zh) * 2021-02-26 2021-06-15 平安普惠企业管理有限公司 一种服务集群单元化分组方法、装置、设备以及介质
CN115033577A (zh) * 2022-08-15 2022-09-09 深圳市星卡软件技术开发有限公司 设备订单数据的存储方法、查询方法及装置

Also Published As

Publication number Publication date
CN115033577B (zh) 2022-11-01
CN115033577A (zh) 2022-09-09

Similar Documents

Publication Publication Date Title
WO2024037094A1 (zh) 设备订单数据的存储方法、查询方法及装置
WO2019095416A1 (zh) 信息推送方法、装置、终端设备及存储介质
WO2020042586A1 (zh) 智能合约地址生成方法、装置、计算机设备及可读存储介质
CN107798038B (zh) 数据响应方法及数据响应设备
US20100087169A1 (en) Threading together messages with multiple common participants
WO2016045641A2 (zh) 数据块储存方法、数据查询方法和数据修改方法
CN113704243A (zh) 数据分析方法、装置、计算机装置及存储介质
US20200210410A1 (en) Service identifier-based data indexing
TWI686705B (zh) 分頁查詢方法及裝置和電子設備
CN111563109A (zh) 基数统计方法、装置、***、设备和计算机可读存储介质
CN111629081A (zh) 互联网协议ip地址数据处理方法、装置及电子设备
CN111443899B (zh) 一种元素处理方法、装置、电子设备及存储介质
WO2019019393A1 (zh) 业务接口调用方法、装置、用户终端和可读存储介质
CN115757545A (zh) 密文检索方法、存储方法、装置、电子设备及存储介质
CN112437148A (zh) 业务请求的处理方法、装置、业务服务器及***
CN111797334A (zh) 一种网址访问方法、装置、电子设备及存储介质
US20180046656A1 (en) Constructing filterable hierarchy based on multidimensional key
US11494499B1 (en) Searching encrypted data stores
WO2019019650A1 (zh) 网站数据处理方法、装置、网站数据处理平台及存储介质
CN111538730B (zh) 一种基于哈希桶算法的数据统计的方法及其***
CN110489988B (zh) 一种曝光设备数量的计算方法及装置
US20170330236A1 (en) Enhancing contact card based on knowledge graph
CN109446758B (zh) 一种数据处理方法、终端及计算机可读介质
CN112818190A (zh) 内容分享方法、装置、电子设备和存储介质
CN111310088A (zh) 一种页面渲染方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23854000

Country of ref document: EP

Kind code of ref document: A1