WO2020052429A1 - Method for compiling data statistics, system and terminal device - Google Patents

Method for compiling data statistics, system and terminal device Download PDF

Info

Publication number
WO2020052429A1
WO2020052429A1 PCT/CN2019/102279 CN2019102279W WO2020052429A1 WO 2020052429 A1 WO2020052429 A1 WO 2020052429A1 CN 2019102279 W CN2019102279 W CN 2019102279W WO 2020052429 A1 WO2020052429 A1 WO 2020052429A1
Authority
WO
WIPO (PCT)
Prior art keywords
transaction
data
statistics
amount
statistical data
Prior art date
Application number
PCT/CN2019/102279
Other languages
French (fr)
Chinese (zh)
Inventor
王欢
潘泉锦
Original Assignee
百富计算机技术(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 百富计算机技术(深圳)有限公司 filed Critical 百富计算机技术(深圳)有限公司
Publication of WO2020052429A1 publication Critical patent/WO2020052429A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/08Payment architectures
    • G06Q20/20Point-of-sale [POS] network systems
    • G06Q20/201Price look-up processing, e.g. updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/08Payment architectures
    • G06Q20/20Point-of-sale [POS] network systems
    • G06Q20/208Input by product or record sensing, e.g. weighing or scanner processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/08Payment architectures
    • G06Q20/20Point-of-sale [POS] network systems
    • G06Q20/202Interconnection or interaction of plural electronic cash registers [ECR] or to host computer, e.g. network details, transfer of information from host to ECR or from ECR to ECR

Definitions

  • the invention belongs to the technical field of data statistics, and particularly relates to a data statistics method, system and terminal device.
  • Point of sale (POS) devices have functions such as support for consumption, pre-authorization, balance inquiry, and transfer. They are safe, fast, and reliable to use. They are often used as payment devices in daily payments.
  • POS Point of sale
  • batch settlement is required once a day. Batch settlement needs to count all transaction data of the day to get data items such as the total number of transactions, the total amount of transactions, and the total amount of tips. It is printed on the receipt.
  • each transaction data is stored in the Indexdb database.
  • the specific process includes:
  • embodiments of the present invention provide a data statistics method, system, and terminal device to solve the problem that the transaction data in the database needs to be traversed during batch settlement in the prior art, which causes a problem that takes too long.
  • a first aspect of the embodiments of the present invention provides a data statistics method, including:
  • the transaction data is counted according to the type of the transaction operation, and the update of the statistical data is performed.
  • the statistical data is read from the preset storage area.
  • a second aspect of the embodiments of the present invention provides a data statistics system, including:
  • the statistical data creation module is configured to create and initialize statistical data, set an initial value of the statistical data, and store the statistical data in a preset storage area.
  • a statistical data update module is configured to perform statistics on the transaction data according to the type of transaction operation and perform an update of the statistical data each time an operation is performed on the transaction data.
  • the statistical data reading module is configured to read the statistical data from the preset storage area during batch settlement.
  • a third aspect of the embodiments of the present invention provides a terminal device including a memory, a processor, and a computer program stored in the memory and executable on the processor.
  • the processor executes the computer program, Steps to implement the data statistics method described above.
  • a computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data statistics method described above are implemented.
  • the embodiment of the present invention has the beneficial effect that, in each transaction, the transaction data is counted according to the type of transaction operation, and the statistical data is updated according to the data obtained after the statistical calculation to ensure the statistics.
  • the data can represent the total amount of the current revenue and expenditure in real time, so when batch settlement is required, you can directly read the statistical data, and you don't need to re-traverse all the transaction data again, which solves the time-consuming problem caused by traversing the transaction data. Reduced data read and processing time.
  • FIG. 1 is a schematic structural diagram of a payment application system architecture according to an embodiment of the present invention
  • FIG. 2 is a schematic flowchart of an implementation method of a data statistics method according to an embodiment of the present invention
  • FIG. 3 is a schematic flowchart of a data processing process according to an embodiment of the present invention.
  • FIG. 4 is a schematic flowchart of the implementation of step S102 in FIG. 2 according to an embodiment of the present invention
  • FIG. 5 is a schematic structural diagram of a data statistics system according to an embodiment of the present invention.
  • FIG. 6 is a schematic structural diagram of a terminal device according to an embodiment of the present invention.
  • the payment application system architecture includes a payment application layer, a middle layer, and a class library.
  • the payment application layer including applications (such as BroadPos payment application), is mainly used to implement business processes such as adding consumption, cancelling transactions, modifying transaction data, deleting transactions, and printing small tickets.
  • BroadPos payment application is a bank card payment application developed based on VUE.
  • VUE is a WEB (World Wide Web, World Wide Web) application development framework.
  • the middle layer similar to the software operation layer, performs information interaction with the payment application layer and the class library, respectively, for performing the steps of a data statistics method described in this application, including: each transaction data generated by the payment application layer , Insert the transaction database, perform statistics on the transaction data and update the statistics.
  • Class library a web application class library provided for the Android operating system, is used to provide operation interfaces to hardware devices, such as the Indexdb database operation interface and localStorag local storage operation interface.
  • the payment application layer When a user performs a transaction operation on the payment application layer, the payment application layer generates the transaction operation type and transaction data of each transaction.
  • the middle layer obtains the transaction operation type and transaction data through the payment application layer and performs statistics.
  • the middle layer passes the transaction through the class library.
  • the data is stored in the transaction database and the statistical data is stored in a local preset storage area.
  • the middle layer stores the transaction data into the transaction database through the Indexdb database operation interface, and stores the statistical data into the local preset storage area through the localStorag local storage operation interface.
  • the BroadPos payment application runs on a payment device (POS device) and can be used in cashier scenarios such as supermarkets and restaurants.
  • the cashier launches the BroadPos payment application.
  • the cashier operates the BroadPos payment application to add a consumption operation.
  • the cashier operates the BroadPos payment application to cancel the transaction.
  • the cashier operates the BroadPos payment application to modify the transaction data.
  • the cashier operates the BroadPos payment application to delete the transaction.
  • the cashier makes batch settlements, counts the total number of transactions, the total amount of transactions, and the total amount of tips on the day, and prints the statistics.
  • FIG. 2 shows a flowchart for implementing a data statistics method according to an embodiment of the present invention. For ease of description, only relevant parts of the embodiment of the present invention are shown, and the details are as follows:
  • a data statistics method provided by an embodiment of the present invention includes:
  • Step S101 Create and initialize statistical data, set an initial value of the statistical data, and store the statistical data in a preset storage area.
  • the statistical data is data obtained through statistical calculation of transaction data, and includes: the total number of transactions, the total amount of transactions, the total amount of tips, and the like.
  • the initial value of the statistical data is set to zero.
  • step S102 each time the transaction data is operated, the transaction data is counted according to the type of the transaction operation, and the update of the statistical data is performed.
  • the types of transaction operations that operate on transaction data generally include: adding consumption, cancelling transactions, modifying transaction data, and deleting transactions. Perform statistical calculations on transaction data according to different types of transaction operations, and update the statistical data to data obtained after statistical calculations.
  • Step S103 During batch settlement, read the statistical data from the preset storage area.
  • Batch settlement refers to the summary and accounting of all income and expenditure in a certain period.
  • the POS device needs to send the total debit amount, total debit amount, total credit amount, and total credit amount to the POS center when the batch transaction flows. Reconcile with POS center.
  • step S103 after the statistical data is read, the statistical data is printed.
  • the transaction data is counted according to the type of transaction operation at each transaction, and the statistical data is updated according to the data obtained after the statistical calculation, so as to ensure that the statistical data can represent the total number of accounts in real time. Therefore, when batch settlement is required, the statistical data can be directly read, and there is no need to traverse all the transaction data again, which solves the time-consuming problem caused by traversing the transaction data and reduces the time for data reading and processing.
  • the data statistics method further includes:
  • step a a transaction database is created and initialized, and an initial state of the transaction database is set.
  • setting the initial state of the transaction database in step a includes: setting basic parameters of the database, such as data format, storage capacity, etc., and clearing the database.
  • Step b each time the transaction data is operated, the transaction database is updated accordingly.
  • updating the transaction database in step b includes: when the transaction operation type is adding consumption, storing the newly added transaction data in the transaction database; when the transaction operation type is canceling the transaction, downloading the transaction data from the transaction. Delete the corresponding transaction data from the database; when the transaction operation type is modify transaction data, modify the corresponding transaction data in the transaction database accordingly; when the transaction operation type is delete transaction, delete the corresponding transaction data from the transaction database Transaction data.
  • Step c After the transaction database is successfully updated, update the statistical data.
  • step c includes: judging whether the transaction database is successfully updated. If the update is successful, perform the step of updating the statistical data in step S102. If the update is unsuccessful, do not perform the step of updating the statistical data in step S102. .
  • a transaction database for storing transaction data is created. Each time the transaction data is operated, new transaction data is generated. The transaction database is updated accordingly according to the new transaction data. The historical transaction data is stored, and new transaction data is continuously added, realizing the continuous update of the transaction database.
  • the data statistics method further includes:
  • Step d after the batch settlement is completed, reset the statistical data to the initial value, and reset the transaction database to the initial state.
  • the steps performed by the terminal device include: reading statistical data, printing the statistical data, resetting the statistical data to an initial value, and resetting the transaction database to an initial state.
  • the transaction database and statistical data processing process includes:
  • step S102 in the embodiment corresponding to FIG. 2 includes:
  • Step S201 When the transaction operation type is add consumption, add the transaction data to the statistical data on the current basis.
  • step S201 includes: when the transaction operation type is adding consumption, storing the newly added transaction data in a transaction database, and determining whether the deposit is successful. If the deposit is successful, the transaction data will be added to the statistical data. If the deposit fails, the statistics are not updated.
  • Step S202 When the type of the transaction operation is canceling the transaction, subtract the transaction data from the statistical data on the current basis.
  • step S202 includes: when the transaction operation type is a cancel transaction, deleting the corresponding transaction data from the transaction database, and determining whether the deletion is successful. If the deletion is successful, the statistical data is subtracted from the transaction data on the current basis. If the deletion fails, the statistics are not updated.
  • Step S203 when the type of the transaction operation is to modify the transaction data, read the original transaction data and the new transaction data, and calculate the difference between the new transaction data and the original transaction data, and place the statistical data on the current basis. The difference is increased by.
  • step S203 includes: when the transaction operation type is modify transaction data, correspondingly modify the corresponding transaction data in the transaction database, and determine whether the modification is successful. If the modification is successful, the difference is added to the statistical data on the current basis. If the modification fails, the statistics are not updated.
  • Step S204 When the transaction operation type is delete transaction, subtract the transaction data from the statistical data on the current basis.
  • step S204 includes: when the transaction operation type is delete transaction, deleting the corresponding transaction data from the transaction database, and determining whether the deletion is successful. If the deletion is successful, the statistical data is subtracted from the transaction data on the current basis. If the deletion fails, the statistics are not updated.
  • the statistical data includes the total number of transactions, the total amount of transactions, and the total amount of tips.
  • step S102 in the embodiment corresponding to FIG. 2 includes:
  • the newly added transaction data is stored in the transaction database, and it is determined whether the deposit is successful. If the deposit is successful, the total number of transactions is increased by 1, the total amount of the transaction is added to the current transaction amount of the transaction, and the total amount of the tip is added to the current transaction tip. If the deposit fails, the statistics are not updated.
  • the corresponding transaction data is deleted from the transaction database, and it is judged whether the deletion is successful. If the deletion is successful, the total number of transactions is increased by one, the total amount of the transaction is subtracted from the amount of the canceled transaction this time, and the total amount of the tip is subtracted from the current amount of the canceled transaction. . If the deletion fails, the statistics are not updated.
  • the transaction operation type of a transaction is delete transaction
  • the corresponding transaction data is deleted from the transaction database, and it is determined whether the deletion is successful. If the deletion is successful, the total number of transactions is increased by 1, the total transaction amount is subtracted from the current deletion transaction amount, and the total tip amount is subtracted from the current deletion transaction tip. If the deletion fails, the statistics are not updated.
  • the statistical data when performing a query operation on the transaction database, the statistical data is not changed.
  • each transaction when each transaction data is updated to the transaction database, each transaction is counted, and the statistical data is updated at any time. Realize the intensive calculation of the existing statistical massive transaction data, which is dispersed into the addition, deletion, and modification operations when each transaction data enters the transaction database, eliminating the intensive operation of data statistics, and can directly obtain statistical data.
  • the statistical data is individually stored in a preset storage area.
  • the transaction data is statistically updated and the statistical data is updated.
  • it is only necessary to read statistical data from a preset storage area and print it, without reading the transaction database and traversing the transaction data. It can solve the time-consuming problem caused when reading the transaction database and traversing the transaction data. Reduced the delay caused by data reading and statistics during batch settlement.
  • a data statistics system 100 provided by an embodiment of the present invention is configured to execute the method steps in the embodiment corresponding to FIG. 2, which includes:
  • the statistical data creating module 110 is configured to create and initialize statistical data, set an initial value of the statistical data, and store the statistical data in a preset storage area.
  • the statistical data updating module 120 is configured to perform statistics on the transaction data according to the type of the transaction operation and perform an update of the statistical data each time an operation is performed on the transaction data.
  • the statistical data reading module 130 is configured to read the statistical data from the preset storage area during batch settlement.
  • the data statistics system 100 further includes:
  • a database creation module is used to create and initialize a transaction database and set an initial state of the transaction database.
  • a database update module is configured to update the transaction database correspondingly each time operation is performed on the transaction data.
  • An update status judgment module is configured to perform an update of the statistical data after the transaction database is successfully updated.
  • the data statistics system 100 further includes:
  • the resetting module is configured to reset the statistical data to the initial value and reset the transaction database to the initial state after the batch settlement is completed.
  • the statistical data update module 120 includes:
  • a first operation unit is configured to add the transaction data to the statistical data on a current basis when the transaction operation type is add consumption.
  • a second operation unit is configured to subtract the transaction data from the statistical data on a current basis when the transaction operation type is a cancelled transaction.
  • a third operation unit configured to read the original transaction data and the new transaction data when the transaction operation type is modified transaction data, and calculate the difference between the new transaction data and the original transaction data, and collect the statistics The data adds the difference on a current basis.
  • a fourth operation unit is configured to subtract the transaction data from the statistical data on a current basis when the transaction operation type is a delete transaction.
  • the first operation unit is further configured to add 1 to the total number of transactions and add the total amount of the transaction to this time when the transaction operation type of a transaction is add consumption.
  • the amount of the consumption transaction, the total amount of the tip is added to the current consumption transaction tip.
  • the second operation unit is further configured to add 1 to the total number of transactions when the type of transaction operation of the transaction is to cancel the transaction, subtract the total amount of the transaction from the amount of the canceled transaction, and reduce the tip. The total amount minus the tip for this cancellation.
  • the fourth operation unit is further configured to add 1 to the total number of transactions when the transaction operation type of a transaction is delete transaction, subtract the total transaction amount from the current transaction amount, and the tip The total amount minus the current transaction tip.
  • the data statistics system 100 further includes other functional modules / units, which are used to implement the method steps of each of the embodiments.
  • FIG. 6 is a schematic diagram of a terminal device according to an embodiment of the present invention.
  • the terminal device 6 of this embodiment includes a processor 60, a memory 61, and a computer program 62 stored in the memory 61 and executable on the processor 60.
  • the processor 60 executes the computer program 62
  • the steps in the embodiments described in Embodiment 1 are implemented, for example, steps S101 to S103 shown in FIG. 2.
  • the processor 60 executes the computer program 62
  • functions of each module / unit in each system embodiment described in Embodiment 2 are implemented, for example, functions of modules 110 to 130 shown in FIG. 5.
  • the terminal device 6 refers to a terminal with data processing capabilities, including but not limited to POS devices, computers, workstations, servers, and even some smart phones, PDAs, tablets, personal digital assistants (PDAs), TV (Smart TV), etc.
  • An operating system is generally installed on the terminal device, including but not limited to: Windows operating system, Linux operating system, Android operating system, Symbian operating system, Windows mobile operating system, and iOS operating system.
  • Windows operating system Windows operating system
  • Linux operating system Linux operating system
  • Android operating system Symbian operating system
  • Windows mobile operating system and iOS operating system.
  • the terminal device may include, but is not limited to, a processor 60 and a memory 61.
  • FIG. 6 is only an example of the terminal device 6 and does not constitute a limitation on the terminal device 6. It may include more or fewer components than shown in the figure, or combine some components or different components
  • the terminal device 6 may further include an input / output device, a network access device, a bus, and the like.
  • the processor 60 may be a central processing unit (Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), and application-specific integrated circuits (Applications) Specific Integrated Circuit (ASIC), off-the-shelf Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • CPU Central Processing Unit
  • DSP digital signal processor
  • ASIC application-specific integrated circuits
  • FPGA off-the-shelf Programmable Gate Array
  • a general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
  • the memory 61 may be an internal storage unit of the terminal device 6, such as a hard disk or a memory of the terminal device 6.
  • the memory 61 may also be an external storage device of the terminal device 6, such as a plug-in hard disk, a smart media card (SMC), and a secure digital (SD) provided on the terminal device 6. 1. flash card Card) and so on. Further, the memory 61 may further include both an internal storage unit of the terminal device 6 and an external storage device.
  • the memory 61 is configured to store the computer program and other programs and data required by the terminal device 6.
  • the memory 61 may also be used to temporarily store data that has been output or is to be output.
  • An embodiment of the present invention further provides a computer-readable storage medium.
  • the computer-readable storage medium stores a computer program.
  • the steps in the embodiments described in Embodiment 1 are implemented, for example, as shown in FIG. Steps S101 to S103 shown in FIG. 2.
  • the functions of each module / unit in each system embodiment described in Embodiment 2 are implemented, for example, the functions of modules 110 to 130 shown in FIG. 5.
  • the computer program may be stored in a computer-readable storage medium. When the computer program is executed by a processor, the computer program may implement the steps of the foregoing method embodiments.
  • the computer program includes computer program code, and the computer program code may be in a source code form, an object code form, an executable file, or some intermediate form.
  • the computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signals, telecommunication signals, and software distribution media.
  • the disclosed terminal device and method may be implemented in other manners.
  • the system / terminal device embodiments described above are only schematic.
  • the division of the modules or units is only a logical function division.
  • components can be combined or integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, which may be electrical, mechanical or other forms.

