A data adaptation transmission method, apparatus, device, and medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-29
- Publication Date
- 2026-08-14
AI Technical Summary
[0005]本发明提供了一种数据适配传输方法、装置、设备和介质,解决了由于各业务系统通常存在不同的独立开发接口,传统方案所使用的接口程序对业务系统入侵性大,更新接口容易导致业务系统不稳定,同时各个业务系统需要人工手动重发数据,进而各业务系统间的数据交互效率降低的技术问题
当后端服务器接收到发送客户端输入的发送请求时,可以先通过网关负载均衡的方式对发送请求进行分流,采用预设的发送任务模板构建所述发送请求对应的至少一个发送任务;调用连接服务将全部所述发送任务封装为并发任务列表,并缓存至预设消息队列;调用引擎服务从所述消息队列提取所述并发任务列表并去重,得到目标查询任务;通过所述引擎服务执行所述目标查询任务,生成待发送信息并发送至接收客户端。从而解决由于各业务系统通常存在不同的独立开发接口,传统方案所使用的接口程序对业务系统入侵性大,更新接口容易导致业务系统不稳定,同时各个业务系统需要人工手动重发数据,进而各业务系统间的数据交互效率降低的技术问题,通过任务封装缓存到消息队列,调用引擎服务执行任务发送信息的方式,更为稳定高效地实现不同业务系统之间的数据适配,进而提高各业务系统之间的数据交互效率。
Smart Images

