POS terminal-based transaction data processing method, device, equipment and storage medium
Patent Information
- Application Number
- CN202210037079.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-13
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2042-01-13
AI Technical Summary
[0003]有鉴于此,本发明的目的是提供了一种基于pos终端的交易数据处理方法、装置、计算机设备及计算机可读存储介质,用于解决现有通过消息中间件返回交易结果的方式容易导致交易结果返回准确率低以及效率低的问题
[0037] The transaction data processing method, device, computer equipment and computer-readable storage medium based on POS terminal provided by the embodiment of the present invention send transaction data to the transaction system through the target POS access terminal, wherein the transaction data carries target subject data, wherein the target subject data includes the target POS access terminal identifier and transaction number data; the transaction data is received and processed by the transaction system to obtain a transaction result; the transaction result and the target subject data are stored in the Redis component through the transaction system, so that the Redis component: matches the target POS access terminal according to the target subject data, and sends the transaction result to the target POS access terminal; and receives the transaction result returned by the Redis component through the target POS access terminal, and returns the transaction result to the target POS terminal associated with the target POS access terminal; the embodiment of the present invention ensures that the transaction result can be quickly and accurately delivered to the corresponding POS terminal through the subscription and publishing mechanism between the POS access terminal and the Redis component and the association relationship between the POS access terminal and the POS terminal, thereby effectively improving the efficiency and accuracy of the transaction result return.
Smart Images

