Template handover method and device, electronic equipment and computer readable storage medium
Concurrent reading and writing of database data through coroutine pool technology solves the problem of CPU blocking and waiting during massive template handover, improves handover efficiency and stability, and ensures data accuracy.
Patent Information
- Application Number
- CN202310371029.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-04
- Publication Date
- 2024-10-15
AI Technical Summary
In the scenario of massive template handover, the existing technology causes the CPU to be blocked and waited multiple times due to the difference between IO read and write speed and CPU running speed, resulting in performance consumption and lag, and reducing the efficiency of template handover.
Using coroutine pool technology, multiple subtasks are constructed to concurrently read data in the database. Concurrent reading and writing are achieved through the data node array and version number array, avoiding the need to wait for each piece of data to be read and written before reading and writing the next data, improving handover. efficiency and ensure data accuracy.
It improves the efficiency and stability of massive template handover, avoids data reading and writing errors, and ensures the accuracy and orderliness of the handover process.
Smart Images

Figure CN118778977A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of the Internet, and relate to but are not limited to a template handover method, device, electronic device, and computer-readable storage medium. Background Art
[0002] At present, for template handover scenarios, for example, handing over a template from member A to member B, if only a small number of templates are handed over, the string key-value pairs (strkv) storage of each template process need to be read one by one, and the system performance can still support it at this time; if the user chooses to hand over massive template data, the massive template process strkv storage needs to be read one by one. Since the current IO reading and writing speed is several orders of magnitude slower than the CPU running speed, the CPU will be blocked multiple times waiting for IO to complete, resulting in empty CPU waiting and time consumption. Figure 1 As shown in the figure, it is a flowchart for the massive template handover scenario in the related art. Each time the CPU sends a handover request message (dispatch) and receives a feedback message (return), it needs to block and wait for a period of time. In the scenario of massive reading and writing, the CPU will repeat the above operations many times, and the performance consumption is unacceptable to the entire system.
[0003] It can be seen that in the related technology, when faced with a massive template handover scenario, the blocking waiting for receiving feedback messages will cause the template handover process to become stuck, thereby reducing the efficiency of the template handover. Summary of the invention
[0004] The embodiments of the present application provide a template handover method, device, electronic device and computer-readable storage medium, which can at least be applied to the field of cloud computing, can improve the efficiency of template handover, and ensure the stable and orderly handover of massive templates.
[0005] The technical solution of the embodiment of the present application is implemented as follows:
[0006] The embodiment of the present application provides a template handover method, comprising: in response to a template handover request, building a coroutine pool; the coroutine pool includes multiple subtasks; the template handover request includes a template identification array corresponding to multiple templates to be handed over, a handover object and a handed over object; the multiple template identifications in the template identification array are added to the multiple subtasks in the coroutine pool in sequence; the multiple subtasks in the coroutine pool are started concurrently, and the data corresponding to the template identification in each of the subtasks is read from a database to obtain the read data corresponding to the multiple templates to be handed over; the read data includes a data node array and a version number array, the data node array includes a data node corresponding to each template identification in the template identification array, and the version number array includes a version number corresponding to each data node in the data node array; based on the handover object and the handed over object, the read data is updated to obtain the updated read data; based on the updated read data, a template handover response message is generated, and the template handover response message is output.
[0007] The present application provides a template handover device, which includes: a coroutine pool construction module, which is used to construct a coroutine pool in response to a template handover request; the coroutine pool includes multiple subtasks; the template handover request includes a template identification array corresponding to multiple templates to be handed over, a handover object and a handed over object; an identification adding module, which is used to add multiple template identifications in the template identification array to multiple subtasks in the coroutine pool in sequence; a data reading module, which is used to concurrently start multiple subtasks in the coroutine pool, read data corresponding to the template identification in each of the subtasks from a database, and obtain the Read data corresponding to multiple templates to be handed over; the read data includes a data node array and a version number array, the data node array includes data nodes corresponding to each template identifier in the template identifier array, and the version number array includes a version number corresponding to each data node in the data node array; a data update module, used to update the read data based on the handover object and the handed over object to obtain updated read data; a message processing module, used to generate a template handover response message based on the updated read data, and output the template handover response message.
[0008] In some embodiments, the coroutine pool construction module is also used to: determine the number of template identifiers in the template identifier array in response to a template handover request; determine the number of coroutines in the coroutine pool based on the number of template identifiers; establish a number of subtasks corresponding to the number of coroutines to complete the construction of the coroutine pool.
[0009] In some embodiments, the coroutine pool construction module is also used to: respond to a template handover request, determine the business scenario corresponding to the template handover request based on the template identifier in the template identifier array; set the number of coroutines in the coroutine pool based on the business scenario; establish a number of subtasks corresponding to the number of coroutines to complete the construction of the coroutine pool.
[0010] In some embodiments, the identification adding module is also used to: split the template identification array to obtain multiple template identification sets; add each template identification set to a subtask in the coroutine pool in sequence according to the order of each template identification set in the template identification array; wherein each subtask has a subtask identification, and the subtask identification can identify the order of the template identification sets in the corresponding subtask in the template identification array.
[0011] In some embodiments, the data reading module is also used to: concurrently start multiple subtasks in the coroutine pool; in response to each of the subtasks, read the data node corresponding to each template identifier in the template identifier set in the subtask and the version number corresponding to the data node from the database to form a data node set and a version number set corresponding to the template identifier set; in accordance with the order of corresponding subtask identifiers of all subtasks, sequentially combine the data node set corresponding to the template identifier set in each subtask to form a data node array in the read data; in accordance with the order of corresponding subtask identifiers of all subtasks, sequentially combine the version number set corresponding to the template identifier set in each subtask to form a version number array in the read data.
[0012] In some embodiments, the device also includes: a data traversal module, used to traverse the data node array to obtain each data node; a deserialization module, used to deserialize the data nodes in the data node array to obtain the data structure of each template to be handed over; a page rendering module, used to render the data structure to obtain a page map of each template to be handed over; a page map output module, used to output the page map of each template to be handed over.
[0013] In some embodiments, the data update module is also used to: parse the data node array in the read data to obtain the approval object node and the operation object node in each of the templates to be handed over; determine the approval handover object and the approval handed over object in the approval object node based on the handover object and the handed over object; determine the operation handover object and the operation handed over object in the operation object node based on the handover object and the handed over object; modify the approval handed over object in the approval object node to the approval handover object; and modify the operation handed over object in the operation object node to the operation handover object to obtain the updated read data.
[0014] In some embodiments, the device also includes: a data node determination module to be updated, which is used to determine the data nodes corresponding to the approval handover object and the operation handover object in the data node array as data nodes to be updated; a target update data node determination module, which is used to determine the data nodes corresponding to the approval handover object and the operation handover object in the data node array as target update data nodes; the data update module is also used to: modify the data node to be updated to the target update data node to obtain the updated read data.
[0015] In some embodiments, the device also includes: a version number updating module, which is used to update the version number corresponding to the data node to be updated after modifying the data node to be updated to the target updated data node, so as to obtain an updated version number; and a version number replacement module, which is used to replace the version number corresponding to the data node to be updated with the updated version number in the version number array.
[0016] In some embodiments, the message processing module is also used to: write the updated read data back to the database; after writing each data node in the updated read data and the version number corresponding to the data node back to the database, generate the template handover response message.
[0017] In some embodiments, the message processing module is also used to: split the data node array and version number array in the updated read data to obtain multiple data node sets and multiple version number sets; wherein each data node set corresponds to a version number set, and each data node set and the corresponding version number set constitute an update data set pair; according to the order of each update data set pair in the data node array and the version number array, each update data set pair is added to the corresponding subtask in the coroutine pool in sequence; concurrently start multiple subtasks in the coroutine pool, and write all update data set pairs back to the database.
[0018] In some embodiments, the device also includes: a version number acquisition module, used to obtain the version number corresponding to each data node in the read data and the version number corresponding to each data node in the updated read data; a version number verification module, used to perform version number verification on each data node based on the version number corresponding to each data node in the read data and the version number corresponding to each data node in the updated read data to obtain a version number verification result; the message processing module is also used to: if the version number verification result of any data node is a passed verification, add the first type of identifier corresponding to the successful template handover to the sub-response message corresponding to the data node in the template handover response message; if the version number verification result of any data node is a failed verification, add the second type of identifier corresponding to the failed template handover to the sub-response message corresponding to the data node in the template handover response message.
[0019] An embodiment of the present application provides an electronic device, including: a memory for storing executable instructions; and a processor for implementing the above-mentioned template handover method when executing the executable instructions stored in the memory.
[0020] An embodiment of the present application provides a computer program product, which includes executable instructions stored in a computer-readable storage medium; wherein a processor of an electronic device reads the executable instructions from the computer-readable storage medium and implements the above-mentioned template handover method when executing the executable instructions.
[0021] An embodiment of the present application provides a computer-readable storage medium storing executable instructions for causing a processor to execute the executable instructions to implement the above-mentioned template handover method.
[0022] The embodiment of the present application has the following beneficial effects: when multiple templates to be handed over are handed over, multiple template identifiers in the template identifier array corresponding to the multiple templates to be handed over are added to the multiple subtasks in the coroutine pool in sequence; thereby realizing the concurrent startup of multiple subtasks in the coroutine pool, reading the data corresponding to the template identifier in each subtask from the database, obtaining the read data corresponding to the multiple templates to be handed over, and further updating the read data based on the handover objects and the handed over objects in the multiple templates to be handed over. In this way, since the data in the database is read concurrently by multiple subtasks in the coroutine pool, there is no need to wait for each piece of data to be read and written before reading and writing the next piece of data, realizing the concurrent reading and writing of massive templates, improving the handover efficiency of massive templates, and ensuring the stable and orderly handover of massive templates. In addition, the read data includes a data node array and a version number array, the data node array includes data nodes corresponding to each template identifier in the template identifier array, and the version number array includes a version number corresponding to each data node in the data node array. In this way, the read data includes not only the data node array but also the version number of each data node in the data node array. The accuracy of the read data can be judged by the version number, thereby avoiding data reading and writing errors and ensuring the accuracy of the template handover process. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 It is an optional architecture diagram of the template handover system provided in the embodiment of the present application;
[0024] Figure 2 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0025] Figure 3 It is an optional flow chart of the template handover method provided in the embodiment of the present application;
[0026] Figure 4 It is another optional flow chart of the template handover method provided in the embodiment of the present application;
[0027] Figure 5 2 are schematic diagrams of two implementation processes for building a coroutine pool provided in embodiments of the present application;
[0028] Figure 6 This is a schematic diagram of the implementation process of reading data from a database provided in an embodiment of the present application;
[0029] Figure 7 It is a schematic diagram of the implementation process of updating the read data provided by the embodiment of the present application;
[0030] Figure 8 It is a schematic diagram of the implementation process of generating a template handover response message provided in an embodiment of the present application;
[0031] Fig. 9 This is a schematic diagram of an application scenario of the template handover method of an embodiment of the present application;
[0032] Fig.10 It is a schematic diagram comparing the implementation process of the embodiment of the present application with that of the related technology;
[0033] Fig.11 It is a schematic diagram of the implementation process of the template handover method provided in the embodiment of the present application;
[0034] Fig.12 It is a page diagram for initiating a template handover request provided in an embodiment of the present application;
[0035] Fig.13 It is a technical schematic diagram of constructing an array provided in an embodiment of the present application;
[0036] Fig.14 It is a technical flow diagram of the collaborative data reading method provided by the embodiment of the present application;
[0037] Fig.15 It is a schematic diagram of a web page representation of a data structure provided in an embodiment of the present application;
[0038] Fig.16 It is a technical flow diagram of the coroutine-style data write-back provided in an embodiment of the present application;
[0039] Fig.17 This is a page diagram of successful handover provided in an embodiment of the present application. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.
[0041] In the following description, reference is made to "some embodiments", which describe a subset of all possible embodiments, but it is understood that "some embodiments" may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict. Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meaning as those commonly understood by those skilled in the art of the technical field of the embodiments of the present application. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.
[0042] At present, the performance of reading and writing the template process strkv storage is acceptable for basic single data read and write operations; however, if a large number of template process strkv is read and written, the time consumption of IO reading and writing is several orders of magnitude slower than the CPU processing speed, and the user experience will be stuck. To solve this problem, the embodiment of the present application proposes a template handover method, which is a technical solution for concurrently reading and writing a large number of strkv flowcharts with version coroutines.
[0043] The template handover method provided in the embodiment of the present application, first, in response to a template handover request, builds a coroutine pool; the coroutine pool includes multiple subtasks; the template handover request includes a template identification array corresponding to multiple templates to be handed over, a handover object and a handed over object; and the multiple template identifications in the template identification array are added to the multiple subtasks in the coroutine pool in sequence; then, the multiple subtasks in the coroutine pool are started, and the data corresponding to the template identification in each subtask is read from the database to obtain the read data corresponding to the multiple templates to be handed over; the read data includes a data node array and a version number array, the data node array includes the data nodes corresponding to each template identification in the template identification array, and the version number array includes the version number corresponding to each data node in the data node array; then, based on the handover object and the handed over object, the read data is updated to obtain the updated read data; finally, based on the updated read data, a template handover response message is generated, and the template handover response message is output. In this way, because the data in the database is read concurrently by multiple subtasks in the coroutine pool, there is no need to wait for each piece of data to be read and written before reading and writing the next piece of data, which realizes the coroutine-style concurrent reading and writing of massive templates, improves the handover efficiency of massive templates, and ensures the stable and orderly handover of massive templates. In addition, because the read data includes not only the data node array but also the version number of each data node in the data node array, the accuracy of the read data can be judged by the version number, thereby avoiding data reading and writing errors and ensuring the accurate progress of the template handover process.
[0044] Here, firstly, an exemplary application of the template handover device of the embodiment of the present application is described, and the template handover device is an electronic device for implementing the template handover method. In one implementation, the template handover device (i.e., electronic device) provided by the embodiment of the present application can be implemented as a terminal, or it can be implemented as a server. In one implementation, the template handover device provided by the embodiment of the present application can be implemented as a notebook computer, a tablet computer, a desktop computer, a mobile phone, a portable music player, a personal digital assistant, a dedicated message device, a portable game device, an intelligent robot, an intelligent home appliance, and an intelligent vehicle-mounted device, etc., any terminal with data reading and writing functions; in another implementation, the template handover device provided by the embodiment of the present application can also be implemented as a server, wherein the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks (CDN, Content Delivery Network), and cloud servers for basic cloud computing services such as big data and artificial intelligence platforms. The terminal and the server can be directly or indirectly connected by wired or wireless communication, which is not limited in the embodiment of the present application. Next, an exemplary application when the template handover device is implemented as a server will be described.
[0045] See also Figure 1 , Figure 1 It is an optional architectural diagram of the template handover system provided in the embodiment of the present application. The embodiment of the present application is explained by taking the template handover method applied to any template handover application as an example. The template handover application can be a business platform of any enterprise. In the template handover application, enterprise employees (i.e., users) can request to handover any number of templates to be handed over. In the embodiment of the present application, the template handover system 10 includes at least a terminal 100, a network 200, and a server 300. Among them, the server 300 can be a server of the template handover application. The server 300 can constitute the template handover device of the embodiment of the present application. The terminal 100 is connected to the server 300 via the network 200, and the network 200 can be a wide area network or a local area network, or a combination of the two.
[0046] In the embodiment of the present application, when requesting to hand over the template to be handed over, the terminal 100 receives the handover object and the handed over object input by the user through the client of the template handover application. Therefore, the client of the template handover application can generate a template handover request based on the handover object and the handed over object input by the user and the template identification array corresponding to the template to be handed over. The terminal 100 sends the template handover request to the server 300 through the network 200. After receiving the template handover request, the server 300 responds to the template handover request and builds a coroutine pool; and adds multiple template identifiers in the template identifier array to multiple subtasks in the coroutine pool in sequence; then, the multiple subtasks in the coroutine pool are started concurrently, and the data corresponding to the template identifier in each subtask is read from the database to obtain read data corresponding to multiple templates to be handed over; the read data includes a data node array and a version number array, the data node array includes data nodes corresponding to each template identifier in the template identifier array, and the version number array includes version numbers corresponding to each data node in the data node array; then, based on the handover object and the handed over object, the read data is updated to obtain updated read data; finally, based on the updated read data, a template handover response message is generated, and the template handover response message is sent to the terminal 100.
[0047] In other embodiments, the template handover device can also be implemented as a terminal, that is, the template handover method of the embodiment of the present application is implemented with the terminal as the execution subject. In the implementation process, when the terminal receives the handover object and the handed over object input by the user, and the template identification array corresponding to the template to be handed over, it responds to the user's input operation, builds a coroutine pool, and adds multiple template identifications in the template identification array to multiple subtasks in the coroutine pool in sequence; then, the terminal concurrently starts multiple subtasks in the coroutine pool, reads the data corresponding to the template identification in each subtask from the database, and obtains the read data corresponding to multiple templates to be handed over; the terminal updates the read data based on the handover object and the handed over object to obtain the updated read data; the terminal generates a template handover response message based on the updated read data, and outputs the template handover response message.
[0048] The template handover method of the embodiment of the present application also relates to the field of cloud computing. Cloud computing is a computing model that distributes computing tasks on a resource pool composed of a large number of computers, so that various application systems can obtain computing power, storage space and information services as needed. The network that provides resources is called a "cloud". The resources in the "cloud" are infinitely expandable in the eyes of users, and can be obtained at any time, used on demand, expanded at any time, and paid for by use. As a basic capability provider for cloud computing, a cloud computing resource pool platform (referred to as cloud platform) will be established, generally referred to as Infrastructure as a Service (IaaS, Infrastructure as a Service), and various types of virtual resources will be deployed in the resource pool for external customers to choose to use. The cloud computing resource pool mainly includes: computing devices (virtualized machines, including operating systems), storage devices, and network devices.
[0049] The template handover method provided in the embodiment of the present application can also be implemented based on a cloud platform and through cloud technology. For example, the server 300 can be a cloud server. A coroutine pool is constructed through a cloud server, or multiple template identifiers in the template identifier array are sequentially added to multiple subtasks in the coroutine pool through a cloud server, and multiple subtasks in the coroutine pool are started concurrently through a cloud server, and data corresponding to the template identifier in each subtask is read from a database to obtain read data corresponding to multiple templates to be handed over, and the read data is updated through the cloud server.
[0050] In some embodiments, a cloud storage may be provided, and the template identification array corresponding to the template to be handed over may be stored in the cloud storage, or the handover object and the handed over object may be stored in the cloud storage. In this way, when a template handover request is received, the handover object and the handed over object may be obtained from the cloud storage, thereby responding to the template handover request and improving the efficiency of template handover.
[0051] It should be noted here that cloud technology refers to a hosting technology that unifies hardware, software, network and other resources in a wide area network or local area network to achieve data computing, storage, processing and sharing. Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model. It can form a resource pool that is used on demand and is flexible and convenient. Cloud computing technology will become an important support. The background services of the technical network system require a large amount of computing and storage resources, such as video websites, picture websites and more portal websites. With the high development and application of the Internet industry, in the future, each item may have its own identification mark, and all need to be transmitted to the background system for logical processing. Data of different levels will be processed separately. All kinds of industry data require strong system backing support, which can be achieved through cloud computing.
[0052] Figure 2 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, Figure 2 The electronic device shown may be a template interface device, which includes: at least one processor 310, a memory 350, at least one network interface 320 and a user interface 330. The various components in the template interface device are coupled together via a bus system 340. It is understood that the bus system 340 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 340 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 340 is not shown in FIG. Figure 2 Various buses are labeled as bus system 340 .
[0053] The processor 310 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0054] The user interface 330 includes one or more output devices 331 that enable presentation of media content, and one or more input devices 332 .
[0055] The memory 350 may be removable, non-removable or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drive, optical disk drive, etc. The memory 350 may optionally include one or more storage devices physically away from the processor 310. The memory 350 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memory. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 350 described in the embodiment of the present application is intended to include any suitable type of memory. In some embodiments, the memory 350 can store data to support various operations, and examples of these data include programs, modules, and data structures or subsets or supersets thereof, as exemplarily described below.
[0056] An operating system 351 includes system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic businesses and processing hardware-based tasks; a network communication module 352 is used to reach other computing devices via one or more (wired or wireless) network interfaces 320. Exemplary network interfaces 320 include: Bluetooth, wireless compatibility certification (WiFi), and Universal Serial Bus (USB), etc.; an input processing module 353 is used to detect one or more user inputs or interactions from one of the one or more input devices 332 and translate the detected inputs or interactions.
[0057] In some embodiments, the device provided in the embodiments of the present application can be implemented in software. Figure 2 A template handover device 354 stored in a memory 350 is shown. The template handover device 354 may be a template handover device in an electronic device, which may be software in the form of a program or a plug-in, and includes the following software modules: a coroutine pool construction module 3541, an identification adding module 3542, a data reading module 3543, a data updating module 3544, and a message processing module 3545. These modules are logical, and therefore may be arbitrarily combined or further split according to the functions implemented. The functions of each module will be described below.
[0058] In other embodiments, the device provided in the embodiments of the present application can be implemented in hardware. As an example, the device provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the template handover method provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs) or other electronic components.
[0059] The template handover method provided in each embodiment of the present application can be executed by an electronic device, wherein the electronic device can be a server or a terminal, that is, the template handover method in each embodiment of the present application can be executed by a server, or by a terminal, or can be executed through interaction between a server and a terminal.
[0060] Figure 3 This is an optional flow chart of the template handover method provided in the embodiment of the present application. Figure 3 The steps shown are explained, and it should be noted that Figure 3 The template handover method in the example is explained by taking the server as the execution subject. Figure 3 As shown, the method includes the following steps S101 to S105:
[0061] Step S101, in response to the template handover request, construct a coroutine pool.
[0062] Here, the template handover request includes a template identification array corresponding to multiple templates to be handed over, a handover object and a handed over object. The template handover request is used to request handover of the template to be handed over, that is, to modify the handed over object in the template to the handover object.
[0063] The template to be handed over can be any template with different process nodes, for example, it can be any work template in the internal management platform of the enterprise. The employees of the enterprise can apply for the handover of any authorized template to be handed over in the internal management platform.
[0064] For example, the template handover method of the embodiment of the present application can be applied to the internal management platform of an enterprise. When an employee resigns, he can hand over the work on hand through the internal management platform. At this time, the template process corresponding to the work to be handed over is the template to be handed over. Alternatively, the resigned employee can also apply for the resignation process in the internal management platform. Then, after the resigned employee submits the application, the resignation process needs to be transferred to the nodes of different leaders for approval. During the approval process of the resignation process, the resignation process will determine the current handover object and the handover object according to the approval results of each leader. That is, the template handover method provided in the embodiment of the present application can be used to realize the transfer of the resignation process of the resigned employee between different nodes.
[0065] The coroutine pool includes multiple subtasks. The number of subtasks in the coroutine pool can be determined according to the number of template identifiers in the template identifier array in the template handover request, or according to the business scenario corresponding to the template handover request. Multiple template identifiers are added to each subtask, and the response to the template handover request is achieved by running multiple subtasks in the coroutine pool. In an embodiment of the present application, when a template handover request is received, the number of subtasks can be determined first, and then the coroutine pool can be constructed according to the number of subtasks.
[0066] The following is an explanation of coroutines: Coroutines are a way to implement multitasking. Coroutines are smaller than threads and occupy smaller execution units (i.e., required resources). Coroutines come with their own CPU context, so as long as the right time comes, one coroutine can be switched to another coroutine. As long as the CPU context is saved or restored during this process, the program can still run. A popular understanding can be: a function in a thread can save some temporary variables and other information of the current function anywhere, and then switch to another function for execution. Note that this is not done by calling a function, and the number of switches and when to switch to the original function can be determined by the developer himself. When implementing multitasking, the switching of coroutines is simply operating the CPU context, so the coroutine switches millions of times a second, and the operating system can withstand it.
[0067] Step S102, adding multiple template identifiers in the template identifier array to multiple subtasks in the coroutine pool in sequence.
[0068] In an embodiment of the present application, the template identification array includes multiple template identifications, and one or more template identifications can be added to each subtask. Each subtask can have a subtask identification for uniquely identifying the subtask. When multiple template identifications in the template identification array are sequentially added to multiple subtasks in the coroutine pool, each template identification can be sequentially added to the subtask according to the subtask identification, and the target number of template identifications added to each subtask can be determined according to the number of subtasks. Then, according to the order of the template identifications in the template identification array, the template identifications corresponding to the target number are sequentially added to a subtask until all template identifications are added to the subtask.
[0069] In some embodiments, the number of template identifiers added in multiple subtasks in the coroutine pool may be the same or different. When the number of template identifiers added in multiple subtasks in the coroutine pool is the same, the number of template identifiers added in each subtask can be determined based on the number of template identifiers in the template identifier array and the number of subtasks; when the number of template identifiers added in multiple subtasks in the coroutine pool is different, a certain number of template identifiers can be added to each subtask according to the load capacity of the subtask. Here, the load capacity refers to the maximum number of template identifiers that can be added when the subtask is started and can run normally.
[0070] Step S103, concurrently starting multiple subtasks in the coroutine pool, reading data corresponding to the template identifier in each subtask from the database, and obtaining read data corresponding to multiple templates to be handed over.
[0071] In an embodiment of the present application, multiple subtasks in the coroutine pool can be started and executed concurrently in the form of coroutines. For multiple subtasks in the coroutine pool, when any subtask is started, other subtasks are also started at the same time. In addition, the processing of multiple subtasks does not distinguish between the order of precedence. When any subtask is processed, the server CPU feeds back the sub-read data corresponding to the subtask. After the sub-read data corresponding to all subtasks are read, the sub-read data corresponding to all subtasks are spliced to obtain the read data corresponding to the multiple templates to be handed over in the template handover request.
[0072] For example, the multiple subtasks in the coroutine pool include task 1, task 2...task N (N is an integer greater than 2), wherein, when task 1 is started, the server will respond to task 1 and read the data corresponding to the template identifier in task 1 from the database. At this time, since the time-consuming data reading and writing is several orders of magnitude slower than the processing speed of the server CPU, it will take a certain amount of time to obtain the sub-read data corresponding to task 1. In the embodiment of the present application, since the multiple subtasks in the coroutine pool are started concurrently, during the execution of task 1, tasks 2 to task N will also be started, and the server CPU will also process tasks 2 to task N. When any task M (M is a positive integer less than N) in tasks 1 to task N is processed, the sub-read data corresponding to task M is returned. After the sub-read data corresponding to tasks 1 to task N are all read out, the N sub-read data are spliced in the order corresponding to the subtask identifier to form the read data corresponding to the multiple templates to be handed over in the template handover request.
[0073] Here, the read data includes a data node array and a version number array. The data node array includes multiple data nodes. The data node array includes data nodes corresponding to each template identifier in the template identifier array. The data node array includes multiple data nodes. The number of data nodes in the data node array is the same as the number of template identifiers in the template identifier array. The version number array includes version numbers corresponding to each data node in the data node array. The version number array includes multiple version numbers. The number of version numbers in the version number array is the same as the number of template identifiers in the template identifier array and the number of data nodes in the data node array. Each template identifier corresponds to a data node, and each data node corresponds to a version number. In the version number array, the version numbers corresponding to different data nodes can be the same or different.
[0074] The database is used to store data nodes of different templates to be handed over. The database can store data of all templates in the template handover application (such as the internal management system of an enterprise), including but not limited to process-related data of all templates, where the process-related data includes: information of different nodes in the process, relationships between different nodes (for example, sequential relationships, parallel relationships, inclusion relationships, etc. between nodes), flow paths and flow methods between different nodes, etc.
[0075] Step S104: updating the read data based on the handover object and the handed over object to obtain updated read data.
[0076] Here, when the read data corresponding to the template identification array is read from the database, the data node array and the version number array in the read data can be updated. When updating, when any data node in the data node array is updated, the version number corresponding to the data node is also updated accordingly.
[0077] The data node can be updated based on the handover object and the handed over object, and after the data node is updated, the version number corresponding to the data node is automatically updated.
[0078] During the implementation process, the data node corresponding to the handed over object in the data node array can be modified to the handover object to realize the update of the data node array in the read data. After the data node corresponding to the handed over object is modified, the version number corresponding to the data node can be automatically updated according to the preset version number update rule.
[0079] Here, the preset version number update rule may be to increase the version number by one in a manner of increasing the version number. For example, if the data node array in the read data includes data node 1, data node 2 ... data node N (N is an integer greater than 2), and the version number array in the read data includes version number 10, version number 20 ... version number N0, if data node 2 is modified, then the version number 20 corresponding to data node 2 may be directly modified to version number 21, that is, the version number of data node 2 is increased by one.
[0080] Step S105: Generate a template handover response message based on the updated read data, and output the template handover response message.
[0081] In the embodiment of the present application, after the data nodes and version numbers of all templates to be handed over in the read data are updated, the updated read data is obtained, and the updated read data includes all data nodes of each template to be handed over after the handover is completed at the current moment. At this time, a template handover response message can be generated to indicate the execution result of this template handover process, so as to respond to the template handover request sent by the terminal.
[0082] After the server generates the template handover response message, it sends the template handover response message to the terminal to complete the response process of this template handover request.
[0083] The template handover method provided by the embodiment of the present application, when handing over multiple templates to be handed over, multiple template identifiers in the template identifier array corresponding to the multiple templates to be handed over are added to the multiple subtasks in the coroutine pool in sequence; thereby realizing the concurrent start of multiple subtasks in the coroutine pool, reading the data corresponding to the template identifier in each subtask from the database, obtaining the read data corresponding to the multiple templates to be handed over, and further updating the read data based on the handover objects and the handed over objects in the multiple templates to be handed over. In this way, since the data in the database is read concurrently by multiple subtasks in the coroutine pool, there is no need to wait for each piece of data to be read and written before reading and writing the next piece of data, realizing the concurrent reading and writing of massive templates, improving the handover efficiency of massive templates, and ensuring the stable and orderly handover of massive templates. In addition, the read data includes a data node array and a version number array, the data node array includes data nodes corresponding to each template identifier in the template identifier array, and the version number array includes a version number corresponding to each data node in the data node array. In this way, the read data includes not only the data node array but also the version number of each data node in the data node array. The accuracy of the read data can be judged by the version number, thereby avoiding data reading and writing errors and ensuring the accuracy of the template handover process.
[0084] In some embodiments, the template handover system includes at least a terminal and a server, and a template handover application is installed on the terminal. The present application embodiment takes the template handover application as an enterprise's business platform as an example for explanation, in which enterprise employees can operate in the enterprise's business platform to hand over the template to be handed over, or personnel outside the enterprise can also operate in the enterprise's business platform to hand over the template to be handed over with enterprise employees.
[0085] The embodiment of the present application is described by taking the template handover method applied to the business platform of any enterprise as an example. The business platform can be any form of template handover application, for example, the business platform can be in the form of a web page, an application program, or a small program. In the business platform, enterprise employees or personnel outside the enterprise (i.e., users) can request the handover of any number of templates to be handed over. The server can be the background server of the business platform.
[0086] Figure 4 is another optional flow chart of the template handover method provided in the embodiment of the present application, such as Figure 4 As shown, the method includes the following steps S201 to S218:
[0087] Step S201: The terminal receives an input operation from a user through a client of a service platform.
[0088] Here, the input operation is used to input the handover object and the handed-over object, and input the template identifiers of multiple templates to be handed-over.
[0089] In some embodiments, templates to which the current user has authority may be displayed on the client of the service platform, and the current user may click to select multiple templates to be handed over from the displayed multiple templates.
[0090] Step S202: In response to the input operation, the terminal obtains a template identification array corresponding to a plurality of templates to be handed over, a handover object, and a handed over object.
[0091] Step S203: the terminal encapsulates the template identification arrays corresponding to the multiple templates to be handed over, the handover object and the handed over object into a template handover request.
[0092] After the user inputs the handover object and the handed over object, as well as the template identifiers of multiple templates to be handed over, the terminal may generate a template handover request based on the template identifier arrays corresponding to the multiple templates to be handed over, the handover object and the handed over object.
[0093] Step S204: the terminal sends a template handover request to the server.
[0094] Step S205: The server builds a coroutine pool in response to the template handover request.
[0095] In an embodiment of the present application, a template handover request includes a template identification array corresponding to a plurality of templates to be handed over, a handover object, and a handed over object. The template handover request is used to request a handover of the template to be handed over, that is, to modify the handed over object in the template to be a handover object. The template to be handed over can be any template with different process nodes, for example, it can be any work template in the internal management platform of an enterprise, and the employees of the enterprise can apply for the handover of any authorized template to be handed over in the internal management platform.
[0096] In some embodiments, the server may also authenticate the template handover request before building the coroutine pool. During the implementation process, the current user's operating rights may be authenticated to determine whether the current user has the authority to hand over these templates to be handed over, and whether the current user has the authority to perform the handover operation on the input handover object and the handed over object. The information in the template handover request may also be authenticated to determine whether the handover object and the handed over object in the template handover request are not empty, whether the enterprise ID and the current user's ID have the authority to hand over the template, and whether the enterprise ID and the current user's ID are in dispute.
[0097] The coroutine pool includes multiple subtasks. The number of subtasks in the coroutine pool can be determined according to the number of template identifiers in the template identifier array in the template handover request, or according to the business scenario corresponding to the template handover request. Multiple template identifiers are added to each subtask, and the response to the template handover request is achieved by running multiple subtasks in the coroutine pool. In an embodiment of the present application, when a template handover request is received, the number of subtasks can be determined first, and then the coroutine pool can be constructed according to the number of subtasks.
[0098] This application embodiment provides two methods for constructing a coroutine pool. Figure 5 , Figure 5 It is shown that step S205 can construct the coroutine pool in two ways, wherein, in one implementation, when the number of subtasks in the coroutine pool is determined according to the number of template identifiers in the template identifier array in the template handover request, step S205 can construct the coroutine pool by following steps S2051 to S2053:
[0099] Step S2051: In response to the template handover request, determine the number of template identifiers in the template identifier array.
[0100] Step S2052, determining the number of coroutines in the coroutine pool based on the number of template identifiers.
[0101] Here, the number of coroutines refers to the number of subtasks recommended in the coroutine pool. The number of template identifiers added in each subtask can be preset. In this way, in one implementation, when the number of template identifiers added in each subtask is the same, the number of template identifiers in the template identifier array can be divided by the number of template identifiers added in each subtask to obtain the number of coroutines in the coroutine pool. In another implementation, when the number of template identifiers added in each subtask is different, the number of template identifiers that can be added to the subtask can be determined at the same time when each subtask is established, and then the number of template identifiers that can be added to the currently established subtasks is summed. When the sum is greater than or equal to the number of template identifiers in the template identifier array, the establishment of new subtasks is stopped. At this time, the number of subtasks is the number of coroutines in the coroutine pool.
[0102] Step S2053, create a number of subtasks corresponding to the number of coroutines to complete the construction of the coroutine pool.
[0103] In an embodiment of the present application, when the number of template identifiers added in each subtask is the same, after the number of coroutines is determined, a corresponding number of subtasks can be established according to the number of coroutines; or, when the number of template identifiers added in each subtask is different, the number of coroutines can be determined while establishing the subtasks, that is, the number of coroutines can be determined while establishing the subtasks, and after the number of coroutines is determined, the corresponding number of subtasks are also completed.
[0104] In the embodiment of the present application, after the number of subtasks corresponding to the number of coroutines is established, it can be considered that the construction of the coroutine pool is completed. The coroutine pool includes the number of subtasks corresponding to the number of coroutines.
[0105] In an embodiment of the present application, the number of subtasks in the coroutine pool is determined according to the number of template identifiers in the template identifier array in the template handover request. In this way, the number of subtasks in the coroutine pool can be accurately determined, and the determined number of subtasks in the coroutine pool can just meet the processing of all template identifiers in the template handover request, thereby greatly saving computing resources while ensuring the CPU computing power of the server.
[0106] In another implementation, when the number of subtasks in the coroutine pool is determined according to the business scenario corresponding to the template handover request, step S205 may construct the coroutine pool by following steps S2054 to S2056:
[0107] Step S2054: In response to the template handover request, based on the template identifier in the template identifier array, determine the business scenario corresponding to the template handover request.
[0108] Step S2055, setting the number of coroutines in the coroutine pool based on the business scenario.
[0109] Here, according to the business scenario corresponding to the target handover request, the number of coroutines matching the business scenario is set. When setting, the coroutine number interval corresponding to each business scenario can be provided in advance. In this way, after determining the business scenario corresponding to the template handover request, the corresponding coroutine number interval is determined according to the business scenario, and then a coroutine number is randomly selected from the coroutine number interval as the coroutine number of the coroutine pool under the current business scenario.
[0110] Step S2056, create a number of subtasks corresponding to the number of coroutines to complete the construction of the coroutine pool.
[0111] In the embodiment of the present application, the number of subtasks in the coroutine pool is determined according to the business scenario corresponding to the template handover request, and the coroutine number interval can be quickly determined based on the mapping relationship between the pre-built business scenario and the coroutine number interval, so as to randomly select a coroutine number from the coroutine number interval. In this way, the efficiency of determining the number of coroutines can be greatly improved, thereby improving the efficiency of building the coroutine pool.
[0112] Step S206: The server sequentially adds the multiple template identifiers in the template identifier array to the multiple subtasks in the coroutine pool.
[0113] In some embodiments, when adding multiple template identifiers in a template identifier array to multiple subtasks in a coroutine pool in sequence, the template identifier array can be split first to obtain multiple template identifier sets; then, each template identifier set is added to a subtask in the coroutine pool in sequence according to the order of each template identifier set in the template identifier array; wherein each subtask has a subtask identifier, and the subtask identifier can identify the order of the template identifier sets in the corresponding subtask in the template identifier array.
[0114] Here, when splitting the template identification array, it can be split according to the number of template identifications that can be added in the subtask to obtain multiple template identification sets. When the number of template identifications that can be added in multiple subtasks is the same, the template identifications in the template identification array are evenly divided according to the same number to obtain multiple template identification sets with the same number of template identifications. When the number of template identifications that can be added in multiple subtasks is different, the multiple subtasks can be first sorted according to the subtask identifications to form a subtask sequence, and then, according to the number of template identifications that can be added to each subtask in the subtask sequence, the template identifications in the template identification array are split in turn to form multiple template identification sets with different numbers of template identifications. In these multiple template identification sets, each template identification set corresponds to a subtask, and the template identification set corresponding to any subtask includes all template identifications to be added to the subtask.
[0115] Step S207, the server concurrently starts multiple subtasks in the coroutine pool, reads data corresponding to the template identifier in each subtask from the database, and obtains read data corresponding to multiple templates to be handed over.
[0116] Here, the read data includes a data node array and a version number array. The data node array includes a data node corresponding to each template identifier in the template identifier array. The data node array includes multiple data nodes. The number of data nodes in the data node array is the same as the number of template identifiers in the template identifier array. The version number array includes a version number corresponding to each data node in the data node array. The version number array includes multiple version numbers. The number of version numbers in the version number array is the same as the number of template identifiers in the template identifier array and the number of data nodes in the data node array. Each template identifier corresponds to a data node, and each data node corresponds to a version number. In the version number array, the version numbers corresponding to different data nodes can be the same or different.
[0117] In some embodiments, see Figure 6 , Figure 6It is shown that in step S207, data corresponding to the template identifier in each subtask is read from the database, which can be implemented by the following steps S2071 to S2074:
[0118] Step S2071, concurrently start multiple subtasks in the coroutine pool.
[0119] In the embodiment of the present application, multiple subtasks in the coroutine pool can be started and executed concurrently in the form of coroutines. For multiple subtasks in the coroutine pool, when any subtask is started, other subtasks are also started at the same time.
[0120] Step S2072, in response to each subtask, read the data node corresponding to each template identifier in the template identifier set in the subtask and the version number corresponding to the data node from the database to form a data node set and a version number set corresponding to the template identifier set.
[0121] In an embodiment of the present application, when responding to any subtask, other subtasks also respond at the same time, and the processing of multiple subtasks does not distinguish between the order of priority. When any subtask is completed, the data node corresponding to each template identifier in the template identifier set in the subtask and the version number corresponding to the data node are read from the database, and then the server CPU feeds back the sub-read data corresponding to the subtask, or temporarily caches the sub-read data corresponding to the subtask.
[0122] During the implementation process, when processing each subtask, the data node corresponding to each template identifier in the template identifier set in the subtask and the version number corresponding to the data node can be read in turn to form a data node set and version number set corresponding to the template identifier set.
[0123] Step S2073, according to the order of the subtask identifiers of all subtasks, the data node sets corresponding to the template identifier set in each subtask are sequentially combined to form a data node array in the read data.
[0124] Here, after all sub-read data corresponding to all sub-tasks are read, the sub-read data corresponding to all sub-tasks are spliced to obtain the read data corresponding to the multiple templates to be handed over in the template handover request. In other words, the data node sets corresponding to the template identification set in each sub-task are sequentially combined to form a data node array in the read data.
[0125] Step S2074 , according to the order of the subtask identifiers of all subtasks, the version number sets corresponding to the template identifier sets in each subtask are sequentially combined to form a version number array in the read data.
[0126] Here, after all sub-read data corresponding to all sub-tasks are read, the sub-read data corresponding to all sub-tasks are spliced to obtain the read data corresponding to the multiple templates to be handed over in the template handover request. In other words, the version number sets corresponding to the template identification set in each sub-task are sequentially combined to form a version number array in the read data.
[0127] After the sequential combination of the data node set and the sequential combination of the version number set is completed, the data node array and the version number array in the read data are formed, thereby completing the data reading of the template identification in all subtasks.
[0128] In the embodiment of the present application, in the database, each data node is stored corresponding to the corresponding version number, so that when reading any data node, the version number corresponding to the data node can be read at the same time.
[0129] Step S208: The server traverses the data node array to obtain each data node.
[0130] Step S209: the server performs deserialization processing on the data nodes in the data node array to obtain the data structure of each template to be handed over.
[0131] Here, deserialization refers to the process of converting a binary content back to a Java object. With deserialization, the bytes saved in the file can be "converted back" to a Java object. In the embodiment of the present application, by deserializing the data nodes in the data node array, the data structure of each template to be handed over can be obtained.
[0132] Step S210: the server performs page rendering on the data structure to obtain a page map of each template to be handed over.
[0133] After obtaining the data structure of each template to be handed over, page rendering is performed based on the data structure to obtain a page diagram of the template to be handed over. In the page diagram, the template flow of the template to be handed over and the node corresponding to which user the current template flow flows to can be displayed.
[0134] Step S211: the server sends the page image of each template to be handed over to the terminal.
[0135] Step S212: the terminal displays a page image of the template to be handed over on the current interface.
[0136] Step S213: the server updates the read data based on the handover object and the handed over object to obtain updated read data.
[0137] In some embodiments, see Figure 7 , Figure 7It is shown that in step S213, data updating is performed on the read data, which can be achieved by following steps S2131 to S2134:
[0138] Step S2131, parsing the data node array in the read data to obtain the approval object node and the operation object node in each template to be handed over.
[0139] Here, the approval object node refers to the processing node corresponding to the approval object of the template to be handed over, and the operation object node refers to the processing node corresponding to the operation object of the template to be handed over.
[0140] In the embodiment of the present application, by performing data analysis on each data node in the data node array in the read data, the approval object node and the operation object node in each template to be handed over can be determined.
[0141] Step S2132: Based on the handover object and the handed-over object, determine the approval handover object and the approval handed-over object in the approval object node.
[0142] In the embodiment of the present application, each template to be handed over corresponds to a preset handover process, in which the handover process pre-sets the approval handover object corresponding to each handover, and the approval handedover object corresponding to each handedover object. In this way, when the server reads the data node array, it can determine the approval handover object corresponding to the handover object and the approval handedover object corresponding to the handedover object from the data node array based on the pre-defined content of the handover process and the handover object and handedover object in the template handover request, and determine the approval handover object and approval handedover object determined from the data node array as the approval handover object and approval handedover object in the approval object node.
[0143] Step S2133: Based on the handover object and the handed over object, determine the operation handover object and the handed over object in the operation object node.
[0144] In the embodiment of the present application, each template to be handed over corresponds to a preset handover process, in which an operation handover object corresponding to each handover and an operation handed over object corresponding to each handed over object are preset. In this way, when the server reads the data node array, it can determine the operation handover object corresponding to the handover object and the operation handed over object corresponding to the handed over object from the data node array based on the pre-defined content of the handover process and the handover object and the handed over object in the template handover request, and determine the operation handover object and the operation handed over object determined from the data node array as the operation handover object and the operation handed over object in the operation object node.
[0145] Step S2134, modifying the approval handed-over object in the approval object node to the approval handover object; and modifying the operation handed-over object in the operation object node to the operation handover object, to obtain updated read data.
[0146] After determining the approval handed over object and the approval handover object from the data node array, the approval handed over object in the data node array is modified to the approval handover object, thereby realizing the modification of the approval handed over object in the approval object node. In other words, by modifying the data in the data node array, the information in the web page corresponding to the approval object node is modified, that is, the process jump of the approval object node of the approver is realized.
[0147] After determining the operation handed over object and the operation handover object from the data node array, the operation handed over object in the data node array is modified to the operation handover object, so as to realize the modification of the approval handed over object in the operation object node. In other words, by modifying the data in the data node array, the information in the web page corresponding to the operation object node is modified, that is, the process jump of the operation object node of the operator is realized.
[0148] In the embodiment of the present application, the data nodes corresponding to the approval handed over object and the operation handed over object in the data node array can be determined as the data nodes to be updated; the data nodes corresponding to the approval handover object and the operation handover object in the data node array can be determined as the target update data nodes. In this way, when the approval handed over object in the approval object node is modified to the approval handover object; and when the operation handed over object in the operation object node is modified to the operation handover object, the data node to be updated can be modified to the target update data node to obtain the updated read data.
[0149] Step S214: After modifying the data node to be updated as the target update data node, the server updates the version number corresponding to the data node to be updated to obtain an updated version number.
[0150] Step S215: The server replaces the version number corresponding to the data node to be updated with the updated version number in the version number array.
[0151] Step S216: The server generates a template handover response message based on the updated read data.
[0152] In some embodiments, see Figure 8 , Figure 8 It is shown that in step S216, a template handover response message is generated, which can be implemented by the following steps S2161 to S2162:
[0153] Step S2161, writing the updated read data back to the database.
[0154] In some embodiments, writing back the updated read data to the database can be achieved in the following manner: splitting the data node array and version number array in the updated read data to obtain multiple data node sets and multiple version number sets; wherein each data node set corresponds to a version number set, and each data node set and the corresponding version number set constitute an updated data set pair; then, according to the order of each updated data set pair in the data node array and the version number array, each updated data set pair is added to the corresponding subtask in the coroutine pool in sequence; finally, multiple subtasks in the coroutine pool are started concurrently to write all updated data set pairs back to the database.
[0155] Step S2162, after each data node in the updated read data and the version number corresponding to the data node are written back to the database, a template handover response message is generated.
[0156] In some embodiments, before generating a template handover response message, the version number corresponding to each data node in the read data and the version number corresponding to each data node in the updated read data can also be obtained; then, based on the version number corresponding to each data node in the read data and the version number corresponding to each data node in the updated read data, a version number verification is performed on each data node to obtain a version number verification result. When generating a template handover response message, if the version number verification result of any data node is a verification pass, the first type of identifier corresponding to the successful template handover is added to the sub-response message corresponding to the data node in the template handover response message; if the version number verification result of any data node is a verification failure, the second type of identifier corresponding to the failed template handover is added to the sub-response message corresponding to the data node in the template handover response message.
[0157] In some embodiments, based on the version number corresponding to each data node in the read data and the version number corresponding to each data node in the updated read data, a version number check is performed on each data node, which can be implemented in the following way: for any data node in the read data and the corresponding data node in the updated read data, it can be determined whether the version number corresponding to the data node in the read data and the version number corresponding to the data node in the updated read data are the same. If they are the same, it indicates that the data node was not updated when the read data was read, and the version number check result for the data node this time is passed; if they are different, the version number difference between the version number corresponding to the data node in the read data and the version number corresponding to the data node in the updated read data is determined. If the updated read data is different, the version number difference between the version number corresponding to the data node in the read data and the version number corresponding to the data node in the updated read data is determined. If the version value difference between the version number corresponding to the data node in the fetched data and the version number corresponding to the data node in the read data is 1, it means that the data node was updated when the read data was read, and during the update process, no other terminal requested to update the data node, that is, no version number conflict occurred, and the version number verification result for the data node this time is also passed; if the version value difference between the version number corresponding to the data node in the updated read data and the version number corresponding to the data node in the read data is greater than 1, it means that the data node was updated when the read data was read, and during the update process, other terminals requested to update the data node, that is, a version number conflict occurred, and the version number verification result for the data node this time is also failed.
[0158] The first type of identifier is used to identify that the version number verification result for any data node is passed, that is, the template handover is successful, and the second type of identifier is used to identify that the version number verification result for any data node is not passed, that is, the template handover fails. The first type of identifier corresponding to the successful template handover or the second type of identifier corresponding to the failed template handover is added to the sub-response message corresponding to the data node in the template handover response message. In this way, by parsing the sub-response message corresponding to each data node, it can be determined whether the template handover process for each template to be handed over is successful.
[0159] Step S217: The server sends a template handover response message to the terminal.
[0160] Step S218: The terminal displays the template handover response message and the page after the template handover on the current interface.
[0161] The template handover method provided in the embodiment of the present application concurrently reads the data in the database through multiple subtasks in the coroutine pool, so there is no need to wait for each piece of data to be read and written before reading and writing the next piece of data, thus realizing the concurrent reading and writing of massive templates in a coroutine manner, improving the handover efficiency of massive templates, and ensuring the stable and orderly handover of massive templates. In addition, since the read data includes not only the data node array but also the version number of each data node in the data node array, the accuracy of the read data can be judged by the version number, thereby avoiding data reading and writing errors and ensuring the accurate implementation of the template handover process.
[0162] In some embodiments, the above-mentioned server may also be a server in a distributed system. In the process of implementation, the steps implemented by the above-mentioned server may also be implemented by different servers in the distributed system. For example, the servers in the distributed system may include a server-side server and a logic-side server, respectively. The server-side server may receive and parse the template handover request of the terminal, authenticate the user, and perform other operations; the logic-side server may build a coroutine pool, add multiple template identifiers in the template identifier array to multiple subtasks in the coroutine pool in sequence, start multiple subtasks in the coroutine pool concurrently, read the data corresponding to the template identifier in each subtask from the database, and perform data update and write back on the read data.
[0163] The following is an explanation of an exemplary application of the embodiments of the present application in a practical application scenario.
[0164] At present, the performance of reading and writing the template process strkv storage is acceptable for basic single data read and write operations; however, if a large number of template process strkv is read and written, the time consumption of IO reading and writing is several orders of magnitude slower than the CPU processing speed, and the user experience will be stuck. To solve this problem, the embodiment of the present application proposes a technical solution for concurrently reading and writing a large number of strkv flowcharts with version coroutines, namely the above-mentioned template handover method.
[0165] Fig. 9 Schematic diagram of the application scenario of the template handover method of the embodiment of the present application. Fig. 9 As shown, a certain template 901 is transferred from member A (test number 1) to member B (other member).
[0166] like Fig.10 As shown, it is a schematic diagram comparing the implementation process of the embodiment of the present application with that of the related technology. In the related technology (such as Fig.10In the left figure), each time the CPU sends a handover request message (dispatch) and receives a feedback message (return), it needs to block and wait for a period of time. In the scenario of massive reading and writing, the CPU will repeat the above operations many times, and this performance consumption is unacceptable for the entire system. If concurrent processing is performed through coroutines, then after the CPU sends a request for dispatch1, it finds that it needs to wait for IO. The CPU will not block at this time, but will continue to send dispatch2 and dispatch3, so that the entire task is executed concurrently instead of blocking and waiting. The method of the embodiment of the present application (such as Fig.10 The right picture in the figure can greatly improve the performance of the entire system. The embodiment of the present application optimizes the performance problem by means of coroutine concurrency and versioned reading and writing. The technical solution of the embodiment of the present application will be described in detail below in combination with the business scenario.
[0167] Fig.11 It is a schematic diagram of the implementation flow of the template handover method provided in an embodiment of the present application, wherein the service end (Svr end) and the logic end (Logic end) are the servers in the above embodiment, and the node (Node) end is the terminal in the above embodiment.
[0168] like Fig.11 As shown, the method comprises the following steps:
[0169] Step S1101: The user selects the template to be handed over and the handover person (ie, the handover object) on the web page, and clicks to initiate the handover.
[0170] Step S1102, the Node generates a template handover request (Req) according to user options and parameter packages.
[0171] Step S1103, the Node end requests to call the background common gateway interface (CGI) and sends the template handover request to the Svr end through the background CGI.
[0172] In the embodiment of the present application, the user selects the template to be handed over (i.e., the template to be handed over) on the web page, selects the handover person and the handover person, and clicks to initiate the handover. Fig.12 The request will be captured by the front end, and the parameters selected by the user will be sorted and packaged to form a template handover request, and then the template handover request will be sent to the CGI interface of the front and back end protocol.
[0173] Step S1104, the Svr end authenticates the operator (user).
[0174] Step S1105: If the authentication is successful, the template handover request is transparently transmitted to the Logic end.
[0175] In the embodiment of the present application, after receiving the template handover request sent by the Node end, the Svr end first authenticates the operator of the web page end to ensure that the operator has the authority to perform the handover process. After confirming that the handover authority is correct, the template handover request transmitted by the Node end is transparently transmitted to the Logic end.
[0176] Step S1106: The Logic end unpacks the template handover request and verifies basic parameters.
[0177] Step S1107, the Logic side adds scooping tasks in batches through the coroutine pool loop.
[0178] In the embodiment of the present application, the Logic end unpacks the template handover request and verifies the basic parameters. After the verification is correct, it starts to obtain the flow chart of the batch template to be handed over. In order to facilitate the use of the coroutine pool, three arrays are constructed here: template identification array, data node array and version number array, such as Fig.13 , which is a technical schematic diagram of constructing an array provided by an embodiment of the present application, wherein the input parameter is a template identification array 131 , and the output parameters are a data node array 132 and a version number array 133 .
[0179] Step S1108, the Logic end starts the coroutine task through the coroutine pool.
[0180] Step S1109, the Logic side concurrently retrieves data from the database (DataBase) through the coroutine pool.
[0181] In the embodiment of the present application, the template handover request on the Node side mainly carries the template identification array. The purpose of constructing the coroutine pool and concurrently retrieving data on the Logic side is to obtain the data node array and version number array corresponding to the template identification array. Fig.14 As shown, it is a technical flow diagram of the coroutine-style data reading provided by the embodiment of the present application. The template identification array can be split into batches, and each small batch of template identification sets is placed in the subtask of the coroutine pool. For example, assuming that there are 1,000 data in the template identification array, and 50 data are placed in the subtask of the coroutine pool as a batch, the entire coroutine pool will have 20 subtasks. Set the number of coroutines in the coroutine pool to 20 (the number of coroutines can also be set to a smaller or larger number according to the business scenario), wait for all subtasks to be loaded, and start all subtasks concurrently, so that the data in the database storage can be read in batches, and stored in the corresponding data node array and version number array in order.
[0182] As for the version number, it is a conflict avoidance process. For example, the version number of data X when it is read from the database is 100, and the version number when it is updated and written back to the database should also be 100. If the version number changes, it means that someone else has also modified the data, and the data cannot be updated. This is a conflict prevention mechanism. Or, if there is a data node whose version number is 1 when it is read from the database, if the data node is updated and then written back to the database, the version number of the data node will automatically increase by 1 and become 2; at this time, data verification will be performed. Since the version number written back should be 2, if it is found that the version number stored in the database has become 3 or 4, it means that other users have updated the data node during this period of time, and the current update of the data node is already in conflict, the update will fail, thus preventing conflicts.
[0183] Step S1110: the database returns the retrieved read data.
[0184] Step S1111, the Logic side modifies the process nodes and performs personnel handover.
[0185] In the embodiment of the present application, after receiving the data node array and version number array returned by the coroutine pool, the Logic end can traverse the data node array and deserialize the data in the data node array. After the data is deserialized and expanded, the data structure of the entire flowchart can be obtained, and the web page representation of the data structure is as follows: Fig.15 When a user transfers a template, he essentially finds the corresponding template process and updates the transferee in the approver node and the copy recipient node to the transferor.
[0186] Step S1112: The Logic side adds write-back tasks in batches through the coroutine pool loop.
[0187] Step S1113, the Logic end starts the write-back task through the coroutine pool.
[0188] Step S1114, the Logic side writes data back to the database concurrently through the coroutine pool.
[0189] In the embodiment of the present application, after the Logic end modifies the process node, it still adds the updated data node to the subtask of the coroutine pool in batches, such as Fig.16As shown, it is a technical flow diagram of the coroutine-style write-back data provided by an embodiment of the present application. The current strkv storage does not support batch operations when updating and writing back, and can only be updated and written back one by one. If there are 1000 data nodes in the array that need to be updated and written back to the database, these 1000 data need to be batched in a batch manner, and each data is placed in the coroutine pool subtask separately, that is, 1000 subtasks are required. After these 1000 subtasks are loaded, the coroutine pool starts and writes back the data in the database. When the data is written back successfully, it means that the template to be handed over has been successfully handed over.
[0190] Step S1115, the database returns the updated data to the Node end in sequence.
[0191] Step S1116, the Node side refreshes the page.
[0192] Step S1117, the Node returns the updated data to the web page.
[0193] In the embodiment of the present application, after the batch write-back is successful, the Logic end returns the final result to the Svr end, and the Svr end returns the package template handover response message (Resp) to the Node end. The Node end checks which templates to be handed over in the batch handover are successfully handed over and which are failed to be handed over (in most scenarios, all are successfully handed over), integrates the array and refreshes the page, and returns it to the user end (i.e., the web page end), and the user end can view the new page. Fig.17 Shown is a page diagram of a successful handover provided in an embodiment of the present application.
[0194] The template handover method provided in the embodiment of the present application, on the one hand, solves the time-consuming problem of CPU blocking when waiting for IO through the batch reading and writing storage method with version number of the coroutine pool; on the other hand, users no longer have to wait for a long time during batch handover operations, ensuring that users have a better product experience.
[0195] It can be understood that in the embodiments of the present application, the content involving user information, such as the template to be handed over, the template identification array, the handover object and the handed over object, if it involves data related to user information or enterprise information, when the embodiments of the present application are applied to specific products or technologies, it is necessary to obtain user permission or consent, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0196] The following is a description of an exemplary structure of the template handover device 354 provided in the embodiment of the present application implemented as a software module. In some embodiments, for example, Figure 2As shown, the template handover device 354 includes: a coroutine pool construction module 3541, which is used to construct a coroutine pool in response to a template handover request; the coroutine pool includes multiple subtasks; the template handover request includes a template identification array corresponding to multiple templates to be handed over, a handover object and a handed over object; an identification adding module 3542, which is used to add multiple template identifications in the template identification array to multiple subtasks in the coroutine pool in sequence; a data reading module 3543, which is used to concurrently start multiple subtasks in the coroutine pool, read data corresponding to the template identification in each of the subtasks from the database, and obtain the multiple The read data corresponding to the template to be handed over; the read data includes a data node array and a version number array, the data node array includes data nodes corresponding to each template identifier in the template identifier array, and the version number array includes version numbers corresponding to each data node in the data node array; a data update module 3544 is used to update the read data based on the handover object and the handed over object to obtain updated read data; a message processing module 3545 is used to generate a template handover response message based on the updated read data, and output the template handover response message.
[0197] In some embodiments, the coroutine pool construction module is also used to: determine the number of template identifiers in the template identifier array in response to a template handover request; determine the number of coroutines in the coroutine pool based on the number of template identifiers; establish a number of subtasks corresponding to the number of coroutines to complete the construction of the coroutine pool.
[0198] In some embodiments, the coroutine pool construction module is also used to: respond to a template handover request, determine the business scenario corresponding to the template handover request based on the template identifier in the template identifier array; set the number of coroutines in the coroutine pool based on the business scenario; establish a number of subtasks corresponding to the number of coroutines to complete the construction of the coroutine pool.
[0199] In some embodiments, the identification adding module is also used to: split the template identification array to obtain multiple template identification sets; add each template identification set to a subtask in the coroutine pool in sequence according to the order of each template identification set in the template identification array; wherein each subtask has a subtask identification, and the subtask identification can identify the order of the template identification sets in the corresponding subtask in the template identification array.
[0200] In some embodiments, the data reading module is also used to: concurrently start multiple subtasks in the coroutine pool; in response to each of the subtasks, read the data node corresponding to each template identifier in the template identifier set in the subtask and the version number corresponding to the data node from the database to form a data node set and a version number set corresponding to the template identifier set; in accordance with the order of corresponding subtask identifiers of all subtasks, sequentially combine the data node set corresponding to the template identifier set in each subtask to form a data node array in the read data; in accordance with the order of corresponding subtask identifiers of all subtasks, sequentially combine the version number set corresponding to the template identifier set in each subtask to form a version number array in the read data.
[0201] In some embodiments, the device also includes: a data traversal module, used to traverse the data node array to obtain each data node; a deserialization module, used to deserialize the data nodes in the data node array to obtain the data structure of each template to be handed over; a page rendering module, used to render the data structure to obtain a page map of each template to be handed over; a page map output module, used to output the page map of each template to be handed over.
[0202] In some embodiments, the data update module is also used to: parse the data node array in the read data to obtain the approval object node and the operation object node in each of the templates to be handed over; determine the approval handover object and the approval handed over object in the approval object node based on the handover object and the handed over object; determine the operation handover object and the operation handed over object in the operation object node based on the handover object and the handed over object; modify the approval handed over object in the approval object node to the approval handover object; and modify the operation handed over object in the operation object node to the operation handover object to obtain the updated read data.
[0203] In some embodiments, the device also includes: a data node determination module to be updated, which is used to determine the data nodes corresponding to the approval handover object and the operation handover object in the data node array as data nodes to be updated; a target update data node determination module, which is used to determine the data nodes corresponding to the approval handover object and the operation handover object in the data node array as target update data nodes; the data update module is also used to: modify the data node to be updated to the target update data node to obtain the updated read data.
[0204] In some embodiments, the device also includes: a version number updating module, which is used to update the version number corresponding to the data node to be updated after modifying the data node to be updated to the target updated data node, so as to obtain an updated version number; and a version number replacement module, which is used to replace the version number corresponding to the data node to be updated with the updated version number in the version number array.
[0205] In some embodiments, the message processing module is also used to: write the updated read data back to the database; after writing each data node in the updated read data and the version number corresponding to the data node back to the database, generate the template handover response message.
[0206] In some embodiments, the message processing module is also used to: split the data node array and version number array in the updated read data to obtain multiple data node sets and multiple version number sets; wherein each data node set corresponds to a version number set, and each data node set and the corresponding version number set constitute an update data set pair; according to the order of each update data set pair in the data node array and the version number array, each update data set pair is added to the corresponding subtask in the coroutine pool in sequence; concurrently start multiple subtasks in the coroutine pool, and write all update data set pairs back to the database.
[0207] In some embodiments, the device also includes: a version number acquisition module, used to obtain the version number corresponding to each data node in the read data and the version number corresponding to each data node in the updated read data; a version number verification module, used to perform version number verification on each data node based on the version number corresponding to each data node in the read data and the version number corresponding to each data node in the updated read data to obtain a version number verification result; the message processing module is also used to: if the version number verification result of any data node is a passed verification, add the first type of identifier corresponding to the successful template handover to the sub-response message corresponding to the data node in the template handover response message; if the version number verification result of any data node is a failed verification, add the second type of identifier corresponding to the failed template handover to the sub-response message corresponding to the data node in the template handover response message.
[0208] It should be noted that the description of the device of the embodiment of the present application is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment, so it is not repeated. For technical details not disclosed in the embodiment of the device, please refer to the description of the method embodiment of the present application for understanding.
[0209] The embodiment of the present application provides a computer program product, which includes an executable instruction, which is a computer instruction; the executable instruction is stored in a computer-readable storage medium. When a processor of an electronic device reads the executable instruction from the computer-readable storage medium and the processor executes the executable instruction, the electronic device executes the method described in the embodiment of the present application.
[0210] The present application embodiment provides a storage medium storing executable instructions, wherein the executable instructions are stored. When the executable instructions are executed by a processor, the processor will execute the method provided by the present application embodiment, for example, Figure 3 The method shown.
[0211] In some embodiments, the storage medium can be a computer-readable storage medium, for example, a ferroelectric random access memory (FRAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPR OM), a flash memory, a magnetic surface memory, an optical disk, or a compact disk read-only memory (CD-ROM), etc.; it can also be various devices including one or any combination of the above memories.
[0212] In some embodiments, executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.
[0213] As an example, executable instructions may, but need not correspond to, a file in a file system, may be stored as part of a file storing other programs or data, for example, in one or more scripts in a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions). As an example, executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one location, or on multiple electronic devices distributed at multiple locations and interconnected by a communication network.
[0214] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.
Claims
1. A template handover method, characterized in that: The method comprises: In response to the template handover request, a coroutine pool is constructed; the coroutine pool includes a plurality of subtasks; the template handover request includes a template identification array corresponding to a plurality of templates to be handed over, a handover object, and a handed over object; Adding multiple template identifiers in the template identifier array to multiple subtasks in the coroutine pool in sequence; Concurrently starting multiple subtasks in the coroutine pool, reading data corresponding to the template identifier in each of the subtasks from a database, and obtaining read data corresponding to the multiple templates to be handed over; the read data includes a data node array and a version number array, the data node array includes a data node corresponding to each template identifier in the template identifier array, and the version number array includes a version number corresponding to each data node in the data node array; Based on the handover object and the handed-over object, updating the read data to obtain updated read data; A template handover response message is generated based on the updated read data, and the template handover response message is output.
2. The method according to claim 1, characterized in that The step of constructing a coroutine pool in response to the template handover request includes: In response to the template handover request, determining the number of template identifiers in the template identifier array; Determine the number of coroutines in the coroutine pool based on the number of template identifiers; Create a number of subtasks corresponding to the number of coroutines to complete the construction of the coroutine pool.
3. The method according to claim 1, characterized in that The step of constructing a coroutine pool in response to the template handover request includes: In response to the template handover request, determining the business scenario corresponding to the template handover request based on the template identifier in the template identifier array; Setting the number of coroutines in the coroutine pool based on the business scenario; Create a number of subtasks corresponding to the number of coroutines to complete the construction of the coroutine pool.
4. The method according to claim 1, characterized in that The adding the multiple template identifiers in the template identifier array to the multiple subtasks in the coroutine pool in sequence includes: Splitting the template identification array to obtain multiple template identification sets; According to the order of each template identification set in the template identification array, each template identification set is added to a subtask in the coroutine pool in turn; wherein each subtask has a subtask identification, and the subtask identification can identify the order of the template identification sets in the corresponding subtask in the template identification array.
5. The method according to claim 4, characterized in that The concurrently starting multiple subtasks in the coroutine pool, reading data corresponding to the template identifier in each of the subtasks from a database, and obtaining read data corresponding to the multiple templates to be handed over, includes: Concurrently start multiple subtasks in the coroutine pool; In response to each of the subtasks, reading from the database a data node corresponding to each template identifier in the template identifier set in the subtask and a version number corresponding to the data node to form a data node set and a version number set corresponding to the template identifier set; According to the order of the subtask identifiers of all subtasks, the data node sets corresponding to the template identifier set in each subtask are sequentially combined to form a data node array in the read data; According to the sequence of the subtask identifiers of all subtasks, the version number sets corresponding to the template identifier sets in each subtask are sequentially combined to form a version number array in the read data.
6. The method according to claim 1, characterized in that The method further comprises: Traversing the data node array to obtain each data node; Deserialize the data nodes in the data node array to obtain the data structure of each template to be handed over; Performing page rendering on the data structure to obtain a page diagram of each template to be handed over; Output the page image of each template to be handed over.
7. The method according to any one of claims 1 to 6, characterized in that: The updating of the read data based on the handover object and the handed over object to obtain updated read data includes: Parsing the data node array in the read data to obtain the approval object node and the operation object node in each template to be handed over; Based on the handover object and the handed-over object, determining the approval handover object and the handed-over object in the approval object node; Based on the handover object and the handed over object, determining the operation handover object and the handed over object in the operation object node; The approval handed-over object in the approval object node is modified to be the approval handover object; and the operation handed-over object in the operation object node is modified to be the operation handover object, to obtain the updated read data.
8. The method according to claim 7, characterized in that The method further comprises: Determine the data nodes corresponding to the approval handed-over object and the operation handed-over object in the data node array as data nodes to be updated; Determine the data nodes corresponding to the approval handover object and the operation handover object in the data node array as target update data nodes; The step of modifying the approval handed-over object in the approval object node to the approval hand-over object; and modifying the operation handed-over object in the operation object node to the operation hand-over object to obtain the updated read data includes: The to-be-updated data node is modified to be the target updated data node, and the updated read data is obtained.
9. The method according to claim 8, characterized in that The method further comprises: After modifying the to-be-updated data node to be the target updated data node, updating the version number corresponding to the to-be-updated data node to obtain an updated version number; In the version number array, the version number corresponding to the data node to be updated is replaced with the updated version number.
10. The method according to any one of claims 1 to 6, characterized in that: The generating a template handover response message based on the updated read data includes: Writing the updated read data back to the database; After each data node in the updated read data and the version number corresponding to the data node are written back to the database, the template handover response message is generated.
11. The method according to claim 10, characterized in that Writing the updated read data back to the database includes: Splitting the data node array and the version number array in the updated read data to obtain multiple data node sets and multiple version number sets; wherein each data node set corresponds to a version number set, and each data node set and the corresponding version number set constitute an updated data set pair; According to the order of each update data set pair in the data node array and the version number array, each update data set pair is added to the corresponding subtask in the coroutine pool in sequence; Concurrently start multiple subtasks in the coroutine pool and write all updated data set pairs back to the database.
12. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: Obtaining a version number corresponding to each data node in the read data and a version number corresponding to each data node in the updated read data; Based on the version number corresponding to each data node in the read data and the version number corresponding to each data node in the updated read data, performing version number verification on each data node to obtain a version number verification result; The generating a template handover response message based on the updated read data includes: If the version number verification result of any data node is verification passed, the first type identifier corresponding to the successful template handover is added to the sub-response message corresponding to the data node in the template handover response message; If the version number verification result of any data node is verification failure, the second type identifier corresponding to the template handover failure is added to the sub-response message corresponding to the data node in the template handover response message.
13. A template handover device, characterized in that: The device comprises: A coroutine pool construction module is used to construct a coroutine pool in response to a template handover request; the coroutine pool includes multiple subtasks; the template handover request includes a template identification array corresponding to multiple templates to be handed over, a handover object, and a handed over object; An identification adding module, used for sequentially adding multiple template identifications in the template identification array to multiple subtasks in the coroutine pool; A data reading module, used for concurrently starting multiple subtasks in the coroutine pool, reading data corresponding to the template identifier in each of the subtasks from a database, and obtaining read data corresponding to the multiple templates to be handed over; the read data includes a data node array and a version number array, the data node array includes a data node corresponding to each template identifier in the template identifier array, and the version number array includes a version number corresponding to each data node in the data node array; A data updating module, used for updating the read data based on the handover object and the handed over object to obtain updated read data; The message processing module is used to generate a template handover response message based on the updated read data, and output the template handover response message.
14. An electronic device, characterized in that: include: A memory for storing executable instructions; The processor is used to implement the template handover method described in any one of claims 1 to 12 when executing the executable instructions stored in the memory.
15. A computer-readable storage medium, characterized in that: Executable instructions are stored, which are used to cause a processor to execute the executable instructions to implement the template handover method described in any one of claims 1 to 12.