Figure CN115269228B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data interaction technology, and in particular to a data adaptation and transmission method, apparatus, device, and medium. Background Technology
[0002] With societal progress, the expansion of hospital scale, and the gradual improvement of information technology, strengthening hospital information technology construction is an important guarantee for improving hospital management level, promoting the internal scientific development and comprehensive construction of hospitals.
[0003] Therefore, the hospital information system currently mainly uses SDKs, traditional view queries, stored procedure queries, HTTP synchronous interface queries to return JSON, web service pushes XML messages, and HTTP protocol to send JSON for data interaction.
[0004] Since each business system typically has different independent development interfaces, the interface programs used in traditional solutions are highly intrusive to the business systems. Updating the interfaces can easily lead to instability in the business systems. At the same time, each business system needs to manually resend data, which reduces the efficiency of data interaction between the business systems. Summary of the Invention
[0005] This invention provides a data adaptation and transmission method, apparatus, device, and medium, which solves the technical problems that traditional solutions use interface programs that are highly intrusive to business systems, and that updating interfaces can easily lead to instability in business systems. At the same time, each business system needs to manually resend data, which reduces the efficiency of data interaction between business systems.
[0006] The first aspect of this invention provides a data adaptation and transmission method applied to a backend server, the method comprising: When a sending request is received from the sending client, at least one sending task corresponding to the sending request is constructed using a preset sending task template; The connection service is invoked to encapsulate all the sending tasks into a concurrent task list and cache it in a preset message queue; The engine service is invoked to retrieve the concurrent task list from the message queue and deduplicate it to obtain the target query task; The engine service executes the target query task, generates information to be sent, and sends it to the receiving client.
[0007] Optionally, the step of constructing at least one sending task corresponding to the sending request using a preset sending task template when a sending request is received from the sending client includes: When a send request is received from the sending client, the input position corresponding to the send request is obtained; If the input location is the location of the synchronous sending link, then the first sending keyword carried by the sending request is extracted, and the first sending keyword is loaded into the preset sending task template to generate a single sending task corresponding to the sending request; If the input location is the location of the asynchronous send button, then extract the second send keyword and the number of tasks created carried in the send request, and use the send task template to create a send task with the same number of tasks created.
[0008] Optionally, the step of extracting the second sending keyword and task creation quantity carried in the sending request, and creating a sending task equal to the task creation quantity using the sending task template if the input location is the location of the asynchronous send button, includes: If the input location is the location of the asynchronous send button, then extract the task creation type, the second send keyword, and the number of tasks created carried in the send request; If the task creation type is a normal query task, then a single sending task is created using the sending task template and the second sending keyword; If the task creation type is a combined query task, then the sending task template and multiple second sending keywords are used to create a sending task equal to the number of tasks created. If the task creation type is a comparison query task, then retrieve the existing sent data corresponding to the second sending keyword; Compare the existing sent data with the historical returned data, determine the differences, and create a single sending task using the sent task template.
[0009] Optionally, the step of executing the target query task through the engine service, generating information to be sent, and sending it to the receiving client includes:
[0010] The engine service extracts the query primary key and receiving address from the target query task. The engine service uses the query primary key to query a preset message database to determine the initial field information corresponding to the query primary key. The engine service maps the initial field information into text format and renders it according to the mapping dictionary within the target query task, generating the information to be sent. The engine service sends the information to be sent to the receiving client corresponding to the receiving address.
[0011] Optionally, the method further includes:
[0012] If the message to be sent is successfully sent, the successful sending log will be recorded in the message database; If the message to be sent fails to be sent, the target query task is executed again through the engine service and the message to be sent is rendered and sent to the receiving client again.
[0013] Optionally, the method further includes: When the information to be sent fails to be sent, the target query task to be executed is written to the abnormal task table. When a task click instruction is received for the abnormal task table, the target query task corresponding to the task click instruction is selected and executed, and the information to be sent is sent to the receiving client.
[0014] Optionally, the backend server has a configuration page, and the method further includes: In response to the data source configuration command entered on the configuration page, a message database corresponding to the data source configuration command is created; When interface document data is received on the configuration page, the interface document data is parsed to extract retransmission parameters, message queue partition parameters, dictionary mapping parameters, sending address information, query parameters, and field conversion parameters. Configure a preset standard sending template according to the sending address information to obtain the first sending template; The first sending template is configured using the retransmission parameters, the message queue partition parameters, and the query parameters to obtain the second sending template; Configure the second sending template using the dictionary mapping parameters, and determine the mapping dictionary within the second sending template; The second sending template is configured using the field conversion parameters, the mapping text format corresponding to the mapping dictionary is determined, the target sending template is obtained, and the sending task template is rendered and generated.
[0015] A second aspect of the present invention provides a data adaptation and transmission apparatus for use in a backend server, the apparatus comprising: The sending task construction module is used to construct at least one sending task corresponding to the sending request using a preset sending task template when a sending request is received from the sending client. The task encapsulation module is used to call the connection service to encapsulate all the sending tasks into a concurrent task list and cache them in a preset message queue; The task filtering module is used to call the engine service to extract the concurrent task list from the message queue and remove duplicates to obtain the target query task; The task execution module is used to execute the target query task through the engine service, generate information to be sent, and send it to the receiving client.
[0016] A third aspect of the present invention provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the data adaptation and transmission method as described in any of the first aspects of the present invention.
[0017] A fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed, implements the data adaptation and transmission method as described in any of the first aspects of the present invention.
[0018] As can be seen from the above technical solutions, the present invention has the following advantages: When the backend server receives a send request from the sending client, it can first distribute the send request through gateway load balancing, construct at least one send task corresponding to the send request using a preset send task template; call the connection service to encapsulate all the send tasks into a concurrent task list and cache it in a preset message queue; call the engine service to retrieve the concurrent task list from the message queue and deduplicate it to obtain the target query task; execute the target query task through the engine service to generate the information to be sent and send it to the receiving client. This solves the technical problems of traditional solutions where different business systems typically have different independent development interfaces, the interface programs used are highly intrusive to business systems, updates to the interfaces easily lead to business system instability, and each business system needs to manually resend data, thus reducing the efficiency of data interaction between business systems. By encapsulating and caching tasks in a message queue and calling the engine service to execute tasks and send information, data adaptation between different business systems is achieved more stably and efficiently, thereby improving the efficiency of data interaction between business systems. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is a flowchart of the steps of a data adaptation and transmission method provided in Embodiment 1 of the present invention; Figure 2 This is a flowchart of the steps of a data adaptation and transmission method provided in Embodiment 2 of the present invention; Figure 3 This is a service call diagram of a data adaptation and transmission method provided in Embodiment 2 of the present invention; Figure 4 This is a structural block diagram of a data adaptation and transmission device provided in Embodiment 3 of the present invention. Detailed Implementation
[0021] This invention provides a data adaptation and transmission method, apparatus, device, and medium to address the technical problems that traditional solutions use interface programs that are highly intrusive to business systems, and that updating interfaces can easily lead to instability in business systems. Furthermore, each business system needs to manually resend data, which reduces the efficiency of data interaction between business systems.
[0022] XML: Extensible Markup Language, a subset of Standard Generalized Markup Language, is a markup language used to structure electronic documents.
[0023] In electronic computers, markup refers to information symbols that computers can understand. Through this markup, computers can process various types of information, such as articles. It can be used to mark data, define data types, and is a source language that allows users to define their own markup languages. It is well-suited for transmission over the World Wide Web, providing a unified method for describing and exchanging structured data independent of applications or vendors. It is a cross-platform, content-dependent technology in the Internet environment and an effective tool for processing distributed structured information today. As early as 1998, the W3C released the XML 1.0 specification, using it to simplify the transmission of document information over the Internet.
[0024] JSON (JavaScript Object Notation) is a lightweight data-interchange format. Based on a subset of ECMAScript (the JavaScript specification defined by the European Computer Association), it uses a text format completely independent of programming languages to store and represent data. Its concise and clear hierarchical structure makes JSON an ideal data exchange language. It is easy for humans to read and write, as well as easy for machines to parse and generate, effectively improving network transmission efficiency.
[0025] SDK (Software Development Kit): A software development kit is generally a collection of development tools used by software engineers to create application software for specific software packages, software frameworks, hardware platforms, operating systems, etc.
[0026] In a broad sense, software development tools refer to a collection of related documents, examples, and tools that assist in the development of a certain type of software.
[0027] A Software Development Kit (SDK) is a collection of development tools used by software engineers to create application software for specific software packages, frameworks, hardware platforms, and operating systems. Generally, an SDK is used to develop applications for the Windows platform. It can be as simple as some files providing an Application Programming Interface (API) for a programming language, but it may also include complex hardware capable of communicating with embedded systems. Common tools include utilities for debugging and other purposes. SDKs often also include sample code, supporting technical annotations, or other supporting documentation to clarify ambiguities for basic reference materials.
[0028] API (Application Programming Interface): Also known as an application programming interface, it's the agreement that governs the interaction between different components of a software system. Due to the increasing scale of software in recent years, complex systems often need to be divided into smaller components, making the design of programming interfaces crucial. In programming practice, the first step in designing a programming interface is to ensure a reasonable division of responsibilities within the software system. Good interface design can reduce the interdependencies between system parts, increase the cohesion of component units, and reduce the coupling between components, thereby improving the maintainability and scalability of the system.
[0029] HTTP (Hypertext Transfer Protocol): The Hypertext Transfer Protocol is a simple request-response protocol. It specifies what messages a client might send to a server and what kind of response it might receive. This simple model was instrumental in the early success of the Web because it made development and deployment very straightforward.
[0030] Web Service: A platform-independent, loosely coupled, self-contained, programmable web-based application that uses open XML (a subset of Standard Generalized Markup Language) standards to describe, publish, discover, coordinate, and configure applications for developing distributed, interactive applications.
[0031] Web Service technology enables different applications running on different machines to exchange data or integrate without the need for additional, specialized third-party software or hardware. Applications implemented according to Web Service specifications can exchange data regardless of their language, platform, or internal protocols. Web Services are self-describing, self-contained, and available network modules that can perform specific business functions. Web Services are also easy to deploy because they are based on common industry standards and existing technologies such as subsets of Standard Generalized Markup Language (SGML) like XML and HTTP. Web Services reduce the cost of application interfaces. Web Services provide a common mechanism for integrating business processes across an entire enterprise or even multiple organizations.
[0032] To make the objectives, features, and advantages of this invention more apparent and understandable, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described below are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0033] Please see Figure 1 , Figure 1 This is a flowchart illustrating the steps of a data adaptation and transmission method provided in Embodiment 1 of the present invention.
[0034] This invention provides a data adaptation and transmission method applied to a backend server, the method comprising: Step 101: When a sending request is received from the sending client, at least one sending task corresponding to the sending request is constructed using a preset sending task template; A client application refers to a program that provides local services to clients in contrast to a backend server. Aside from some applications that run only locally, these are typically installed on ordinary client machines and require coordination with the backend server to function.
[0035] In this embodiment of the application, when the backend server receives a sending request input by the sending client, it indicates that the sending client needs to send data. At this time, at least one sending task corresponding to the sending request can be constructed according to the preset sending task template.
[0036] It should be noted that the task template can be generated by configuring parameters, calling methods, and statements on the backend server's configuration page. This includes the parameters for constructing the task, the parameter usage process, and the task execution logic.
[0037] Step 102: Call the connection service to encapsulate all sending tasks into a concurrent task list and cache them in a preset message queue; The connection service refers to ensuring that the connection for a request will not be broken. It acts as a bridge between the requesting task and the message queue, and can send a list of concurrent tasks to the message queue via HTTP requests by providing an interface.
[0038] The concurrent task list refers to a list composed of the primary keys corresponding to the Task objects generated after the sent tasks are encapsulated.
[0039] In this embodiment, since the data retrieval logic and the sending process are both loaded into the sending task, after the sending task is constructed, the connection service can be directly called to encapsulate all sending tasks into a concurrent task list. At the same time, in order to ensure that data can be sent smoothly under massive data push, the concurrent task list is cached in the message queue.
[0040] Step 103: Call the engine service to retrieve the concurrent task list from the message queue and deduplicate it to obtain the target query task; The engine service's main function is to retrieve tasks from the message queue, generate complete messages based on the task parameters, and send them to the corresponding backend interface service. It also records the sending result (success or failure), allowing failed tasks to be resent, thus ensuring the normal flow of data.
[0041] To ensure the normal flow of data, the engine service can be called to extract a list of concurrent tasks from the message queue. After deduplicating the sending tasks in the list, the executable target query tasks can be selected.
[0042] Step 104: Execute the target query task through the engine service to generate the information to be sent and send it to the receiving client.
[0043] In this embodiment of the application, after the engine service filters and obtains the target query task, the target query task can be executed through the engine service to call the task execution logic of information query and information generation, generate the information to be sent and send it to the receiving client.
[0044] It should be noted that the receiving client can be a backend interface service or other clients, such as a medical business system responsible for different functions.
[0045] In this embodiment, when the backend server receives a sending request from the sending client, it can first distribute the sending request through gateway load balancing, construct at least one sending task corresponding to the sending request using a preset sending task template; call the connection service to encapsulate all sending tasks into a concurrent task list and cache it in a preset message queue; call the engine service to extract the concurrent task list from the message queue and deduplicate it to obtain the target query task; execute the target query task through the engine service to generate the information to be sent and send it to the receiving client. This solves the technical problems of traditional solutions where the interface programs used by different business systems are highly intrusive to the business systems, updating the interfaces easily leads to business system instability, and each business system needs to manually resend data, thus reducing the efficiency of data interaction between business systems. By encapsulating and caching tasks in a message queue and calling the engine service to execute tasks and send information, data adaptation between different business systems is achieved more stably and efficiently, thereby improving the efficiency of data interaction between business systems.
[0046] Please see Figure 2 , Figure 2 This is a flowchart illustrating the steps of a data adaptation and transmission method provided in Embodiment 2 of the present invention.
[0047] This invention provides a data adaptation and transmission method applied to a backend server, the method comprising: Step 201: When a send request is received from the sending client, obtain the input position corresponding to the send request.
[0048] Sending a request refers to the request information input by the sending client, which is used to start the task building process of the backend server and specify the type of task to be built.
[0049] In this embodiment of the application, when the backend server receives a sending request input by the sending client, it performs detection on the page corresponding to the sending client to obtain the input position corresponding to the sending request and determine the task type that the sending request needs to construct.
[0050] It should be noted that the sending client has an input page. The sending client responds to user input commands such as clicks, touches, and presses, and constructs the corresponding sending request according to the trigger position of the input command on the page.
[0051] Step 202: If the input location is the location of the synchronous sending link, extract the first sending keyword carried in the sending request, load the first sending keyword into the preset sending task template, and generate a single sending task corresponding to the sending request.
[0052] In this embodiment of the application, if the input location is the location of the synchronous sending link, it indicates that the task type that the sending client needs to establish is a synchronous sending task. The first sending keyword carried in the sending request can be extracted, and the first sending keyword can be loaded into the preset sending task template to create a single sending task corresponding to the sending request.
[0053] It should be noted that the synchronous sending link refers to the link in the input page on the sending client, which is used to initiate the generation of the sending task.
[0054] Step 203: If the input location is the location of the asynchronous send button, extract the second send keyword and the number of tasks created carried in the send request, and use the send task template to create a send task equal to the number of tasks created.
[0055] Further, the following sub-steps S11-S15 may be included: S11. If the input location is the location of the asynchronous send button, extract the task creation type, second send keyword and task creation quantity carried in the send request; The task creation type refers to the type of task being created, including but not limited to ordinary query tasks, combined query tasks, and comparison query tasks.
[0056] In this embodiment of the application, an asynchronous send button is also provided on the input page of the sending client. If the input position is the position of the asynchronous send button, the task creation type, the second send keyword and the number of task creation carried by the sending request are extracted as the data basis for subsequent task creation.
[0057] S12. If the task creation type is a normal query task, then a single sending task is created using the sending task template and the second sending keyword. In one example of this application, if the extracted task creation type is a normal query task, it means that only a single query and a single send are needed at this time. The second send keyword can be loaded into the send task template to create a single send task.
[0058] S13. If the task creation type is a combined query task, then use the task sending template and multiple second sending keywords to create a sending task equal to the number of task creations. In another example of this application, if the task creation type is a combined query task, it means that multiple query statements are needed to query information to query multiple standard input parameters simultaneously. In this case, multiple second sending keywords can be loaded into the sending task template to create a sending task equal to the number of tasks created.
[0059] It should be noted that the task creation process can be as follows: select a standard template, configure the execution frequency (the execution time t2 = t1 + Δt, where t1 is the last execution time and Δt is the frequency setting time), select a data source, and select a query type (there are two query types: time rollover query and general query. Time rollover query can automatically calculate the difference between the current time and the last query end time, and query the data between the differences each time. General query executes the query based on the configured query statement).
[0060] S14. If the task creation type is a comparison query task, then retrieve the existing sent data corresponding to the second sending keyword; S15. Compare existing sent data with historical returned data, identify the differences, and create a single sending task using the sending task template.
[0061] Optionally, to prevent the data receiver from being unable to receive data due to unstable factors such as program problems, the task creation type can be selected as a comparison query task. This can detect the existing sent data corresponding to the second sending keyword, compare the existing sent data with the historical returned data, thereby determining the difference between the two, obtaining the difference data and loading it into the sending task template to create a single sending task.
[0062] It should be noted that the construction of the comparison query task can be further tested to perform the sending task function test. The implementation logic is as follows: pass the two statements to the backend service -> create a dynamic data source object -> establish a data source connection -> execute the SQL statement of the comparison query task configured above -> take the difference set of the data retrieved by the two statements and compare to find the data that was not sent -> if the above process does not report any errors, it is considered to have been executed successfully.
[0063] It's worth mentioning that after creating the sending task, you can further test its execution by calling the test method via HTTP POST. The test method's logic is as follows: create a dynamic data source object -> establish a data source connection -> execute the SQL statement in the configured sending task template -> check for errors during execution; if an error occurs, return "false" to indicate test failure; otherwise, return "true" to indicate test success.
[0064] In one example of this application, the backend server has a configuration page, and the method further includes the following steps S21-S26: S21. Respond to the data source configuration command entered on the configuration page and create a message database corresponding to the data source configuration command; In the implementation, in response to the data source configuration command entered on the configuration page, after the data source information is filled in on the form, data is sent to the backend via the HTTP protocol. The Dynamic Datasource Base class (a custom-developed Java class that encapsulates a series of methods for data source operations, such as CRUD operations) is used to convert the data into Java objects. Calling the add method in the class allows the data source information to be inserted into the message database, creating a message database corresponding to the data source configuration command.
[0065] The message database type can be selected, including Oracle, SQL Server, MySQL, etc., and the message database account, password, and connection address can be configured. The maximum number of connections, minimum number of connections, and request timeout for the message database can all be configured to ensure the rational utilization of data source resources.
[0066] Optionally, after configuring the message database, it can also be tested. By clicking the test button, an HTTP POST request (a network protocol request method) is sent to the server backend. The testDbSource method of the DbConfigController controller (Java class) is called. The code initializes the data source, calls the default test connection statement of the message database, and judges whether the test is successful by the return value. If it returns "true", the test is successful; if it returns "false", the test fails.
[0067] S22. When the interface document data is received on the configuration page, parse the interface document data and extract the resend parameters, message queue partition parameters, dictionary mapping parameters, sending address information, query parameters and field conversion parameters. In this embodiment of the application, interface document data can be uploaded on the configuration page to provide the data basis for subsequent configuration. The interface document data can be of type Excel, and the content of the Excel is the field information of the standard template, and the sent XML or JSON sample (XML and JSON are both standardized text formats).
[0068] Upon receiving the API documentation data, it can be parsed to extract retransmission parameters, message queue partition parameters, dictionary mapping parameters, sending address information, query parameters, and field conversion parameters. Specifically, this can be achieved using an HTML form submission via an HTTP POST request, calling the `uploadExcel` method of the `TemplateStaticController` class. The `uploadExcel` method's logic is as follows: Get the file name -> Get the number of all worksheets -> Get a single sheet (workbook) -> Iterate from the first row -> Get the data from each cell. An object is constructed based on the data from each cell, and an `INSERT` statement is used to write the data to the message database.
[0069] S23. Configure the preset standard sending template according to the sending address information to obtain the first sending template; In the specific implementation, a JSON string can be constructed according to the sending address information, and the data can be sent to the backend server through the HTTP POST method. The sending system receiving system information can be written into the message database using the message database INSERT statement, thereby constructing the first sending template.
[0070] S24. Configure the first sending template using retransmission parameters, message queue partition parameters, and query parameters to obtain the second sending template; Meanwhile, the message queue can have multiple partitions, each with independent data. You can configure which partition data of a given standard goes to; by default, it goes to a random partition. The advantage of selecting a partition is that it ensures the queue for that standard's data is dedicated and won't mix with data from other partitions, guaranteeing the timely delivery of critical business data.
[0071] To address this, a retransmission parameter can be used to identify whether the system filters duplicate information, whether to retransmit incorrectly, and the number of retransmissions. This parameter can be cached in the front-end object as a property of the `standard` object, where `standard` is a custom object. Simultaneously, queues are configured for partitions of various data types according to data queue partitioning parameters. Furthermore, the query logic within the first sending template is configured according to query parameters to obtain the second sending template.
[0072] Specifically, configuration can be done through query statements, also known as SQL statements, which are a type of database query syntax, such as SELECT. After the user enters the statement "from dual" on the interface, the front-end page temporarily stores the statement in a memory object.
[0073] S25. Configure the second sending template using dictionary mapping parameters, and determine the mapping dictionary in the second sending template; Meanwhile, a dictionary mapping parameter is used to configure the second sending template. This data mapping relationship is then encapsulated into a QueryResultMapping object (a custom object) on the front-end HTML page. This object contains the source code, source name, target code, and target name. This determines the mapping dictionary within the second sending template.
[0074] S26. Configure the second sending template using field conversion parameters, determine the mapping text format corresponding to the mapping dictionary, obtain the target sending template, and render and generate the sending task template.
[0075] Finally, the second sending template is configured using field conversion parameters. The fields retrieved from the database need to be rendered onto XML or JSON text, which requires configuring template mapping to determine the mapping text format corresponding to the mapping dictionary, obtain the target sending template, and render and generate the sending task template.
[0076] It should be noted that before rendering the task template, the feasibility of sending the template can be verified by creating a dynamic data source object -> establishing a data source connection -> executing the configured SQL statement -> mapping the query results to the target sending template -> checking for errors during execution. If an error occurs, return "false" to indicate test failure; otherwise, return "true" to indicate test success.
[0077] Optionally, all the data can be encapsulated into a single object called `standard`. The `standard` object contains all the properties configured in the above steps, such as the query statement, message queue partition information, and deduplication information. This information is then saved to the database. An HTTP POST request calls the `saveStandardSnap` method of the `TemplateDynamicController` class. This method converts the object into JSON text format and automatically generates a version number, starting from 1.0 and incrementing by 0.1 each time. Finally, the non-relational database's insert method is called to write the data.
[0078] In another example of this application, after filling in the query parameters, you can enter the template debugging interface and call the `unitTest` method of `TemplateDynamicController`. The design logic of this method is as follows: obtain the test standard -> query data using the query parameters -> render the template (XML or JSON) -> call the `send` method of the web service to send data -> obtain the return value to determine if the sending was successful. Click the "Publish" button to publish the configuration. After publishing, write the publishing information to the registry center. The engine service listens to the registry center and updates its local cache if a new version is found. Server data flow process: call the `Release` method of `TemplateStaticController`. The design logic of this method is as follows: construct the registry center node (system ID + service code) -> lock the registry center to prevent concurrency issues -> obtain the latest version number -> add 0.1 to the current standard based on the latest version -> write data to the registry center -> the engine service listens for changes in the registry center data -> pulls the latest data to update the local cache.
[0079] Step 204: Call the connection service to encapsulate all sending tasks into a concurrent task list and cache them in a preset message queue; After generating and sending tasks, the data can be encapsulated into a list of concurrent tasks, namely Task objects, and cached in a preset message queue.
[0080] In practice, all sending tasks can be encapsulated into a list of concurrent tasks by calling the link service. Then, the primary key of each sending task can be extracted and pushed to a preset message queue for further processing.
[0081] Step 205: Call the engine service to retrieve the concurrent task list from the message queue and deduplicate it to obtain the target query task; In this embodiment of the application, the concurrent task list can be extracted from the message queue by calling the engine service, and the target query task can be obtained after deduplicating each sending task, and then waiting for subsequent task execution.
[0082] Step 206: Execute the target query task through the engine service to generate the information to be sent and send it to the receiving client.
[0083] Optionally, step 206 may include the following sub-steps S31-S34: S31. Extract the query primary key and receiving address from the target query task through the engine service; S32. Use the engine service to query the preset message database using the primary key to determine the initial field information corresponding to the primary key; S33. Using the engine service, query the mapping dictionary within the task according to the target, map the initial field information into text format and render it to generate the information to be sent; S34. Send the information to be sent to the receiving client corresponding to the receiving address through the engine service.
[0084] In this embodiment, the target query task can be executed through the engine service. The query primary key and the receiving address to be sent are extracted from the target query task through its configured process. The query primary key is used to query the preset message database to determine the initial field information corresponding to the query primary key. Then, according to the mapping dictionary in the target query task, the initial field information is mapped into text format and rendered to generate the information to be sent. Finally, the information to be sent is sent to the receiving client corresponding to the receiving address through the engine service.
[0085] It should be noted that if it is a scheduled task, the execution of the target query task can be performed by detecting the real time. If it is a synchronous task, the information to be sent will be sent directly according to the sending task generated after the trigger.
[0086] Optionally, the method further includes the following steps S41-S42:
[0087] S41. If the message to be sent is sent successfully, the successful sending log will be recorded in the message database. S42. If the message to be sent fails to be sent, the target query task will be executed again through the engine service and the message to be sent will be rendered and sent to the receiving client again.
[0088] Furthermore, the method also includes the following steps S43-S44: S43. When the message to be sent fails to be sent, the target query task to be executed is written to the exception task table. S44. When a task click instruction is received for the abnormal task table, select the target query task corresponding to the task click instruction and execute it, and send the information to be sent to the receiving client.
[0089] In this embodiment, clicking on the abnormal task table invokes a background query method, which displays abnormal data. Users can select a portion of the data to resend or click "resend all." The resend method is then invoked to obtain recipient information and establish a data source.
[0090] Please see Figure 3 This technical solution may include the following services: gateway, connection management service, message queue, engine service, registry center, and API management service.
[0091] Gateway: Its main functions are load balancing and health checks. This technology is designed for distributed microservice architectures to ensure system performance and high availability. The gateway automatically distributes request traffic based on demand, ensuring each service is in optimal condition. For unavailable services, the gateway will also detect them and forward requests to services that are currently in a healthy state.
[0092] Connection Management Service: Ensures that the connection for requests is not broken, acting as a bridge between the requesting task and the message queue. Provides an interface to send tasks to the message queue as HTTP requests.
[0093] Message queues: Their main function is peak shaving. When faced with massive data pushes, to ensure that the data is received smoothly and correctly, message queues can temporarily store the data, and the engine service can pull data from the message queue according to its own consumption capacity.
[0094] Engine service: Its main function is to retrieve tasks from the message queue, generate complete messages based on the task parameters, and send them to the corresponding backend interface service. It also records the sending result (success or failure), allowing failed tasks to be resent, thus ensuring the normal flow of data.
[0095] Registry Center: The registry center is mainly used for event notification. After the configuration center service modifies the attributes of the message template (such as the sending address), it will notify the registry center, which will then push the updated data to both the engine service and the API call service.
[0096] API Management Service: API management offers both synchronous and asynchronous data distribution. Tasks can be generated and pushed to the connection management service via scheduled tasks configured on the page, or tasks can be synchronously invoked directly through the API.
[0097] When the backend server receives a send request from the sending client, it can first distribute the send request through gateway load balancing, constructing at least one send task corresponding to the send request using a preset send task template; then, it calls the connection service to encapsulate all send tasks into a concurrent task list and caches it in a preset message queue; finally, it calls the engine service to retrieve the concurrent task list from the message queue and deduplicate it to obtain the target query task; and then, it executes the target query task through the engine service to generate the information to be sent and send it to the receiving client. This solves the technical problems of traditional solutions where the interface programs used by different business systems are highly intrusive to the business systems, and updating the interfaces can easily lead to instability in the business systems. Furthermore, each business system needs to manually resend data, resulting in reduced data interaction efficiency between business systems. By encapsulating tasks and caching them in the message queue, and then calling the engine service to execute the tasks and send information, it achieves more stable and efficient data adaptation between different business systems, thereby improving the efficiency of data interaction between them.
[0098] Please see Figure 4 , Figure 4 This is a structural block diagram of a data adaptation and transmission device provided in Embodiment 3 of the present invention.
[0099] This invention provides a data adaptation and transmission device applied to a backend server. The device includes: The sending task construction module 401 is used to construct at least one sending task corresponding to the sending request using a preset sending task template when a sending request is received from the sending client. The task encapsulation module 402 is used to call the connection service to encapsulate all sending tasks into a concurrent task list and cache them in a preset message queue; The task filtering module 403 is used to call the engine service to extract the concurrent task list from the message queue and remove duplicates to obtain the target query task; Task execution module 404 is used to execute target query tasks through engine service, generate information to be sent and send it to the receiving client.
[0100] Optionally, the task construction module 401 includes: The input position acquisition submodule is used to obtain the input position corresponding to the sending request when a sending request is received from the sending client. The Synchronous Task Creation Submodule is used to extract the first sending keyword carried in the sending request if the input location is the location of the synchronous sending link, and load the first sending keyword into the preset sending task template to generate a single sending task corresponding to the sending request. The asynchronous task creation submodule is used to extract the second sending keyword and task creation quantity carried in the sending request if the input position is the position of the asynchronous send button, and to create a sending task with the same number of tasks as the task creation quantity using the sending task template.
[0101] Optionally, the asynchronous task creation submodule is specifically used for: If the input location is the location of the asynchronous send button, then extract the task creation type, the second send keyword, and the number of tasks created carried in the send request; If the task creation type is a normal query task, then a single sending task is created using the sending task template and the second sending keyword; If the task creation type is a combined query task, then the task template and multiple second sending keywords are used to create a sending task equal to the number of task creations. If the task creation type is a comparison query task, then retrieve the existing sent data corresponding to the second sending keyword; Compare existing sent data with historical returned data, identify the differences, and create a single sending task using the sending task template.
[0102] Optionally, task execution module 404 is specifically used for:
[0103] The engine service extracts the query primary key and receiving address from the target query task. The engine service uses the primary key to query the preset message database and determines the initial field information corresponding to the primary key. The engine service queries the mapping dictionary within the task according to the target, maps the initial field information into text format and renders it to generate the message to be sent; The engine service sends the information to be sent to the receiving client corresponding to the receiving address.
[0104] Optionally, the device further includes:
[0105] The success recording module is used to record a success log to the message database if the message to be sent is successfully sent. The failure resend module is used to re-execute the target query task and render the information to be sent through the engine service if the information to be sent fails to be sent, and then resend the information to be sent to the receiving client.
[0106] Optionally, the device further includes: The exception task table writing module is used to write the target query task to be executed to the exception task table when the information to be sent fails to be sent. The retransmission selection module is used to select the target query task corresponding to the task click instruction when a task click instruction for the abnormal task table is received, execute it, and send the information to be sent to the receiving client.
[0107] Optionally, the backend server has a configuration page, and the device also includes: The message database creation module is used to respond to the data source configuration instructions entered on the configuration page and create a message database corresponding to the data source configuration instructions. The document parsing module is used to parse the interface document data when it is received on the configuration page, and extract retransmission parameters, message queue partition parameters, dictionary mapping parameters, sending address information, query parameters and field conversion parameters. The first configuration module is used to configure a preset standard sending template according to the sending address information to obtain the first sending template; The second configuration module is used to configure the first sending template using retransmission parameters, message queue partition parameters and query parameters, and obtain the second sending template. The third configuration module is used to configure the second sending template using dictionary mapping parameters and to determine the mapping dictionary in the second sending template. The template rendering module is used to configure the second sending template using field conversion parameters, determine the mapping text format corresponding to the mapping dictionary, obtain the target sending template, and render and generate the sending task template.
[0108] This invention provides an electronic device, including a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the data adaptation and transmission method as described in any embodiment of this invention.
[0109] This invention provides a computer-readable storage medium storing a computer program thereon, which, when executed, implements the data adaptation and transmission method as described in any embodiment of this invention.
[0110] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0111] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.
[0112] 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 network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0113] Furthermore, the functional units in the various embodiments of the present invention 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.
[0114] 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 the present invention, 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 the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0115] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A data adaptation and transmission method, characterized in that, Applied to a backend server, the method includes: When a sending request is received from the sending client, at least one sending task corresponding to the sending request is constructed using a preset sending task template; The connection service is invoked to encapsulate all the sending tasks into a concurrent task list and cache it in a preset message queue; The engine service is invoked to retrieve the concurrent task list from the message queue and deduplicate it to obtain the target query task; The engine service executes the target query task, generates information to be sent, and sends it to the receiving client. The step of constructing at least one sending task corresponding to the sending request using a preset sending task template when a sending request is received from the sending client includes: When a send request is received from the sending client, the input position corresponding to the send request is obtained; If the input location is the location of the synchronous sending link, then the first sending keyword carried by the sending request is extracted, and the first sending keyword is loaded into the preset sending task template to generate a single sending task corresponding to the sending request; If the input location is the location of the asynchronous send button, then extract the second send keyword and the number of tasks created carried in the send request, and use the send task template to create a send task with the same number of tasks created.
2. The method according to claim 1, characterized in that, The step of extracting the second sending keyword and task creation quantity carried in the sending request, and creating a sending task equal to the task creation quantity using the sending task template if the input position is the position of the asynchronous send button, includes: If the input location is the location of the asynchronous send button, then extract the task creation type, the second send keyword, and the number of tasks created carried in the send request; If the task creation type is a normal query task, then a single sending task is created using the sending task template and the second sending keyword; If the task creation type is a combined query task, then the sending task template and multiple second sending keywords are used to create a sending task equal to the number of tasks created. If the task creation type is a comparison query task, then retrieve the existing sent data corresponding to the second sending keyword; Compare the existing sent data with the historical returned data, determine the differences, and create a single sending task using the sent task template.
3. The method according to claim 1, characterized in that, The step of executing the target query task through the engine service, generating information to be sent, and sending it to the receiving client includes: The engine service extracts the query primary key and receiving address from the target query task. The engine service uses the query primary key to query a preset message database to determine the initial field information corresponding to the query primary key. The engine service maps the initial field information into text format and renders it according to the mapping dictionary within the target query task, generating the information to be sent. The engine service sends the information to be sent to the receiving client corresponding to the receiving address.
4. The method according to any one of claims 1-3, characterized in that, The method further includes: If the message to be sent is successfully sent, the successful sending log will be recorded in the message database; If the message to be sent fails to be sent, the target query task is executed again through the engine service and the message to be sent is rendered and sent to the receiving client again.
5. The method according to claim 4, characterized in that, The method further includes: When the information to be sent fails to be sent, the target query task to be executed is written to the abnormal task table. When a task click instruction is received for the abnormal task table, the target query task corresponding to the task click instruction is selected and executed, and the information to be sent is sent to the receiving client.
6. The method according to claim 1, characterized in that, The backend server has a configuration page, and the method further includes: In response to the data source configuration command entered on the configuration page, a message database corresponding to the data source configuration command is created; When interface document data is received on the configuration page, the interface document data is parsed to extract retransmission parameters, message queue partition parameters, dictionary mapping parameters, sending address information, query parameters, and field conversion parameters. Configure a preset standard sending template according to the sending address information to obtain the first sending template; The first sending template is configured using the retransmission parameters, the message queue partition parameters, and the query parameters to obtain the second sending template; Configure the second sending template using the dictionary mapping parameters, and determine the mapping dictionary within the second sending template; The second sending template is configured using the field conversion parameters, the mapping text format corresponding to the mapping dictionary is determined, the target sending template is obtained, and the sending task template is rendered and generated.
7. A data adaptation and transmission device, characterized in that, The device, applied to a backend server, includes: The sending task construction module is used to construct at least one sending task corresponding to the sending request using a preset sending task template when a sending request is received from the sending client. The task encapsulation module is used to call the connection service to encapsulate all the sending tasks into a concurrent task list and cache them in a preset message queue; The task filtering module is used to call the engine service to extract the concurrent task list from the message queue and remove duplicates to obtain the target query task; The task execution module is used to execute the target query task through the engine service, generate information to be sent, and send it to the receiving client; The task construction module includes: The input position acquisition submodule is used to acquire the input position corresponding to the sending request when a sending request is received from the sending client. The synchronous task creation submodule is used to extract the first sending keyword carried by the sending request if the input position is the position of the synchronous sending link, and load the first sending keyword into the preset sending task template to generate a single sending task corresponding to the sending request. The asynchronous task creation submodule is used to extract the second sending keyword and task creation quantity carried in the sending request if the input position is the position of the asynchronous send button, and to create a sending task with the same number of tasks as the sending task template.
8. An electronic device, characterized in that, The system includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor causes the processor to perform the steps of the data adaptation and transmission method as described in any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed, it implements the data adaptation and transmission method as described in any one of claims 1-6.
Citation Information
Patent Citations
Multi-channel message notification sending method and device
CN110601952A
Asynchronous data processing method and device based on big data, equipment and storage medium
CN111061804A
Timed task processing method, device and system, computer equipment and storage medium
CN111666138A
Distributed task scheduling operation system and method based on message queue
CN114327837A