Method, device, equipment, system and storage medium for processing data

Through the collaborative work of Lambda service and data module, the accumulated and real-time data in the data module are obtained and aggregated, which solves the problem of incomplete statistical results in the prior art and improves the accuracy of data.

CN114416817BActive Publication Date: 2024-12-20BEIJING MEGAROBO TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111572472.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-21
Publication Date
2024-12-20
Estimated Expiration
2041-12-21

AI Technical Summary

Technical Problem

When processing data, the prior art cannot promptly and completely reflect sales over a period of time, resulting in incomplete statistical results.

Method used

Through the communication with the first data module and the second data module through the Lambda service, the accumulated data and real-time data of the query time are obtained, and the two are aggregated to obtain the target data.

Benefits of technology

It realizes complete acquisition of data over a period of time and improves the accuracy of statistical results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114416817B_ABST
    Figure CN114416817B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a method, device, equipment, system and storage medium for processing data. The method for processing data is applied to Lambda service, by obtaining the query time and time period of target data; determining whether the query time is in a preset time period, wherein the time period includes multiple time periods, and the multiple time periods include a preset time period; in the case of determining that the query time is not in the preset time period, searching for query records in the time period where the query time is located from the first data module; in the case of failing to find query records from the first data module database, obtaining the cumulative data of the previous time period within the time period up to the time period where the query time is located from the second data module database; determining the real-time data of the time period where the query time is located; obtaining the target data according to the cumulative data and the real-time data, thereby solving the problem of incomplete target data and improving the accuracy of target data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data processing, and in particular to a method for processing data, an apparatus for processing data, a device for processing data, a system for processing data, and a storage medium. Background Art

[0002] In the operation of new retail business, in order to obtain better operation plans, operators need to plan and adjust operations based on some sales indicators. For example, for unmanned retail coffee machines, it is necessary to count indicators such as the number of sales orders, number of cups sold, and sales amount on a weekly, monthly or annual basis.

[0003] In the current data processing methods, data based on weekly, monthly, and annual dimensions usually fall within the T+1 category. Taking the weekly dimension as an example, when querying data on a certain day of this week, only data from Monday this week to the previous day can be found, and all data from Monday this week to the current query time cannot be obtained, resulting in the inability to timely and comprehensively reflect sales conditions. In other words, when using the current data processing methods to collect statistics on data within a period of time, the statistical results are incomplete. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a method, apparatus, device, system and storage medium for processing data, aiming to solve the problem of incomplete statistical results when statistics are performed on data within a period of time in the prior art.

[0005] In order to achieve the above-mentioned object, the first aspect of the present application provides a method for processing data, which is applied to a Lambda service, wherein the Lambda service communicates with a first data module and a second data module respectively, and the method for processing data includes:

[0006] The Lambda service obtains the query time and time period of the target data;

[0007] Determining whether the query time is within a preset time period, wherein the time period includes a plurality of time periods, and the plurality of time periods includes the preset time period;

[0008] When it is determined that the query time is not within the preset time period, searching the first data module for query records within the time period within which the query time is located;

[0009] In the case that the query record cannot be found from the first data module, the accumulated data of the time period before the time period of the query time is obtained from the second data module;

[0010] Determine the real-time data of the time period in which the query time falls;

[0011] The target data is obtained according to the accumulated data and the real-time data.

[0012] In the embodiment of the present application, determining the real-time data of the time period in which the query time is located includes:

[0013] Searching for order information from the first data module according to the time period of the query time;

[0014] The order information is aggregated to obtain the real-time data.

[0015] In an embodiment of the present application, the method for processing data further includes:

[0016] Obtain the order status of the order information;

[0017] Determine the first order information that the order status is a final transaction status;

[0018] Aggregate the first order information to obtain the real-time data.

[0019] In an embodiment of the present application, the first data module is used to store order information with the latest order status and the cumulative data of the previous time period within the time period to the time period where the query time is located; the second data module is used to store the cumulative data of the previous time period within the time period, or to store the cumulative data of the previous time period within the time period and the real-time data of the current time period.

[0020] In an embodiment of the present application, the method for processing data further includes:

