Data Encapsulation Method, Device, Application Server and Storage Medium
By using the service platform fields to determine the processing interface in the application server, and calling the parent and child class methods to verify and encapsulate the order data, the complex code problems caused by different formats of third-party service order data are solved, and unified encapsulation and code reuse are achieved.
Patent Information
- Application Number
- CN202111275205.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-29
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2041-10-29
AI Technical Summary
In the prior art, when software applications access multiple third-party services, due to the different order data formats of each third-party service, developers need to set a set of functional codes for each order data, which makes the code logic complex and difficult to maintain.
After receiving order information in the application server, the service platform field is used to determine the processing interface, the parent class method is called to verify and decrypt the signature and encryption fields, and encapsulate it in combination with the subclass method to generate unified order data.
It realizes unified packaging and processing of order data of different third-party services, reducing the code complexity of software applications, and improving code reusability and maintenance efficiency.
Smart Images

Figure CN113918130B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of big data technology, and particularly relates to a data encapsulation method, device, application server, and storage medium. Background Art
[0002] In today's software environment with rich scenarios and complete functions, in the software applications developed by developers, it not only includes the services of the software application itself, but also usually connects many third-party services through the Oauth2.0 three-party login-free protocol or software development kit integration. In this way, it is convenient for users to directly jump to the running interface of the third-party service when using the software application to use and experience the functions of the third-party service.
[0003] Generally, to implement the functions of the above-mentioned third-party services, the partners of the third-party services need to transmit orders and buried-point user information back to the background database of the software application through data interfaces. However, due to the wide variety of order types accessed by the third-party services, there are also differences in the order data defined by different partners of the third-party services. Therefore, developers need to set a set of functional codes for the processing process of each order data in the software application, making the implementation logic of the functional codes of the software application complex and not conducive to maintenance. Summary of the Invention
[0004] The embodiments of this application provide a data encapsulation method, device, application server, and storage medium, which can solve the problem of complex implementation logic of the functional codes of software applications.
[0005] In the first aspect, the embodiments of this application provide a data encapsulation method, which includes:
[0006] Receiving order information returned by a third-party service; the order information includes at least a service platform field, an encrypted field, and a signature field;
[0007] Determining a processing interface for processing the order information according to the service platform field; the processing interface includes at least a parent method and a child method for processing the encrypted field and the signature field;
[0008] Invoking the parent method to perform verification and decryption processing on the signature field and the encrypted field respectively to obtain order data;
[0009] Invoking the child method to perform encapsulation processing on the order data to obtain the encapsulated order data.
[0010] In the second aspect, the embodiments of this application provide a data encapsulation device, which includes:
[0011] A receiving module, configured to receive order information returned by a third-party service; the order information at least includes a service platform field, an encrypted field, and a signature field;
[0012] A processing interface determination module, configured to determine a processing interface for processing the order information according to the service platform field; the processing interface at least includes a parent method and a subclass method for processing the encrypted field and the signature field;
[0013] A parent method calling module, configured to call the parent method to respectively perform verification and decryption processing on the signature field and the encrypted field to obtain order data;
[0014] A subclass method calling module, configured to call the subclass method to perform encapsulation processing on the order data to obtain the encapsulated order data.
[0015] In a third aspect, an embodiment of the present application provides an application server, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the method in the first aspect described above is implemented.
[0016] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, characterized in that when the computer program is executed by a processor, the method in the first aspect described above is implemented.
[0017] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product runs on an application server, the application server is caused to execute the method in the first aspect described above.
[0018] The beneficial effects of the embodiments of the present application compared with the prior art are as follows: When the application server receives order information returned by any third-party service, it can determine a parent method for executing the same processing flow according to the service identifier in the service platform field of the order information. In this way, it is not necessary for developers to repeatedly write a large number of similar codes for each processing flow of order information in the software application, reducing the code complexity in the software application. Then, the application server can determine a subclass method for executing the subsequent processing flow according to the service identifier in the service platform field. In this way, a processing interface for processing the order information is generated. At the same time, since the subclass method is an execution method set in the software application, when the application server calls the subclass method to process the order data in sequence, the finally encapsulated order data is the order data that can be directly used by the software application. In this way, unified encapsulation processing can be performed on the order data of different third-party services, and it is not necessary for developers to separately set a set of functional codes for the data format of each order data in the software application. Description of the Drawings
[0019] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the accompanying drawings required for use in the embodiments or the description of the prior art. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can also be obtained based on these drawings.
[0020] Figure 1 is the implementation flowchart of a data encapsulation method provided by an embodiment of the present application;
[0021] Figure 2 is a schematic diagram of an implementation manner of S102 of a data encapsulation method provided by an embodiment of the present application;
[0022] Figure 3 is a schematic diagram of an implementation manner of S103 of a data encapsulation method provided by an embodiment of the present application;
[0023] Figure 4 is the implementation flowchart of a data encapsulation method provided by another embodiment of the present application;
[0024] Figure 5 is the implementation flowchart of a data encapsulation method provided by still another embodiment of the present application;
[0025] Figure 6 is the structural schematic diagram of a data encapsulation device provided by an embodiment of the present application;
[0026] Figure 7 is the structural schematic diagram of an application server provided by an embodiment of the present application. Detailed implementation manners
[0027] In the following description, for the purpose of illustration rather than limitation, specific details such as specific system structures and technologies are presented to thoroughly understand the embodiments of the present application. However, those skilled in the art should clearly understand that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid unnecessary details from interfering with the description of the present application.
[0028] It should be understood that when used in the specification of the present application and the appended claims, the term "comprising" indicates the presence of the described features, wholes, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.
[0029] In addition, in the description of the specification and the appended claims of the present application, the terms "first", "second", "third", etc. are only used for distinguishing descriptions and should not be construed as indicating or implying relative importance.
[0030] The data encapsulation method provided by the embodiments of the present application can be applied to an application server. Specifically, for any software application (APP) on the application server, when the software application runs various services, it needs to be supported by the corresponding application server of the software application.
[0031] Please refer to Figure 1 , Figure 1 which shows a flowchart of the implementation of a data encapsulation method provided by the embodiments of the present application. The method includes the following steps:
[0032] S101. The application server receives order information returned by a third-party service; the order information includes at least a service platform field, an encrypted field, and a signature field.
[0033] In one embodiment, the software application usually includes the services of the software application itself and also externally connects to third-party services provided by other third-party companies. Generally, the software application can be docked with the third-party service through various methods such as the open authorization (Oauth2.0) three-party single sign-on protocol or the integration of a software development kit (SDK), so that the user can directly jump to the page of the third-party service on the software application to use and experience the functions. Among them, the application server is the server that supports the software application to run.
[0034] It should be noted that since each third-party company's corresponding third-party service usually defines its own service type, service function, data processing method, and data structure, when the development company of the software application docks multiple third-party services, it usually needs to develop a set of data processing processes for each third-party service. However, due to the large number of third-party services, the overall development process is usually long and cumbersome, and it is not easy to develop and maintain.
[0035] In one embodiment, the above order information is the information returned by the third-party service to the application server. It can be understood that the third-party service is a service on the software application. Therefore, the third-party service can send the order information back to the application server through the software application interface of the software application to enable the software application to run the third-party server.
[0036] In one embodiment, the above service platform field is specifically the platform identification field, which contains at least information such as service identification and order type. Among them, the service identification can be a number, a letter, or other forms of identification, and this service identification usually has unique identification, which is used to identify the corresponding third-party service of the current order information on the software application. Among them, the above order type is used to clarify the business type to which the order information belongs. It can be understood that each order type corresponds to a processing flow for processing the order information.
[0037] In one embodiment, the above encryption field is specifically the data field, which contains the substantial business data in the order information. The above signature field is specifically the sign field, which contains the information for verifying the signature of the order information. Exemplarily, the third-party service can directly sign the order information.
[0038] S102. The application server determines the processing interface for processing the order information according to the service platform field; the processing interface at least includes a parent method and a child method for processing the encryption field and the signature field.
[0039] In one embodiment, the above service platform field may contain the service identification and order type and other field information described in S101 above, and there is no limitation on this. It should be noted that in this embodiment, the application server can determine the parent method for processing the remaining data structures (encryption field, signature field, or other data structures) of the order information according to the service identification, and determine the child method for processing the order data in the encryption field according to the order type.
[0040] It should be noted that the above processing interface is the interface for the application server to call the parent method and the child method. The above parent method is determined based on the service identification. Exemplarily, the application server can pre-set a processing interface for each third-party service and configure a unique identification (i.e., service identification) for each processing interface. After that, for any processing interface, the methods that can be called by this processing interface can pre-set a parent method. Among them, this parent method can be considered as a general method that the order information supported by this third-party service must implement.
[0041] Specifically, when the number of third-party services is multiple, refer to Figure 2 , in S102, when the application server determines the processing interface for processing the order information according to the service platform field, the processing interface for processing the order information can be specifically obtained through the following sub-steps S1021 - S1028, which are described in detail as follows:
[0042] S1021. For any third-party service, the application server obtains various order information generated during the operation of the business corresponding to the third-party service.
[0043] In one embodiment, the above third-party service and order information have been explained in S101 above, and will not be elaborated here. It can be understood that if there is only one third-party service, there should also be only one corresponding processing interface. In this case, the application server can directly determine the processing interface for processing the order information.
[0044] In one embodiment, the business supported by a third-party service usually generates various order information during operation. Among them, the processing flow of each order information is usually different. Exemplarily, for any third-party service, the processing flow of each order information includes but is not limited to the following types: Type 1: signature verification, decryption + order storage in the database + synchronization with related systems; Type 2: signature verification, decryption + freezing and cancellation verification of orders related to payment and coupons; Type 3: signature verification, decryption + other operations, which are not limited here.
[0045] S1022. The application server determines the same processing flow when each order information is processed; the same processing flow at least includes the same verification and decryption processing flow for the signature field and the encrypted field in each order information.
[0046] In one embodiment, according to the example in S1021 above, for the various order information generated during the operation of the business supported by the third-party service, the application server should perform processing flows such as signature verification and decryption on each order information. That is, perform the signature verification process on the signature field and the decryption process on the encrypted field. And for multiple order information belonging to the same third-party service, the signature verification and decryption processes of each order information should be consistent.
[0047] It can be understood that for the various order information generated during the operation of the third-party service, when each order information is processed, there may also be other same processing flows (that is, not only limited to the same processing flow of signature verification and decryption of order information).
[0048] Among them, determining the same processing flow when each order information is processed can be: for any third-party service, the application server can pre-obtain the processing flow of each order information of the third-party service; then, determine the same processing flow from all the processing flows. Specifically, it can be determined according to the types of the processing flows of each order information recorded in S1021 above.
[0049] S1023. The application server obtains the parent class method for processing the same processing flow.
[0050] S1024. The application server encapsulates the parent class method into the initial processing interface corresponding to the third-party service.
[0051] In one embodiment, for any same processing flow, developers can pre-develop the function code corresponding to the same processing flow. It can be understood that the function code is the parent class method used to process the same processing flow during runtime. Exemplarily, the parent class method should at least include the method for the processing flow of verifying the signature and decrypting the order information.
[0052] It should be noted that after developers develop the function code corresponding to the same processing flow, it can be stored in the specified storage path of the application server so that the application server can obtain it at any time.
[0053] In one embodiment, after obtaining the above parent class method, the application server can encapsulate the parent class method into the initial processing interface pre-developed by the staff, so that when the third-party service runs, the application server can call the parent class method in the initial processing interface at any time to preliminarily process the order information sent by the third-party service. Furthermore, the application server can complete the construction of the initial processing interface corresponding to each third-party service.
[0054] It can be understood that since the number of third-party services is multiple, and each third-party service corresponding to each third-party company usually defines its own data processing method and data structure. That is, although the order information of each third-party service needs to execute the data processing process of verifying the signature and decrypting. However, due to the different data processing methods and data structures, the corresponding parent class methods for verifying the signature and decrypting should also be different. Therefore, when the number of third-party services is multiple, the application server usually also sets up corresponding initial processing interfaces one by one, and each initial processing interface is set with a parent class method for processing the order information of each third-party service.
[0055] Based on the above description, it can be understood that after constructing the initial processing interface corresponding to each third-party payment, the application server can also distinguish multiple initial processing interfaces through the following steps:
[0056] S1025. The application server configures the service identifier corresponding to the initial processing interface to distinguish multiple initial processing interfaces.
[0057] In one embodiment, in the order information sent by a third-party service, the service platform field usually contains a service identifier with unique identification. Therefore, the application server can pre-record the service identifiers of each third-party service; then, configure the service identifier correspondingly as the service identifier of the initial processing interface. Based on this, after receiving the order information returned by any third-party service, the application server can also perform the following steps to determine the initial processing interface for processing the order information, which are described in detail as follows:
[0058] S1026. The application server determines the initial processing interface for processing the order information according to the service identifier in the service platform field.
[0059] It should be noted that the initial processing interface determined at this time only includes the ability to perform preliminary processing on the order information, that is, it cannot perform subsequent processing procedures on the order data in the order information. Specifically, the application server can only call the parent class method in the initial processing interface to perform the signature verification and decryption processing procedures on the signature field and the encrypted field respectively.
[0060] Based on this, in order to generate a processing interface that can perform subsequent processing procedures on the order data in the order information, the application server also needs to configure the subclass method for performing subsequent processing procedures for the parent class method in the initial processing interface. Specifically, the application server can configure the subclass method for the initial processing interface according to the following steps to generate the final processing interface, which are described in detail as follows:
[0061] S1027. The application server determines the subclass method for processing the order data in the encrypted field based on the order type.
[0062] S1028. The application server encapsulates the subclass method into the parent class method in the initial processing interface through a preset encapsulation rule to generate the final processing interface.
[0063] In one embodiment, the above order type has been explained in the above S101 and will not be described again here. Among them, referring to the description of the processing procedures for each order information in the above S1021, which includes but is not limited to the following types, the order type in the order information can be determined, that is, it can be used to determine the subsequent processing procedures required for the order information. Among them, the order type can exist in the form of numbers in the service platform field. Exemplarily, as shown in type 1, type 2, and type 3 in the above S1021, each type (for example, type 1, type 2, and type 3) is preset with a subsequent processing procedure for a corresponding order information in the application server.
[0064] In one embodiment, the above-mentioned subclass method is a method for performing the above-mentioned subsequent processing flow on order data. Specifically, the subclass method includes, but is not limited to, saving and encapsulating the decrypted order data, or sending the encapsulated order data to an associated system associated with the software application, which is not limited herein.
[0065] Based on this, it can be understood that for a third-party service, in order to implement specific service functions, the processing flows for processing order information belonging to the same type of third-party service are generally the same, and each processing flow has its own fixed step sequence. For example, after determining the processing interface required by the third-party service based on the service platform field, first verify the signature field in the order information according to the superclass method in the processing interface; after the signature verification passes, decrypt the encrypted field to obtain the order data; then, perform subsequent process processing on the obtained order data according to the subclass method.
[0066] Therefore, in order to avoid repeatedly writing similar code when performing the corresponding processing flow for each type of order information, the application server can solidify the same processing flow into a superclass method and encapsulate it in the initial processing interface. Then, solidify different processing flows into corresponding subclass methods respectively, so that each corresponds to a separate data processing flow.
[0067] Specifically, a third-party service usually corresponds to a superclass method (ThirdCallback), and the superclass method can encapsulate the execution methods corresponding to the above two same processing flows of signature verification (validateSing) and data decryption (decryptData). For the processing interface, in addition to including the above two superclass methods, it can also include multiple other subclass methods. Among them, when performing subsequent processing on the current order data, not all of the subclass methods are necessary. Therefore, the application server can also determine the currently required subclass methods from multiple subclass methods and encapsulate them in the superclass method in the initial processing interface to generate the final processing interface.
[0068] Exemplarily, if the order type is a data synchronization type, and the processing steps for the order information of this type include multiple steps such as signature verification, decryption, order storage in the database, and synchronization with the associated system, then the subclass methods determined by the application server can include multiple methods such as a method for saving data (saveOrder2DB), a method for assembling personalized orders (prepareUnionMsg), and a method for sending orders to the associated system for distribution (sendMQMsg). Among them, each specific subclass method can be pre-encapsulated with corresponding functional code, and each subclass method can be encapsulated into the initial processing interface according to the pre-set encapsulation rules.
[0069] In one embodiment, the above encapsulation rule is a logical rule pre-written by a developer, which can be used to unify the functional code of a single subclass method into another functional code (the parent class method in the initial processing interface) for implementation and call. Specifically, it can refer to the existing Object Oriented Programming (OOP) encapsulation.
[0070] In one embodiment, by encapsulating the parent class methods corresponding to the same processing flow in multiple order information of a third-party service in the initial processing interface, and setting corresponding subclass methods for the remaining processing flows of each order information, the application server can store the subclass methods. After that, developers do not have to specifically set a set of functional codes in the software application for the order information of each third-party service, reducing the complexity of the functional codes of the software application. That is, after the software application determines the subsequent process for processing the order information according to the order type, it can automatically call the corresponding subclass method and encapsulate it into the corresponding initial processing interface to implement the automated processing of the order information. Moreover, since the parent class method and the subclass method are both separately developed functional codes, they can be automatically called by the application server according to the order type, further improving the code reusability.
[0071] It can be understood that after generating any processing interface, the application server can also save the processing interface, so that when receiving order information of the same third-party service later, and the order type of the order information corresponds to the subclass method included in the processing interface, there is no need to temporarily encapsulate the processing interface for processing the order information.
[0072] Based on this, in another embodiment, for an existing processing interface, if the order information needs to execute the remaining processing flows, the developer can expand it on the basis of the existing processing interface. That is, add the remaining subclass methods and set the order type corresponding to each added subclass method for the application server to call.
[0073] S103. The application server calls the parent class method to perform verification and decryption processing on the signature field and the encrypted field respectively to obtain the order data.
[0074] In one embodiment, based on the explanations in S101 and S102 above, the application server needs to verify the signature based on the information in the signature field to verify whether the order information is sent by the third-party server. Then, after the signature verification passes, decrypt the information in the encrypted field to obtain the required order data. It can be understood that at this time, the order data is usually the business data required during the operation of the third-party service.
[0075] Specifically, refer toFigure 3 In S103, the application server calls the parent class method to perform verification and decryption processing on the signature field and the encrypted field respectively to obtain the order data. Specifically, it can be implemented through the following sub-steps S1031 - S1032:
[0076] S1031: The application server calls the parent class method to perform verification processing on the signature field to obtain the verification result.
[0077] S1032: If the verification result is successful, the application server calls the parent class method again to decrypt the encrypted field to obtain the order data.
[0078] In one embodiment, the methods for verifying the signature field and decrypting the encrypted field can both be predefined by the application server and the third-party server in advance.
[0079] Exemplarily, the process of verifying the signature field can be as follows: The server of the third-party service can first perform a hash calculation on the order information to obtain a hash value; then, encrypt the hash value using the private key to generate a signature; finally, attach the signature to the sign field in the order information and send it to the application server. It can be understood that the process of the application server verifying the signature can be: For the received order information, first extract the signature contained in the signature field of the order information; then, decrypt the signature using the public key to obtain the hash value A. Finally, the application server can perform a hash calculation on the order information again to obtain the hash value B. If the hash value A and the hash value B are the same, the verification is successful, otherwise the verification fails. Among them, using the private key and the public key for signature verification is an existing digital signature technology, and no detailed description will be given here.
[0080] S104: The application server calls the subclass method to perform encapsulation processing on the order data to obtain the encapsulated order data.
[0081] In one embodiment, the above subclass method is explained in the above S101 - S102 and will not be described again here. It should be noted that since the subclass method is an execution method developed and set in the application server, when the application server calls the subclass method to process the order data in sequence, the finally generated order data is the order data that the software application can directly use. That is, the finally generated order data is the encapsulated order data.
[0082] It can be understood that for the finally encapsulated order data, since its encapsulation rules are defined by the development company of the application server itself. Therefore, the data structure of the encapsulated order data will also be unified into the data structure defined by the development company itself at this time. Based on this, after the above method is executed, when the software application runs any third-party service separately, the application server can directly unify the order data in the order information returned by each third-party service into the same data structure, so as to realize the unified processing of the order data of different third-party services. For example, the order data returned by different third-party services can be visually displayed on the software application at the same time.
[0083] Based on this, in this embodiment, when the application server receives the order information returned by any third-party service, it can determine the parent class method for executing the same processing flow according to the service identifier in the service platform field of the order information. In this way, there is no need for developers to repeatedly write a large number of similar codes for the processing flow of each order information in the software application, reducing the code complexity in the software application. Then, the application server can determine the subclass method for executing the subsequent processing flow according to the service identifier in the service platform field. In this way, a processing interface for processing this order information is generated. At the same time, since the subclass method is the execution method set in the software application, when the application server calls the subclass method to process the order data in sequence, the finally encapsulated order data is the order data that the software application can directly use. In this way, the unified encapsulation processing of the order data of different third-party services can be realized, and there is no need for developers to set a set of function codes for the data format of each order data in the software application.
[0084] In one embodiment, referring to Figure 4 , after calling the subclass method in S104 to encapsulate the order data and obtaining the encapsulated order data, the following steps S105-S106 are further included:
[0085] S105. The application server synchronizes the encapsulated order data to the associated system for display. Or,
[0086] S106. The application server stores the encapsulated order data in the database to realize a closed loop for the processing flow of the order information.
[0087] In one embodiment, the above-mentioned associated system is a system associated with an application server, and the application server can display all the encapsulated order data obtained by the software application in the synchronization system. This enables the order center in the software application to uniformly display the orders of all third-party services used by the user in the software application, enhancing the user experience. Alternatively, store each encapsulated order data in a database to achieve a closed-loop processing flow for order information.
[0088] In one embodiment, the number of third-party services includes multiple. Referring to Figure 5 , after calling the subclass method in S104 to encapsulate the order data and obtaining the encapsulated order data, the following steps S11 - S14 are further included:
[0089] S11. The application server obtains the exception information that occurs when the third-party service runs abnormally.
[0090] In one embodiment, the above-mentioned exception information is the information of any abnormal process during the processing of order information. Exemplarily, the above-mentioned exception information may include the information of failed signature verification for the information in the signature field, the information of failed decryption for the information in the encrypted field, the information of the order not being stored in the database, and the information of failed synchronization of order data to the associated system. There is no limitation to this.
[0091] S12. The application server determines the reporting interface for reporting the exception to the third-party server corresponding to the third-party service; each third-party service corresponds to a reporting interface for reporting exceptions, and the data format used when each reporting interface reports data is the same.
[0092] In one embodiment, the above-mentioned reporting interface can be the interface used by the application server to report exceptions to any third-party server. Among them, the number of the reporting interfaces corresponds one-to-one with the number of third-party services. Among them, for any reporting interface, the data format used when it reports data is consistent.
[0093] S13. The application server encapsulates the exception information according to the data format of the reporting interface.
[0094] S14. The application server reports the encapsulated exception information to the third-party server through the reporting interface corresponding to the third-party service.
[0095] In one embodiment, for any exception information that occurs during the operation of a third-party service, since the application server encapsulates the exception information in a unified data format and then returns it to the corresponding third-party server. Therefore, it is possible to avoid developers having to develop various functional codes to report exception information in various data formats when facing different third-party services.
[0096] In another embodiment, if the exception information that occurs during the implementation of the same processing process by different third-party services is the same or similar, the application server can also unify the exception information to be returned for this exception.
[0097] Specifically, for the A third-party service and the B third-party service, if both third-party services respectively encounter an exception information of signature verification failure for the signature field in their respective order information during the process of verifying the signature of the order information, the application server can set the exception information for signature verification failure of the two third-party services to the same information. In this way, for multiple third-party services on the software application, the application server not only unifies the exception information to be returned when each third-party service encounters the same exception, but also unifies the data format of the exception information. The only difference is that the reporting interface for reporting exception information to the A third-party service should be different from the reporting interface for reporting exception information to the B third-party service.
[0098] It can be understood that at this time, the application server only needs to maintain a set of functional codes in the software application in a data format, and for each exception, only one information template for the corresponding exception information needs to be maintained respectively, reducing the complexity of the functional codes in the software application.
[0099] Please refer to Figure 6 , Figure 6 which is a structural block diagram of a data encapsulation device provided by an embodiment of the present application. In this embodiment, each module included in the data encapsulation device is used to execute Figures 1 to 5 the corresponding steps in the corresponding embodiment. Specifically, please refer to Figures 1 to 5 and Figures 1 to 5 the relevant descriptions in the corresponding embodiments. For the sake of convenience of description, only the parts related to this embodiment are shown. Referring to Figure 6 , the data encapsulation device 600 may include: a receiving module 610, a processing interface determination module 620, a parent class method call module 630, and a subclass method call module 640, where:
[0100] The receiving module 610 is used to receive the order information returned by the third-party service; the order information includes at least a service platform field, an encrypted field, and a signature field.
[0101] A processing interface determination module 620, configured to determine a processing interface for processing order information according to service platform fields; the processing interface at least includes a parent method and a subclass method for processing encrypted fields and signature fields.
[0102] A parent method call module 630, configured to call the parent method to perform verification and decryption processing on the signature field and the encrypted field respectively to obtain order data.
[0103] A subclass method call module 640, configured to call the subclass method to perform encapsulation processing on the order data to obtain the encapsulated order data.
[0104] In one embodiment, the service platform fields include a service identifier and an order type; the processing interface determination module 620 is further configured to:
[0105] Determine an initial processing interface for processing order information according to the service identifier; the initial processing interface includes a parent method for processing encrypted fields and signature fields; determine a subclass method for processing the order data in the encrypted field based on the order type; generate a final processing interface by encapsulating the subclass method into the parent method in the initial processing interface through a preset encapsulation rule.
[0106] In one embodiment, the number of third-party services includes multiple; the data encapsulation device 600 further includes:
[0107] A construction module, configured to construct an initial processing interface corresponding to each third-party service.
[0108] A configuration module, configured to configure a service identifier corresponding to the initial processing interface.
[0109] In one embodiment, the construction module is further configured to:
[0110] For any one of the third-party services, obtain multiple order information generated during the operation of the business corresponding to the third-party service; determine the same processing flow when each order information is processed; the same processing flow at least includes the same verification and decryption processing flow for the signature field and the encrypted field in each order information; obtain a parent method for processing the same processing flow; encapsulate the parent method into the initial processing interface corresponding to the third-party service.
[0111] In one embodiment, the parent method call module 630 is further configured to:
[0112] Call the parent method to perform verification processing on the signature field to obtain a verification result; if the verification result is verification success, then call the parent method again to perform decryption processing on the encrypted field to obtain order data.
[0113] In one embodiment, the data encapsulation device 600 further includes:
[0114] A display module, configured to synchronize the encapsulated order data to an associated system for display. Alternatively,
[0115] A storage module, configured to store the encapsulated order data in a database to form a closed loop for the processing flow of order information.
[0116] In one embodiment, the number of third-party services includes multiple; the data encapsulation device 600 further includes:
[0117] An acquisition module, configured to acquire exception information indicating that an exception occurs during the operation of a third-party service.
[0118] A reporting interface determination module, configured to determine a reporting interface for reporting exceptions to a third-party server corresponding to the third-party service; each third-party service corresponds to a reporting interface for reporting exceptions, and the data format used for reporting data by each reporting interface is the same;
[0119] An encapsulation module, configured to encapsulate the exception information according to the data format of the reporting interface.
[0120] A transmission module, configured to report the encapsulated exception information to the third-party server through the reporting interface corresponding to the third-party service.
[0121] It should be understood that Figure 6 in the block diagram of the data encapsulation device shown, each module is configured to execute Figures 1 to 5 each step in the corresponding embodiment, and for Figures 1 to 5 each step in the corresponding embodiment has been explained in detail in the above embodiments. For details, please refer to FIG. Figures 1 to 5 and Figures 1 to 5 the relevant descriptions in the corresponding embodiments, which will not be elaborated here.
[0122] Figure 7 is a block diagram of an application server provided by an embodiment of the present application. As Figure 7 shown, the application server 700 in this embodiment includes: a processor 710, a memory 720, and a computer program 730 stored in the memory 720 and executable on the processor 710, such as a program for the data encapsulation method. When the processor 710 executes the computer program 730, the steps in each of the above data encapsulation method embodiments are implemented, such as Figure 1 S101 to S104 shown. Alternatively, when the processor 710 executes the computer program 730, the functions of each module in the above Figure 6 corresponding embodiment are implemented. For example, Figure 6 the functions of the modules 610 to 640 shown. For details, please refer to Figure 6The relevant descriptions in the corresponding embodiments.
[0123] Exemplarily, the computer program 730 can be divided into one or more modules. One or more modules are stored in the memory 720 and executed by the processor 710 to implement the data encapsulation method provided by the embodiments of the present application. One or more modules can be a series of computer program instruction segments capable of completing specific functions, and these instruction segments are used to describe the execution process of the computer program 730 in the application server 700. For example, the computer program 730 can implement the data encapsulation method provided by the embodiments of the present application.
[0124] The application server 700 may include, but is not limited to, a processor 710 and a memory 720. Those skilled in the art can understand that Figure 7 merely examples of the application server 700, which do not constitute a limitation on the application server 700. It may include more or fewer components than those shown in the figure, or combine certain components, or different components. For example, the application server may also include input / output devices, network access devices, buses, etc.
[0125] The so-called processor 710 may be a central processing unit, or may also be other general-purpose processors, digital signal processors, application-specific integrated circuits, off-the-shelf programmable gate arrays, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0126] The memory 720 may be an internal storage unit of the application server 700, such as the hard disk or memory of the application server 700. The memory 720 may also be an external storage device of the application server 700, such as a plug-in hard disk, a smart memory card, a flash memory card, etc. equipped on the application server 700. Further, the memory 720 may also include both the internal storage unit and the external storage device of the application server 700.
[0127] The embodiments of the present application provide an application server, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the data encapsulation method in the above-mentioned various embodiments.
[0128] Fourthly, the embodiments of the present application provide a computer-readable storage medium, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the data encapsulation method in the above-mentioned various embodiments.
[0129] Fifthly, an embodiment of the present application provides a computer program product. When the computer program product runs on an application server, it causes the application server to execute the data encapsulation methods in the above various embodiments.
[0130] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A data encapsulation method, characterized in that, Including: Receiving order information returned by a third-party service; The order information at least includes a service platform field, an encrypted field, and a signature field; Determining a processing interface for processing the order information according to the service platform field; the processing interface at least includes a parent method and a child method for processing the encrypted field and the signature field; Invoking the parent method to perform verification and decryption processing on the signature field and the encrypted field respectively to obtain order data; Invoking the child method to perform encapsulation processing on the order data to obtain encapsulated order data; Wherein, the service platform field includes a service identifier and an order type; The determining a processing interface for processing the order information according to the service platform field includes: Determining an initial processing interface for processing the order information according to the service identifier; the initial processing interface includes a parent method for processing the encrypted field and the signature field; Determining a child method for processing the order data in the encrypted field based on the order type; Generating the final processing interface by encapsulating the child method into the parent method in the initial processing interface through a preset encapsulation rule, and the encapsulation rule is used to unify the functional code of a single child method into the parent method in the initial processing interface for implementation and invocation.
2. The data encapsulation method according to claim 1, wherein The number of the third-party services includes multiple; Before determining the initial processing interface for processing the order information according to the service identifier, it further includes: Constructing an initial processing interface corresponding to each third-party service; Configuring a service identifier corresponding to the initial processing interface.
3. The data encapsulation method according to claim 2, wherein The constructing an initial processing interface corresponding to each third-party service includes: For any one third-party service, obtaining multiple order information generated during the operation of the business corresponding to the third-party service; Determining the same processing flow existing when each order information is processed; the same processing flow at least includes the same verification and decryption processing flow for the signature field and the encrypted field in each order information; Obtaining a parent method for processing the same processing flow; Encapsulating the parent method into the initial processing interface corresponding to the third-party service.
4. The data encapsulation method according to claim 1, wherein The invoking the parent method to perform verification and decryption processing on the signature field and the encrypted field respectively to obtain order data includes: Invoking the parent method to perform verification processing on the signature field to obtain a verification result; If the verification result is verification success, then invoking the parent method again to perform decryption processing on the encrypted field to obtain the order data.
5. The data encapsulation method according to any one of claims 1-4, characterized in that, After invoking the child method to perform encapsulation processing on the order data to obtain encapsulated order data, it further includes: Synchronizing the encapsulated order data to an associated system for display; or, Storing the encapsulated order data in a database to achieve a closed loop for the processing flow of the order information.
6. The data encapsulation method according to claim 1, characterized in that The number of the third-party services includes multiple; After invoking the child method to perform encapsulation processing on the order data to obtain encapsulated order data, it further includes: Obtain the exception information of the third-party service when an exception occurs during operation; Determine the reporting interface for reporting the exception to the third-party server corresponding to the third-party service; each third-party service corresponds to a reporting interface for reporting exceptions, and the data format used when each reporting interface reports data is the same; Encapsulate the exception information according to the data format of the reporting interface; Report the encapsulated exception information to the third-party server through the reporting interface corresponding to the third-party service.
7. A data encapsulation device, characterized in that It includes: A receiving module, configured to receive order information returned by a third-party service; The order information at least includes a service platform field, an encrypted field, and a signature field; A processing interface determination module, configured to determine a processing interface for processing the order information according to the service platform field; the processing interface at least includes a parent method and a subclass method for processing the encrypted field and the signature field; A parent method calling module, configured to call the parent method to respectively perform verification and decryption processing on the signature field and the encrypted field to obtain order data; A subclass method calling module, configured to call the subclass method to perform encapsulation processing on the order data to obtain the encapsulated order data; Wherein, the service platform field includes a service identifier and an order type; the processing interface determination module is further configured to: determine an initial processing interface for processing order information according to the service identifier; the initial processing interface includes a parent method for processing the encrypted field and the signature field; determine a subclass method for processing the order data in the encrypted field based on the order type; generate a final processing interface by encapsulating the subclass method into the parent method in the initial processing interface through a preset encapsulation rule; The encapsulation rule is used to unify the function code of a single subclass method into the parent method in the initial processing interface for implementation and call.
8. An application server, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, the method described in any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, the method described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Order processing method and device, electronic equipment and storage medium
CN111626878A
Service processing method for multiple types of services, computer equipment and storage medium
CN113032398A