Data processing method, device, equipment and storage medium
By processing response data in real-time in data push technology, determining interfaces and objects, finding cached data and processing it, the need for complex real-time data push is solved and data processing is unified and efficient.
Patent Information
- Application Number
- CN202111560025.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-17
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2041-12-17
AI Technical Summary
Existing data push technology cannot meet the needs of complex real-time data push, especially when it comes to complex data processing, inconsistent push formats, transmission interruptions, and difficult data association.
When receiving a data response through the real-time push component, determine the response callback interface, convert it into a business response object, extract the unique identifier of the data, find the cached data object, determine the transmission status based on the response callback interface, call the preset interface for data processing, and use multi-threading Processing improves efficiency.
It achieves unified formatting of data processing, improves the real-time and efficiency of data transmission, meets complex real-time push requirements, and ensures that each business process works independently without interfering with each other.
Smart Images

Figure CN114254027B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a data processing method, device, equipment and storage medium. Background Art
[0002] Nowadays, data push is a common technical means, mainly used to transmit data to the client. According to different implementation methods, the existing data push can generally be divided into two categories: Pull: the client regularly pulls data from the server; Push: the server actively pushes data to the client.
[0003] Among them, the Pull method is generally implemented by periodic polling. However, due to the time interval in the polling process, the data cannot be guaranteed to be real-time, and cannot meet the requirements of high real-time performance. Push is generally implemented by long connection, such as Websocket long connection. However, the existing Push method has poor effect in actual use and has the following defects: no unified data format is set in the data push process, and data processing is complicated; data push is pushed to a unified callback interface, and multiple matches are required when there are many push demands, and data processing is slow; if a large amount of data needs to be transmitted to the client, it is easy to cause transmission interruption in one data push, and if it is divided into multiple transmissions, it is difficult to associate the data.
[0004] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention
[0005] The main purpose of the present invention is to provide a data processing method, device, equipment and storage medium, aiming to solve the technical problem that the existing technology cannot meet the complex real-time data push requirements.
[0006] To achieve the above object, the present invention provides a data processing method, which comprises the following steps:
[0007] When receiving the business response data fed back by the data response end through the real-time push component, determining the response callback interface corresponding to the business response data;
[0008] Convert the business response data into a business response object, and extract a unique data identifier from the business response object;
[0009] Searching for a corresponding cache data object according to the data unique identifier;
[0010] If the response callback interface is a transmission end interface, a business data object is determined according to the business response object and the cache data object, and a preset business interface is called according to the business data object to perform data processing.
[0011] Optionally, after searching for a corresponding cache data object according to the data unique identifier, the method further includes:
[0012] If the response callback interface is a data adding interface, extracting the data to be processed from the business response object;
[0013] The cache data object is updated according to the data to be processed.
[0014] Optionally, after searching for a corresponding cache data object according to the data unique identifier, the method further includes:
[0015] If the response callback interface is a data exception interface, extracting an exception identification code from the business response object;
[0016] Searching for corresponding abnormal prompt information in a preset abnormal prompt information database according to the abnormal identification code;
[0017] The cache data object corresponding to the data unique identifier in the preset data cache space is cleared, and the abnormal prompt information is displayed.
[0018] Optionally, if the response callback interface is a transmission end interface, determining a business data object according to the business response object and the cached data object, and calling a preset business interface for data processing according to the business data object, including:
[0019] If the response callback interface is a transmission end interface, determining the business data object according to the business response object and the cache data object;
[0020] Determine the number of data items of the business data in the business data object;
[0021] If the number of data items is greater than or equal to a preset threshold, determining the number of threads according to the number of data items;
[0022] Acquire multiple data processing threads from a preset data thread pool according to the number of threads;
[0023] The multiple data processing threads collaborate to call a preset business interface according to the business data object to perform data processing.
[0024] Optionally, before searching for a corresponding cache data object according to the data unique identifier, the method further includes:
[0025] If it is detected that the preset data processing mode is the high-efficiency processing mode, detecting whether there is an object processing thread corresponding to the data unique identifier in the preset object processing thread pool;
[0026] If so, extracting the object processing thread from the preset object processing thread pool;
[0027] Correspondingly, the step of searching for the corresponding cache data object according to the data unique identifier includes:
[0028] The object processing thread searches for a corresponding cache data object in a preset data cache space according to the data unique identifier.
[0029] Optionally, when receiving the service response data fed back by the data response end, before obtaining the response callback interface corresponding to the service response data, the method further includes:
[0030] When interacting with the data response end, obtain the parameters to be sent and the callback interface information;
[0031] Generate a unique data identifier according to the parameters to be sent by using a preset identifier generation algorithm;
[0032] Constructing a service request object according to the parameters to be sent, the callback interface information, and the data unique identifier;
[0033] Convert the business request object into a new format to obtain business request data;
[0034] The service request data is pushed to the data response end through a real-time push component, so that the data response end feeds back service response data according to the service request data.
[0035] Optionally, the generating a unique data identifier according to the to-be-sent parameter by using a preset identifier generation algorithm may include:
[0036] Get the current system time and preset device ID;
[0037] splicing the current system time, the preset device identifier and the parameters to be sent in a preset order to obtain spliced data;
[0038] A data unique identifier is generated according to the spliced data using a preset identifier generation algorithm.
[0039] In addition, to achieve the above object, the present invention also provides a data processing device, which includes the following modules:
[0040] A data transmission module, used to determine a response callback interface corresponding to the business response data when receiving the business response data fed back by the data response end through the real-time push component;
[0041] A data extraction module, used to convert the business response data into a business response object and extract a data unique identifier from the business response object;
[0042] A data search module, used to search for a corresponding cache data object according to the data unique identifier;
[0043] The data processing module is used to determine the business data object according to the business response object and the cache data object if the response callback interface is a transmission end interface, and call a preset business interface for data processing according to the business data object.
[0044] In addition, to achieve the above-mentioned purpose, the present invention also proposes a data processing device, which includes: a processor, a memory, and a data processing program stored in the memory and executable on the processor, and the data processing program implements the steps of the data processing method described above when executed by the processor.
[0045] In addition, to achieve the above-mentioned purpose, the present invention also proposes a computer-readable storage medium, on which a data processing program is stored, and when the data processing program is executed, the steps of the data processing method described above are implemented.
[0046] The present invention reduces the difficulty of data processing by converting business response data into a business response object of a unified format when receiving business response data, and can also extract a data unique identifier from the business response object, search for a corresponding cached data object according to the data unique identifier, and then determine whether the data transmission is completed according to a response callback interface. When the transmission is completed, a business data object containing all the business data of the business process corresponding to the data unique identifier is generated according to the cached data object and the business response object, and subsequent business processes are executed according to the business data object, thereby realizing the independent operation of each business process and preventing the data of each business process from interfering with each other, thereby meeting complex real-time push requirements. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 It is a schematic diagram of the structure of an electronic device in a hardware operating environment involved in an embodiment of the present invention;
[0048] Figure 2 It is a flowchart of a first embodiment of a data processing method of the present invention;
[0049] Figure 3 It is a flowchart of a second embodiment of a data processing method of the present invention;
[0050] Figure 4 It is a structural block diagram of the first embodiment of the data processing device of the present invention.
[0051] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0052] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0053] Reference Figure 1 , Figure 1 The present invention is a schematic diagram of the data processing device structure of the hardware operating environment involved in the embodiment of the present invention.
[0054] like Figure 1 As shown, the electronic device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (Wireless-Fidelity, WI-FI) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM), or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk storage. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0055] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation on the electronic device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0056] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a data processing program.
[0057] exist Figure 1 In the electronic device shown, the network interface 1004 is mainly used for data communication with a network server; the user interface 1003 is mainly used for data interaction with a user; the processor 1001 and the memory 1005 in the electronic device of the present invention can be set in a data processing device, and the electronic device calls the data processing program stored in the memory 1005 through the processor 1001, and executes the data processing method provided by an embodiment of the present invention.
[0058] The embodiment of the present invention provides a data processing method, referring to Figure 2 , Figure 2 The figure is a flow chart of a first embodiment of a data processing method of the present invention.
[0059] In this embodiment, the data processing method includes the following steps:
[0060] Step S10: when receiving the business response data fed back by the data response end through the real-time push component, determining the response callback interface corresponding to the business response data.
[0061] It should be noted that the executor of this embodiment of the present invention may be the data processing device, and the data processing device may be an electronic device such as a personal computer or a server, or other devices that can achieve the same or similar functions. This embodiment does not impose any restrictions on this. In this embodiment and the following embodiments, the data processing method of the present invention is described by taking the data processing device as an example.
[0062] It should be noted that the data response end is connected to the data processing device and can push data to the terminal device of the data processing device. The real-time push component can be a functional component pre-set for real-time push based on websocket, and a data push interface and multiple response callback interfaces can be set in the real-time push component. The response callback interface corresponding to the business response data can be the response callback interface of the real-time push component receiving the business response data.
[0063] Step S20: converting the business response data into a business response object, and extracting a data unique identifier from the business response object.
[0064] It should be noted that the data processing device and the data response end have pre-agreed on a unified data push format. After receiving the business response data, the data processing device can convert the business response data into a business response object according to the pre-agreed data format. The data unique identifier can be an identifier used to mark the batch to which the data belongs. If the data unique identifiers of two business response objects are the same, it means that the data contained in the two business response objects are business data of the same batch.
[0065] In actual use, when receiving the business response data, the data processing device will first perform a data format check on the business response data according to the pre-agreed data format. Only when the data format check passes will the received business response data be converted into a business response object. When the data check passes, the legal range of the data can also be obtained, and the legality of the data contained in the business response object can be checked according to the legal range of the data. Only when it is legal will the subsequent steps be executed, for example: the length of the unique identifier of the data contained in the business response object is detected. If the length is consistent with the identifier length set in the legal range of the data, the data in the business response object is determined to be legal. If not, the data in the business response object is determined to be illegal.
[0066] Step S30: searching for the corresponding cache data object according to the data unique identifier.
[0067] It should be noted that the cache data object may be a stream object, and the cache data object may store business data of the same batch as the business response object. Searching for the corresponding cache data object according to the data unique identifier may be searching for the corresponding cache data object in a preset cache space according to the data unique identifier, wherein the preset cache space may store multiple cache data objects with different data unique identifiers.
[0068] It is understandable that if the received business response data is the first data in a batch of business data corresponding to the data unique identifier, the cache data object corresponding to the data unique identifier does not exist in the preset cache space. At this time, a blank cache data object can be created based on the data unique identifier.
[0069] Furthermore, for the efficiency of data processing, the following steps may be included before step S30 in this embodiment:
[0070] If it is detected that the preset data processing mode is the high-efficiency processing mode, detecting whether there is an object processing thread corresponding to the data unique identifier in the preset object processing thread pool;
[0071] If so, extracting the object processing thread from the preset object processing thread pool;
[0072] Accordingly, the step S30 may include:
[0073] The object processing thread searches for a corresponding cache data object in a preset data cache space according to the data unique identifier.
[0074] It should be noted that since the data processing device may communicate with multiple different data response terminals at the same time, and each data response terminal may feedback business response data with different data unique identifiers to the data processing device, using only one thread for processing may result in slower data processing progress. If the data processing device has sufficient device resources, multiple object processing threads can be set in the data processing device, and processing can be performed collaboratively through multiple object processing threads.
[0075] In actual use, detecting whether there is an object processing thread corresponding to the data unique identifier in the preset object processing thread pool can be done by searching for the corresponding mapping record in the thread identifier mapping table corresponding to the preset object processing thread pool based on the data unique identifier. If the corresponding mapping record is found, it is determined that there is an object processing thread corresponding to the data unique identifier. If the corresponding mapping record is not found, it is determined that there is no object processing thread corresponding to the data unique identifier.
[0076] In the specific implementation, if there is no object processing thread corresponding to the data unique identifier in the preset object processing thread pool, an idle object processing thread or an object processing thread with a low load can be obtained from the preset object processing thread pool, and a mapping record is generated based on the thread identifier and data unique identifier of the obtained object processing thread, and added to the thread identifier mapping table corresponding to the preset object processing thread pool.
[0077] It can be understood that if there is an object processing thread corresponding to the data unique identifier in the preset object processing thread pool, it means that the object processing thread has previously processed the business data corresponding to the data unique identifier. Therefore, the object processing thread can be directly obtained and subsequent steps can be executed through the object processing thread.
[0078] Step S40: If the response callback interface is a transmission end interface, a business data object is determined according to the business response object and the cache data object, and a preset business interface is called according to the business data object to perform data processing.
[0079] It should be noted that the preset business interface can be a pre-set functional interface for executing business logic. If the response callback interface is a transmission end interface, it means that the business data of the same batch corresponding to the data unique identifier has been pushed. Therefore, the business data object can be determined according to the business response object and the cached data object, and then the preset business interface is called according to the business data object to process the data and execute subsequent business processes.
[0080] In actual use, determining the business data object according to the business response object and the cache data object may be to read the business data contained in the business response object, add the business data to the cache data object, and after the addition is completed, use the cache data object as the business data object. Calling the preset business interface for data processing according to the business data object may be to read the business data contained in the business data object, and use the read business data as an interface call parameter to call the preset business interface for data processing.
[0081] Further, in order to improve the execution efficiency of data processing, step S40 in this embodiment may include:
[0082] If the response callback interface is a transmission end interface, determining the business data object according to the business response object and the cache data object;
[0083] Determine the number of data items of the business data in the business data object;
[0084] If the number of data items is greater than or equal to a preset threshold, determining the number of threads according to the number of data items;
[0085] Acquire multiple data processing threads from a preset data thread pool according to the number of threads;
[0086] The multiple data processing threads collaborate to call a preset business interface according to the business data object to perform data processing.
[0087] It should be noted that determining the business data object based on the business response object and the cache data object may be to read the business data contained in the business response object, add the business data to the cache data object, and after the addition is completed, use the cache data object as the business data object.
[0088] In actual use, since the business data object is a stream object, the number of business data in the business data object can be determined by using the function interface preset by the stream object. Of course, the business data object can also be converted into a collection, and then the number of business data can be determined according to the total number of collection indexes.
[0089] It should be noted that the preset threshold value may be an integer value preset by the administrator of the data processing device. Determining the number of threads according to the number of data items may be to divide the number of data items by the preset threshold value to obtain a ratio and a remainder, and determine the number of threads according to the ratio and the remainder. For example, assuming that the preset threshold value is 10 and the number of data items is 112, the value obtained by dividing the number of data items by the preset threshold value is 11, and the remainder is 2, wherein the remainder>0, and the number of threads is 11+1=12.
[0090] In actual use, obtaining multiple data processing threads in a preset data thread pool according to the number of threads may be obtaining multiple data processing threads in a preset data thread pool whose number is the same as the number of threads. Collaborating with multiple data processing threads to call a preset business interface according to the business data object for data processing may be reading business data in the business data object, distributing the business data evenly to the multiple data processing threads, so that each data processing thread uses the received business data as an interface call parameter to call the preset business interface for data processing.
[0091] It is understandable that if the number of data items is greater than the preset threshold, it means that the amount of data is large. If only one thread is used to process the data, the overall execution efficiency may be slow. In order to improve the execution efficiency, data processing can be performed collaboratively by multiple data processing threads.
[0092] Further, in order to determine whether the service data has been transmitted completely when the service response data is received, and to manage the previously transmitted service data in a unified manner when the transmission is not completed, after step S30 in this embodiment, the following is further included:
[0093] If the response callback interface is a data adding interface, extracting the data to be processed from the business response object;
[0094] The cache data object is updated according to the data to be processed.
[0095] It should be noted that if the response callback interface is a data adding interface, it means that the business data of the same batch corresponding to the data unique identifier has not been transmitted yet, and other business data of the same batch corresponding to the data unique identifier may be pushed to the data processing device in the future. Therefore, the data to be processed is extracted from the business response object at this time, and then the cached data object is updated according to the data to be processed. The data to be processed may be the business data contained in the business response object, and updating the cached data object according to the data to be processed may be adding the data to be processed to the cached data object.
[0096] It is understandable that since the business data of the same batch corresponding to the data unique identifier has not been completely transmitted to the data processing device, it is only necessary to cache the data and continue to wait for the data response end to push subsequent business data.
[0097] Furthermore, in order to facilitate the user to check the cause of the abnormality and ensure that the data processing device can operate normally, after step S30 in this embodiment, the following steps are further included:
[0098] If the response callback interface is a data exception interface, extracting an exception identification code from the business response object;
[0099] Searching for corresponding abnormal prompt information in a preset abnormal prompt information database according to the abnormal identification code;
[0100] The cache data object corresponding to the data unique identifier in the preset data cache space is cleared, and the abnormal prompt information is displayed.
[0101] It should be noted that if the response callback interface is a data exception interface, it means that the transmission of this business data is abnormal, that is, the data response end may have an internal error in the data processing process, and subsequent data cannot be pushed to the data processing device. Therefore, at this time, the exception identification code can be extracted from the business response object, and then the corresponding exception prompt information can be found in the preset exception prompt information library according to the exception identification code, and the exception prompt information can be displayed to prompt the user that the business process corresponding to the data unique identifier has failed to execute, so that the user can check the exception and perform corresponding processing.
[0102] It is understandable that due to the abnormal transmission of business data corresponding to the data unique identifier, the business corresponding to the data unique identifier has become difficult to continue. At this time, if the cache data object corresponding to the data unique identifier in the preset cache space is not processed, the cache data object will continue to occupy device resources. As the data processing device continues to run, the amount of abnormal business data increases, and the device resources of the data processing device will be occupied in large quantities, and may even affect the normal operation of the data processing device. Therefore, in order to ensure the normal operation of the data processing device, it is necessary to clear the cache data object corresponding to the data unique identifier in the preset data cache space to avoid a large amount of device resources of the data processing device being occupied.
[0103] This embodiment reduces the difficulty of data processing by converting business response data into a business response object in a unified format when receiving business response data. It can also extract the data unique identifier from the business response object, search for the corresponding cache data object according to the data unique identifier, and then determine whether the data transmission is completed according to the response callback interface. When the transmission is completed, a business data object containing all the business data of the business process corresponding to the data unique identifier is generated according to the cache data object and the business response object, and subsequent business processes are executed according to the business data object, thereby realizing the independent operation of each business process and preventing the data of each business process from interfering with each other, thereby meeting complex real-time push requirements.
[0104] refer to Figure 3 , Figure 3 FIG. 4 is a flow chart of a second embodiment of a data processing method according to the present invention.
[0105] Based on the first embodiment, the data processing method of this embodiment further includes, before step S10:
[0106] Step S01: when interacting with the data response end, obtaining the parameters to be sent and the callback interface information.
[0107] It should be noted that the parameters to be sent may be data that needs to be pushed to the data response end when data interaction is performed at the data response end. The callback interface information may include information such as the interface access address, interface function, and interface data format of each response callback interface.
[0108] Step S02: Generate a unique data identifier according to the parameters to be sent using a preset identifier generation algorithm.
[0109] It should be noted that generating a unique data identifier according to the parameters to be sent by using a preset identifier generation algorithm may be inputting the parameters to be sent as parameters into the preset identifier generation algorithm for calculation, thereby obtaining the unique data identifier. The preset identifier generation algorithm may be an MD5 algorithm or a similar algorithm.
[0110] Furthermore, in order to ensure the uniqueness of the data unique identifier, step S02 in this embodiment may include:
[0111] Get the current system time and preset device ID;
[0112] splicing the current system time, the preset device identifier and the parameters to be sent in a preset order to obtain spliced data;
[0113] A data unique identifier is generated according to the spliced data using a preset identifier generation algorithm.
[0114] It should be noted that the current system time may be the system time in the data processing device at the current time. The preset device identifier may be a unique identifier assigned to the data processing device by the administrator of the data processing device. The preset sequence may be set by the administrator of the data processing device according to actual needs, for example, the preset sequence is set to preset device identifier-current system time-parameters to be sent.
[0115] It is understandable that the same device will basically not communicate with another device with the same parameters at the same time. Therefore, by combining the current system time, the preset device identifier and the parameters to be sent for splicing, and then generating a data unique identifier based on the spliced data through a preset identifier generation algorithm, the uniqueness of the generated data unique identifier can be guaranteed, thereby avoiding the existence of the same data unique identifier, which leads to confusion in business data.
[0116] In actual use, the current system time can also be added to the business request object and sent to the data response end. When the data response end receives the business request data corresponding to the business request object, it can also extract the current system time and the parameters to be sent from the business request data, and then generate a data unique identifier in the same way as the data processing device based on the preset device identifier of the pre-stored data processing device, and compare the data unique identifier in the received business request data with the generated data unique identifier to determine whether the received business request data is forged data.
[0117] In a specific implementation, if only the current system time, the preset device identifier and the parameters to be sent are spliced in a preset order to obtain spliced data, and then a data unique identifier is generated based on the spliced data, the difficulty of cracking the data unique identifier will be relatively low. Therefore, the current system time, the preset device identifier and the parameters to be sent can be encrypted according to a preset encryption algorithm to obtain a time encrypted ciphertext, an identifier encrypted ciphertext and a parameter encrypted ciphertext, and then the time encrypted ciphertext, the identifier encrypted ciphertext and the parameter encrypted ciphertext are spliced in a preset order to obtain spliced ciphertext data, and then a data unique identifier is generated based on the spliced ciphertext data through a preset identifier generation algorithm, thereby increasing the difficulty of cracking the data unique identifier. Among them, the preset encryption algorithm can be an irreversible encryption algorithm, such as: MD5, HMAC, SHA1, SHA-224, SHA-256 and other algorithms.
[0118] Step S03: construct a service request object according to the parameters to be sent, the callback interface information, and the data unique identifier.
[0119] It should be noted that constructing a business request object according to the parameters to be sent, the callback interface information and the data unique identifier may be adding the parameters to be sent, the callback interface information and the data unique identifier to a preset request object template, thereby obtaining the business request object. The preset request object template may be determined according to a code file of a preset business request object.
[0120] Step S04: convert the format of the service request object to obtain service request data.
[0121] It should be noted that converting the format of the service request object to obtain the service request data may be formatting the service request object into a pre-agreed data transmission format, thereby obtaining the service request object.
[0122] Step S05: Pushing the service request data to the data response end through a real-time push component, so that the data response end feeds back service response data according to the service request data.
[0123] In actual use, the business request data can be pushed to the data response end by calling the data push interface in the real-time push component. When the data response end receives the business request data, it will process the data according to the parameters to be sent in the business request data, and bind the generated business data with the data unique identifier when the data processing is completed, and push the business data to the corresponding response callback interface based on the callback interface information in the business request data.
[0124] This embodiment obtains the parameters to be sent and the callback interface information when interacting with the data response end; generates a data unique identifier according to the parameters to be sent through a preset identifier generation algorithm; constructs a business request object according to the parameters to be sent, the callback interface information, and the data unique identifier; converts the format of the business request object to obtain business request data; and pushes the business request data to the data response end through a real-time push component, so that the data response end can feedback business response data according to the business request data. Since the data unique identifier is generated according to the parameters to be sent, and the data unique identifier, the parameters to be sent, and the callback interface information are pushed to the data response end together, the data response end can process data according to the parameters to be sent and generate business data, and select the corresponding response callback interface according to actual needs, bind the business data with the data unique identifier and push it to the corresponding response callback interface in the data processing device, so that the data processing device can execute subsequent business processes, ensuring that the data processing device can efficiently process data.
[0125] In addition, an embodiment of the present invention further provides a storage medium, on which a data processing program is stored. When the data processing program is executed by a processor, the steps of the data processing method described above are implemented.
[0126] Reference Figure 4 , Figure 4 It is a structural block diagram of the first embodiment of the data processing device of the present invention.
[0127] like Figure 4 As shown, the data processing device proposed in the embodiment of the present invention includes:
[0128] The data transmission module 10 is used to determine the response callback interface corresponding to the business response data when receiving the business response data fed back by the data response end through the real-time push component;
[0129] A data extraction module 20, used to convert the business response data into a business response object, and extract a data unique identifier from the business response object;
[0130] A data search module 30, used to search for a corresponding cache data object according to the data unique identifier;
[0131] The data processing module 40 is used to determine the business data object according to the business response object and the cache data object if the response callback interface is a transmission end interface, and call a preset business interface to perform data processing according to the business data object.
[0132] This embodiment reduces the difficulty of data processing by converting business response data into a business response object in a unified format when receiving business response data. It can also extract the data unique identifier from the business response object, search for the corresponding cache data object according to the data unique identifier, and then determine whether the data transmission is completed according to the response callback interface. When the transmission is completed, a business data object containing all the business data of the business process corresponding to the data unique identifier is generated according to the cache data object and the business response object, and subsequent business processes are executed according to the business data object, thereby realizing the independent operation of each business process and preventing the data of each business process from interfering with each other, thereby meeting complex real-time push requirements.
[0133] Furthermore, the data processing module 40 is also used to extract the data to be processed from the business response object if the response callback interface is a data adding interface; and update the cached data object according to the data to be processed.
[0134] Furthermore, the data processing module 40 is also used to extract the exception identification code from the business response object if the response callback interface is a data exception interface; search for corresponding exception prompt information in a preset exception prompt information library according to the exception identification code; clear the cache data object corresponding to the data unique identifier in the preset data cache space, and display the exception prompt information.
[0135] Furthermore, the data processing module 40 is also used to determine the business data object based on the business response object and the cache data object if the response callback interface is a transmission end interface; determine the number of business data in the business data object; if the number of data is greater than or equal to a preset threshold, determine the number of threads based on the number of data; obtain multiple data processing threads from a preset data thread pool based on the number of threads; and collaboratively call the preset business interface to perform data processing according to the business data object through the multiple data processing threads.
[0136] Furthermore, the data search module 30 is further configured to detect whether there is an object processing thread corresponding to the data unique identifier in the preset object processing thread pool if it is detected that the preset data processing mode is the high-efficiency processing mode; if so, extract the object processing thread from the preset object processing thread pool;
[0137] The data search module 30 is further configured to search for a corresponding cache data object in a preset data cache space according to the data unique identifier through the object processing thread.
[0138] Furthermore, the data transmission module 10 is also used to obtain the parameters to be sent and the callback interface information when interacting with the data response end; generate a data unique identifier according to the parameters to be sent through a preset identifier generation algorithm; construct a business request object according to the parameters to be sent, the callback interface information, and the data unique identifier; convert the format of the business request object to obtain business request data; and push the business request data to the data response end through a real-time push component, so that the data response end feeds back business response data according to the business request data.
[0139] Furthermore, the data transmission module 10 is also used to obtain the current system time and the preset device identifier; splice the current system time, the preset device identifier and the parameters to be sent in a preset order to obtain spliced data; and generate a data unique identifier based on the spliced data through a preset identifier generation algorithm.
[0140] It should be understood that the above is only an example and does not constitute any limitation on the technical solution of the present invention. In specific applications, technicians in this field can make settings as needed, and the present invention does not limit this.
[0141] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of the present invention. In practical applications, technicians in this field can select part or all of them according to actual needs to achieve the purpose of the present embodiment, and no limitation is made here.
[0142] In addition, for technical details that are not described in detail in this embodiment, reference can be made to the data processing method provided in any embodiment of the present invention, and will not be repeated here.
[0143] In addition, it should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0144] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0145] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory (ROM) / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0146] 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 specification 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 data processing method, characterized in that: The data processing method comprises the following steps: When receiving the business response data fed back by the data response end through the real-time push component, determining the response callback interface corresponding to the business response data; Convert the business response data into a business response object, and extract a unique data identifier from the business response object; Searching for a corresponding cache data object according to the data unique identifier; If the response callback interface is a transmission end interface, a business data object is determined according to the business response object and the cache data object, and a preset business interface is called according to the business data object to perform data processing.
2. The data processing method according to claim 1, characterized in that: After searching the corresponding cache data object according to the data unique identifier, the method further includes: If the response callback interface is a data adding interface, extracting the data to be processed from the business response object; The cache data object is updated according to the data to be processed.
3. The data processing method according to claim 1, characterized in that: After searching the corresponding cache data object according to the data unique identifier, the method further includes: If the response callback interface is a data exception interface, extracting an exception identification code from the business response object; According to the abnormal identification code, searching for corresponding abnormal prompt information in a preset abnormal prompt information library; The cache data object corresponding to the data unique identifier in the preset data cache space is cleared, and the abnormal prompt information is displayed.
4. The data processing method according to claim 1, characterized in that: If the response callback interface is a transmission end interface, determining a business data object according to the business response object and the cache data object, and calling a preset business interface for data processing according to the business data object, including: If the response callback interface is a transmission end interface, determining the business data object according to the business response object and the cache data object; Determine the number of data items of the business data in the business data object; If the number of data items is greater than or equal to a preset threshold, determining the number of threads according to the number of data items; Acquire multiple data processing threads from a preset data thread pool according to the number of threads; The multiple data processing threads collaborate to call a preset business interface according to the business data object to perform data processing.
5. The data processing method according to claim 1, characterized in that: Before searching for the corresponding cache data object according to the data unique identifier, the method further includes: If it is detected that the preset data processing mode is the high-efficiency processing mode, detecting whether there is an object processing thread corresponding to the data unique identifier in the preset object processing thread pool; If so, extracting the object processing thread from the preset object processing thread pool; Correspondingly, the step of searching for the corresponding cache data object according to the data unique identifier includes: The object processing thread searches for a corresponding cache data object in a preset data cache space according to the data unique identifier.
6. The data processing method according to any one of claims 1 to 5, characterized in that: When receiving the service response data fed back by the data response end, before obtaining the response callback interface corresponding to the service response data, the method further includes: When interacting with the data response end, obtain the parameters to be sent and the callback interface information; Generate a unique data identifier according to the parameters to be sent by using a preset identifier generation algorithm; Constructing a service request object according to the parameters to be sent, the callback interface information, and the data unique identifier; Convert the business request object into a new format to obtain business request data; The service request data is pushed to the data response end through a real-time push component, so that the data response end feeds back service response data according to the service request data.
7. The data processing method according to claim 6, characterized in that: Generating a unique data identifier according to the to-be-sent parameter by using a preset identifier generation algorithm may include: Get the current system time and preset device ID; splicing the current system time, the preset device identifier and the parameters to be sent in a preset order to obtain spliced data; A data unique identifier is generated according to the spliced data using a preset identifier generation algorithm.
8. A data processing device, characterized in that: The data processing device comprises the following modules: A data transmission module, used to determine a response callback interface corresponding to the business response data when receiving the business response data fed back by the data response end through the real-time push component; A data extraction module, used to convert the business response data into a business response object and extract a data unique identifier from the business response object; A data search module, used to search for a corresponding cache data object according to the data unique identifier; The data processing module is used to determine the business data object according to the business response object and the cache data object if the response callback interface is a transmission end interface, and call a preset business interface for data processing according to the business data object.
9. A data processing device, characterized in that: The data processing device comprises: a processor, a memory, and a data processing program stored in the memory and executable on the processor, wherein the data processing program implements the steps of the data processing method according to any one of claims 1 to 7 when executed by the processor.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a data processing program, and when the data processing program is executed, the steps of the data processing method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Data processing method, device and equipment and storage medium
CN112162987A
Business processing request processing method and module and computer readable storage medium
CN113704297A