[0021] In the case where it is determined that the query time is within the preset time period, determining the real-time data of the time period within which the query time is located;

[0022] The real-time data is aggregated to obtain the target data, and the target data is output to the second data module.

[0023] In an embodiment of the present application, the method for processing data further includes:

[0024] When the query record is found in the first data module, obtaining historical data corresponding to the time period of the query time from the first data module;

[0025] Determine the real-time data of the time period in which the query time falls;

[0026] The target data is obtained according to the historical data and the real-time data, and the target data is output to the second data module.

[0027] In the embodiment of the present application, obtaining the target data according to the accumulated data and the real-time data includes:

[0028] The accumulated data and the real-time data are aggregated to obtain the target data.

[0029] In an embodiment of the present application, the method for processing data further includes:

[0030] Outputting the accumulated data to the first data module;

[0031] Acquire historical data corresponding to the time period of the query time from the first data module;

[0032] The target data is obtained according to the historical data and the real-time data.

[0033] In the embodiment of the present application, the first data module is a DynamoDB database, and the second data module is a MongoDB database.

[0034] A second aspect of the present application provides a device for processing data, which is applied to a Lambda service, wherein the Lambda service communicates with a first data module and a second data module respectively, and the device for processing data includes:

[0035] Time acquisition module, used to obtain the query time and time period of target data;

[0036] a time period determination module, used to determine whether the query time is within a preset time period, wherein the time period includes a plurality of time periods, and the plurality of time periods includes the preset time period;

[0037] A record search module, configured to search the first data module for a query record in the time period in which the query time is located when it is determined that the query time is not in the preset time period;

[0038] An accumulated data determination module, configured to obtain accumulated data of a time period before the time period of the query time from the second data module when the query record cannot be found from the first data module;

[0039] A real-time data determination module, used to determine the real-time data of the time period in which the query time falls;

[0040] A target data determination module is used to obtain the target data according to the accumulated data and the real-time data.

[0041] A second aspect of the present application provides a device for processing data, comprising:

[0042] a memory for a program used for device detection;

[0043] A processor is configured to call the program for processing data from the memory so that the processor can execute the above method for processing data.

[0044] A third aspect of the present application provides a system for processing data, comprising: a first-level Lambda service, a first data module, and a second data module, wherein the first-level Lambda service communicates with the first data module and the second data module respectively; wherein:

[0045] The first-level Lambda service is used to obtain the query time and time period of the target data, determine whether the query time is in a preset time period, wherein the time period includes multiple time periods, and the multiple time periods include the preset time period. If it is determined that the query time is not in the preset time period, search the query record of the time period in which the query time is located from the first data module. If the query record cannot be found from the first data module, obtain the accumulated data of the time period before the time period in which the query time is located from the second data module, determine the real-time data of the time period in which the query time is located, and obtain the target data according to the accumulated data and the real-time data;

[0046] The first data module is used to store the query record;

[0047] The second data module is used to store the accumulated data of the time period ending in the previous time period of the query time period, or to store the accumulated data of the time period ending in the previous time period and the real-time data of the current time period.

[0048] A fourth aspect of the present application provides a machine-readable storage medium having instructions stored thereon, which, when executed by a processor, configure the processor to execute the above-mentioned method for processing data.

[0049] Through the above technical solution, the acquisition of cumulative data and real-time data over a period of time is realized, and the target data is obtained based on the cumulative data and real-time data, which solves the problem of incomplete target data and improves the accuracy of the target data.

[0050] Other features and advantages of the embodiments of the present application will be described in detail in the subsequent specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] The accompanying drawings are used to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present application, but do not constitute a limitation on the embodiments of the present application. In the accompanying drawings:

[0052] Figure 1 A schematic diagram of an application environment of a method for processing data according to an embodiment of the present application is schematically shown;

[0053] Figure 2 A schematic diagram of a system for processing data according to an embodiment of the present application is schematically shown;

[0054] Figure 3 A schematic diagram of a process for processing data according to an embodiment of the present application is shown;

[0055] Figure 4 A schematic diagram of a process flow of a method for processing data according to another embodiment of the present application is shown;

[0056] Figure 5 A schematic diagram of a process flow of a method for processing data according to another embodiment of the present application is shown;