Abstract

Provided by the present solution are a method for compiling data statistics, a system and a terminal device, the method comprising: creating and initializing statistics data, setting an initial value for the statistics data, and storing the statistics data in a preset storage area; compiling statistics for transaction data according to transaction operation type each time when performing an operation on the transaction data, and updating the statistics data; and reading the statistics data from the preset storage area during batch settlement. In the present solution, statistics are compiled for transaction data according to transaction operation type and the statistics data is updated according to data obtained after statistics calculation during each transaction so as to guarantee that the statistics data may characterize in real time the accounting total of current income and expenses, thus the statistics data may be directly read when batch settlement must be performed without having to traverse all of the transaction data again, thereby solving of the problem of time consumption caused by traversing transaction data, and reducing the time for reading and processing data.

Description

一种数据统计方法、系统及终端设备Data statistics method, system and terminal equipment 技术领域Technical field
本发明属于数据统计技术领域,尤其涉及一种数据统计方法、系统及终端设备。The invention belongs to the technical field of data statistics, and particularly relates to a data statistics method, system and terminal device.
背景技术Background technique
POS(point of sale,销售终端)设备具有支持消费、预授权、余额查询和转帐等功能,使用起来安全、快捷、可靠,是日常支付中经常用到一种支付设备。在POS设备的应用场景中(使用BroadPos支付应用),每天需要进行一次批结算,批结算需要统计当天的所有交易数据得到当天交易总笔数、交易总金额、小费总金额等数据项,并将其打印到小票上。Point of sale (POS) devices have functions such as support for consumption, pre-authorization, balance inquiry, and transfer. They are safe, fast, and reliable to use. They are often used as payment devices in daily payments. In the application scenario of the POS device (using the BroadPos payment application), batch settlement is required once a day. Batch settlement needs to count all transaction data of the day to get data items such as the total number of transactions, the total amount of transactions, and the total amount of tips. It is printed on the receipt.
目前,每笔交易数据会存储到Indexdb数据库。批结算时,具体过程包括:Currently, each transaction data is stored in the Indexdb database. During batch settlement, the specific process includes:
1. 读取Indexdb数据库中所有的交易数据。1. Read all transaction data in the Indexdb database.
2. 遍历交易数据,统计交易总笔数、交易总金额、小费总金额等数据项。2. Traverse the transaction data, and count the data items such as the total number of transactions, the total amount of transactions, and the total amount of tips.
3. 打印统计结果。3. Print the statistical results.
测试发现,在Indexdb数据库存储的交易数据为1000笔时,读取Indexdb数据库的交易数据,耗时约4秒,遍历1000笔交易数据并逐笔进行计算,耗时约2秒,相当于用户需要等待约6秒才开始打印。如果交易数据超过1000笔,时间会更久,严重影响用户体验。The test found that when the transaction data stored in the Indexdb database is 1000, it takes about 4 seconds to read the transaction data in the Indexdb database. Iterates through 1000 transaction data and calculates it one by one, which takes about 2 seconds, which is equivalent to the user's needs. Wait about 6 seconds before printing starts. If the transaction data exceeds 1,000 transactions, the time will be longer, which will seriously affect the user experience.
综上,现有技术中存在批结算时需遍历数据库中的交易数据,从而导致耗时过长的问题。In summary, in the prior art, there is a problem that the transaction data in the database needs to be traversed during batch settlement, which results in a problem that takes too long.
技术问题technical problem
有鉴于此,本发明实施例提供了一种数据统计方法、系统及终端设备,以解决现有技术中在批结算时需遍历数据库中的交易数据,从而导致耗时过长的问题。In view of this, embodiments of the present invention provide a data statistics method, system, and terminal device to solve the problem that the transaction data in the database needs to be traversed during batch settlement in the prior art, which causes a problem that takes too long.
技术解决方案Technical solutions
本发明实施例的第一方面提供了一种数据统计方法,包括:A first aspect of the embodiments of the present invention provides a data statistics method, including:
创建并初始化统计数据,设定所述统计数据的初始值,将所述统计数据存储在预设存储区域。Create and initialize statistical data, set initial values of the statistical data, and store the statistical data in a preset storage area.
在每一次对交易数据进行操作时,根据交易操作类型对所述交易数据进行统计,并执行对所述统计数据的更新。Every time an operation is performed on the transaction data, the transaction data is counted according to the type of the transaction operation, and the update of the statistical data is performed.
在批结算时,从所述预设存储区域读取所述统计数据。During batch settlement, the statistical data is read from the preset storage area.
本发明实施例的第二方面提供了一种数据统计系统,包括:A second aspect of the embodiments of the present invention provides a data statistics system, including:
统计数据创建模块,用于创建并初始化统计数据,设定所述统计数据的初始值,将所述统计数据存储在预设存储区域。The statistical data creation module is configured to create and initialize statistical data, set an initial value of the statistical data, and store the statistical data in a preset storage area.
统计数据更新模块,用于在每一次对交易数据进行操作时,根据交易操作类型对所述交易数据进行统计,并执行对所述统计数据的更新。A statistical data update module is configured to perform statistics on the transaction data according to the type of transaction operation and perform an update of the statistical data each time an operation is performed on the transaction data.
统计数据读取模块,用于在批结算时,从所述预设存储区域读取所述统计数据。The statistical data reading module is configured to read the statistical data from the preset storage area during batch settlement.
本发明实施例的第三方面提供了一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如上所述数据统计方法的步骤。A third aspect of the embodiments of the present invention provides a terminal device including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, Steps to implement the data statistics method described above.
本发明实施例的第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现如上所述数据统计方法的步骤。According to a fourth aspect of the embodiments of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data statistics method described above are implemented.
有益效果Beneficial effect
本发明实施例与现有技术相比存在的有益效果是:通过在每一次交易时,根据交易操作类型对交易数据进行统计,并按照统计计算后得到的数据对统计数据进行更新,以保证统计数据能够实时表征当前收支情况的核算总数,从而在需要进行批结算时,直接读取统计数据即可,不需要再重新遍历一遍所有的交易数据,解决了遍历交易数据引起的耗时问题,减少了数据读取和处理的时间。Compared with the prior art, the embodiment of the present invention has the beneficial effect that, in each transaction, the transaction data is counted according to the type of transaction operation, and the statistical data is updated according to the data obtained after the statistical calculation to ensure the statistics. The data can represent the total amount of the current revenue and expenditure in real time, so when batch settlement is required, you can directly read the statistical data, and you don't need to re-traverse all the transaction data again, which solves the time-consuming problem caused by traversing the transaction data. Reduced data read and processing time.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only the present invention. For some embodiments, for those of ordinary skill in the art, other drawings can be obtained according to these drawings without paying creative labor.
图1是本发明的一个实施例提供的一种支付应用系统架构的结构示意图;FIG. 1 is a schematic structural diagram of a payment application system architecture according to an embodiment of the present invention; FIG.
图2是本发明的一个实施例提供的一种数据统计方法的实现流程示意图;FIG. 2 is a schematic flowchart of an implementation method of a data statistics method according to an embodiment of the present invention; FIG.
图3是本发明的一个实施例提供的数据处理过程的流程示意图;3 is a schematic flowchart of a data processing process according to an embodiment of the present invention;
图4是本发明的一个实施例提供的图2中步骤S102的实现流程示意图;FIG. 4 is a schematic flowchart of the implementation of step S102 in FIG. 2 according to an embodiment of the present invention; FIG.
图5是本发明的一个实施例提供的一种数据统计系统的结构示意图;5 is a schematic structural diagram of a data statistics system according to an embodiment of the present invention;
图6是本发明的一个实施例提供的终端设备的结构示意图。FIG. 6 is a schematic structural diagram of a terminal device according to an embodiment of the present invention.
本发明的实施方式Embodiments of the invention
以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本发明实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本发明。在其它情况中,省略对众所周知的系统、装置、电路以及方法的详细说明,以免不必要的细节妨碍本发明的描述。In the following description, for the purpose of illustration rather than limitation, specific details such as a specific system structure and technology are provided in order to thoroughly understand the embodiments of the present invention. However, it should be clear to a person skilled in the art that the present invention can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present invention with unnecessary details.
本发明的说明书和权利要求书及上述附图中的术语“包括”以及其他任何变形,是指“包括但不限于”,意图在于覆盖不排他的包含。例如包含一系列步骤或单元的过程、方法或系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。此外,术语“第一”、“第二”和“第三”等是用于区别不同对象,而非用于描述特定顺序。The term "including" and any other variations in the description and claims of the present invention and the above-mentioned drawings mean "including but not limited to", and are intended to cover non-exclusive inclusion. For example, a process, method or system, product, or device containing a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally includes Other steps or units inherent to these processes, methods, products or equipment. In addition, the terms “first”, “second”, “third”, and the like are used to distinguish different objects, and are not used to describe a specific order.
本申请基于一种支付应用系统架构实现,如图1所示,该支付应用系统架构包括支付应用层、中间层和类库。This application is implemented based on a payment application system architecture. As shown in FIG. 1, the payment application system architecture includes a payment application layer, a middle layer, and a class library.
支付应用层,包括应用程序(例如   BroadPos支付应用),主要用于实现添加消费、撤销交易、修改交易数据、删除交易、小票打印等业务流程。BroadPos支付应用为一种基于VUE开发的银行卡支付应用。VUE为WEB(World Wide Web,万维网)应用开发框架。The payment application layer, including applications (such as BroadPos payment application), is mainly used to implement business processes such as adding consumption, cancelling transactions, modifying transaction data, deleting transactions, and printing small tickets. BroadPos payment application is a bank card payment application developed based on VUE. VUE is a WEB (World Wide Web, World Wide Web) application development framework.
中间层,类似于软件操作层,分别与支付应用层和类库进行信息交互,用于执行本申请中所述的一种数据统计方法的步骤,包括:将支付应用层产生的每笔交易数据,插入交易数据库,对交易数据进行统计并更新统计数据。The middle layer, similar to the software operation layer, performs information interaction with the payment application layer and the class library, respectively, for performing the steps of a data statistics method described in this application, including: each transaction data generated by the payment application layer , Insert the transaction database, perform statistics on the transaction data and update the statistics.
类库,为安卓操作系统提供的WEB应用类库,用于提供对硬件设备的操作接口,例如Indexdb数据库操作接口和localStorag本地存储操作接口。Class library, a web application class library provided for the Android operating system, is used to provide operation interfaces to hardware devices, such as the Indexdb database operation interface and localStorag local storage operation interface.
用户在支付应用层上进行交易操作时,支付应用层生成每笔交易的交易操作类型和交易数据,中间层通过支付应用层获取交易操作类型和交易数据并进行统计,中间层通过类库将交易数据存入交易数据库以及将统计数据存入本地的预设存储区域。示例性的,中间层通过Indexdb数据库操作接口将交易数据存入交易数据库,通过localStorag本地存储操作接口将统计数据存入本地的预设存储区域。When a user performs a transaction operation on the payment application layer, the payment application layer generates the transaction operation type and transaction data of each transaction. The middle layer obtains the transaction operation type and transaction data through the payment application layer and performs statistics. The middle layer passes the transaction through the class library. The data is stored in the transaction database and the statistical data is stored in a local preset storage area. Exemplarily, the middle layer stores the transaction data into the transaction database through the Indexdb database operation interface, and stores the statistical data into the local preset storage area through the localStorag local storage operation interface.
以一个具体应用场景为例,在使用POS设备的场景中,BroadPos支付应用运行于支付设备(POS设备),可以用于超市、餐饮等收银的场景。收银员启动BroadPos支付应用,当客户购物消费时,收银员操作BroadPos支付应用做添加消费操作。当客户退货时,收银员操作BroadPos支付应用做撤销交易操作。当金额输入错误或者客户部分退货时,收银员操作BroadPos支付应用做修改交易数据操作。当重复交易需要删除重复的交易时,收银员操作BroadPos支付应用做删除交易操作。每天结束时,收银员做批结算,统计当天的交易总笔数、交易总金额和小费总金额等统计数据,并打印统计数据。Taking a specific application scenario as an example, in a scenario using a POS device, the BroadPos payment application runs on a payment device (POS device) and can be used in cashier scenarios such as supermarkets and restaurants. The cashier launches the BroadPos payment application. When a customer makes a purchase, the cashier operates the BroadPos payment application to add a consumption operation. When the customer returns the goods, the cashier operates the BroadPos payment application to cancel the transaction. When the amount is incorrectly entered or the customer returns a part, the cashier operates the BroadPos payment application to modify the transaction data. When a duplicate transaction needs to delete a duplicate transaction, the cashier operates the BroadPos payment application to delete the transaction. At the end of each day, the cashier makes batch settlements, counts the total number of transactions, the total amount of transactions, and the total amount of tips on the day, and prints the statistics.
为了说明本发明所述的技术方案,下面通过具体实施例来进行说明。In order to explain the technical solution of the present invention, the following description is made through specific embodiments.
实施例Examples 11 :
图2示出了本发明一实施例所提供的一种数据统计方法的实现流程图,为了便于说明,仅示出了与本发明实施例相关的部分,详述如下:FIG. 2 shows a flowchart for implementing a data statistics method according to an embodiment of the present invention. For ease of description, only relevant parts of the embodiment of the present invention are shown, and the details are as follows:
如图2所示,本发明实施例所提供的一种数据统计方法,包括:As shown in FIG. 2, a data statistics method provided by an embodiment of the present invention includes:
步骤S101,创建并初始化统计数据,设定所述统计数据的初始值,将所述统计数据存储在预设存储区域。Step S101: Create and initialize statistical data, set an initial value of the statistical data, and store the statistical data in a preset storage area.
本实施例中,统计数据为对交易数据进行统计计算后得到的数据,包括:交易总笔数、交易总金额和小费总金额等。示例性的,设定统计数据的初始值为零。In this embodiment, the statistical data is data obtained through statistical calculation of transaction data, and includes: the total number of transactions, the total amount of transactions, the total amount of tips, and the like. Exemplarily, the initial value of the statistical data is set to zero.
步骤S102,在每一次对交易数据进行操作时,根据交易操作类型对所述交易数据进行统计,并执行对所述统计数据的更新。In step S102, each time the transaction data is operated, the transaction data is counted according to the type of the transaction operation, and the update of the statistical data is performed.
本实施例中,对交易数据进行操作的交易操作类型一般包括:添加消费、撤销交易、修改交易数据和删除交易等。根据不同的交易操作类型对交易数据进行统计计算,并将所述统计数据更新为统计计算后得到的数据。In this embodiment, the types of transaction operations that operate on transaction data generally include: adding consumption, cancelling transactions, modifying transaction data, and deleting transactions. Perform statistical calculations on transaction data according to different types of transaction operations, and update the statistical data to data obtained after statistical calculations.
步骤S103,在批结算时,从所述预设存储区域读取所述统计数据。Step S103: During batch settlement, read the statistical data from the preset storage area.
批结算是指对某一时期内的所有收支情况进行总结、核算。在使用POS设备的应用场景中,批结算时,POS设备需将当批次交易流水的借记总金额、借记总笔数、贷记总金额和贷记总笔数上送POS中心,并与POS中心对账。Batch settlement refers to the summary and accounting of all income and expenditure in a certain period. In the application scenario where POS equipment is used, during batch settlement, the POS device needs to send the total debit amount, total debit amount, total credit amount, and total credit amount to the POS center when the batch transaction flows. Reconcile with POS center.
在一个实施例中,在步骤S103之后,读取统计数据后,打印所述统计数据。In one embodiment, after step S103, after the statistical data is read, the statistical data is printed.
本实施例中,通过在每一次交易时,根据交易操作类型对交易数据进行统计,并按照统计计算后得到的数据对统计数据进行更新,以保证统计数据能够实时表征当前收支情况的核算总数,从而在需要进行批结算时,直接读取统计数据即可,不需要再重新遍历一遍所有的交易数据,解决了遍历交易数据引起的耗时问题,减少了数据读取和处理的时间。In this embodiment, the transaction data is counted according to the type of transaction operation at each transaction, and the statistical data is updated according to the data obtained after the statistical calculation, so as to ensure that the statistical data can represent the total number of accounts in real time. Therefore, when batch settlement is required, the statistical data can be directly read, and there is no need to traverse all the transaction data again, which solves the time-consuming problem caused by traversing the transaction data and reduces the time for data reading and processing.
在本发明的一个实施例中,所述数据统计方法还包括:In an embodiment of the present invention, the data statistics method further includes:
步骤a,创建并初始化交易数据库,设定所述交易数据库的初始状态。In step a, a transaction database is created and initialized, and an initial state of the transaction database is set.
在一个实施例中,步骤a中设定交易数据库的初始状态包括:设定数据库的基本参数,例如数据格式、存储容量等,并清空数据库。In one embodiment, setting the initial state of the transaction database in step a includes: setting basic parameters of the database, such as data format, storage capacity, etc., and clearing the database.
步骤b,在每一次对交易数据进行操作时,对所述交易数据库进行相应的更新。Step b: each time the transaction data is operated, the transaction database is updated accordingly.
在一个实施例中,步骤b中交易数据库进行更新包括:当所述交易操作类型为添加消费时,将新增的交易数据存入交易数据库;当所述交易操作类型为撤销交易时,从交易数据库中删除对应的交易数据;当所述交易操作类型为修改交易数据时,将交易数据库中对应的交易数据做相应修改;当所述交易操作类型为删除交易时,从交易数据库中删除对应的交易数据。In one embodiment, updating the transaction database in step b includes: when the transaction operation type is adding consumption, storing the newly added transaction data in the transaction database; when the transaction operation type is canceling the transaction, downloading the transaction data from the transaction. Delete the corresponding transaction data from the database; when the transaction operation type is modify transaction data, modify the corresponding transaction data in the transaction database accordingly; when the transaction operation type is delete transaction, delete the corresponding transaction data from the transaction database Transaction data.
步骤c,在所述交易数据库更新成功后,执行对所述统计数据的更新。Step c: After the transaction database is successfully updated, update the statistical data.
在一个实施例中,步骤c包括:判断交易数据库是否更新成功,若更新成功则执行步骤S102中对统计数据进行更新的步骤,若更新不成功则不执行步骤S102中对统计数据进行更新的步骤。In one embodiment, step c includes: judging whether the transaction database is successfully updated. If the update is successful, perform the step of updating the statistical data in step S102. If the update is unsuccessful, do not perform the step of updating the statistical data in step S102. .
本实施例中,创建了用于存储交易数据的交易数据库,在每一次对交易数据进行操作时,会产生新的交易数据,根据新的交易数据对交易数据库进行相应的更新,交易数据库中既存储有历史的交易数据,又不断加入新的交易数据,实现了交易数据库的不断更新。In this embodiment, a transaction database for storing transaction data is created. Each time the transaction data is operated, new transaction data is generated. The transaction database is updated accordingly according to the new transaction data. The historical transaction data is stored, and new transaction data is continuously added, realizing the continuous update of the transaction database.
在本发明的一个实施例中,所述数据统计方法还包括:In an embodiment of the present invention, the data statistics method further includes:
步骤d,在批结算完成之后,将所述统计数据重置为所述初始值,将所述交易数据库重置为所述初始状态。Step d, after the batch settlement is completed, reset the statistical data to the initial value, and reset the transaction database to the initial state.
本实施例中,当收银员执行批结算时,终端设备执行的步骤包括:读取统计数据,打印统计数据,重置统计数据为初始值,重置交易数据库为初始状态。In this embodiment, when the cashier performs batch settlement, the steps performed by the terminal device include: reading statistical data, printing the statistical data, resetting the statistical data to an initial value, and resetting the transaction database to an initial state.
为了便于理解,下面以一个具体应用场景为例对以上实施例进行说明。To facilitate understanding, the above embodiment is described below by taking a specific application scenario as an example.
如图3所示,对交易数据库和统计数据的处理过程包括:As shown in Figure 3, the transaction database and statistical data processing process includes:
首先判断Indexdb数据库中是否存在交易数据库。若不存在,则创建并初始化交易数据库,并设定交易数据库的初始状态。若存在,则清空当前的交易数据库,以将其恢复为初始状态。First, determine whether a transaction database exists in the Indexdb database. If it does not exist, create and initialize the transaction database and set the initial state of the transaction database. If it exists, the current transaction database is cleared to restore it to its original state.
然后,判断预设存储区域中是否存在统计数据。若不存在,则创建并初始化统计数据,设定统计数据的初始值。若存在,则重置统计数据为初始值。Then, it is determined whether statistical data exists in the preset storage area. If it does not exist, create and initialize statistical data and set the initial value of the statistical data. If it exists, reset the statistics to the initial value.
如图4所示,在本发明的一个实施例中,图2所对应的实施例中的步骤S102包括:As shown in FIG. 4, in an embodiment of the present invention, step S102 in the embodiment corresponding to FIG. 2 includes:
步骤S201,当所述交易操作类型为添加消费时,将所述统计数据在当前基础上增加交易数据。Step S201: When the transaction operation type is add consumption, add the transaction data to the statistical data on the current basis.
在一个实施例中,步骤S201包括:当所述交易操作类型为添加消费时,将新增的交易数据存入交易数据库,并判断是否存入成功。若存入成功,则将统计数据在当前基础上增加交易数据。若存入失败,则不更新统计数据。In one embodiment, step S201 includes: when the transaction operation type is adding consumption, storing the newly added transaction data in a transaction database, and determining whether the deposit is successful. If the deposit is successful, the transaction data will be added to the statistical data. If the deposit fails, the statistics are not updated.
步骤S202,当所述交易操作类型为撤销交易时,将所述统计数据在当前基础上减去交易数据。Step S202: When the type of the transaction operation is canceling the transaction, subtract the transaction data from the statistical data on the current basis.
在一个实施例中,步骤S202包括:当所述交易操作类型为撤销交易时,从交易数据库中删除对应的交易数据,并判断是否删除成功。若删除成功,则将所述统计数据在当前基础上减去交易数据。若删除失败,则不更新统计数据。In one embodiment, step S202 includes: when the transaction operation type is a cancel transaction, deleting the corresponding transaction data from the transaction database, and determining whether the deletion is successful. If the deletion is successful, the statistical data is subtracted from the transaction data on the current basis. If the deletion fails, the statistics are not updated.
步骤S203,当所述交易操作类型为修改交易数据时,读取原交易数据和新交易数据,并计算所述新交易数据减所述原交易数据的差值,将所述统计数据在当前基础上增加所述差值。Step S203, when the type of the transaction operation is to modify the transaction data, read the original transaction data and the new transaction data, and calculate the difference between the new transaction data and the original transaction data, and place the statistical data on the current basis. The difference is increased by.
在一个实施例中,步骤S203包括:当所述交易操作类型为修改交易数据时,将交易数据库中对应的交易数据做相应修改,并判断是否修改成功。若修改成功,则将所述统计数据在当前基础上增加所述差值。若修改失败,则不更新统计数据。In one embodiment, step S203 includes: when the transaction operation type is modify transaction data, correspondingly modify the corresponding transaction data in the transaction database, and determine whether the modification is successful. If the modification is successful, the difference is added to the statistical data on the current basis. If the modification fails, the statistics are not updated.
步骤S204,当所述交易操作类型为删除交易时,将所述统计数据在当前基础上减去交易数据。Step S204: When the transaction operation type is delete transaction, subtract the transaction data from the statistical data on the current basis.
在一个实施例中,步骤S204包括:当所述交易操作类型为删除交易时,从交易数据库中删除对应的交易数据,并判断是否删除成功。若删除成功,则将所述统计数据在当前基础上减去交易数据。若删除失败,则不更新统计数据。In one embodiment, step S204 includes: when the transaction operation type is delete transaction, deleting the corresponding transaction data from the transaction database, and determining whether the deletion is successful. If the deletion is successful, the statistical data is subtracted from the transaction data on the current basis. If the deletion fails, the statistics are not updated.
在本发明的一个实施例中,所述统计数据包括交易总笔数、交易总金额和小费总金额。In one embodiment of the present invention, the statistical data includes the total number of transactions, the total amount of transactions, and the total amount of tips.
初始状态时,交易数据库中没有交易数据。统计数据中的交易总笔数、交易总金额和小费总金额这三个数据字段的值均为零。In the initial state, there is no transaction data in the transaction database. The values of the three data fields: total number of transactions, total amount of transactions, and total amount of tips in the statistics are all zero.
在本发明的一个实施例中,图2所对应的实施例中的步骤S102包括:In an embodiment of the present invention, step S102 in the embodiment corresponding to FIG. 2 includes:
1)当有一笔交易的交易操作类型为添加消费时,将所述交易总笔数加1,将所述交易总金额加上本次的消费交易金额,将所述小费总金额加上本次的消费交易小费。1) When the transaction operation type of a transaction is add consumption, add 1 to the total number of transactions, add the total transaction amount to the current consumption transaction amount, and add the total tip amount to this time Tips for consumer transactions.
2)当有一笔交易的交易操作类型为撤销交易时,将所述交易总笔数加1,将所述交易总金额减去本次的撤销交易金额,将所述小费总金额减去本次的撤销交易小费。2) When the transaction operation type of a transaction is cancellation transaction, add 1 to the total number of transactions, subtract the total transaction amount from the current transaction cancellation amount, and subtract the total tip amount from the current transaction amount. Tips for canceling transactions.
3)当有一笔交易的交易操作类型为修改交易数据时,所述交易总笔数不变,将所述交易总金额加上交易金额差值,将所述小费总金额加上小费金额差值,其中,交易金额差值=新交易金额-原交易金额,小费金额差值=新交易小费金额-原交易小费金额。3) When the transaction operation type of a transaction is to modify the transaction data, the total number of transactions does not change, the total amount of the transaction plus the difference in the transaction amount, and the total amount of the tip plus the difference in the tip amount Among them, the difference between the transaction amount = the new transaction amount-the original transaction amount, and the difference between the tip amount = the new transaction tip amount-the original transaction tip amount.
4)当有一笔交易的交易操作类型为删除交易时,将所述交易总笔数加1,将所述交易总金额减去本次的删除交易金额,将所述小费总金额减去本次的删除交易小费。4) When the transaction operation type of a transaction is delete transaction, add 1 to the total number of transactions, subtract the total transaction amount from the current delete transaction amount, and subtract the total amount from the tip. Delete transaction tip.
为了便于理解,以一个具体应用场景为例对本实施例进行说明。For ease of understanding, this embodiment is described by taking a specific application scenario as an example.
当有一笔交易的交易操作类型为添加消费时,将新增的交易数据存入交易数据库,并判断是否存入成功。若存入成功,则将所述交易总笔数加1,将所述交易总金额加上本次的消费交易金额,将所述小费总金额加上本次的消费交易小费。若存入失败,则不更新统计数据。When the transaction operation type of a transaction is add consumption, the newly added transaction data is stored in the transaction database, and it is determined whether the deposit is successful. If the deposit is successful, the total number of transactions is increased by 1, the total amount of the transaction is added to the current transaction amount of the transaction, and the total amount of the tip is added to the current transaction tip. If the deposit fails, the statistics are not updated.
当有一笔交易的交易操作类型为撤销交易时,从交易数据库中删除对应的交易数据,并判断是否删除成功。若删除成功,则将所述交易总笔数加1,将所述交易总金额减去本次的撤销交易金额,将所述小费总金额减去本次的撤销交易小费。。若删除失败,则不更新统计数据。When the transaction operation type of a transaction is undo transaction, the corresponding transaction data is deleted from the transaction database, and it is judged whether the deletion is successful. If the deletion is successful, the total number of transactions is increased by one, the total amount of the transaction is subtracted from the amount of the canceled transaction this time, and the total amount of the tip is subtracted from the current amount of the canceled transaction. . If the deletion fails, the statistics are not updated.
当有一笔交易的交易操作类型为修改交易数据时,将交易数据库中对应的交易数据做相应修改,并判断是否修改成功。若修改成功,则所述交易总笔数不变,将所述交易总金额加上交易金额差值,将所述小费总金额加上小费金额差值,其中,交易金额差值=新交易金额-原交易金额,小费金额差值=新交易小费金额-原交易小费金额。若修改失败,则不更新统计数据。When the transaction operation type of a transaction is to modify the transaction data, the corresponding transaction data in the transaction database is modified accordingly, and it is determined whether the modification is successful. If the modification is successful, the total number of transactions does not change, the total amount of the transaction plus the difference in the transaction amount, and the total amount of the tip plus the difference in the tip amount, where the difference in the transaction amount = the new transaction amount -Original transaction amount, tip amount difference = new transaction tip amount-original transaction tip amount. If the modification fails, the statistics are not updated.
当有一笔交易的交易操作类型为删除交易时,从交易数据库中删除对应的交易数据,并判断是否删除成功。若删除成功,则将所述交易总笔数加1,将所述交易总金额减去本次的删除交易金额,将所述小费总金额减去本次的删除交易小费。若删除失败,则不更新统计数据。When the transaction operation type of a transaction is delete transaction, the corresponding transaction data is deleted from the transaction database, and it is determined whether the deletion is successful. If the deletion is successful, the total number of transactions is increased by 1, the total transaction amount is subtracted from the current deletion transaction amount, and the total tip amount is subtracted from the current deletion transaction tip. If the deletion fails, the statistics are not updated.
在一个实施例中,对交易数据库进行查询操作时,不更改所述统计数据。In one embodiment, when performing a query operation on the transaction database, the statistical data is not changed.
本发明实施例中,通过在每一笔的交易数据更新到交易数据库时,对每笔交易进行统计,统计数据随时更新。实现了把现有的统计海量交易数据的密集运算,分散到每笔交易数据进入交易数据库时的增、删、改操作中,省去了数据统计的密集运算环节,能够直接得到统计数据。In the embodiment of the present invention, when each transaction data is updated to the transaction database, each transaction is counted, and the statistical data is updated at any time. Realize the intensive calculation of the existing statistical massive transaction data, which is dispersed into the addition, deletion, and modification operations when each transaction data enters the transaction database, eliminating the intensive operation of data statistics, and can directly obtain statistical data.
本方案将统计数据单独存储到预设存储区域,在每笔交易增,删,改时,进行该交易数据的统计,并更新统计数据。这样当执行批结算时,仅需要从预设存储区域中读取统计数据并打印,不需要读取交易数据库,也不需要遍历交易数据。可以解决读取交易数据库、遍历交易数据时引起的耗时问题。减少了在批结算时,由于数据读取、统计造成的延时。In this solution, the statistical data is individually stored in a preset storage area. When each transaction is added, deleted, or changed, the transaction data is statistically updated and the statistical data is updated. In this way, when performing batch settlement, it is only necessary to read statistical data from a preset storage area and print it, without reading the transaction database and traversing the transaction data. It can solve the time-consuming problem caused when reading the transaction database and traversing the transaction data. Reduced the delay caused by data reading and statistics during batch settlement.
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本发明实施例的实施过程构成任何限定。It should be understood that the size of the sequence numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
实施例Examples 22 :
如图5所示,本发明的一个实施例提供的数据统计系统100,用于执行图2所对应的实施例中的方法步骤,其包括:As shown in FIG. 5, a data statistics system 100 provided by an embodiment of the present invention is configured to execute the method steps in the embodiment corresponding to FIG. 2, which includes:
统计数据创建模块110,用于创建并初始化统计数据,设定所述统计数据的初始值,将所述统计数据存储在预设存储区域。The statistical data creating module 110 is configured to create and initialize statistical data, set an initial value of the statistical data, and store the statistical data in a preset storage area.
统计数据更新模块120,用于在每一次对交易数据进行操作时,根据交易操作类型对所述交易数据进行统计,并执行对所述统计数据的更新。The statistical data updating module 120 is configured to perform statistics on the transaction data according to the type of the transaction operation and perform an update of the statistical data each time an operation is performed on the transaction data.
统计数据读取模块130,用于在批结算时,从所述预设存储区域读取所述统计数据。The statistical data reading module 130 is configured to read the statistical data from the preset storage area during batch settlement.
在本发明的一个实施例中,所述数据统计系统100还包括:In an embodiment of the present invention, the data statistics system 100 further includes:
数据库创建模块,用于创建并初始化交易数据库,设定所述交易数据库的初始状态。A database creation module is used to create and initialize a transaction database and set an initial state of the transaction database.
数据库更新模块,用于在每一次对交易数据进行操作时,对所述交易数据库进行相应的更新。A database update module is configured to update the transaction database correspondingly each time operation is performed on the transaction data.
更新状态判断模块,用于在所述交易数据库更新成功后,执行对所述统计数据的更新。An update status judgment module is configured to perform an update of the statistical data after the transaction database is successfully updated.
在本发明的一个实施例中,所述数据统计系统100还包括:In an embodiment of the present invention, the data statistics system 100 further includes:
重置模块,用于在批结算完成之后,将所述统计数据重置为所述初始值,将所述交易数据库重置为所述初始状态。The resetting module is configured to reset the statistical data to the initial value and reset the transaction database to the initial state after the batch settlement is completed.
在本发明的一个实施例中,统计数据更新模块120包括:In one embodiment of the present invention, the statistical data update module 120 includes:
第一操作单元,用于当所述交易操作类型为添加消费时,将所述统计数据在当前基础上增加所述交易数据。A first operation unit is configured to add the transaction data to the statistical data on a current basis when the transaction operation type is add consumption.
第二操作单元,用于当所述交易操作类型为撤销交易时,将所述统计数据在当前基础上减去所述交易数据。A second operation unit is configured to subtract the transaction data from the statistical data on a current basis when the transaction operation type is a cancelled transaction.
第三操作单元,用于当所述交易操作类型为修改交易数据时,读取原交易数据和新交易数据,并计算所述新交易数据减所述原交易数据的差值,将所述统计数据在当前基础上增加所述差值。A third operation unit, configured to read the original transaction data and the new transaction data when the transaction operation type is modified transaction data, and calculate the difference between the new transaction data and the original transaction data, and collect the statistics The data adds the difference on a current basis.
第四操作单元,用于当所述交易操作类型为删除交易时,将所述统计数据在当前基础上减去所述交易数据。A fourth operation unit is configured to subtract the transaction data from the statistical data on a current basis when the transaction operation type is a delete transaction.
在本发明的一个实施例中,第一操作单元,还用于当有一笔交易的交易操作类型为添加消费时,将所述交易总笔数加1,将所述交易总金额加上本次的消费交易金额,将所述小费总金额加上本次的消费交易小费。In an embodiment of the present invention, the first operation unit is further configured to add 1 to the total number of transactions and add the total amount of the transaction to this time when the transaction operation type of a transaction is add consumption. The amount of the consumption transaction, the total amount of the tip is added to the current consumption transaction tip.
第二操作单元,还用于当有一笔交易的交易操作类型为撤销交易时,将所述交易总笔数加1,将所述交易总金额减去本次的撤销交易金额,将所述小费总金额减去本次的撤销交易小费。The second operation unit is further configured to add 1 to the total number of transactions when the type of transaction operation of the transaction is to cancel the transaction, subtract the total amount of the transaction from the amount of the canceled transaction, and reduce the tip. The total amount minus the tip for this cancellation.
第三操作单元,还用于当有一笔交易的交易操作类型为修改交易数据时,所述交易总笔数不变,将所述交易总金额加上交易金额差值,将所述小费总金额加上小费金额差值,其中,交易金额差值=新交易金额-原交易金额,小费金额差值=新交易小费金额-原交易小费金额。The third operation unit is further configured to: when the transaction operation type of a transaction is to modify transaction data, the total number of transactions does not change, add the total amount of the transaction plus the difference in the transaction amount, and change the total amount of the tip Add the tip amount difference, where the transaction amount difference = the new transaction amount-the original transaction amount, and the tip amount difference = the new transaction tip amount-the original transaction tip amount.
第四操作单元,还用于当有一笔交易的交易操作类型为删除交易时,将所述交易总笔数加1,将所述交易总金额减去本次的删除交易金额,将所述小费总金额减去本次的删除交易小费。The fourth operation unit is further configured to add 1 to the total number of transactions when the transaction operation type of a transaction is delete transaction, subtract the total transaction amount from the current transaction amount, and the tip The total amount minus the current transaction tip.
在一个实施例中,数据统计系统100还包括其他功能模块/单元,用于实现实施例1中各实施例的方法步骤。In one embodiment, the data statistics system 100 further includes other functional modules / units, which are used to implement the method steps of each of the embodiments.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即所述数据统计系统100的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。实施例中的各功能模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述数据统计系统100中模块的具体工作过程,可以参考实施例1中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of the description, only the above-mentioned division of the functional modules is used as an example. In practical applications, the above functions can be allocated by different functional modules as required, that is The internal structure of the data statistics system 100 is divided into different functional modules to complete all or part of the functions described above. Each functional module in the embodiment may be integrated into one processing unit, or each unit may exist separately physically, or two or more units may be integrated into one unit. The above integrated modules may be implemented in the form of hardware. , Can also be implemented in the form of software functional units. In addition, the specific names of the functional modules are only for the convenience of distinguishing from each other, and are not used to limit the protection scope of the present application. For specific working processes of the modules in the data statistics system 100 described above, reference may be made to the corresponding processes in Embodiment 1, and details are not described herein again.
实施例Examples 33 :
图6是本发明一实施例提供的终端设备的示意图。如图6所示,该实施例的终端设备6包括:处理器60、存储器61以及存储在所述存储器61中并可在所述处理器60上运行的计算机程序62。所述处理器60执行所述计算机程序62时实现如实施例1中所述的各实施例中的步骤,例如图2所示的步骤S101至S103。或者,所述处理器60执行所述计算机程序62时实现如实施例2中所述的各系统实施例中的各模块/单元的功能,例如图5所示模块110至130的功能。FIG. 6 is a schematic diagram of a terminal device according to an embodiment of the present invention. As shown in FIG. 6, the terminal device 6 of this embodiment includes a processor 60, a memory 61, and a computer program 62 stored in the memory 61 and executable on the processor 60. When the processor 60 executes the computer program 62, the steps in the embodiments described in Embodiment 1 are implemented, for example, steps S101 to S103 shown in FIG. 2. Alternatively, when the processor 60 executes the computer program 62, functions of each module / unit in each system embodiment described in Embodiment 2 are implemented, for example, functions of modules 110 to 130 shown in FIG. 5.
所述终端设备6是指具有数据处理能力的终端,包括但不限于POS设备、计算机、工作站、服务器,甚至是一些性能优异的智能手机、掌上电脑、平板电脑、个人数字助理(PDA)、智能电视(Smart TV) 等。终端设备上一般都安装有操作系统,包括但不限于:Windows操作系统、LINUX操作系统、安卓(Android)操作系统、Symbian操作系统、Windows mobile操作系统、以及iOS操作系统等等。以上详细罗列了终端设备6的具体实例,本领域技术人员可以意识到,终端设备并不限于上述罗列实例。The terminal device 6 refers to a terminal with data processing capabilities, including but not limited to POS devices, computers, workstations, servers, and even some smart phones, PDAs, tablets, personal digital assistants (PDAs), TV (Smart TV), etc. An operating system is generally installed on the terminal device, including but not limited to: Windows operating system, Linux operating system, Android operating system, Symbian operating system, Windows mobile operating system, and iOS operating system. The specific examples of the terminal device 6 are listed in detail above, and those skilled in the art can realize that the terminal device is not limited to the above listed examples.
所述终端设备可包括,但不仅限于,处理器60、存储器61。本领域技术人员可以理解,图6仅仅是终端设备6的示例,并不构成对终端设备6的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述终端设备6还可以包括输入输出设备、网络接入设备、总线等。The terminal device may include, but is not limited to, a processor 60 and a memory 61. Those skilled in the art can understand that FIG. 6 is only an example of the terminal device 6 and does not constitute a limitation on the terminal device 6. It may include more or fewer components than shown in the figure, or combine some components or different components For example, the terminal device 6 may further include an input / output device, a network access device, a bus, and the like.
所称处理器60可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器 (Digital Signal Processor,DSP)、专用集成电路 (Application Specific Integrated Circuit,ASIC)、现成可编程门阵列 (Field-Programmable Gate Array,FPGA) 或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。The processor 60 may be a central processing unit (Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), and application-specific integrated circuits (Applications) Specific Integrated Circuit (ASIC), off-the-shelf Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
所述存储器61可以是所述终端设备6的内部存储单元,例如终端设备6的硬盘或内存。所述存储器61也可以是所述终端设备6的外部存储设备,例如所述终端设备6上配备的插接式硬盘,智能存储卡(Smart Media Card, SMC),安全数字(Secure Digital, SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器61还可以既包括所述终端设备6的内部存储单元也包括外部存储设备。所述存储器61用于存储所述计算机程序以及所述终端设备6所需的其他程序和数据。所述存储器61还可以用于暂时地存储已经输出或者将要输出的数据。The memory 61 may be an internal storage unit of the terminal device 6, such as a hard disk or a memory of the terminal device 6. The memory 61 may also be an external storage device of the terminal device 6, such as a plug-in hard disk, a smart media card (SMC), and a secure digital (SD) provided on the terminal device 6. 1. flash card Card) and so on. Further, the memory 61 may further include both an internal storage unit of the terminal device 6 and an external storage device. The memory 61 is configured to store the computer program and other programs and data required by the terminal device 6. The memory 61 may also be used to temporarily store data that has been output or is to be output.
实施例Examples 44 :
本发明实施例还提供了一种计算机可读存储介质,计算机可读存储介质存储有计算机程序,计算机程序被处理器执行时实现如实施例1中所述的各实施例中的步骤,例如图2所示的步骤S101至步骤S103。或者,所述计算机程序被处理器执行时实现如实施例2中所述的各系统实施例中的各模块/单元的功能,例如图5所示的模块110至130的功能。An embodiment of the present invention further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the steps in the embodiments described in Embodiment 1 are implemented, for example, as shown in FIG. Steps S101 to S103 shown in FIG. 2. Alternatively, when the computer program is executed by a processor, the functions of each module / unit in each system embodiment described in Embodiment 2 are implemented, for example, the functions of modules 110 to 130 shown in FIG. 5.
所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质等。The computer program may be stored in a computer-readable storage medium. When the computer program is executed by a processor, the computer program may implement the steps of the foregoing method embodiments. The computer program includes computer program code, and the computer program code may be in a source code form, an object code form, an executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signals, telecommunication signals, and software distribution media.
在上述实施例中,对各个实施例的描述都各有侧重,实施例1至4可以任意组合,组合后形成的新的实施例也在本申请的保护范围之内。某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the above embodiments, the description of each embodiment has its own emphasis. Embodiments 1 to 4 can be arbitrarily combined, and new embodiments formed after the combination are also within the protection scope of this application. For a part that is not detailed or recorded in an embodiment, reference may be made to related descriptions in other embodiments.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Those of ordinary skill in the art may realize that the units and algorithm steps of each example described in connection with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. A person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
在本发明所提供的实施例中,应该理解到,所揭露的终端设备和方法,可以通过其它的方式实现。例如,以上所描述的系统/终端设备实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。In the embodiments provided by the present invention, it should be understood that the disclosed terminal device and method may be implemented in other manners. For example, the system / terminal device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be another division manner, such as multiple units. Or components can be combined or integrated into another system, or some features can be ignored or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, which may be electrical, mechanical or other forms.
以上所述实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围,均应包含在本发明的保护范围之内。The above-mentioned embodiments are only used to illustrate the technical solutions of the present invention, but not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still implement the foregoing implementations. The technical solutions described in the examples are modified, or some of the technical features are equivalently replaced; and these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in Within the scope of the present invention.

