CN108156197B - Method and device for acquiring user distribution information - Google Patents
Method and device for acquiring user distribution information Download PDFInfo
- Publication number
- CN108156197B CN108156197B CN201611104620.5A CN201611104620A CN108156197B CN 108156197 B CN108156197 B CN 108156197B CN 201611104620 A CN201611104620 A CN 201611104620A CN 108156197 B CN108156197 B CN 108156197B
- Authority
- CN
- China
- Prior art keywords
- user
- information
- area
- distribution
- distribution table
- Prior art date
- Legal status (The legal status 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 status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/52—Network services specially adapted for the location of the user terminal
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The application discloses a method and a device for acquiring user distribution information, wherein the method comprises the following steps: acquiring operation information of a user in real time; extracting the position information of the user in the operation information; searching whether an area identifier corresponding to the position information exists in a distribution table preset for a user, wherein the distribution table comprises area identifiers and numerical values corresponding to the area identifiers; if the area identifier exists, increasing the numerical value corresponding to the area identifier in the distribution table by a preset increment value; if the position information does not exist, setting the area identification corresponding to the position information in the distribution table, and setting the numerical value corresponding to the newly set area identification as a preset initial value. According to the method and the device, the position information is extracted from the operation information in real time, and the table is set, so that operations such as query or data statistics and the like are not required to be directly performed on a database, the calculation rate of the user distribution information is increased, and the purpose of the method and the device is achieved.
Description
Technical Field
The present invention relates to the field of streaming data processing technologies, and in particular, to a method and an apparatus for acquiring user distribution information.
Background
In the era of data explosion, stream processing calculation becomes a popular research field at present, and the characteristics of high efficiency and rapidness become important for main research. How to calculate the distribution of users in a region or area in the stream processing is also a valuable solution.
In the prior art, a query result of a user distribution condition is obtained by writing data into a database in real time and then by sql query of the database.
However, although the scheme in the prior art is simple, in the case of a large amount of data, the calculation speed by the scheme is too slow, and the requirement of stream processing cannot be met.
Disclosure of Invention
In view of the above, the present application is proposed to provide a technical problem that overcomes or at least partially solves the problem of the prior art that the rate of user distribution information calculation is too slow.
The application provides a method for acquiring user distribution information, which comprises the following steps:
acquiring operation information of a user in real time;
extracting the position information of the user in the operation information;
searching whether an area identifier corresponding to the position information exists in a distribution table preset for a user, wherein the distribution table comprises area identifiers and numerical values corresponding to the area identifiers; if the area identifier exists, increasing the numerical value corresponding to the area identifier in the distribution table by a preset increment value; if the position information does not exist, setting the area identification corresponding to the position information in the distribution table, and setting the numerical value corresponding to the newly set area identification as a preset initial value.
The above method, preferably, further comprises:
receiving a query request, wherein the query request is used for requesting to return the regional distribution state of a user, and the query request at least comprises a user identifier;
and returning the distribution table corresponding to the user identification based on the query request.
Preferably, after the extracting the location information of the user in the operation information, the method further includes:
and writing the position information into a preset summary table, so that the summary table comprises the position information in all operation information of the user.
The above method, preferably, further comprises:
receiving a query request, wherein the query request at least comprises a user identifier;
and monitoring whether fault information is generated in the flow processing process of the operation information, if the fault information is generated, returning the general table corresponding to the user identification, and if the fault information is not generated, returning the distribution table corresponding to the user identification.
The present application further provides an apparatus for acquiring user distribution information, including:
the operation acquisition unit is used for acquiring operation information of a user in real time;
a position extraction unit configured to extract position information of a user in the operation information;
the identification searching unit is used for searching whether an area identification corresponding to the position information exists in a distribution table preset for a user, and the distribution table comprises the area identification and a numerical value corresponding to the area identification; if the digital value exists in the digital value accumulation unit, triggering the digital value accumulation unit, and if the digital value does not exist in the digital value accumulation unit, triggering the identification setting unit;
a numerical value accumulation unit, configured to increase a numerical value corresponding to the area identifier in the distribution table by a preset increment value;
and the mark setting unit is used for setting the area marks corresponding to the position information in the distribution table and setting the numerical values corresponding to the newly set area marks as preset initial values.
The above apparatus, preferably, further comprises:
the first query unit is used for receiving a query request, the query request is used for requesting to return the area distribution state of a user, the query request at least comprises a user identifier, and a distribution table corresponding to the user identifier is returned based on the query request.
The above apparatus, preferably, further comprises:
and the summary table writing unit is used for writing the position information into a preset summary table after the position extraction unit extracts the position information of the user in the operation information, so that the summary table comprises the position information in all the operation information of the user.
The above apparatus, preferably, further comprises:
and the second query unit is used for receiving a query request, wherein the query request at least comprises a user identifier, monitoring whether fault information is generated in the flow processing process of the operation information, returning a general table corresponding to the user identifier if the fault information is generated, and returning a distribution table corresponding to the user identifier if the fault information is not generated.
By means of the technical scheme, the method and the device for acquiring user distribution information provided by the application extract user position information in user real-time operation information in stream processing, and set the region identifier and the numerical value in a preset distribution table based on the position of a user, for example, if the region identifier corresponding to the position information exists in the distribution table, the corresponding numerical value is increased by a preset increment, if the region identifier corresponding to the position information does not exist in the distribution table, the region identifier is increased in the distribution table, and the corresponding numerical value is set as a preset initial value, so as to record the number of times of the user appearing under each region identifier, further characterize the distribution state of the user in the whole region, obtain the user distribution information, supply subsequent query, extract the position information of the operation information in real time in the process and set the table, operations such as query or data statistics and the like do not need to be directly carried out on the database, the calculation rate of the user distribution information is increased, and the purpose of the application is achieved.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a flowchart of a method for acquiring user distribution information according to an embodiment of the present application;
FIGS. 2 and 3 are diagrams illustrating an application example of an embodiment of the present application;
fig. 4 is a flowchart of a method for acquiring user distribution information according to a second embodiment of the present application;
fig. 5 is a flowchart of a method for acquiring user distribution information according to a third embodiment of the present application;
FIG. 6 is a partial flow chart of a third embodiment of the present application;
fig. 7 is a schematic structural diagram of an apparatus for acquiring user distribution information according to a fourth embodiment of the present application;
fig. 8 is a schematic structural diagram of an apparatus for acquiring user distribution information according to a fifth embodiment of the present application;
fig. 9 is a schematic structural diagram of an apparatus for acquiring user distribution information according to a sixth embodiment of the present application.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Referring to fig. 1, an implementation flowchart of a method for acquiring user distribution information according to an embodiment of the present application is suitable for counting distribution conditions of users in various areas, such as the number of times of occurrence in an area a, in a stream processing, and specifically, the method may include the following steps:
step 101: and acquiring the operation information of the user in real time.
The operation information of the user refers to operation information generated by the user in various operations, such as logging in a system, a website or an application, and then, for example, the user searches information such as road conditions or routes through the application, the user can generate data and record the data as long as the user performs online operation, and the recorded operation information records information representing the position of the user.
Step 102: position information of the user in the operation information is extracted.
The location information of the user may be coordinate data or a geographic building name, and the location information corresponds to an area, for example, in fig. 2, the coordinate a of the user and the geographic building "mall B" both correspond to an area a, the coordinate C of the user corresponds to an area B, and the geographic building "school d" corresponds to an area C. A plurality of position information can be corresponded to one area, each position information is corresponded to one area only, and the corresponding relation between the area and the position can be set according to the requirements of users.
Step 103: and searching whether the area identification corresponding to the position information exists in a distribution table preset for a user, if so, executing step 104, and if not, executing step 105.
The distribution table preset for the user is a distribution table which can generate a hash map in a memory before stream processing, one distribution table corresponds to one user identifier, each user distribution table has two types of fields, the first field is set as a field of an area identifier, the distribution table can have a plurality of fields of area identifiers, and the fields can store area identifiers such as an area A, an area B, an area C and the like; the second field is a value field, each value field corresponds to a field of the area identifier, and is in a one-to-one mapping relationship, such as 2, 1, and 1, as shown in fig. 3.
The relationship between the location information and the area identifier may be understood as: the area identification is an area identification of an area to which the position information belongs.
In this embodiment, when searching for whether the area identifier corresponding to the location information exists in the distribution table of the user, the following method may be used:
and matching the position information with each area identifier in the field of the area identifier of the distribution table, wherein if the area identifier of the area to which the position information belongs is found, the existence of the area identifier corresponding to the position information is indicated, and otherwise, the existence of the area identifier is not indicated.
Step 104: and increasing the value corresponding to the area identifier corresponding to the position information in the distribution table by a preset increment value.
In a specific implementation, the increment value may be 1 or set according to actual requirements.
If the area identifier corresponding to the location information exists in the distribution table, it indicates that the location information of the user has already occurred in the streaming process, the area identifier corresponding to the location information already exists in the distribution table, and the corresponding value is not 0, and at this time, it is only necessary to accumulate the increment value on the value, for example, increase by 1, and then the number of times that the user appears in the area corresponding to the area identifier can be counted.
Step 105: and setting an area identifier corresponding to the position information in the distribution table, and setting a numerical value corresponding to the newly set area identifier as a preset initial value.
In a specific implementation, the initial value may be 1 or set as required. In this embodiment, the area identifier and the numerical value are set in the distribution table, and specifically, a new field is added to a field of the area identifier in the distribution table or content in an existing field is emptied as a new field, where the new field includes a field serving as the area identifier and a field of a numerical value corresponding to the area identifier, an area identifier corresponding to the location information is set in the field of the area identifier, and the field of the numerical value corresponding to the area identifier is set as an initial value, such as 1.
In this embodiment, the distribution table in the stream processing is a state table capable of ensuring user distribution information, where the area identifier in the distribution table is an identifier of an area where a user has appeared, and the amount of the numerical value corresponding to each area identifier is the number of times that the user appears in the area, so as to represent the number of times that the user appears in each area.
By means of the foregoing technical solution, in the method for acquiring user distribution information provided in this embodiment of the present application, user location information in user real-time operation information is extracted in stream processing, and area identifiers and numerical values are set in a preset distribution table based on a location of a user, for example, if an area identifier corresponding to location information already exists in the distribution table, a preset increment is added to a corresponding numerical value, if an area identifier corresponding to location information does not yet exist in the distribution table, the area identifier is added to the distribution table, and the corresponding numerical value is set as a preset initial value, so as to record the number of times that the user appears in each area identifier, further characterize a distribution state of the user in the whole area, obtain user distribution information, provide subsequent query, perform location information extraction on operation information in real time in this process and perform table setting, operations such as query or data statistics and the like do not need to be directly carried out on the database, the calculation rate of the user distribution information is increased, and the purpose of the application is achieved.
In one implementation, a staff member such as an analyst may query the distribution condition of the user in a certain area or each area by querying the distribution table, specifically, refer to fig. 4, which is an implementation flowchart of a method for acquiring user distribution information provided in the second embodiment of the present application, where the method further includes:
step 401: receiving a query request, wherein the query request is used for requesting to return the regional distribution state of the user, and the query request at least comprises the user identification.
The query request may be generated by an analyst or other staff operating through a query terminal according to actual needs, where the query request at least includes a user identifier of a certain user to be queried, such as a user name or a number representing the user identity.
Step 402: and returning the distribution table corresponding to the user identification based on the query request.
In this embodiment, the distribution table set for the user can fully represent the distribution state of the user in each area, and therefore, in this embodiment, after receiving the query request, returning the distribution table corresponding to the user identifier may specifically include: and returning the whole distribution table corresponding to the user identification to provide the worker for checking or performing other processing, or returning the part of the area identification in the distribution table and the field of the corresponding numerical value to provide the worker for checking or performing other processing.
In an implementation, in order to ensure reliability of obtaining user distribution information in stream processing, in this embodiment, the location information of the user that is collected in real time may be backed up and stored, specifically, refer to fig. 5, which is an implementation flowchart of a method for obtaining user distribution information provided in the third embodiment of the present application, after step 102, the method may further include the following steps:
step 106: and writing the position information into a preset summary table, so that the summary table comprises the position information in all the operation information of the user.
The summary table includes location information in all operation information of the user, but not operation information of the user, so the data size is not large.
When the method is provided for the analyst and other staff to query the user distribution information, it is necessary to monitor whether a distribution table is inaccurate due to a fault occurring in the flow processing process in real time, for example, whether fault information is generated in the flow processing process of the monitoring operation information, so as to ensure accuracy and reliability of the user distribution information obtained by the analyst and other staff, specifically, as shown in fig. 6, the method may further include the following steps:
step 601: a query request is received.
The query request may be generated by an analyst or other staff operating through the query terminal according to actual needs, and the query request at least includes a user identifier of a certain user to be queried, such as a user name or a number representing the user identity.
Step 602: and monitoring whether fault information is generated in the flow processing process of the operation information, if the fault information is generated, executing the step 603, and if the fault information is not generated, executing the step 604.
In this embodiment, the purpose of monitoring whether fault information is generated in the flow processing process of the operation information is to: monitoring whether the real-time task for stream processing is operating normally, if so, executing step 604, and if not, indicating that the distribution table may have been inaccurate, such as missing statistics of the number of times that the user appears at a certain position in a certain area or repeatedly counting the number of times that the user appears at a certain position in a certain area, and then executing step 603.
It should be noted that the real-time task performing stream processing herein refers to a real-time task performing area statistics on the position information in the operation information, and if the real-time task fails, it indicates that the output result distribution table of the task may be inaccurate.
Step 603: and returning the summary table corresponding to the user identification.
That is to say, in this embodiment, the extracted position information is backed up to the summary table, and if the summary table is not affected when the real-time task fails, the summary table is returned to the staff, and the staff performs further statistics or query, so as to ensure the accuracy and reliability of the information obtained by the staff.
Step 604: and returning the distribution table corresponding to the user identification.
If the real-time task does not have a fault, the distribution table is accurate and reliable, at the moment, the distribution table is returned to the staff, and more visual user distribution information can be fed back to the staff on the premise of ensuring the accuracy and reliability of the user distribution information obtained by the staff, so that the work of further inquiring or counting by the staff is saved, and the work load of the staff is reduced.
Referring to fig. 7, a schematic structural diagram of an apparatus for acquiring user distribution information according to a fourth embodiment of the present application, where the apparatus is adapted to count distribution conditions of users in various areas, such as the number of times of occurrence in the area a, in a stream processing, and specifically, the apparatus may include the following structures:
an operation obtaining unit 701 is configured to obtain operation information of a user in real time.
The operation information of the user refers to operation information generated by the user in various operations, such as logging in a system, a website or an application, and then, for example, the user searches information such as road conditions or routes through the application, the user can generate data and record the data as long as the user performs online operation, and the recorded operation information records information representing the position of the user.
A location extracting unit 702, configured to extract location information of the user in the operation information.
The location information of the user may be coordinate data or a geographic building name, and the location information corresponds to an area, for example, in fig. 2, the coordinate a of the user and the geographic building "mall B" both correspond to an area a, the coordinate C of the user corresponds to an area B, and the geographic building "school d" corresponds to an area C. A plurality of position information can be corresponded to one area, each position information is corresponded to one area only, and the corresponding relation between the area and the position can be set according to the requirements of users.
An identifier searching unit 703, configured to search, in a distribution table preset for a user, whether an area identifier corresponding to the location information exists, if so, trigger the numerical value accumulating unit 704, and if not, trigger the identifier setting unit 705.
The distribution table preset for the user is a distribution table which can generate a hash map in a memory before stream processing, one distribution table corresponds to one user identifier, each user distribution table has two types of fields, the first field is set as a field of an area identifier, the distribution table can have a plurality of fields of area identifiers, and the fields can store area identifiers such as an area A, an area B, an area C and the like; the second field is a value field, each value field corresponds to a field of the area identifier, and is in a one-to-one mapping relationship, such as 1, 3, and 6, as shown in fig. 3.
The relationship between the location information and the area identifier may be understood as: the area identification is an area identification of an area to which the position information belongs.
In this embodiment, when the identifier searching unit 703 searches whether the area identifier corresponding to the location information exists in the distribution table of the user, it may be implemented in the following manner:
and matching the position information with each area identifier in the field of the area identifier of the distribution table, wherein if the area identifier of the area to which the position information belongs is found, the existence of the area identifier corresponding to the position information is indicated, and otherwise, the existence of the area identifier is not indicated.
A value accumulating unit 704, configured to increase the value corresponding to the area identifier in the distribution table by a preset increment value.
In a specific implementation, the increment value may be 1 or set according to actual requirements.
If the area identifier corresponding to the location information exists in the distribution table, it indicates that the location information of the user has occurred in the streaming process, the area identifier corresponding to the location information already exists in the distribution table, and the corresponding value is not 0, and at this time, the numerical value accumulation unit 704 only needs to accumulate the incremental value in the numerical value, for example, increase by 1, so as to count the number of times that the user appears in the area corresponding to the area identifier.
An identifier setting unit 705, configured to set an area identifier corresponding to the location information in the distribution table, and set a value corresponding to the newly set area identifier as a preset initial value.
In a specific implementation, the initial value may be 1 or set as required. In this embodiment, the identifier setting unit 705 sets the area identifier and the numerical value in the distribution table, which may specifically be that a new field is added to a field of the area identifier in the distribution table or content in an already existing field is emptied as a new field, the field includes the field serving as the area identifier and a field of the numerical value corresponding to the area identifier, an area identifier corresponding to the location information is set in the field of the area identifier, and the field of the numerical value corresponding to the area identifier is set as an initial value, for example, set as 1.
In this embodiment, the distribution table in the stream processing is a state table capable of ensuring user distribution information, where the area identifier in the distribution table is an identifier of an area where a user has appeared, and the amount of the numerical value corresponding to each area identifier is the number of times that the user appears in the area, so as to represent the number of times that the user appears in each area.
It should be noted that, in the implementation of the server for stream processing, the apparatus for acquiring user distribution information in this embodiment may include a processor and a memory, where the operation obtaining unit 701, the position extracting unit 702, the identifier searching unit 703, the numerical value accumulating unit 704, the identifier setting unit 705, and the like are all stored in the memory as program units, and the processor executes the program units stored in the memory to implement corresponding functions.
The processor may include a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more, and the distribution condition of the user in each area is counted by adjusting the kernel parameters.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
With the above technical solution, the apparatus for acquiring user distribution information provided in the fourth embodiment of the present application extracts user location information in the user real-time operation information in stream processing, and sets the region identifier and the numerical value in a preset distribution table based on the location of the user, for example, if the region identifier corresponding to the location information already exists in the distribution table, the corresponding numerical value increases by a preset increment, and if the region identifier corresponding to the location information does not yet exist in the distribution table, the region identifier is increased in the distribution table, and the corresponding numerical value is set as a preset initial value, so as to record the number of times that the user appears in each region identifier, further characterize the distribution state of the user in the whole region, obtain the user distribution information, provide subsequent query, perform location information extraction on the operation information in real time in this process and perform table setting, operations such as query or data statistics and the like do not need to be directly carried out on the database, the calculation rate of the user distribution information is increased, and the purpose of the application is achieved.
In one implementation, a staff member such as an analyst may query the distribution condition of the user in a certain area or each area by querying the distribution table, specifically, referring to fig. 8, which is a schematic structural diagram of an apparatus for acquiring user distribution information provided in the fifth embodiment of the present application, the apparatus may further include the following structure:
a first query unit 706, configured to receive a query request, where the query request is used to request to return the area distribution state of the user, and the query request at least includes a user identifier, and return the distribution table corresponding to the user identifier based on the query request.
The query request may be generated by an analyst or other staff operating through a query terminal according to actual needs, where the query request at least includes a user identifier of a certain user to be queried, such as a user name or a number representing the user identity.
In this embodiment, the distribution table set for the user can fully represent the distribution state of the user in each area, and therefore, after receiving the query request, the first query unit 706 returns the distribution table corresponding to the user identifier, which may specifically include: and returning the whole distribution table corresponding to the user identification to provide the worker for checking or performing other processing, or returning the part of the area identification in the distribution table and the field of the corresponding numerical value to provide the worker for checking or performing other processing.
In an implementation, in order to ensure reliability of obtaining user distribution information in stream processing, in this embodiment, the location information of a user collected in real time may be backed up and stored, specifically, refer to fig. 9, which is a schematic structural diagram of an obtaining apparatus for user distribution information provided in a sixth embodiment of the present application, where the apparatus may further include the following structure:
a summary table writing unit 707, configured to write the location information into a preset summary table after the location extracting unit 702 extracts the location information of the user in the real-time operation information, so that the summary table includes the location information in all the operation information of the user.
The summary table includes location information in all operation information of the user, but not operation information of the user, so the data size is not large.
When the device is provided for an analyst or other staff to inquire the user distribution information, it is necessary to monitor whether a distribution table is inaccurate due to a fault occurring in the flow processing process in real time, for example, whether fault information is generated in the flow processing process of the monitoring operation information, so as to ensure the accuracy and reliability of the user distribution information obtained by the analyst or other staff, and the device may further include the following structure:
a second query unit 708, configured to receive a query request, where the query request at least includes a user identifier, monitor whether fault information is generated in a stream processing process of operation information, return a summary table corresponding to the user identifier if the fault information is generated, and return a distribution table corresponding to the user identifier if the fault information is not generated.
The query request may be generated by an analyst or other staff operating through the query terminal according to actual needs, and the query request at least includes a user identifier of a certain user to be queried, such as a user name or a number representing the user identity.
Specifically, the purpose of the second query unit 708 in this embodiment of monitoring whether fault information is generated in the process of processing the stream of operation information is to: monitoring whether the real-time task for stream processing normally runs, if so, returning the distribution table corresponding to the user identification, and if not, indicating that the distribution table may have an inaccurate condition, such as missing statistics of the times of the user appearing at a certain position in a certain area or repeatedly counting the times of the user appearing at a certain position in a certain area, and at the moment, returning the general table corresponding to the user identification.
It should be noted that the real-time task performing stream processing herein refers to a real-time task performing area statistics on the position information in the operation information, and if the real-time task fails, it indicates that the output result distribution table of the task may be inaccurate.
That is to say, in this embodiment, the summary table writing unit 707 backs up the extracted location information to the summary table, and if the real-time task fails, the summary table is returned to the staff by the second query unit 708, and the staff performs further statistics or query to ensure the accuracy and reliability of the information obtained by the staff.
If the real-time task does not have a fault, the distribution table is accurate and reliable, at the moment, the second query unit 708 returns the distribution table to the staff, and on the premise that the accuracy and the reliability of the user distribution information obtained by the staff are guaranteed, more visual user distribution information can be fed back to the staff, so that the work of further query or statistics of the staff is saved, and the workload of the staff is reduced.
It should be noted that the method and apparatus in this embodiment may be applied to a stream processing server, and run in the form of a computer program product on a stream processor to implement the above functions, that is, the present application further provides a computer program product capable of running on a server and being adapted to execute program code for initializing the following method steps when executed on the server to implement the corresponding functions:
the method comprises the steps of acquiring operation information of a user in real time, extracting position information of the user in the operation information, searching whether an area identifier corresponding to the position information exists in a distribution table preset for the user, wherein the distribution table comprises the area identifier and a numerical value corresponding to the area identifier, if so, increasing the numerical value corresponding to the area identifier in the distribution table by a preset incremental value, if not, setting the area identifier corresponding to the position information in the distribution table, and setting the numerical value corresponding to the newly set area identifier as a preset initial value.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims (8)
1. A method for acquiring user distribution information, which is used for counting the distribution situation of users in each area in stream processing, comprises the following steps:
acquiring operation information of a user in real time, wherein the operation information of the user is operation information generated in various operations of the user;
extracting the position information of the user in the operation information, wherein the position information corresponds to only one area, and the area corresponds to a plurality of position information;
searching whether an area identifier corresponding to the position information exists in a distribution table preset for a user, wherein the distribution table is a state table for ensuring user distribution information, one distribution table corresponds to one user identifier, the distribution table comprises area identifiers and numerical values corresponding to the area identifiers, and the area identifiers are area identifiers of areas to which the position information belongs;
if the area identifier exists, increasing the numerical value corresponding to the area identifier in the distribution table by a preset increment value; if the position information does not exist, setting the area identification corresponding to the position information in the distribution table, and setting the numerical value corresponding to the newly set area identification as a preset initial value.
2. The method of claim 1, further comprising:
receiving a query request, wherein the query request is used for requesting to return the regional distribution state of a user, and the query request at least comprises a user identifier;
and returning the distribution table corresponding to the user identification based on the query request.
3. The method of claim 1, wherein after said extracting location information of a user in said operation information, said method further comprises:
and writing the position information into a preset summary table, so that the summary table comprises the position information in all operation information of the user.
4. The method of claim 3, further comprising:
receiving a query request, wherein the query request at least comprises a user identifier;
and monitoring whether fault information is generated in the flow processing process of the operation information, if the fault information is generated, returning the general table corresponding to the user identification, and if the fault information is not generated, returning the distribution table corresponding to the user identification.
5. An apparatus for acquiring user distribution information, which is used for counting distribution of users in various areas in stream processing, the apparatus comprising:
the operation acquisition unit is used for acquiring operation information of a user in real time, wherein the operation information of the user is operation information generated by the user in various operations;
a position extracting unit, configured to extract position information of a user in the operation information, where the position information corresponds to only one area, and the area corresponds to multiple pieces of position information;
an identifier searching unit, configured to search, in a distribution table preset for a user, whether an area identifier corresponding to the location information exists, where the distribution table is a state table for guaranteeing user distribution information, one distribution table corresponds to one user identifier, the distribution table includes area identifiers and values corresponding to the area identifiers, and the area identifiers are area identifiers of areas to which the location information belongs; if the digital value exists in the digital value accumulation unit, triggering the digital value accumulation unit, and if the digital value does not exist in the digital value accumulation unit, triggering the identification setting unit;
a numerical value accumulation unit, configured to increase a numerical value corresponding to the area identifier in the distribution table by a preset increment value;
and the mark setting unit is used for setting the area marks corresponding to the position information in the distribution table and setting the numerical values corresponding to the newly set area marks as preset initial values.
6. The apparatus of claim 5, further comprising:
the first query unit is used for receiving a query request, the query request is used for requesting to return the area distribution state of a user, the query request at least comprises a user identifier, and a distribution table corresponding to the user identifier is returned based on the query request.
7. The apparatus of claim 5, further comprising:
and the summary table writing unit is used for writing the position information into a preset summary table after the position extraction unit extracts the position information of the user in the operation information, so that the summary table comprises the position information in all the operation information of the user.
8. The apparatus of claim 7, further comprising:
and the second query unit is used for receiving a query request, wherein the query request at least comprises a user identifier, monitoring whether fault information is generated in the flow processing process of the operation information, returning a general table corresponding to the user identifier if the fault information is generated, and returning a distribution table corresponding to the user identifier if the fault information is not generated.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611104620.5A CN108156197B (en) | 2016-12-05 | 2016-12-05 | Method and device for acquiring user distribution information |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611104620.5A CN108156197B (en) | 2016-12-05 | 2016-12-05 | Method and device for acquiring user distribution information |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108156197A CN108156197A (en) | 2018-06-12 |
CN108156197B true CN108156197B (en) | 2021-02-05 |
Family
ID=62470007
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201611104620.5A Active CN108156197B (en) | 2016-12-05 | 2016-12-05 | Method and device for acquiring user distribution information |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108156197B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108921505B (en) * | 2018-06-21 | 2023-04-07 | 平安科技(深圳)有限公司 | Rate determination method, electronic device, and computer-readable storage medium |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1852353B (en) * | 2005-10-18 | 2010-05-05 | 华为技术有限公司 | Method, device and system for processing user data |
CN101083785A (en) * | 2007-07-04 | 2007-12-05 | 贾林 | Method and system for obtaining people information |
RU2541892C1 (en) * | 2011-02-10 | 2015-02-20 | Нтт Докомо, Инк. | Apparatus for estimating number of terminals and method of estimating number of terminals |
EP2675206A1 (en) * | 2011-02-10 | 2013-12-18 | Ntt Docomo, Inc. | Area range estimation device and area range estimation method |
CN105376709A (en) * | 2015-10-10 | 2016-03-02 | 北京中创信测信息技术有限公司 | Regional population statistical method and system based on mobile communication technology |
-
2016
- 2016-12-05 CN CN201611104620.5A patent/CN108156197B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN108156197A (en) | 2018-06-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3425524A1 (en) | Cloud platform-based client application data calculation method and device | |
CN107733869B (en) | Equipment identification method and device | |
CN106202235B (en) | Data processing method and device | |
CN110413634B (en) | Data query method, system, device and computer readable storage medium | |
US9372765B2 (en) | System and method for recovering system status consistently to designed recovering time point in distributed database | |
CN109934268B (en) | Abnormal transaction detection method and system | |
CN104504122A (en) | Database migration data verification method and system | |
CN104978324B (en) | Data processing method and device | |
CN106897342B (en) | Data verification method and equipment | |
WO2017020725A1 (en) | Data detection method and device | |
CN112583944B (en) | Processing method and device for updating domain name certificate | |
CN107644033B (en) | Method and equipment for querying data in non-relational database | |
WO2015196885A1 (en) | Method and apparatus for acquiring and storing performance data of cloud computing system | |
CN113918658A (en) | Method and device for recovering data | |
CN108156197B (en) | Method and device for acquiring user distribution information | |
CN106648839A (en) | Method and device for processing data | |
CN112347131B (en) | Urban rail project demand identification and coverage method and device | |
CN108153777B (en) | Method and device for acquiring data access information | |
CN106557483B (en) | Data processing method, data query method, data processing equipment and data query equipment | |
CN109947713B (en) | Log monitoring method and device | |
CN114064707A (en) | Data query method and device for data virtualization server and storage medium | |
CN109471901B (en) | Data synchronization method and device | |
CN111367956A (en) | Data statistical method and device | |
CN107016028B (en) | Data processing method and apparatus thereof | |
CN106156185B (en) | Method, device and system for inquiring service request execution state |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB02 | Change of applicant information | ||
CB02 | Change of applicant information |
Address after: 100080 No. 401, 4th Floor, Haitai Building, 229 North Fourth Ring Road, Haidian District, Beijing Applicant after: Beijing Guoshuang Technology Co.,Ltd. Address before: 100086 Cuigong Hotel, 76 Zhichun Road, Shuangyushu District, Haidian District, Beijing Applicant before: Beijing Guoshuang Technology Co.,Ltd. |
|
GR01 | Patent grant | ||
GR01 | Patent grant |