[0057] Figure 6 The structure block diagram of the device for processing data according to the embodiment of the present application is schematically shown;

[0058] Figure 7 The internal structure diagram of a computer device according to an embodiment of the present application is schematically shown. DETAILED DESCRIPTION

[0059] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the specific implementation methods described herein are only used to illustrate and explain the embodiments of the present application, and are not used to limit the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0060] It should be noted that if the embodiments of the present application involve directional indications (such as up, down, left, right, front, back...), the directional indications are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.

[0061] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present application, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or suggesting their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0062] The method for processing data provided in this application can be applied to Figure 1 In the application environment shown in the figure, the device interacts with the cloud microservices through the Internet of Things technology. The cloud microservices are the logic developed by the back-end developers using code. For example, the device sends order information to the cloud, and the cloud sends the information to the device to start production. The cloud service sends all business data to the business database for storage, and sends part of the data to the storage device. The data sent to the storage device is used by the data warehouse for batch processing to obtain the accumulated data described below and store it in the business database. On the other hand, it is used by the Figure 2 The system in the system performs real-time processing to obtain the real-time data described below and store it in Figure 2 In the first data module and the second data module, Figure 1 Business database and Figure 2 The second data module in can be the same component or module, for example, both are MongoDB databases. In one example, the Internet of Things technology and cloud services can be built based on the cloud computing service AWS, the cloud microservices are deployed on the cloud server of AWS, and the business database is the MongoDB database. The cloud server of AWS sends all business data to the MongoDB database for storage, and at the same time sends part of the data (for example, transaction data such as order amount, order details, beverage type, discount information, etc.) to the AWS storage unit S3 for analysis by big data engineers who build data warehouses and real-time processing by the system in 2.

[0063] Figure 2The schematic diagram of the system for processing data according to the embodiment of the present application is schematically shown. The method for processing data in the embodiment of the present application can be implemented based on the system architecture. Specifically, the first-level Lambda service is used to obtain the query time and time period of the target data, determine whether the query time is in a preset period, wherein the time period includes multiple periods, and the multiple periods include the preset period. When it is determined that the query time is not in the preset period, the query record of the period where the query time is located is found from the first data module. When the query record cannot be found from the first data module, the accumulated data of the previous period of the period where the query time is located in the time period is obtained from the second data module, and the real-time data of the period where the query time is located is determined. The target data is obtained according to the accumulated data and the real-time data; the first data module is used to store the query record; the second data module is used to store the accumulated data of the previous period of the period where the query time is located in the time period, or to store the accumulated data of the previous period in the time period and the real-time data of the current period. The first data module and the second data module may belong to the same database or different databases. For example, the first data module is a DynamoDB database, and the second data module is a MongoDB database.

[0064] Furthermore, the system for processing data may also include: a storage unit S3, for obtaining raw data; a second-level Lambda service, for obtaining raw data from the storage unit S3, and identifying the raw data (for example, adding a tenant ID to each order information to mark which tenant the order comes from, so that when there are many tenants, it is convenient to find the sales situation of the corresponding tenant. The tenant here can be understood as Figure 1 The multiple devices in the system are rented to different tenants respectively) to obtain the data to be processed; the first-level Lambda service is also used to process the data to be processed, calculate the indicator data, and output the indicator data to the second data module.

[0065] Combined Figure 1 , the device uploads the original data related to the business to the microservice in the cloud in real time, and the microservice in the cloud writes the original data to the storage device in real time (such as Figure 2In the storage unit S3 in the storage unit S3), after adding a new file to the storage unit S3, a message is sent to the second-level Lambda service, and the second-level Lambda service identifies the original data to obtain the data to be processed. The first-level Lambda service processes the data to be processed and calculates the indicator data. Taking the original data as the sales data of beverages as an example, the indicator data can be: the number of sales orders, the number of cups sold, and the sales amount under the weekly dimension of different tenants, and the number of sales orders, the number of cups sold, and the sales amount under the monthly dimension of different tenants. After being processed by the first-level Lambda service, the obtained flow of order status will be stored in the first data module (such as DynamoDB database); in addition, the indicator data processed by the first-level Lambda service will be stored in the second data module (such as MongoDB database) for developers to obtain indicator data according to business indicators. Among them, when storing data in the MongoDB database, if the database primary key is repeated, the latter data will overwrite the content of the previous data.