Figure CN114386958B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a method, apparatus, computer equipment, and computer-readable storage medium for processing transaction data based on a POS terminal. Background Art
[0002] In the existing POS-based transaction data processing process, transaction results are returned in the following manner: when multiple POS devices simultaneously send transaction data processing requests to the transaction system, the transaction system, through synchronous calls, returns an intermediate status of "processing" to each of the POS devices. The transaction results are then notified to the upstream system via asynchronous messages, which then return the results to the POS devices. However, this transaction result return method has the following drawbacks: the upstream system may return a transaction result that should have been returned to POS device A to POS device B, making it impossible to return every transaction result to the correct POS device. This results in low transaction result accuracy, long transaction data processing time, and low transaction data processing efficiency. Summary of the Invention
[0003] In view of this, the purpose of the present invention is to provide a transaction data processing method, device, computer equipment and computer-readable storage medium based on a POS terminal, which is used to solve the problem that the existing method of returning transaction results through message middleware easily leads to low accuracy and low efficiency of transaction results.
[0004] One aspect of an embodiment of the present invention provides a transaction data processing method based on a POS terminal, comprising:
[0005] Sending transaction data to the transaction system through the target POS access terminal, wherein the transaction data carries target subject data, wherein the target subject data includes the target POS access terminal identifier and transaction number data;
[0006] receiving and processing the transaction data through the transaction system to obtain a transaction result;
[0007] The transaction result and the target subject data are stored in a redis component through the transaction system, so that the redis component: matches the target POS access terminal according to the target subject data, and sends the transaction result to the target POS access terminal; and
[0008] The transaction result returned by the redis component is received through the target POS access terminal, and the transaction result is returned to the target POS terminal associated with the target POS access terminal.
[0009] Optionally, the method further comprises pre-establishing a communication connection between the POS terminal and the POS access terminal, wherein the step of establishing the communication connection comprises:
[0010] Sending a synchronization sequence number data packet to the POS access terminal through the POS terminal to request a connection; wherein the synchronization sequence number data packet is used to request a connection to the POS access terminal; the synchronization sequence number data packet carries the POS terminal identification;
[0011] The POS access terminal receives the synchronization sequence number data packet, and based on the synchronization sequence number data packet, generates and returns a handshake confirmation packet to the POS terminal; wherein the handshake confirmation packet indicates that the POS access terminal confirms the establishment of a connection with the POS terminal;
[0012] The POS terminal receives the handshake confirmation packet, generates and returns a confirmation character packet to the POS access terminal based on the handshake confirmation packet, so that the POS terminal establishes a communication connection with the POS access terminal; wherein the confirmation character packet indicates that the POS terminal receives the confirmation connection request from the POS access terminal, and the POS terminal confirms the establishment of a communication connection with the POS access terminal.
[0013] Optionally, after the POS terminal confirms that a communication connection has been established with the POS access terminal, the method further includes:
[0014] If the POS access terminal does not receive any data sent by the corresponding POS terminal within a preset time period, a TCP detection packet is generated and sent to the corresponding POS terminal to evaluate whether the corresponding POS terminal is alive.
[0015] Optionally, matching the target POS access terminal according to the target subject data further includes:
[0016] Match the target POS access terminal identifier in the target subject data with each POS access terminal identifier pre-stored in the redis component;
[0017] If there is a matching result, the POS access terminal in the Redis component that matches the target POS access terminal identifier is determined as the target POS access terminal.
[0018] Optionally, the receiving, through the target POS access terminal, the transaction result returned by the Redis component and returning the transaction result to a target POS terminal associated with the target POS access terminal further includes:
[0019] Querying, through the target POS access terminal, whether there is a target TCP connection associated with the target POS number according to the target POS number in the transaction result;
[0020] If it is determined that there is a target TCP connection associated with the target POS number, obtaining a target POS terminal corresponding to the target POS number;
[0021] The transaction result is returned to the target POS terminal via the target TCP connection.
[0022] Optionally, the method further includes:
[0023] If the target POS access terminal does not receive the transaction result within the preset time, it returns waiting data to the POS terminal, and the waiting data indicates that the transaction is being processed;
[0024] If the POS access terminal does not receive the transaction result after returning the waiting data to the POS terminal for a preset number of times, a transaction result query request is generated and sent to the transaction system through the POS access terminal, so that the transaction system responds to the transaction result query request to generate and return the transaction result.
[0025] Optionally, the method further includes:
[0026] Receiving, through the transaction system, the transaction data sent by a plurality of POS terminals, wherein the target subject data in each transaction data further includes a corresponding processing level tag;
[0027] sorting the plurality of transaction data according to each processing level tag by the transaction system;
[0028] The transaction system allocates a corresponding computing server to each transaction data according to a preset load balancing rule and a processing level label corresponding to each transaction data; the computing server is used to process the received transaction data;
[0029] The transaction system calls the computing power server to process the transaction data it receives and generate corresponding transaction results.
[0030] One aspect of an embodiment of the present invention further provides a transaction data processing device based on a POS terminal, comprising:
[0031] A data sending module is used to send transaction data to the transaction system through the target POS access terminal, wherein the transaction data carries target subject data, wherein the target subject data includes the target POS access terminal identifier and transaction number data;
[0032] A transaction processing module, configured to receive and process the transaction data through the transaction system to obtain a transaction result;
[0033] A matching module, configured to store the transaction result and the target subject data in a redis component through the transaction system, so that the redis component: matches the target POS access terminal according to the target subject data, and sends the transaction result to the target POS access terminal; and
[0034] The transaction result returning module is used to receive the transaction result returned by the redis component through the target POS access terminal, and return the transaction result to the target POS terminal associated with the target POS access terminal.
[0035] One aspect of an embodiment of the present invention further provides a computer device, which includes 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 steps of the transaction data processing method based on the POS terminal as described above are implemented.
[0036] One aspect of an embodiment of the present invention further provides a computer-readable storage medium, which stores a computer program. The computer program can be executed by at least one processor to enable the at least one processor to perform the steps of the transaction data processing method based on the POS terminal as described above.
[0037] The transaction data processing method, device, computer equipment and computer-readable storage medium based on POS terminal provided by the embodiment of the present invention send transaction data to the transaction system through the target POS access terminal, wherein the transaction data carries target subject data, wherein the target subject data includes the target POS access terminal identifier and transaction number data; the transaction data is received and processed by the transaction system to obtain a transaction result; the transaction result and the target subject data are stored in the Redis component through the transaction system, so that the Redis component: matches the target POS access terminal according to the target subject data, and sends the transaction result to the target POS access terminal; and receives the transaction result returned by the Redis component through the target POS access terminal, and returns the transaction result to the target POS terminal associated with the target POS access terminal; the embodiment of the present invention ensures that the transaction result can be quickly and accurately delivered to the corresponding POS terminal through the subscription and publishing mechanism between the POS access terminal and the Redis component and the association relationship between the POS access terminal and the POS terminal, thereby effectively improving the efficiency and accuracy of the transaction result return.
[0038] The present invention will be described in detail below with reference to the accompanying drawings and specific embodiments, but this does not limit the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 The following is a schematic diagram showing an environment application of a transaction data processing method based on a POS terminal according to an embodiment of the present invention;
[0040] Figure 2 The following schematically shows an example flow chart of a transaction data processing method based on a POS terminal implemented by the present invention;
[0041] Figure 3 The following is a schematic flow chart showing the steps of implementing a transaction data processing method based on a POS terminal according to the present invention;
[0042] Figure 4 The following is a schematic flow chart showing the steps of implementing a transaction data processing method based on a POS terminal according to the present invention;
[0043] Figure 5 The following is a schematic flow chart showing the steps of implementing a transaction data processing method based on a POS terminal according to the present invention;
[0044] Figure 6 The following is a schematic flow chart showing the steps of implementing a transaction data processing method based on a POS terminal according to the present invention;
[0045] Figure 7 The following schematically shows a block diagram of a transaction data processing device based on a POS terminal according to a second embodiment of the present invention;
[0046] Figure 8 The hardware structure diagram of a computer device suitable for implementing a transaction data processing method based on a POS terminal according to the third embodiment of the present invention is schematically shown. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0048] It should be noted that the descriptions of "first", "second", etc. in the embodiments of the present invention are for descriptive purposes only and should not be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include at least one of such features. In addition, the technical solutions between the various embodiments can be combined with each other, but this must be based on the fact that they can be implemented by ordinary technicians in this field. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0049] In the description of the present invention, it should be understood that the numerical labels before the steps do not identify the order in which the steps are executed, but are only used to facilitate the description of the present invention and to distinguish each step, and therefore should not be understood as a limitation of the present invention.
[0050] Example 1
[0051] See also Figure 1 , shows a flowchart of the steps of the transaction data processing method based on the POS terminal according to an embodiment of the present invention. It is understood that the flowchart in this method embodiment is not intended to limit the order of execution of the steps. The following example description is based on a computer device as the execution subject, as follows:
[0052] like Figure 1 As shown, the transaction data processing method based on the POS terminal may include steps S100 to S106, wherein:
[0053] Step S100: sending transaction data to the transaction system through the target POS access terminal, wherein the transaction data carries target subject data, wherein the target subject data includes the target POS access terminal identifier and transaction number data.
[0054] In an exemplary embodiment, to improve transaction data processing efficiency, POS access points are typically clustered, including POS access point A, POS access point B, POS access point C, ..., POS access point N. Different POS access points can establish TCP connections with different POS terminals. After establishing a TCP connection, each transaction conducted at a POS terminal sends the corresponding transaction data to the corresponding POS access point. TCP stands for Transmission Control Protocol; before establishing a TLS or SSL (Secure Sockets Layer) connection in a TCP-based HTTPS request, a TCP three-way handshake is performed to establish the connection.
[0055] See also Figure 2The method further includes pre-establishing a communication connection between the POS terminal and the POS access terminal, wherein the step of establishing the communication connection further includes steps S200 to S204, wherein: step S200, sending a synchronization sequence number data packet to the POS access terminal by the POS terminal to request a connection; wherein the synchronization sequence number data packet is used to request a connection from the POS access terminal; the synchronization sequence number data packet carries the POS terminal identifier; step S202, receiving the synchronization sequence number data packet by the POS access terminal, and generating and returning a handshake confirmation packet to the POS terminal based on the synchronization sequence number data packet; wherein the handshake confirmation packet indicates that the POS access terminal confirms the establishment of a connection with the POS terminal; and step S204, receiving the handshake confirmation packet by the POS terminal, and generating and returning a confirmation character packet to the POS access terminal based on the handshake confirmation packet, so that the POS terminal establishes a communication connection with the POS access terminal; wherein the confirmation character packet indicates that the POS terminal receives the confirmation connection request from the POS access terminal and that the POS terminal confirms the establishment of a communication connection with the POS access terminal. In this embodiment, the POS terminal identifier can be the POS terminal's POS number, which represents a physical POS device. For example, the topic data includes: POS access terminal identifier (such as the POS access terminal IP address) and transaction number data (such as the POS number and transaction number). For example, the topic data is [POS access terminal IP address: POS number: transaction number].
[0056] After the POS terminal confirms that a communication connection has been established with the POS access terminal, the method further includes: if the POS access terminal does not receive any data sent by the corresponding POS terminal within a preset time period, generating and sending a TCP detection packet to the corresponding POS terminal to evaluate whether the corresponding POS terminal is alive.
[0057] Step S102: receiving and processing the transaction data through the transaction system to obtain a transaction result.
[0058] In an exemplary embodiment, the transaction system parses and calculates the transaction data according to a preset calculation rule therein, and obtains a transaction result.
[0059] Step S104: The transaction result and the target subject data are stored in a redis component through the transaction system, so that the redis component matches the target POS access terminal according to the target subject data and sends the transaction result to the target POS access terminal.
[0060] To ensure fast communication between the POS access point and the Redis component, the method includes pre-establishing a persistent connection between each POS access point and the Redis component. Each POS access point, acting as a subscriber, subscribes to topic data from the Redis component. After obtaining the transaction results, the transaction system stores them in its database and publishes the transaction results and target topic data to the Redis component. After receiving the target topic data, the Redis component matches the POS access point and sends the transaction results to the corresponding target POS access point via the persistent connection between the POS access point and the Redis component.
[0061] In an embodiment of the present invention, the wildcard matching rule of the redis component is that the actual subscription of the pos access terminal to the redis component is [pos access terminal IP: Pos number: *], where "*" is a wildcard; the wildcard matching rule is to match the pos access terminal related to the pos access terminal IP (such as pos access terminal A) according to the actually subscribed subject data.
[0062] See also Figure 3 , the matching of the target POS access terminal according to the target subject data can also be achieved through the following operations: step S300, matching the target POS access terminal identifier in the target subject data with each POS access terminal identifier pre-stored in the redis component; and step S302, if there is a consistent match in the matching result, then the POS access terminal in the redis component that matches the target POS access terminal identifier is determined as the target POS access terminal. In this embodiment, the subsystems that need to communicate are decoupled through the POS access terminal, the transaction system, and the redis component, and each system can be managed independently without affecting the management of the overall system. And the decoupling of each subsystem allows the application programs of each system to focus more on its core functions, effectively improving the development efficiency and quality of each subsystem. Step S106, receiving the transaction result returned by the redis component through the target POS access terminal, and returning the transaction result to the target POS terminal associated with the target POS access terminal.
[0063] In an exemplary embodiment, the transaction result includes a target POS number; Figure 4, the step S106 of receiving the transaction result returned by the redis component through the target POS access terminal and returning the transaction result to the target POS terminal associated with the target POS access terminal may also include steps S400 to S404, wherein: step S400, querying whether there is a target TCP connection associated with the target POS number through the target POS access terminal according to the target POS number in the transaction result; step S402, if it is determined that there is a target TCP connection associated with the target POS number, obtaining the target POS terminal corresponding to the target POS number; and step S404, returning the transaction result to the target POS terminal through the target TCP connection. In this embodiment, if there is no TCP connection associated with the target POS number, the transaction result is stored in the database of the target POS access terminal, and within a preset time period, it is repeatedly queried whether there is a TCP connection associated with the target POS number. If the TCP connection associated with the target POS number is still not found after the preset number of queries, an abnormal result is generated and saved in the database.
[0064] In order to improve the user experience of POS devices, please refer to Figure 5 , the method also includes: step S500, if the target POS access terminal does not receive the transaction result within the preset time, then waiting data is returned to the POS terminal, and the waiting data indicates that the transaction is being processed; and step S502, if the POS access terminal does not receive the transaction result after returning the waiting data to the POS terminal for a preset number of times, then a transaction result query request is generated and sent to the transaction system through the POS access terminal, so that the transaction system responds to the transaction result query request to generate and return the transaction result. Among them, the preset number of times can be 3 times. Through the data processing feedback mechanism of the POS access terminal, the POS access terminal will initiate a transaction result query when the transaction result cannot be queried for three consecutive times. The POS access terminal does not need to repeatedly query the transaction result while waiting for the transaction result; the query of the POS access terminal is reduced, the time for users to wait for transaction results is effectively shortened, and the user experience of the POS device is further improved; and the resource loss of the POS access system and the transaction system is saved.
[0065] The level of different POS terminals determines the speed of message return; please refer to Figure 6The method further includes: step S600, receiving the transaction data sent by multiple POS terminals through the transaction system, wherein the target subject data in each transaction data also includes a corresponding processing level tag; step S602, sorting the multiple transaction data according to each processing level tag through the transaction system; step S604, allocating a corresponding computing power server to each transaction data according to a preset load balancing rule and the processing level tag corresponding to each transaction data through the transaction system; the computing power server is used to process the received transaction data; and step S606, calling the computing power server through the transaction system to process the received transaction data and generate a corresponding transaction result. In this embodiment, different transaction data are processed according to the priority of different information, which can improve the user experience of the POS device to a certain extent.
[0066] Example 2
[0067] Please continue reading Figure 7 , schematically illustrating a block diagram of a POS terminal-based transaction data processing device 70 of the present invention. In this embodiment, the POS terminal-based transaction data processing device 70 may include or be divided into one or more program modules. One or more program modules are stored in a storage medium and executed by one or more processors to implement the present invention and the aforementioned POS terminal-based transaction data processing method. A program module, as referred to in this embodiment of the present invention, refers to a series of computer program instruction segments capable of performing specific functions. Rather than the program itself, it is more suitable for describing the execution process of the POS terminal-based transaction data processing device 70 in a storage medium. The following description will specifically introduce the functions of each program module of this embodiment.
[0068] like Figure 7 As shown, the transaction data processing device 70 based on the POS terminal may include a data sending module 700, a transaction processing module 702, a matching module 704 and a transaction result returning module 706, wherein:
[0069] The data sending module 700 is used to send transaction data to the transaction system through the target POS access terminal, wherein the transaction data carries target subject data, wherein the target subject data includes the target POS access terminal identifier and transaction number data;
[0070] Transaction processing module 702, configured to receive and process the transaction data through the transaction system to obtain a transaction result;
[0071] A matching module 704 is configured to store the transaction result and the target subject data in a redis component through the transaction system, so that the redis component matches the target POS access terminal according to the target subject data and sends the transaction result to the target POS access terminal; and
[0072] The transaction result returning module 706 is configured to receive the transaction result returned by the redis component through the target POS access terminal, and return the transaction result to the target POS terminal associated with the target POS access terminal.
[0073] In an exemplary embodiment, the POS terminal-based transaction data processing device 70 further includes a connection module (not identified). The connection module is further configured to: send a synchronization sequence number data packet to the POS access terminal via the POS terminal to request a connection; wherein the synchronization sequence number data packet is used to request a connection from the POS access terminal; the synchronization sequence number data packet carries the POS terminal identifier; receive the synchronization sequence number data packet via the POS access terminal, and based on the synchronization sequence number data packet, generate and return a handshake confirmation packet to the POS terminal; wherein the handshake confirmation packet indicates that the POS access terminal confirms the establishment of a connection with the POS terminal; receive the handshake confirmation packet via the POS terminal, and based on the handshake confirmation packet, generate and return a confirmation character packet to the POS access terminal to establish a communication connection between the POS terminal and the POS access terminal; wherein the confirmation character packet indicates that the POS terminal has received the connection confirmation request from the POS access terminal and that the POS terminal has confirmed the establishment of a communication connection with the POS access terminal.
[0074] In an exemplary embodiment, the connection module is further configured to: if the POS access terminal does not receive any data sent by the corresponding POS terminal within a preset time period, generate and send a TCP detection packet to the corresponding POS terminal to evaluate whether the corresponding POS terminal is alive.
[0075] In an exemplary embodiment, the matching module 704 is further used to: match the target POS access terminal identifier in the target subject data with each POS access terminal identifier pre-stored in the Redis component; if there is a consistent match in the matching results, the POS access terminal in the Redis component that matches the target POS access terminal identifier is determined as the target POS access terminal.
[0076] In an exemplary embodiment, the transaction result returning module 706 is further used to: query whether there is a target TCP connection associated with the target POS number according to the target POS number in the transaction result through the target POS access terminal; if it is determined that there is a target TCP connection associated with the target POS number, obtain the target POS terminal corresponding to the target POS number; and return the transaction result to the target POS terminal through the target TCP connection.
[0077] In an exemplary embodiment, the transaction data processing device 70 based on the POS terminal further includes a query module (not identified), which is further configured to: if the target POS access terminal does not receive the transaction result within a preset time, return waiting data to the POS terminal, wherein the waiting data indicates that the transaction is being processed; if the POS access terminal does not receive the transaction result after returning the waiting data to the POS terminal a preset number of times, generate and send a transaction result query request to the transaction system through the POS access terminal, so that the transaction system responds to the transaction result query request to generate and return the transaction result.
[0078] In an exemplary embodiment, the transaction data processing based on the POS terminal also includes a sorting module (not identified), and the sorting module is further used to: receive the transaction data sent by multiple POS terminals through the transaction system, and the target subject data in each transaction data also includes a corresponding processing level label; sort the multiple transaction data according to each processing level label through the transaction system; allocate a corresponding computing power server to each transaction data according to a preset load balancing rule and the processing level label corresponding to each transaction data through the transaction system; the computing power server is used to process the received transaction data; and call the computing power server through the transaction system to process the received transaction data and generate a corresponding transaction result.
[0079] Example 3
[0080] See Figure 8 , is a hardware architecture diagram of a computer device 10000 suitable for implementing a transaction data processing method based on a POS terminal according to the third embodiment of the present invention. In this embodiment, the computer device 10000 is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions. The computer device 10000 can be a smart phone, tablet computer, laptop computer, desktop computer, rack server, blade server, tower server or cabinet server (including an independent server, or a server cluster composed of multiple servers), gateway, etc. Figure 8As shown, the computer device 10000 includes at least, but is not limited to, a memory 10010, a processor 10020, and a network interface 10030 that can be interconnected and communicated via a system bus.
[0081] In this embodiment, memory 10010 includes at least one type of computer-readable storage medium, including flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic storage, a magnetic disk, an optical disk, etc. In some embodiments, memory 10010 may be an internal storage unit of computer device 10000, such as a hard disk or internal memory of computer device 10000. In other embodiments, memory 10010 may also be an external storage device of computer device 10000, such as a plug-in hard disk equipped on computer device 10000, a Smart Media Card (SMC), a Secure Digital (SD) card, a flash memory card, etc. Of course, memory 10010 may also include both internal storage units of computer device 10000 and external storage devices thereof. In this embodiment, the memory 10010 is generally used to store the operating system and various application software installed on the computer device 10000, such as the program code of the transaction data processing device 70 based on the POS terminal in the above embodiment. In addition, the memory 10010 can also be used to temporarily store various data that has been output or is about to be output.
[0082] In some embodiments, processor 10020 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. Processor 10020 is typically used to control the overall operation of computer device 10000, such as performing control and processing related to data interaction or communication with computer device 10000. In this embodiment, processor 10020 is used to execute program code stored in memory 10010 or process data, such as executing POS terminal-based transaction data processing device 70 to implement the POS terminal-based transaction data processing method of the above-described embodiment.
[0083] The network interface 10030 may include a wireless network interface or a wired network interface. The network interface 10030 is generally used to establish a communication connection between the computer device 10000 and other electronic devices. For example, the network interface 10030 is used to connect the computer device 10000 to an external terminal via a network, and to establish a data transmission channel and a communication connection between the computer device 10000 and the external terminal. The network may be a wireless or wired network such as an intranet, the Internet, the Global System of Mobile Communications (GSM), Wideband Code Division Multiple Access (WCDMA), a 4G network, a 5G network, Bluetooth, or Wi-Fi.
[0084] It should be pointed out that Figure 8 Computer device 10000 is shown with only components 10010 - 10030 , but it should be understood that implementation of all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.
[0085] In this embodiment, the POS terminal-based transaction data processing device 70 stored in the memory 10010 can also be divided into one or more program modules, and the one or more program modules are stored in the memory 10010 and executed by one or more processors (processor 10020 in this embodiment) to complete the present invention.
[0086] For example, Figure 7 A schematic diagram of program modules for implementing the second embodiment of the POS terminal-based transaction data processing device 70 is shown. In this embodiment, the POS terminal-based transaction data processing device 70 can be divided into a data transmission module 700, a transaction processing module 702, a matching module 704, and a transaction result return module 706. As used herein, a program module refers to a series of computer program instruction segments capable of performing specific functions. It is more suitable than a program to describe the execution process of the POS terminal-based transaction data processing device 70 in the computer device 10000. The specific functions of the program modules 700-706 have been described in detail in the second embodiment and will not be repeated here.
[0087] Example 4
[0088] This embodiment also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by at least one processor, the steps of the transaction data processing method based on the POS terminal in the embodiment are implemented.
[0089] In this embodiment, computer-readable storage media include flash memory, hard disks, multimedia cards, card-type memories (e.g., SD or DX memories), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic storage, magnetic disks, optical disks, servers, app stores, and the like. In some embodiments, the computer-readable storage medium may be an internal storage unit of a computer device, such as the computer device's hard disk or memory. In other embodiments, the computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a flash memory card, and the like. Of course, the computer-readable storage medium may also include both the internal storage unit and external storage devices of the computer device. In this embodiment, the computer-readable storage medium is typically used to store the operating system and various application software installed on the computer device, such as the program code of the jamming detection method described in the embodiment. In addition, the computer-readable storage medium may also be used to temporarily store various types of data that has been output or is about to be output.
[0090] Obviously, those skilled in the art should understand that the various modules or steps of the above-mentioned embodiments of the present invention can be implemented using a general-purpose computing device, they can be concentrated on a single computing device, or distributed across a network composed of multiple computing devices. Alternatively, they can be implemented using program code executable by the computing device, so that they can be stored in a storage device and executed by the computing device. In some cases, the steps shown or described can be performed in a different order than herein, or they can be made into separate integrated circuit modules, or multiple modules or steps can be made into a single integrated circuit module for implementation. Thus, the embodiments of the present invention are not limited to any specific combination of hardware and software.
[0091] The serial numbers of the above embodiments of the present invention are for description only and do not represent the advantages or disadvantages of the embodiments.
[0092] The above are only preferred embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention description and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A transaction data processing method based on POS terminal, characterized in that: include: Sending transaction data to the transaction system through the target POS access terminal, wherein the transaction data carries target subject data, wherein the target subject data includes the target POS access terminal identifier and transaction number data; receiving and processing the transaction data through the transaction system to obtain a transaction result; The transaction result and the target subject data are stored in a redis component through the transaction system, so that the redis component: matches the target POS access terminal according to the target subject data, and sends the transaction result to the target POS access terminal; and receiving the transaction result returned by the redis component through the target POS access terminal, and returning the transaction result to the target POS terminal associated with the target POS access terminal; The method further includes pre-establishing a communication connection between the POS terminal and the POS access terminal, wherein the step of establishing the communication connection includes: Sending a synchronization sequence number data packet to the POS access terminal through the POS terminal to request a connection; wherein the synchronization sequence number data packet is used to request a connection to the POS access terminal; the synchronization sequence number data packet carries the POS terminal identification; The POS access terminal receives the synchronization sequence number data packet, and based on the synchronization sequence number data packet, generates and returns a handshake confirmation packet to the POS terminal; wherein the handshake confirmation packet indicates that the POS access terminal confirms the establishment of a connection with the POS terminal; The POS terminal receives the handshake confirmation packet, generates and returns a confirmation character packet to the POS access terminal based on the handshake confirmation packet, so that the POS terminal establishes a communication connection with the POS access terminal; wherein the confirmation character packet indicates that the POS terminal receives the confirmation connection request from the POS access terminal and that the POS terminal confirms the establishment of a communication connection with the POS access terminal; The method further comprises: Receiving the transaction data sent by a plurality of POS terminals through the transaction system, wherein the target subject data in each transaction data further includes a corresponding processing level tag; sorting the plurality of transaction data according to each processing level tag by the transaction system; The transaction system allocates a corresponding computing server to each transaction data according to a preset load balancing rule and a processing level label corresponding to each transaction data; the computing server is used to process the received transaction data; The transaction system calls the computing power server to process the received transaction data and generate corresponding transaction results; The target subject data is dynamically matched through the publish-subscribe mode of Redis, and the target POS access terminal identifier is bound to the TCP connection information pre-stored in Redis.
2. The transaction data processing method based on POS terminal according to claim 1, characterized in that: After the POS terminal confirms that a communication connection has been established with the POS access terminal, the method further includes: If the POS access terminal does not receive any data sent by the corresponding POS terminal within a preset time period, a TCP detection packet is generated and sent to the corresponding POS terminal to evaluate whether the corresponding POS terminal is alive.
3. The transaction data processing method based on POS terminal according to claim 2, characterized in that: The matching of the target POS access terminal according to the target subject data further includes: Match the target POS access terminal identifier in the target subject data with each POS access terminal identifier pre-stored in the redis component; If there is a matching result, the POS access terminal in the Redis component that matches the target POS access terminal identifier is determined as the target POS access terminal.
4. The transaction data processing method based on POS terminal according to claim 3, characterized in that: The method further comprises: receiving the transaction result returned by the redis component through the target POS access terminal, and returning the transaction result to the target POS terminal associated with the target POS access terminal; Querying, through the target POS access terminal, whether there is a target TCP connection associated with the target POS number according to the target POS number in the transaction result; If it is determined that there is a target TCP connection associated with the target POS number, obtaining a target POS terminal corresponding to the target POS number; The transaction result is returned to the target POS terminal via the target TCP connection.
5. The transaction data processing method based on POS terminal according to claim 1, characterized in that: The method further comprises: If the target POS access terminal does not receive the transaction result within the preset time, it returns waiting data to the POS terminal, and the waiting data indicates that the transaction is being processed; If the POS access terminal does not receive the transaction result after returning the waiting data to the POS terminal for a preset number of times, a transaction result query request is generated and sent to the transaction system through the POS access terminal, so that the transaction system responds to the transaction result query request to generate and return the transaction result.
6. A transaction data processing device based on a POS terminal, characterized in that: include: A data sending module is used to send transaction data to the transaction system through the target POS access terminal, wherein the transaction data carries target subject data, wherein the target subject data includes the target POS access terminal identifier and transaction number data; A transaction processing module, configured to receive and process the transaction data through the transaction system to obtain a transaction result; A matching module, configured to store the transaction result and the target subject data in a redis component through the transaction system, so that the redis component: matches the target POS access terminal according to the target subject data, and sends the transaction result to the target POS access terminal; and A transaction result returning module, configured to receive the transaction result returned by the redis component through the target POS access terminal, and return the transaction result to a target POS terminal associated with the target POS access terminal; A connection module, configured to send a synchronization sequence number data packet to the POS access terminal through the POS terminal to request a connection; wherein the synchronization sequence number data packet is used to request a connection to the POS access terminal; and the synchronization sequence number data packet carries the POS terminal identifier; The POS access terminal receives the synchronization sequence number data packet, and based on the synchronization sequence number data packet, generates and returns a handshake confirmation packet to the POS terminal; wherein the handshake confirmation packet indicates that the POS access terminal confirms the establishment of a connection with the POS terminal; The connection module is further configured to receive the handshake confirmation packet through the POS terminal, and based on the handshake confirmation packet, generate and return a confirmation character packet to the POS access terminal, so that the POS terminal establishes a communication connection with the POS access terminal; wherein the confirmation character packet indicates that the POS terminal has received the confirmation connection request from the POS access terminal, and the POS terminal confirms the establishment of a communication connection with the POS access terminal; a sorting module, configured to receive the transaction data sent by a plurality of POS terminals through the transaction system, wherein the target subject data in each transaction data further includes a corresponding processing level tag; sorting the plurality of transaction data according to each processing level tag by the transaction system; The transaction system allocates a corresponding computing server to each transaction data according to a preset load balancing rule and a processing level label corresponding to each transaction data; the computing server is used to process the received transaction data; The transaction system calls the computing power server to process the received transaction data and generate corresponding transaction results; The target subject data is dynamically matched through the publish-subscribe mode of Redis, and the target POS access terminal identifier is bound to the TCP connection information pre-stored in Redis.
7. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the transaction data processing method based on the POS terminal according to any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which can be executed by at least one processor to enable the at least one processor to perform the steps of the transaction data processing method based on the POS terminal as claimed in any one of claims 1 to 5.
Citation Information
Patent Citations
Transaction information processing method and device, computer equipment and computer readable medium
CN112333083A