Methods, apparatus, storage media, and electronic devices for generating request messages
By identifying business field nodes in the original template and generating messages using a predefined type template engine, the problems of high time costs and high server power consumption when placing orders for different businesses are solved, achieving fast and low-cost message generation.
Patent Information
- Application Number
- CN202211422982.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-14
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2042-11-14
AI Technical Summary
In existing technologies, different business orders require development and configuration to generate new messages, resulting in high time costs, low development efficiency, and high server power consumption.
By obtaining the business fields of the target business, determining their nodes in the original template, and using a predefined type template engine to generate message information based on the business fields and template, request messages are dynamically generated. The hierarchical relationship diagram of all business fields is used to quickly match and generate messages.
This significantly reduces the time cost of generating new messages, lowers server power consumption, and improves system availability and development efficiency.
Smart Images

Figure CN115686499B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of software development, and more specifically, to a method, apparatus, storage medium, and electronic device for generating request messages. Background Technology
[0002] The underlying business of the omnichannel operations center involves order synchronization. Since the business information required for order synchronization varies from business to business, the order synchronization messages are not identical. In related technologies, each time a different business places an order, new messages need to be generated through development and configuration, which significantly increases time costs, reduces development efficiency, and consumes considerable power.
[0003] There is currently no effective solution to the above problems. Summary of the Invention
[0004] This application provides a method, apparatus, storage medium, and electronic device for generating request messages, to at least solve the technical problems in the related art where the need to develop and configure new messages to generate new messages when placing orders for different businesses results in high time costs, low development efficiency, and high server power consumption.
[0005] According to one aspect of the embodiments of this application, a method for generating a request message is provided, comprising: obtaining a target service selected by a target object, determining a first service field corresponding to the target service; determining a first node corresponding to the first service field in an original template, determining a second node having an association relationship with the first node; obtaining a second service field corresponding to the second node, and calling a predetermined type template engine to generate message information based on the first service field, the second service field, and the original template, wherein the predetermined type template engine is used to reference an object defined by code of a predetermined type according to a template language, and the original template is used to at least provide all service fields and determine the hierarchical relationship between all service fields.
[0006] Optionally, the predefined type template engine is invoked to generate message information based on the first business field, the second business field, and the original template, including: determining that the first business field and the second business field are template languages to be matched; matching the template languages to be matched with the original template; determining the first context corresponding to the first business field and the second context corresponding to the second business field based on the matching result; and generating message information based on the object defined by the code of the predefined type by invoking the first context and the second context.
[0007] Optionally, the template language to be matched is matched with the original template, including: calling the tree diagram of the hierarchical relationship of all business fields corresponding to the original template; recursively traversing the tree diagram starting from the first node, determining the branches of the first node along the depth direction of the tree diagram, until the branches of the first node have been traversed; determining that all the nodes on the branches of the first node in the traversal result are second nodes that are related to the first node.
[0008] Optionally, the tree diagram is recursively traversed starting from the first node, and the branches of the first node are determined along the depth direction of the tree diagram until all branches of the first node have been traversed. This includes: determining the first branch of the first node along the depth direction of the tree diagram, marking the fields of the nodes in the first branch in the original template; jumping out of the marked first branch, recursively determining the next branch, and marking the fields of the next branch in the original template, until all fields of all nodes in the branches of the first node have been marked in the original template.
[0009] Optionally, determining the first business field corresponding to the target business includes: when multiple target businesses are selected for the target object, dividing the target businesses based on business type, determining a third business field where target businesses of the same type have overlap; determining a fourth business field where target businesses of the same type have differences; and generating the first business field based on the third and fourth business fields.
[0010] Optionally, determining the first business field corresponding to the target business includes: when it is determined that multiple target businesses selected by the target object are the same business, determining the first business field based on any one of the multiple target businesses.
[0011] Optionally, determining the first business field corresponding to the target business includes: obtaining the target type corresponding to the target business; parsing historical businesses with the same target type in historical data to determine the keywords corresponding to the historical businesses; and determining the keywords as the first business field corresponding to the target business.
[0012] According to another aspect of the embodiments of this application, an apparatus for generating a request message is also provided, comprising: a first acquisition module, configured to acquire a target service selected by a target object and determine a first service field corresponding to the target service; a determination module, configured to determine a first node corresponding to the first service field in an original template and determine a second node having an association relationship with the first node; and a second acquisition module, configured to acquire a second service field corresponding to the second node and call a predetermined type template engine to generate message information based on the first service field, the second service field, and the original template, wherein the predetermined type template engine is used to reference an object defined by code of a predetermined type according to a template language, and the original template is used to at least provide all service fields and determine the hierarchical relationship between all service fields.
[0013] According to another aspect of the embodiments of this application, a non-volatile storage medium is also provided, the storage medium including a stored program, wherein, when the program is running, it controls the device where the storage medium is located to execute any method for generating a request message.
[0014] According to another aspect of the embodiments of this application, an electronic device is also provided, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute instructions in any method of generating a request message.
[0015] In this embodiment, the required business fields are marked using the original full business information. Requests are then dynamically generated based on the markings and the field display rules in the original template. Specifically, by obtaining the target business selected by the target object, the first business field corresponding to the target business is determined; the first node corresponding to the first business field in the original template is determined; a second node associated with the first node is determined; the second business field corresponding to the second node is obtained; and a predefined type template engine is invoked to generate message information based on the first business field, the second business field, and the original template. The predefined type template engine is used to reference objects defined by code of a predefined type according to the template language. The original template is used to at least provide all business fields and determine the hierarchical relationship between them. This improves system availability and significantly reduces the time cost of generating new messages and the server power consumption of the service. This solves the technical problems of high time costs, low development efficiency, and high server power consumption caused by the need for development and configuration to generate new messages when placing orders for different businesses in related technologies. Attached Figure Description
[0016] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0017] Figure 1 This is a flowchart illustrating a method for generating a request message according to an embodiment of this application;
[0018] Figure 2 This is a flowchart of generating request messages based on the Velocity template engine;
[0019] Figure 3 This is a screenshot of the original template content of the request message generated based on the Velocity template engine according to the present invention.
[0020] Figure 4 This is a screenshot showing specific code technical details from an optional embodiment of this application.
[0021] Figure 5 This is a screenshot of specific code technical details in an optional embodiment of this application;
[0022] Figure 6 This is a schematic diagram of an apparatus for generating a request message according to an embodiment of this application;
[0023] Figure 7 A schematic block diagram of an example electronic device 700 that can be used to implement embodiments of this application is shown. Detailed Implementation
[0024] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0025] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0026] To facilitate a better understanding of the embodiments of this application by those skilled in the art, the technical terms or some nouns that may be involved in this application are explained as follows:
[0027] Velocity is a Java-based template engine that allows anyone to simply use a template language (VTL) to reference objects defined in Java code. When Velocity is applied to web development, UI designers and Java programmers can simultaneously develop a website following the MVC architecture. This means UI designers can focus on the page's visual appeal, while Java programmers focus on business logic coding. Velocity separates Java code from web pages, facilitating long-term website maintenance and providing an alternative to JSP and PHP. Velocity's capabilities extend far beyond web development. For example, it can generate SQL, PostScript, and XML from templates. It can also be used as a standalone tool to generate source code and reports, or as an integration component with other systems. Velocity can also provide template services for the Turbine web development architecture. The Velocity + Turbine template service allows a web application to be developed using a true MVC model.
[0028] According to an embodiment of this application, a method embodiment for generating a request message is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0029] Figure 1 This is a method for generating request messages according to embodiments of this application, such as... Figure 1 As shown, the method includes the following steps:
[0030] Step S102: Obtain the target business selected by the target object, and determine the first business field corresponding to the target business;
[0031] Step S104: Determine the first node corresponding to the first business field in the original template, and determine the second node that is associated with the first node;
[0032] Step S106: Obtain the second business field corresponding to the second node, and call the predefined type template engine to generate message information based on the first business field, the second business field, and the original template. The predefined type template engine is used to reference objects defined by code of the predefined type according to the template language. The original template is used to provide at least all business fields and determine the hierarchical relationship between all business fields.
[0033] In this embodiment, the required business fields are marked using the original full business information. Requests are then dynamically generated based on the markings and the field display rules in the original template. Specifically, by obtaining the target business selected by the target object, the first business field corresponding to the target business is determined; the first node corresponding to the first business field in the original template is determined; a second node associated with the first node is determined; the second business field corresponding to the second node is obtained; and a predefined type template engine is invoked to generate message information based on the first business field, the second business field, and the original template. The predefined type template engine is used to reference objects defined by code of a predefined type according to the template language. The original template is used to at least provide all business fields and determine the hierarchical relationship between them. This improves system availability and significantly reduces the time cost of generating new messages and the server power consumption of the service. This solves the technical problems of high time costs, low development efficiency, and high server power consumption caused by the need for development and configuration to generate new messages when placing orders for different businesses in related technologies.
[0034] In some embodiments of this application, the generation of message information by calling a predetermined type template engine based on a first business field, a second business field, and an original template can be achieved through the following steps: Specifically, the first business field and the second business field can be determined as template languages to be matched; the template languages to be matched are matched with the original template; based on the matching result, the first context corresponding to the first business field and the second context corresponding to the second business field are determined; and the message information is generated by calling the object defined by the code of the predetermined type based on the first context and the second context.
[0035] It should be noted that the aforementioned predefined template engines include, but are not limited to, the Velocity template engine. It should also be noted that the original template maps the hierarchical relationships of all potentially used business fields; that is, the hierarchical relationships between all business fields. By matching the fields in the original template, all fields with related relationships can be found. Since the original template contains all business fields and maps the hierarchical relationships between them, it can be understood as a small database composed of all business fields plus a hierarchical relationship diagram (e.g., a tree diagram).
[0036] In some optional embodiments of this application, matching the template language to be matched with the original template can also be achieved through the following steps: Specifically, a tree diagram of the hierarchical relationship of all business fields corresponding to the original template can be invoked; the tree diagram is recursively traversed starting from the first node, and the branches of the first node are determined along the depth direction of the tree diagram until all branches of the first node have been traversed; the nodes on all branches of the first node in the traversal result are determined to be second nodes that are related to the first node. It can be understood that through the above traversal process, all second nodes that are related to the first business can be quickly determined, and then the required message information can be quickly generated according to the first business and the second business fields corresponding to the second nodes. All message information generation requirements can be met by an original template, without the need for redeveloping the system for different businesses.
[0037] Specifically, starting from the first node, the tree diagram is recursively traversed. Branches of the first node are determined along the depth direction of the tree diagram until all branches of the first node have been traversed. This allows for the determination of the first branch along the depth direction of the tree diagram, marking the fields in the original template corresponding to the nodes in that branch. The process then jumps out of the marked first branch and recursively determines the next branch, marking the corresponding fields in the original template for that branch, until all fields corresponding to all nodes in the first node's branches have been marked in the original template. In other words, by leveraging the relationships between nodes in the tree diagram, the corresponding business fields in the original template can be marked, facilitating the Velocity template engine's rapid identification of the required message information.
[0038] In an exemplary embodiment of this application, determining the first business field corresponding to the target business can also involve, when multiple target businesses are selected as the target object, dividing the target businesses based on business type, determining a third business field where target businesses of the same type have overlap; determining a fourth business field where target businesses of the same type have differences; and generating the first business field based on the third and fourth business fields. It is understood that business fields among businesses of the same type often have a large number of duplicate fields. Therefore, by determining the same fields among businesses of the same type (i.e., business fields that have overlap), the purpose of batch processing data can be achieved, saving data processing time.
[0039] Understandably, when multiple target services selected by the target object are determined to be the same service, the first service field is determined based on any one of the multiple target services. It's easy to note that if multiple services are the same, then only one service needs to be processed through the above message generation process; there's no need for duplicate processing.
[0040] To facilitate the determination of the first business field corresponding to the target business, in one embodiment of this application, the target type corresponding to the target business can be obtained; historical businesses with the same target type in historical data can be parsed to determine the keywords corresponding to the historical businesses; and the keywords can be determined as the first business field corresponding to the target business.
[0041] Figure 2 This is a flowchart of generating request messages based on the Velocity template engine, such as... Figure 2 As shown, the process mainly consists of two parts:
[0042] S202 can be based on a full object with a field hierarchy (i.e., the hierarchical relationship of each field mapping in the original template), and mark the fields to be displayed, their parent nodes, and the parent nodes of the parent nodes, etc., in a recursive manner. If it is found that the parent node of the current field has been marked, the current branch can be exited.
[0043] S204 dynamically generates requests using the original template and fields with pre-defined display tags.
[0044] It's worth noting that marking the parent node's parent node can be done using a depth-first traversal of a binary tree. This involves traversing the tree's depth, searching as deeply as possible along each branch. If all edges containing the current node have been searched, the process backtracks to the starting node of that edge. This process is repeated until all reachable nodes from the source node are found. This continues until all fields to be displayed are marked, and then the required request message is automatically generated based on the original template.
[0045] Figure 3 This is a screenshot of the request message generated based on the Velocity template engine of this invention, compared to a portion of the original template content. Figure 4 and Figure 5 This demonstrates some specific technical details.
[0046] Figure 6 This is an apparatus for generating a request message according to an embodiment of this application, such as... Figure 6 As shown, the device includes:
[0047] The first acquisition module 60 is used to acquire the target business selected by the target object and determine the first business field corresponding to the target business.
[0048] Module 62 is used to determine the first node corresponding to the first business field in the original template and to determine the second node that is associated with the first node.
[0049] The second acquisition module 64 is used to acquire the second business field corresponding to the second node, and call the predefined type template engine to generate message information based on the first business field, the second business field and the original template. The predefined type template engine is used to reference objects defined by code of the predefined type according to the template language. The original template is used to provide at least all business fields and determine the hierarchical relationship between all business fields.
[0050] In this device for generating request messages, the first acquisition module 60 is used to acquire the target business selected by the target object and determine the first business field corresponding to the target business; the determination module 62 is used to determine the first node corresponding to the first business field in the original template and determine the second node that is associated with the first node; the second acquisition module 64 is used to acquire the second business field corresponding to the second node and call the predefined type template engine to generate message information based on the first business field, the second business field and the original template. The predefined type template engine is used to reference objects defined by code of the predefined type according to the template language. The original template is used to at least provide all business fields and determine the hierarchical relationship between all business fields, thereby improving the availability of the system and significantly reducing the time cost of generating new messages and reducing the server power consumption of the service. This solves the technical problems of high time cost, low development efficiency and high server power consumption caused by the need for development and configuration to generate new messages when placing orders for different businesses in related technologies.
[0051] According to another aspect of the embodiments of this application, a non-volatile storage medium is also provided, the storage medium including a stored program, wherein, when the program is running, it controls the device where the storage medium is located to execute any method for generating a request message.
[0052] Specifically, the aforementioned storage medium is used to store program instructions for the following functions, thereby implementing the following functions:
[0053] The process involves: obtaining the selected target business from the target object; determining the first business field corresponding to the target business; determining the first node corresponding to the first business field in the original template; determining the second node that is associated with the first node; obtaining the second business field corresponding to the second node; and calling the predefined type template engine to generate message information based on the first business field, the second business field, and the original template. The predefined type template engine is used to reference objects defined by code of a predefined type according to the template language. The original template is used to provide at least all business fields and determine the hierarchical relationship between all business fields.
[0054] Optionally, in this embodiment, the storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. More specific examples of the storage medium include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0055] In an exemplary embodiment of this application, a computer program product is also provided, including a computer program that, when executed by a processor, implements the method for generating a request message as described above.
[0056] Optionally, when executed by a processor, the computer program may perform the following steps:
[0057] The process involves: obtaining the selected target business from the target object; determining the first business field corresponding to the target business; determining the first node corresponding to the first business field in the original template; determining the second node that is associated with the first node; obtaining the second business field corresponding to the second node; and calling the predefined type template engine to generate message information based on the first business field, the second business field, and the original template. The predefined type template engine is used to reference objects defined by code of a predefined type according to the template language. The original template is used to provide at least all business fields and determine the hierarchical relationship between all business fields.
[0058] An electronic device is provided according to an embodiment of the present application, the electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method of generating a request message as described above.
[0059] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0060] Figure 7A schematic block diagram of an example electronic device 700 that can be used to implement embodiments of this application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the application described and / or claimed herein.
[0061] like Figure 7 As shown, device 700 includes a computing unit 701, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 702 or a computer program loaded from storage unit 708 into random access memory (RAM) 703. RAM 703 may also store various programs and data required for the operation of device 700. The computing unit 701, ROM 702, and RAM 703 are interconnected via bus 704. Input / output (I / O) interface 705 is also connected to bus 704.
[0062] Multiple components in device 700 are connected to I / O interface 705, including: input unit 706, such as keyboard, mouse, etc.; output unit 707, such as various types of monitors, speakers, etc.; storage unit 708, such as disk, optical disk, etc.; and communication unit 709, such as network card, modem, wireless transceiver, etc. Communication unit 709 allows device 700 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0063] The computing unit 701 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 701 performs the various methods and processes described above, such as the method of generating a request message. For example, in some embodiments, the method of generating a request message may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on device 700 via ROM 702 and / or communication unit 709. When the computer program is loaded into RAM 703 and executed by the computing unit 701, one or more steps of the method of generating a request message described above may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured to perform the method of generating a request message by any other suitable means (e.g., by means of firmware).
[0064] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0065] The program code used to implement the methods of this application may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0066] In the context of this application, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0067] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0068] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0069] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0070] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0071] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0072] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0073] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0074] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0075] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0076] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method of generating a request message, characterized by, include: Obtain the target business selected by the target object, and determine the first business field corresponding to the target business; Determine the first node corresponding to the first business field in the original template, and determine the second node that is associated with the first node; The process involves obtaining the second business field corresponding to the second node, and then invoking a predefined type template engine to generate message information based on the first business field, the second business field, and the original template. This includes: determining that the first business field and the second business field are template languages to be matched; matching the template languages to be matched with the original template; determining the first context corresponding to the first business field and the second context corresponding to the second business field based on the matching result; and generating the message information by invoking an object defined by code of a predefined type based on the first context and the second context. The predefined type template engine is used to reference objects defined by code of a predefined type based on the template language, and the original template is used to at least provide all business fields and determine the hierarchical relationship between all business fields.
2. The method of claim 1, wherein, Matching the template language to be matched with the original template includes: Call the tree diagram of the hierarchical relationship of all business fields corresponding to the original template; Starting from the first node, recursively traverse the tree diagram, determine the branches of the first node along the depth direction of the tree diagram, until all branches of the first node have been traversed. In the traversal result, all nodes on the branches of the first node are determined to be second nodes that are related to the first node.
3. The method of claim 2, wherein, Starting from the first node, recursively traverse the tree diagram, determining the branches of the first node along the depth direction of the tree diagram, until all branches of the first node have been traversed, including: Determine the first branch of the first node along the depth direction of the tree diagram, and mark the fields of the nodes in the first branch in the original template; Jump out of the first branch that has already been marked, use recursion to determine the next branch, and mark the field corresponding to the next branch in the original template, until all the fields corresponding to all nodes in the first node's branches have been marked in the original template.
4. The method according to claim 1, characterized in that, Determining the first business field corresponding to the target business includes: If it is determined that multiple target services are selected for the target object, the target services are divided based on the service type, and a third service field is determined where target services of the same type have overlap. Identify the fourth business field that differs among the target services of the same type; The first business field is generated based on the third business field and the fourth business field.
5. The method according to claim 1, characterized in that, Determining the first business field corresponding to the target business includes: If it is determined that multiple target services selected by the target object are the same service, the first service field is determined based on any one of the multiple target services.
6. The method according to claim 1, characterized in that, Determining the first business field corresponding to the target business includes: Obtain the target type corresponding to the target service; Analyze historical data containing historical transactions of the same type as the target to determine the keywords corresponding to the historical transactions; The keyword is determined to be the first business field corresponding to the target business.
7. An apparatus for generating a request message, characterized in that, include: The first acquisition module is used to acquire the target business selected by the target object and determine the first business field corresponding to the target business. The determination module is used to determine the first node corresponding to the first business field in the original template, and to determine the second node that is associated with the first node. The second acquisition module is used to acquire the second business field corresponding to the second node, and to call a predetermined type template engine to generate message information based on the first business field, the second business field, and the original template. This includes: determining that the first business field and the second business field are template languages to be matched; matching the template languages to be matched with the original template; determining the first context corresponding to the first business field and the second context corresponding to the second business field based on the matching result; and generating the message information by calling an object defined by code of a predetermined type based on the first context and the second context. The predetermined type template engine is used to reference an object defined by code of a predetermined type based on the template language, and the original template is used to at least provide all business fields and determine the hierarchical relationship between all business fields.
8. A non-volatile storage medium, characterized in that, The storage medium includes a stored program, wherein, when the program is executed, it controls the device where the storage medium is located to execute the method for generating a request message as described in any one of claims 1 to 6.
9. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the method for generating a request message as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Service message processing method and device
CN102255786A
Coding method, decoding method and coding / decoding device based on extensible markup language (XML)
CN102314371A