[0066] Furthermore, the system for processing data may also include: a message transmission module (such as Amazon SNS FIFO service) and a queue console module (such as Amazon SQS FIFO service), the message transmission module and the queue console module are respectively arranged between the second-level Lambda service and the first-level Lambda service, and after the second-level Lambda service obtains the data to be processed, it transmits the data to be processed to the first-level Lambda service through the message transmission module and the queue console module.

[0067] Figure 3 The flowchart of the method for processing data according to an embodiment of the present application is schematically shown. Figure 3 As shown, in one embodiment of the present application, a method for processing data is provided, which is applied to a Lambda service, and the Lambda service communicates with a first data module and a second data module respectively. The method may include the following steps:

[0068] S10: The query time and time period at which the Lambda service obtains the target data.

[0069] It should be understood that the time period refers to the statistical period of the target data. When the target data is counted in a weekly dimension, the time period is one week. When the target data is counted in a monthly dimension, the time period is one month. When the target data is counted in a yearly dimension, the time period is one year, and so on.

[0070] The target data refers to the data that needs to be obtained, including the real-time data of the query time and the accumulated data before the query time. Among them, the real-time data is obtained through the real-time processing task, and the accumulated data is obtained through the batch processing task. Taking the time period of one week as an example, assuming that the scheduled start time of the batch processing is 0:15 am every day, and the average running time is about 45 minutes to complete, for the convenience of presentation, it is assumed that the batch processing task can be completed at 1:00 am (the batch processing is the data from 0:00 on Monday to 0:00 on the current day, for example, the batch processing is performed at 0:15 am on Wednesday. The data from 0:00 on Monday to 0:00 on Wednesday). Obviously, how to count the real-time data of this week within the time range from 0:00 on the next day to the end of the batch processing is a question worth thinking about. This question can be divided into two parts: if today is Monday, then the real-time data of this week is the real-time data that occurred on that day; if today is other times other than Monday (for the convenience of presentation, take Tuesday as an example), the query before the batch processing ends at dawn on Tuesday, the data of this week = the real-time data of Monday + the real-time data of Tuesday; the query after the batch processing ends at dawn on Tuesday, the data of this week = the batch processing data of Monday + the real-time data of Tuesday.

[0071] Theoretically, if the batch processing is completed at midnight on Tuesday, the batch processing data results on Monday are consistent with the real-time data results on Monday. Considering that the data module may have an automatic overwriting mechanism, for example, after the batch processing of the MongoDB database is completed at midnight on the next day, the batch processing results will overwrite the real-time results of the previous day. After the batch processing is completed at midnight on the next day, the embodiment of the present application uses the batch processing data on Monday because the batch processing data is more reliable than the real-time processing data.

[0072] The executor of the embodiment of the present application is the Lambda service. When the business volume is small and the data is small, the Lambda service is used to execute the core logic of statistics. It is called up when in use and released when there is no data, which can better control costs.

[0073] S20: Determine whether the query time is within a preset time period, wherein the time period includes a plurality of time periods, and the plurality of time periods includes the preset time period.

[0074] For example, the time period is one week and the time period is one day. There are seven days in a week, that is, seven time periods. The preset time period is the first day of the time period, that is, Monday. For the convenience of description, the following description is based on the time period being one week, the time period being one day, and the preset time period being Monday.

[0075] Specifically, the time period corresponding to the query time may be compared with the preset time period to determine whether the time period corresponding to the query time is the same as the preset time, so as to determine whether the query time is within the preset time period.

[0076] S30: When it is determined that the query time is not in the preset time period, searching the first data module for query records in the time period in which the query time is located.

[0077] The first data module is used to store order information with the latest order status and the accumulated data from the deadline period to the previous period of the query time. The first data module can be a database, such as a DynamoDB database.

[0078] Taking the first data module being a DynamoDB database as an example, when it is determined that the query time is not Monday, the query records of the query time can be searched from the DynamoDB database.

[0079] S40: When no query record is found in the first data module, the accumulated data of the time period before the query time period within the time period is obtained from the second data module.