Claims (10)

  1. 一种数据统计方法,其特征在于,包括:A data statistics method, characterized in that it includes:
    创建并初始化统计数据,设定所述统计数据的初始值,将所述统计数据存储在预设存储区域;Creating and initializing statistical data, setting an initial value of the statistical data, and storing the statistical data in a preset storage area;
    在每一次对交易数据进行操作时,根据交易操作类型对所述交易数据进行统计,并执行对所述统计数据的更新;Each time operation is performed on the transaction data, statistics are performed on the transaction data according to the type of transaction operation, and update of the statistical data is performed;
    在批结算时,从所述预设存储区域读取所述统计数据。During batch settlement, the statistical data is read from the preset storage area.
  2. 如权利要求1所述的数据统计方法,其特征在于,还包括:The data statistics method according to claim 1, further comprising:
    创建并初始化交易数据库,设定所述交易数据库的初始状态;Creating and initializing a transaction database, and setting an initial state of the transaction database;
    在每一次对交易数据进行操作时,对所述交易数据库进行相应的更新;Each time the transaction data is operated, the transaction database is updated accordingly;
    在所述交易数据库更新成功后,执行对所述统计数据的更新。After the transaction database is successfully updated, update of the statistical data is performed.
  3. 如权利要求2所述的数据统计方法,其特征在于,还包括:The data statistics method according to claim 2, further comprising:
    在批结算完成之后,将所述统计数据重置为所述初始值,将所述交易数据库重置为所述初始状态。After the batch settlement is completed, the statistical data is reset to the initial value, and the transaction database is reset to the initial state.
  4. 如权利要求1所述的数据统计方法,其特征在于,所述根据交易操作类型对所述交易数据进行统计,并执行对所述统计数据的更新,包括:The data statistics method according to claim 1, wherein the performing statistics on the transaction data according to a transaction operation type and performing an update on the statistics data comprises:
    当所述交易操作类型为添加消费时,将所述统计数据在当前基础上增加所述交易数据;When the transaction operation type is add consumption, adding the transaction data to the statistical data on the current basis;
    当所述交易操作类型为撤销交易时,将所述统计数据在当前基础上减去所述交易数据;When the transaction operation type is cancel transaction, subtract the transaction data from the statistical data on the current basis;
    当所述交易操作类型为修改交易数据时,读取原交易数据和新交易数据,并计算所述新交易数据减所述原交易数据的差值,将所述统计数据在当前基础上增加所述差值;When the transaction operation type is modified transaction data, read the original transaction data and the new transaction data, and calculate the difference between the new transaction data and the original transaction data, and add the statistical data to the current basis. Mentioned difference;
    当所述交易操作类型为删除交易时,将所述统计数据在当前基础上减去所述交易数据。When the transaction operation type is a delete transaction, the statistical data is subtracted from the transaction data on the current basis.
  5. 如权利要求4所述的数据统计方法,其特征在于,所述统计数据包括交易总笔数、交易总金额和小费总金额。The data statistics method according to claim 4, wherein the statistical data comprises a total number of transactions, a total amount of transactions, and a total amount of tips.
  6. 如权利要求5所述的数据统计方法,其特征在于,所述根据交易操作类型对所述交易数据进行统计,并执行对所述统计数据的更新,包括:The data statistics method according to claim 5, wherein the step of performing statistics on the transaction data according to a transaction operation type and performing an update of the statistics data comprises:
    当有一笔交易的交易操作类型为添加消费时,将所述交易总笔数加1,将所述交易总金额加上本次的消费交易金额,将所述小费总金额加上本次的消费交易小费;When the transaction operation type of a transaction is add consumption, the total number of transactions is increased by 1, the total amount of the transaction is added to the current transaction amount of the transaction, and the total amount of the tip is added to the current consumption. Transaction tip
    当有一笔交易的交易操作类型为撤销交易时,将所述交易总笔数加1,将所述交易总金额减去本次的撤销交易金额,将所述小费总金额减去本次的撤销交易小费;When the transaction operation type of a transaction is cancellation transaction, add 1 to the total number of transactions, subtract the total transaction amount from the current cancellation transaction amount, and subtract the total tip amount from the current cancellation. Transaction tip
    当有一笔交易的交易操作类型为修改交易数据时,所述交易总笔数不变,将所述交易总金额加上交易金额差值,将所述小费总金额加上小费金额差值,其中,交易金额差值=新交易金额-原交易金额,小费金额差值=新交易小费金额-原交易小费金额;When the transaction operation type of a transaction is to modify transaction data, the total number of transactions does not change, the total amount of the transaction plus the difference in transaction amount, and the total amount of the tip plus the difference in tip amount, where , Difference in transaction amount = new transaction amount-original transaction amount, tip amount difference = new transaction tip amount-original transaction tip amount;
    当有一笔交易的交易操作类型为删除交易时,将所述交易总笔数加1,将所述交易总金额减去本次的删除交易金额,将所述小费总金额减去本次的删除交易小费。When the transaction operation type of a transaction is delete transaction, add 1 to the total number of transactions, subtract the total transaction amount from the current deletion transaction amount, and subtract the total tip amount from the current deletion. Tipping for transactions.
  7. 一种数据统计系统,其特征在于,包括:A data statistics system, comprising:
    统计数据创建模块,用于创建并初始化统计数据,设定所述统计数据的初始值,将所述统计数据存储在预设存储区域;A statistical data creation module, configured to create and initialize statistical data, set an initial value of the statistical data, and store the statistical data in a preset storage area;
    统计数据更新模块,用于在每一次对交易数据进行操作时,根据交易操作类型对所述交易数据进行统计,并执行对所述统计数据的更新;A statistical data update module, configured to perform statistics on the transaction data according to the type of the transaction operation and perform an update of the statistical data each time an operation is performed on the transaction data;
    统计数据读取模块,用于在批结算时,从所述预设存储区域读取所述统计数据。The statistical data reading module is configured to read the statistical data from the preset storage area during batch settlement.
  8. 如权利要求7所述的数据统计系统,其特征在于,还包括:The data statistics system according to claim 7, further comprising:
    数据库创建模块,用于创建并初始化交易数据库,设定所述交易数据库的初始状态;A database creation module for creating and initializing a transaction database and setting an initial state of the transaction database;
    数据库更新模块,用于在每一次对交易数据进行操作时,对所述交易数据库进行相应的更新;A database update module, configured to update the transaction database correspondingly each time operation is performed on the transaction data;
    更新状态判断模块,用于在所述交易数据库更新成功后,执行对所述统计数据的更新。An update status judgment module is configured to perform an update of the statistical data after the transaction database is successfully updated.
  9. 一种终端设备,其特征在于,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如权利要求1至6任一项所述数据统计方法的步骤。A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the processor implements claims 1 to Steps of the data statistics method according to any one of 6.
  10. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1至6任一项所述数据统计方法的步骤。A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, and the computer program, when executed by a processor, implements the steps of the data statistics method according to any one of claims 1 to 6. .