[0080] The second data module is used to store the accumulated data up to the previous period within the time period, or to store the accumulated data up to the previous period within the time period and the real-time data of the current period. The second data module can be a database, such as a MongoDB database.

[0081] Taking the second data module as a MongoDB database as an example, the MongoDB database stores the accumulated data of the day before the query deadline of the week, or the accumulated data of the day before the query deadline of the week and the real-time data of the day.

[0082] It should be understood that, when no query record is found, it means that the query is the first query of the day, and the accumulated data up to the previous day is obtained from the MongoDB database.

[0083] In one example, after the accumulated data is obtained, the accumulated data may be inserted into a DynamoDB database.

[0084] S50: Determine the real-time data of the time period in which the query time falls.

[0085] In a specific implementation, the order information can be searched from the first data module according to the time period of the query time; and the order information is aggregated to obtain real-time data.

[0086] In one example, the order status of order information in a DynamoDB database may be obtained; the order status may be determined to be the first order information of the final transaction status; and the first order information may be aggregated to obtain real-time data.

[0087] The aggregation processing includes summing and counting, for example, the amount of the orders is summed up by the SUM function, and the order IDs are counted by the count function.

[0088] S60: Obtain target data according to the accumulated data and the real-time data.

[0089] In one example, the Lambda service may aggregate the real-time data and the accumulated data to obtain the target data.

[0090] In another example, the Lambda service may also obtain historical data corresponding to the time period of the query time from the first data module; and obtain target data based on the historical data and real-time data.

[0091] The embodiment of the present application obtains the query time and time period of the target data; determines whether the query time is in a preset time period, wherein the time period includes multiple time periods, and the multiple time periods include a preset time period; when it is determined that the query time is not in the preset time period, searches for query records in the time period where the query time is located from the first data module; when no query record is found from the first data module database, obtains the cumulative data of the previous time period within the time period up to the time period where the query time is located from the second data module database; determines the real-time data of the time period where the query time is located; obtains the target data based on the cumulative data and the real-time data, thereby solving the problem of incomplete target data and improving the accuracy of the target data.

[0092] Figure 4 The flowchart of a method for processing data according to another embodiment of the present application is schematically shown. Figure 4 As shown, in another embodiment of the present application, a method for processing data is provided, and the method may further include the following steps:

[0093] S31: When it is determined that the query time is in a preset time period, determine the real-time data of the time period in which the query time is located.

[0094] S32: aggregate the real-time data to obtain target data, and output the target data to the second data module.

[0095] It should be understood that when it is determined that the query time is in the preset time period, the target data for this week is the real-time data occurring on that day. The real-time data for the time period in which the query time is located can be obtained directly from the first data module, and the real-time data can be aggregated such as summing and counting to obtain the target data, which is then output to the second data module.

[0096] The embodiment of the present application improves the efficiency of aggregate statistics by directly processing real-time data to obtain target data when the query time is within a preset period.

[0097] Figure 5 The flowchart of a method for processing data according to another embodiment of the present application is schematically shown. Figure 5 As shown, in another embodiment of the present application, a method for processing data is provided, and the method may further include the following steps:

[0098] S41: when a query record is found in the first data module, historical data corresponding to the time period of the query time is obtained from the first data module.

[0099] S42: Determine the real-time data of the time period in which the query time falls.

[0100] S43: Obtain target data according to historical data and real-time data, and output the target data to the second data module.

[0101] It should be understood that when a query record is found in the first data module, it means that at least one query has been made before this query, and the data in the second data module, whether it is real-time data or batch data of the previous day, has been inserted into the first data module. The historical data and real-time data in the first data module can be directly spliced ​​to obtain the real-time data of this week up to the query time and write it into the second data module.

[0102] The embodiment of the present application improves the reliability of aggregate statistics by obtaining historical data from the first data module when a query record is found in the first data module, and then obtaining target data based on the historical data and real-time data.