PCT/CN2019/102279 2018-09-13 2019-08-23 Method for compiling data statistics, system and terminal device WO2020052429A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811066834.7 2018-09-13
CN201811066834.7A CN109299931A (en) 2018-09-13 2018-09-13 A kind of data statistical approach, system and terminal device

Publications (1)

Publication Number Publication Date
WO2020052429A1 true WO2020052429A1 (en) 2020-03-19

Family

ID=65166945

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/102279 WO2020052429A1 (en) 2018-09-13 2019-08-23 Method for compiling data statistics, system and terminal device

Country Status (2)

Country Link
CN (1) CN109299931A (en)
WO (1) WO2020052429A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109299931A (en) * 2018-09-13 2019-02-01 百富计算机技术(深圳)有限公司 A kind of data statistical approach, system and terminal device
CN112084219A (en) * 2020-09-16 2020-12-15 京东数字科技控股股份有限公司 Method, apparatus, electronic device, and medium for processing data

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040034643A1 (en) * 2002-08-19 2004-02-19 International Business Machines Corporation System and method for real time statistics collection for use in the automatic management of a database system
CN101557316A (en) * 2009-05-14 2009-10-14 阿里巴巴集团控股有限公司 Method and system for updating statistical data
CN103164318A (en) * 2011-12-13 2013-06-19 中国银联股份有限公司 Method and device for automation health examination of online system
CN109299931A (en) * 2018-09-13 2019-02-01 百富计算机技术(深圳)有限公司 A kind of data statistical approach, system and terminal device

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102156933A (en) * 2010-02-11 2011-08-17 阿里巴巴集团控股有限公司 Method and counting system for counting electronic commerce transaction data
EP2490135A1 (en) * 2011-02-21 2012-08-22 Amadeus S.A.S. Method and system for providing statistical data from a data warehouse
CN103049556B (en) * 2012-12-28 2016-11-09 中国科学院深圳先进技术研究院 A kind of fast statistical query method of magnanimity medical data
CN106202081B (en) * 2015-04-30 2020-03-13 阿里巴巴集团控股有限公司 Real-time data processing method and device
CN106201839B (en) * 2015-04-30 2020-02-14 阿里巴巴集团控股有限公司 Information loading method and device for business object
CN107833051B (en) * 2017-10-19 2021-11-19 中国银行股份有限公司 Data statistical method and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040034643A1 (en) * 2002-08-19 2004-02-19 International Business Machines Corporation System and method for real time statistics collection for use in the automatic management of a database system
CN101557316A (en) * 2009-05-14 2009-10-14 阿里巴巴集团控股有限公司 Method and system for updating statistical data
CN103164318A (en) * 2011-12-13 2013-06-19 中国银联股份有限公司 Method and device for automation health examination of online system
CN109299931A (en) * 2018-09-13 2019-02-01 百富计算机技术(深圳)有限公司 A kind of data statistical approach, system and terminal device