[0103] Figure 3 , Figure 4 and Figure 5 1 and 2 are flowcharts of a method for processing data in one embodiment. Figure 3 , Figure 4 and Figure 5 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 3 , Figure 4 and Figure 5 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0104] In one embodiment, Figure 6 As shown, a device for processing data is provided, which is applied to Lambda service. The Lambda service communicates with the first data module and the second data module respectively. The device for processing data includes: a time acquisition module 10, a time period determination module 20, a record search module 30, an accumulated data determination module 40, a real-time data determination module 50 and a target data determination module 60, wherein: the time acquisition module 10 is used to obtain the query time and time period of the target data; the time period determination module 20 is used to determine whether the query time is in a preset time period, wherein the time period includes multiple time periods, and the multiple time periods include the preset time period; the record search module 30 is used to search the query record of the time period where the query time is located from the first data module when it is determined that the query time is not in the preset time period; the accumulated data determination module 40 is used to obtain the accumulated data of the time period before the time period where the query time is located from the second data module when the query record cannot be found from the first data module; the real-time data determination module 50 is used to determine the real-time data of the time period where the query time is located; the target data determination module 60 is used to obtain the target data according to the accumulated data and the real-time data.

[0105] Furthermore, the real-time data determination module 50 is also used to search for order information from the first data module according to the time period of the query time; and perform aggregation processing on the order information to obtain real-time data.

[0106] Furthermore, the real-time data determination module 50 is also used to obtain the order status of the order information; determine the first order information whose order status is the final transaction status; and perform aggregation processing on the first order information to obtain real-time data.

[0107] Furthermore, the real-time data determination module 50 is also used to determine the real-time data of the time period in which the query time is located when it is determined that the query time is in a preset time period; the target data determination module 60 is also used to aggregate the real-time data to obtain target data and output the target data to the second data module.

[0108] Furthermore, the cumulative data determination module 40 is also used to obtain historical data corresponding to the time period in which the query time is located from the first data module when a query record is found in the first data module; the real-time data determination module 50 is also used to determine the real-time data of the time period in which the query time is located; the target data determination module 60 is also used to obtain target data based on historical data and real-time data, and output the target data to the second data module.

[0109] Furthermore, the target data determination module 60 is also used to aggregate the accumulated data and the real-time data to obtain the target data.

[0110] Furthermore, the accumulated data determination module 40 is also used to output the accumulated data to the first data module, and obtain the historical data corresponding to the time period of the query time from the first data module; the target data determination module 60 is also used to obtain the target data based on the historical data and the real-time data.

[0111] An embodiment of the present application also provides a device for processing data, comprising: a memory for a program for device detection; a processor, configured to call the program for processing data from the memory so that the processor can execute the above-mentioned method for processing data.

[0112] An embodiment of the present application also provides a machine-readable storage medium on which a program is stored, and when the program is executed by a processor, the above-mentioned method for processing data is implemented.

[0113] The embodiment of the present application provides a computer device, which may be a terminal, and its internal structure diagram may be as follows: Figure 7 As shown. The computer device includes a processor A01, a network interface A02, a display screen A04, an input device A05 and a memory (not shown in the figure) connected through a system bus. Among them, the processor A01 of the computer device is used to provide computing and control capabilities. The memory of the computer device includes an internal memory A03 and a non-volatile storage medium A06. The non-volatile storage medium A06 stores an operating system B01 and a computer program B02. The internal memory A03 provides an environment for the operation of the operating system B01 and the computer program B02 in the non-volatile storage medium A06. The network interface A02 of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor A01, a method for processing data is implemented. The display screen A04 of the computer device can be a liquid crystal display or an electronic ink display, and the input device A05 of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.

[0114] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0115] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0116] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0117] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0118] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0119] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0120] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0121] Computer readable media include permanent and non-permanent, removable and non-removable media, and can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules 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 disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0122] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0123] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. A method for processing data, characterized in that Applied to a Lambda service, the Lambda service communicates with a first data module and a second data module respectively, the method comprising: The Lambda service obtains the query time and time period of the target data; Determining whether the query time is within a preset time period, wherein the time period includes a plurality of time periods, and the plurality of time periods includes the preset time period; When it is determined that the query time is not within the preset time period, searching the first data module for query records within the time period within which the query time is located; In the case that the query record cannot be found from the first data module, the accumulated data of the time period before the time period of the query time is obtained from the second data module; Determine the real-time data of the time period in which the query time falls; Obtaining the target data according to the accumulated data and the real-time data; The first data module is used to store order information with the latest order status and the accumulated data from the time period up to the previous time period of the query time; the second data module is used to store the accumulated data from the time period up to the previous time period, or to store the accumulated data from the time period up to the previous time period and the real-time data of the current time period; The first data module is a DynamoDB database, and the second data module is a MongoDB database.