Also Published As

Publication number Publication date
CN109299931A (en) 2019-02-01

Similar Documents

Publication Publication Date Title
CN108376364B (en) Payment system account checking method and device and terminal device
CN103677771A (en) Processing method and device for concurrent transactions
US20160042340A1 (en) Closed prepayment program via merchant pos terminals
CN110288343A (en) A kind of method of payment and device
CN109034783A (en) Bill refund calculation method, device and computer readable storage medium
WO2020042764A1 (en) Amount settlement system and method
CN110264214A (en) It is a kind of trade bill generation and check and write off method, device and equipment
WO2020052429A1 (en) Method for compiling data statistics, system and terminal device
CN111667225A (en) Financial data processing method and device and computer system
WO2020103504A1 (en) User resource management method and device, apparatus, and computer-readable storage medium
CN109325728A (en) A kind of debt data processing method and terminal device based on user data resource
CN108985840A (en) A kind of block chain electric business price protection is supported and debt-credit payment system and method
TWI729889B (en) Electronic money management system and electronic money management method
CN108153795A (en) A kind of data processing method, system and the device of electronics red packet
CN109886676A (en) Method of payment, calculating equipment, storage medium for block chain network
CN108681957B (en) Cross-border e-commerce transaction order restoration method, system, equipment and storage medium
CN115456612B (en) Accounting method, system, terminal and storage medium for balance base table
JP2016110321A (en) Fund transfer method, system, and program
WO2020103573A1 (en) Block chain-based network transaction signature method and device, and terminal equipment
JP6510472B2 (en) Payment system, method and program
AU5793301A (en) Expenditure Management System, Method and Recording Media
CN113837648A (en) Enterprise relevance analysis method and device and associated enterprise recommendation method and device
CN109359970B (en) Smart card management method and device and terminal equipment
CN112132509A (en) Refund processing method, device, medium and terminal equipment
US10050979B2 (en) Executing a process based on validity information indicating one of validity and invalidity

Legal Events

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

Ref document number: 19860697

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19860697

Country of ref document: EP

Kind code of ref document: A1