2. The method according to claim 1, characterized in that The determining of the real-time data of the time period in which the query time is located includes: Searching for order information from the first data module according to the time period of the query time; The order information is aggregated to obtain the real-time data.

3. The method according to claim 2, characterized in that Also includes: Obtain the order status of the order information; Determine the first order information that the order status is a final transaction status; Aggregate the first order information to obtain the real-time data.

4. The method according to any one of claims 1 to 3, characterized in that Also includes: In the case where it is determined that the query time is within the preset time period, determining the real-time data of the time period within which the query time is located; The real-time data is aggregated to obtain the target data, and the target data is output to the second data module.

5. The method according to any one of claims 1 to 3, characterized in that: Also includes: When the query record is found in the first data module, obtaining historical data corresponding to the time period of the query time from the first data module; Determine the real-time data of the time period in which the query time falls; The target data is obtained according to the historical data and the real-time data, and the target data is output to the second data module.

6. The method according to claim 1, characterized in that The obtaining the target data according to the accumulated data and the real-time data comprises: The accumulated data and the real-time data are aggregated to obtain the target data.

7. The method according to claim 1, characterized in that Also includes: Outputting the accumulated data to the first data module; Acquire historical data corresponding to the time period of the query time from the first data module; The target data is obtained according to the historical data and the real-time data.

8. A device for processing data, characterized in that Applied to a Lambda service, the Lambda service communicates with a first data module and a second data module respectively, and the device for processing data includes: Time acquisition module, used to obtain the query time and time period of target data; a time period determination module, used to determine whether the query time is within a preset time period, wherein the time period includes a plurality of time periods, and the plurality of time periods includes the preset time period; A record search module, configured to search the first data module for a query record in the time period in which the query time is located when it is determined that the query time is not in the preset time period; An accumulated data determination module, configured to obtain accumulated data of a time period before the time period of the query time from the second data module when the query record cannot be found from the first data module; A real-time data determination module, used to determine the real-time data of the time period in which the query time falls; A target data determination module, used to obtain the target data according to the accumulated data and the real-time data; The first data module is used to store order information with the latest order status and the accumulated data from the time period up to the previous time period of the query time; the second data module is used to store the accumulated data from the time period up to the previous time period, or to store the accumulated data from the time period up to the previous time period and the real-time data of the current time period; The first data module is a DynamoDB database, and the second data module is a MongoDB database.

9. A device for processing data, characterized in that include: a memory for a program used for device detection; A processor is configured to call the program for processing data from the memory so that the processor can execute the method for processing data according to any one of claims 1 to 7.

10. A system for processing data, characterized in that include: A first-level Lambda service, a first data module, and a second data module, wherein the first-level Lambda service communicates with the first data module and the second data module respectively; wherein The first-level Lambda service is used to obtain the query time and time period of the target data, determine whether the query time is in a preset time period, wherein the time period includes multiple time periods, and the multiple time periods include the preset time period. If it is determined that the query time is not in the preset time period, search the query record of the time period in which the query time is located from the first data module. If the query record cannot be found from the first data module, obtain the accumulated data of the time period before the time period in which the query time is located from the second data module, determine the real-time data of the time period in which the query time is located, and obtain the target data according to the accumulated data and the real-time data; The first data module is used to store the query record, order information with the latest order status, and the accumulated data of the time period before the query time period within the time period; The second data module is used to store the accumulated data of the time period ending in the previous time period of the query time period, or to store the accumulated data of the time period ending in the previous time period and the real-time data of the current time period; The first data module is a DynamoDB database, and the second data module is a MongoDB database.

11. A machine-readable storage medium having instructions stored thereon, characterized in that: When the instructions are executed by a processor, the processor is configured to perform the method for processing data according to any one of claims 1 to 7.