File synchronization method, device and storage medium between business systems
By embedding a file synchronization module as a dependency package into the business system and using a remote interface for scheduled file synchronization, the problem of high cost of file synchronization between different systems is solved, and efficient file synchronization and decoupling are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SMCAIOT
- Filing Date
- 2024-05-14
- Publication Date
- 2026-06-02
AI Technical Summary
When synchronizing files between different business systems, existing technologies require writing file retrieval functions separately for each business system, resulting in excessive costs.
By embedding a file synchronization module as a dependency package into each business system, and using timed file retrieval tasks to call remote interfaces for file synchronization, file synchronization can be achieved by setting up only a few interfaces in the system, thus decoupling it from the business system.
It reduced the cost of fetching files between business systems, enabled efficient file synchronization between different systems, and reduced the need for repetitive code writing.
Smart Images

Figure CN118394726B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of file synchronization technology, specifically to a file synchronization method, device, and storage medium between business systems. Background Technology
[0002] In application areas such as cloud computing, big data, and the Internet of Things, a large number of files need to be transferred between different business systems to achieve file synchronization between different business systems. For example, the first business system can actively pull files from the second business system to transfer the files from the second business system to the first business system.
[0003] However, when implementing file retrieval functionality in business systems, technical personnel often write the file retrieval function directly in the corresponding business system. If multiple business systems exist simultaneously, the file retrieval function needs to be written separately for each business system, making the file retrieval cost too high.
[0004] Therefore, how to reduce the cost of file retrieval is a technical problem that urgently needs to be solved. Summary of the Invention
[0005] This application provides a file synchronization method, device, and storage medium between business systems, aiming to reduce the cost of file retrieval between business systems.
[0006] On one hand, this application provides a file synchronization method between business systems. The method is applied to a terminal, which includes a first business system and a first file synchronization module. The first file synchronization module is embedded in the first business system as a dependency package. The method includes:
[0007] The file retrieval task in the first file synchronization module is triggered periodically.
[0008] When the file retrieval task is triggered, a second file retrieval instruction is sent to the second remote interface to call the second file query interface set in the second business system through the second remote interface, and to query the second file to be retrieved from the second business system to the first business system using the second file query interface. The second remote interface is set in the second file synchronization module, and the second file synchronization module is embedded in the second business system in the form of a dependency package.
[0009] Receive the second file retrieved from the second remote interface and store the second file in the first business system;
[0010] Send a successful storage message for the second file to the second remote interface, so as to call the second synchronous callback interface set in the second business system through the second remote interface, and use the second synchronous callback interface to change the file status of the second file in the second business system from the first status to the second status.
[0011] In some embodiments, the first business system is provided with a first file query interface and a first synchronization callback interface, the first file synchronization module includes a first remote interface, and the method further includes:
[0012] When the first remote interface receives the first file retrieval instruction, it calls the first file query interface and uses the first file query interface to query the first file to be retrieved from the first business system to the second business system;
[0013] The first file is sent back to the second file synchronization module;
[0014] When the first remote interface receives the storage success message of the first file sent by the second file synchronization module, it calls the first synchronization callback interface set in the first business system and uses the first synchronization callback interface to change the file status of the first file in the first business system from the first status to the second status.
[0015] In some embodiments, the dependency package used when the first file synchronization module is embedded in the first business system is the same as the dependency package used when the second file synchronization module is embedded in the second business system.
[0016] In some embodiments, the method further includes:
[0017] Obtain the service call mode of the first file synchronization module;
[0018] When the service call mode is a one-way call, the task status of the file retrieval task is set to the enabled state so that the file retrieval task can be triggered periodically.
[0019] In some embodiments, the first business system is provided with a first file query interface and a first synchronization callback interface, and the method further includes:
[0020] When the service call mode is a one-way call, the task status of the file push task in the first file synchronization module is set to the enabled state so as to trigger the file push task at regular intervals.
[0021] When the file push task is triggered, the first file query interface is called to query the first file to be pushed to the second business system in the first business system and obtain the file identifier of the first file.
[0022] The first file is downloaded based on the file identifier, the first file is sent to the second remote interface to invoke the second remote interface, and the first file is stored in the second business system using the second remote interface;
[0023] Upon receiving the successful storage message of the first file from the second remote interface, the first synchronization callback interface is invoked to change the file status of the first file in the first business system from the first status to the second status.
[0024] In some embodiments, receiving the second file pulled by the second remote interface and storing the second file in the first business system includes:
[0025] Receive the second file retrieved from the second remote interface;
[0026] Detect whether the second file exists in the first business system;
[0027] If the second file does not exist in the first business system, the second file will be stored in the first business system.
[0028] The method further includes:
[0029] If the second file exists in the first business system, the second file in the first business system is updated using the second file retrieved through the second remote interface.
[0030] In some embodiments, the first business system is provided with a first file compression interface, and the method further includes:
[0031] The file compression task in the first file synchronization module is triggered periodically.
[0032] When the file compression task is triggered, the first file compression interface is called to query the download address of the file to be compressed in the first business system.
[0033] Download the file to be compressed according to the download address, and compress the file to obtain the first file;
[0034] Upload the first file to the first business system.
[0035] In some embodiments, the step of compressing the file to be compressed to obtain the first file includes:
[0036] Identify the file type of the file to be compressed, which includes image type or document type;
[0037] When the file type is image, the file to be compressed is compressed to obtain a first file with an image resolution smaller than that of the file to be compressed.
[0038] When the file type is document, the file to be compressed is compressed to obtain the first file in a preset compression format.
[0039] On the other hand, this application also provides a computer device, the computer device comprising:
[0040] One or more processors;
[0041] Memory; and
[0042] One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the steps in the file synchronization method between any of the business systems described above.
[0043] On the other hand, this application also provides a computer-readable storage medium having a computer program stored thereon, the computer program being loaded by a processor to perform the steps in the file synchronization method between any of the business systems described in the present invention.
[0044] On the other hand, embodiments of this application provide a computer program product, including a computer program or instructions, which are executed by a processor to implement a file synchronization method between business systems as described in any of the preceding claims.
[0045] The file synchronization method, device, and storage medium between business systems provided in this application embed a first file synchronization module into a first business system as a dependency package, and a second file synchronization module into a second business system as a dependency package. By periodically triggering a file retrieval task in the first file synchronization module, the second remote interface in the second file synchronization module is used to call the second file query interface and the second synchronization callback interface in the second business system to actively retrieve files from the second business system to the first business system. This decouples the file retrieval function between different business systems from the business systems, and only requires setting a few interfaces for calling in the business systems, without having to write file retrieval functions separately for each business system, thereby reducing the file retrieval cost between business systems. Attached Figure Description
[0046] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0047] Figure 1 This is a schematic diagram illustrating the file push relationship between the first business system and the second business system provided in this application embodiment;
[0048] Figure 2 This is a schematic flowchart of an embodiment of the file synchronization method between business systems provided in this application.
[0049] Figure 3 This is a schematic flowchart of another embodiment of the file synchronization method between business systems provided in this application.
[0050] Figure 4 This is a schematic flowchart of another embodiment of the file synchronization method between business systems provided in this application.
[0051] Figure 5 This is a schematic diagram of an embodiment of the computer device provided in this application. Detailed Implementation
[0052] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0053] In the description of this application, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the stated features. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0054] In this application, the term "some embodiments" is used to mean "used as an example, illustration, or description." Any embodiment described as "some embodiments" in this application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use this application. Details are set forth in the following description for purposes of explanation. It should be understood that those skilled in the art will recognize that this application can be made without using these specific details. In other instances, well-known structures and processes are not described in detail to avoid obscuring the description of this application with unnecessary detail. Therefore, this application is not intended to be limited to the embodiments shown, but is consistent with the broadest scope of the principles and features disclosed in this application.
[0055] This application provides a method, device, and storage medium for file synchronization between business systems, which will be described in detail below.
[0056] The file synchronization method between business systems provided in this application embodiment is described using file synchronization between a first business system and a second business system as an example.
[0057] Please see Figure 1 The first business system embeds a first file synchronization module as a dependency package, and the second business system embeds a second file synchronization module as a dependency package. The first and second business systems run on different terminals. A dependency package refers to a software package containing independent modules that a corresponding business system depends on. For example, the first file synchronization module is embedded as an independent module in the first business system, rather than being an integral part of it. Therefore, the first file synchronization module can be decoupled from the first business system, thus improving the reusability of its code. For instance, code from the first file synchronization module can be reused in the second file synchronization module.
[0058] exist Figure 1In this process, the first business system retrieves a second file from the second business system to the first business system through communication between the first and second file synchronization modules, thus achieving file synchronization between the two systems. To ensure compatibility between the first and second file synchronization modules, and vice versa, only a few interfaces need to be configured in each system for invocation. This eliminates the need to write complete file push functionality in either system, reducing the cost of file retrieval between business systems. For example, the interfaces required for the second business system include a second file query interface and a second synchronization callback interface. The second file query interface is used to query the second file to be retrieved from the second business system to the first business system, providing the second file synchronization module with file query functionality from the second business system. The second synchronization callback interface is used to return the corresponding processing result after the file retrieval process between the first business system and the second business system is completed. For example, after the file retrieval process for the second file is completed, the file status of the second file in the second business system is changed from the first status to the second status. The first status can be an unsynchronized status, and the second status can be a synchronized status.
[0059] Please see Figure 2 , Figure 2 This is a schematic flowchart of an embodiment of the file synchronization method between business systems provided in this application. Figure 1 Based on the illustrated embodiment, this file synchronization method between business systems is applied to a terminal, which includes a first business system and a first file synchronization module. The method can be executed by the first file synchronization module in the terminal, and specifically may include:
[0060] 201. Trigger the file retrieval task in the first file synchronization module at regular intervals.
[0061] In this embodiment, the first file synchronization module has multiple different file-related tasks, such as file retrieval tasks, file push tasks, and file compression tasks. Each file-related task in the first file synchronization module is generally triggered periodically as a scheduled task; for example, the file retrieval task in the first file synchronization module is triggered periodically.
[0062] 202. When the file retrieval task is triggered, a second file retrieval command is sent to the second remote interface to call the second file query interface set in the second business system through the second remote interface, and to query the second file to be retrieved from the second business system to the first business system using the second file query interface.
[0063] In this embodiment, the second file synchronization module is equipped with a second remote interface, which is used for remote invocation by a remote end, such as the first file synchronization module, to achieve interaction with the remote end. When a file retrieval task is triggered, a second file retrieval command is generated and sent to the second remote interface. This allows the second remote interface to invoke a second file query interface, enabling the second business system to query for the second file to be retrieved from the first business system. After obtaining the second file, the second remote interface sends the retrieved file back to the sender of the second file retrieval command, i.e., the first file synchronization module.
[0064] In order to send the second file retrieval command to the second remote interface, the address of the second remote interface can be pre-set in the first file synchronization module so that the second file retrieval command can be sent to the second remote interface according to the address of the second remote interface.
[0065] In some embodiments, the second file query interface is used to query the second file to be pulled from the second business system to the first business system. Specifically, the second file query interface is first used to obtain the file query method set in the second business system (e.g., MySQL, PostgreSQL, Oracle, Redis, etc.), and then the first file query interface is used to query the second file to be pulled from the second business system to the first business system according to that file query method. It can be seen that the above file query method is set in the second business system, not in the second file synchronization module. This gives the developers of the second business system greater freedom. Developers can set the file query method corresponding to the characteristics of the second business system, making the file query method more compatible with the second business system, without being limited to a certain file query method that may be attached to the second file synchronization module.
[0066] 203. Receive the second file pulled from the second remote interface and store the second file in the first business system.
[0067] In this embodiment, storing the second file in the first business system specifically means uploading the second file to the local machine of the first business system or storing it on a designated server mounted on the first business system. The designated server mounted on the first business system can be pre-configured within the first business system.
[0068] 204. Send a successful storage message for the second file to the second remote interface, so as to call the second synchronous callback interface set in the second business system through the second remote interface, and use the second synchronous callback interface to change the file status of the second file in the second business system from the first status to the second status.
[0069] In this embodiment, after the second file is stored in the first business system, the retrieval process for the second file is considered complete. At this time, a successful storage message for the second file can be sent to the second remote interface. The second remote interface can then call the second synchronous callback interface to provide feedback on the processing result to the second business system. For example, the second synchronous callback interface can be used to change the file status of the second file in the second business system from the first status to the second status, thereby ensuring the correctness of the file status of the second file in the second business system.
[0070] In some embodiments, the second business system stores the file states of multiple different files to distinguish which files are second files to be pulled to the first business system and which have already been successfully pulled to the first business system. Therefore, when querying the second file to be pulled to the first business system using the second file query interface, the second file query interface is used to query the file states of multiple files stored in the second business system, thereby sequentially identifying files with a first state as second files. Similarly, the first business system also stores the file states of multiple different files. The function of the file states in the first business system is similar to that in the second business system, and will not be elaborated upon here.
[0071] The file synchronization method between business systems provided in this application embeds a first file synchronization module into a first business system as a dependency package, and a second file synchronization module into a second business system as a dependency package. By periodically triggering the file retrieval task in the first file synchronization module, the second remote interface in the second file synchronization module is used to call the second file query interface and the second synchronization callback interface in the second business system to actively retrieve files from the second business system to the first business system. This decouples the file retrieval function between different business systems from the business systems themselves, and only requires setting a few interfaces for calling in the business systems, without having to write file retrieval functions separately for each business system, thereby reducing the file retrieval cost between business systems.
[0072] like Figure 3 As shown, in Figure 2 Based on the illustrated embodiment, the first business system is equipped with a first file query interface and a first synchronization callback interface. The first file synchronization module includes a first remote interface to facilitate the second business system in retrieving files from the first business system. Thus, combined with... Figure 2 In the illustrated embodiment, the first business system and the second business system can pull files from each other's business systems, achieving bidirectional file synchronization between the first and second business systems. The file synchronization method between the business systems can be executed by the first file synchronization module in the terminal, and this method may further include:
[0073] 301. When the first remote interface receives the first file retrieval instruction, it calls the first file query interface and uses the first file query interface to query the first file to be retrieved from the first business system to the second business system.
[0074] In this embodiment, similar to the first business system needing to retrieve a second file from the second business system, the second business system may also need to retrieve a first file from the first business system. Therefore, with Figure 2 Similar to "sending a second file retrieval command to the second remote interface" in the illustrated embodiment, the second file synchronization module can also send a first file retrieval command to the first remote interface. When the first remote interface receives the first file retrieval command, the first file synchronization module can call the first file query interface in the first file synchronization module to query the first file to be retrieved from the first business system to the second business system.
[0075] 302. Send the first file back to the second file synchronization module.
[0076] 303. When the first remote interface receives the storage success message of the first file sent by the second file synchronization module, it calls the first synchronization callback interface set in the first business system and uses the first synchronization callback interface to change the file status of the first file in the first business system from the first status to the second status.
[0077] In this embodiment, when the first remote interface receives the storage success message of the first file sent by the second file synchronization module, it indicates that the second business system has successfully stored the first file. Therefore, the first synchronization callback interface can be called to change the file status of the first file in the first business system from the first status to the second status, thereby ensuring the correctness of the file status of the first file in the first business system.
[0078] In some embodiments, the dependency package used when the first file synchronization module is embedded in the first business system is the same as the dependency package used when the second file synchronization module is embedded in the second business system. That is, the same dependency package is embedded in the first business system and the second business system respectively, forming the first file synchronization module in the first business system and the second file synchronization module in the second business system, and implementing the file retrieval function in the first business system and the second business system respectively. This allows the dependency package to be reused between different business systems, further reducing the cost of pushing files between different business systems.
[0079] The file synchronization method between business systems provided in this application embodiment achieves bidirectional file synchronization between the first business system and the second business system through bidirectional file retrieval between the first business system and the second business system, thereby reducing the cost of bidirectional file retrieval between the first business system and the second business system.
[0080] In some embodiments, under the requirements of certain application scenarios, file synchronization modules embedded in certain business systems are subject to service call restrictions. For example, a file synchronization module embedded in a certain business system may not be allowed to be called by other ends, but may call services from other ends (for example, when the first business system is on an intranet or local area network, while the second business system is on a public network, in order to ensure the security of the first business system, the first business system may be set to not be allowed to be called by other ends, but may call services from other ends). Another example is that a file synchronization module embedded in a certain business system may be allowed to be called by other ends, but may not call services from other ends. Yet another example is that a file synchronization module embedded in a certain business system may be allowed to be called by other ends, and may also call services from other ends. Since when a file synchronization module embedded in a business system is not allowed to be called by other terminals, other terminals cannot pull files from the file synchronization module or push files to the file synchronization module. Similarly, when a file synchronization module embedded in a business system is not allowed to call services from other terminals, the file synchronization module cannot pull files from other terminals or push files to other terminals. Therefore, the file synchronization method between business systems may further include: obtaining the service call mode of the first file synchronization module, where the service call mode includes one of one-way call, one-way called, or bidirectional call. One-way call, for example, may be disallowed from being called by other terminals but allows calling services from other terminals; one-way called may be allowed to be called by other terminals but disallows calling services from other terminals; and bidirectional call includes being allowed to be called by other terminals and also allowing calling services from other terminals. Based on the service call mode, the task status of the file pull task and / or file push task in the first file synchronization module is set.
[0081] The task status of the file fetch and file push tasks in the first file synchronization module can include an "on" state and a "off" state. When the file fetch task is in the "on" state, it will be triggered periodically; when it is in the "off" state, it will not be triggered periodically. Similarly, when the file push task is in the "on" state, it will be triggered periodically; when it is in the "off" state, it will not be triggered periodically. Therefore, based on the service call mode, setting the task status of the file fetch and file push tasks in the first file synchronization module can include: when the service call mode is a one-way call, setting the task status of the file fetch task in the first file synchronization module to the "on" state to facilitate periodic triggering of the file fetch task, and / or setting the task status of the file push task in the first file synchronization module to the "on" state to facilitate periodic triggering of the file push task; when the service call mode is a one-way called state, setting the task status of the file fetch task in the first file synchronization module to the "off" state, and / or setting the task status of the file push task in the first file synchronization module to the "off" state. When the service call mode is bidirectional, the task status setting of the file retrieval task in the first file synchronization module can be determined based on actual needs.
[0082] It should be noted that when setting the task status of file retrieval and file push tasks, it is necessary to ensure that the task status of file retrieval in the first file synchronization module and file push in the second file synchronization module are not both enabled at the same time, so as to avoid duplicate synchronization of files between the first and second business systems.
[0083] Furthermore, such as Figure 4 As shown, in Figure 2 Based on the illustrated embodiment, the first business system is equipped with a first file query interface and a first synchronization callback interface. The file synchronization method between business systems can be executed by the first file synchronization module in the terminal, and this method may further include:
[0084] 401. When the service call mode is one-way call, set the task status of the file push task in the first file synchronization module to the enabled state so that the file push task can be triggered on a timed basis.
[0085] In this embodiment, when the service call mode is a one-way call, in order to achieve bidirectional file synchronization between the first business system and the second business system, in addition to setting the task status of the file retrieval task in the first file synchronization module to the enabled state, the task status of the file retrieval task in the first file synchronization module can also be set to the enabled state, so as to trigger the file push task at regular intervals.
[0086] 402. When the file push task is triggered, call the first file query interface to query the first file in the first business system to be pushed to the second business system and obtain the file identifier of the first file.
[0087] In this embodiment, when the file push task is triggered periodically, the first file query interface provided by the first business system is invoked to query the first file to be pushed to the second business system through the file query function of the first business system, and obtain the file identifier of the first file. The file identifier of the first file may include the name of the first file, the storage address of the first file in the first business system, etc.
[0088] In some embodiments, calling the first file query interface to query the first file in the first business system to be pushed to the second business system may include: calling the first file query interface to obtain the file query method set in the first business system (e.g., mysql, pgsql, oracle, redis, etc.); and using the first file query interface to query the first file in the first business system to be pushed to the second business system according to the file query method. It can be seen that the above-mentioned file query method is set in the first business system, rather than in the first file synchronization module. This gives the developers of the first business system greater freedom. Developers can set the file query method corresponding to the first business system based on its characteristics, making the file query method more compatible with the first business system, without being limited to a certain file query method that may be attached to the first file synchronization module.
[0089] 403. Download the first file based on the file identifier, send the first file to the second remote interface to invoke the second remote interface, and use the second remote interface to store the first file in the second business system.
[0090] In this embodiment, the first file in the first business system is located and downloaded based on a file identifier. For example, the first file can be located and downloaded based on at least one of the file name or the storage address of the first file in the first business system. The storage address of the first file in the first business system can be a local storage address within the first business system or an address on a designated file server mounted to the first business system. In the step of storing the first file in the second business system using the second remote interface, the first file can be stored locally in the second business system or stored on a designated file server mounted to the second business system using the second remote interface.
[0091] In some embodiments, the processing after the second remote interface in the second business system is invoked is described. Specifically, when the second remote interface is invoked, the second file synchronization module can use the second remote interface to store the first file received by the second remote interface into the second business system. When the second file synchronization module receives the storage address of the first file in the second business system, it sends a successful storage message to the first file synchronization module, so that the first file synchronization module can modify the file status of the first file in the first business system accordingly upon receiving the successful storage message from the second file synchronization module.
[0092] 404. Upon receiving the successful storage message of the first file from the second remote interface, call the first synchronous callback interface to change the file status of the first file in the first business system from the first status to the second status.
[0093] In this embodiment, when the storage success message of the first file is received from the second remote interface, it indicates that the second business system has successfully stored the first file. Therefore, the first synchronization callback interface can be called to change the file status of the first file in the first business system from the first status to the second status, thereby ensuring the correctness of the file status of the first file in the first business system.
[0094] In some embodiments, the dependency package used when the first file synchronization module is embedded in the first business system is the same as the dependency package used when the second file synchronization module is embedded in the second business system. That is, the same dependency package is embedded in the first business system and the second business system respectively, forming the first file synchronization module in the first business system and the second file synchronization module in the second business system (at this time, the task status of the file retrieval task and the file push task in the first file synchronization module are both in the enabled state, and the task status of the file retrieval task and the file push task in the second file synchronization module are both in the disabled state). This allows the dependency package to be reused between different business systems, further reducing the cost of pushing files between different business systems.
[0095] The file synchronization method between business systems provided in this application embodiment sets the task status of both the file retrieval task and the file push task in the first file synchronization module to the enabled state when the service call mode of the first file synchronization module is a one-way call, so as to realize bidirectional file synchronization between the first business system and the second business system.
[0096] In some embodiments, during the file transfer link of file push or file pull, network fluctuations or disconnections may cause the loss of successful storage messages for the first or second file. This can lead to repeated file synchronization between the first and second business systems, resulting in multiple duplicate files stored in either system. To address this, taking the first business system pulling a second file from the second business system as an example, receiving the second file pulled from the second remote interface and storing it in the first business system can include: receiving the second file pulled from the second remote interface; detecting whether the second file exists in the first business system; if the second file does not exist in the first business system, storing it in the first business system to avoid multiple duplicate files; if the second file exists in the first business system, updating the second file in the first business system using the second file pulled from the second remote interface, rather than storing the second file pulled from the second remote interface as a new file, to avoid multiple duplicate files stored in the first business system.
[0097] In some embodiments, since the files pushed or pulled between the first business system and the second business system may be large, a file compression function can also be provided to reduce the time spent on file transfer. Specifically, the first business system is provided with a first file compression interface, and the first file synchronization module is provided with a file compression task. Similar to the file pull task and the file push task, the file compression task can also be triggered and executed periodically as a scheduled task. The file synchronization method between business systems may also include:
[0098] Step 1: Trigger the file compression task in the first file synchronization module at regular intervals.
[0099] Step 2: When the file compression task is triggered, call the first file compression interface to query the download address of the file to be compressed in the first business system.
[0100] Understandably, in order to enable the first business system to provide a query function for the download address of the file to be compressed, relevant technical personnel can set up the first file compression interface in the business system in advance for the first file synchronization module to call.
[0101] Step 3: Download the file to be compressed from the download address, compress the file to obtain the first file.
[0102] In this embodiment, upon obtaining the download address of the file to be compressed in the first business system, the file can be downloaded from the corresponding location in the first business system according to the download address. Then, the file is compressed to obtain the aforementioned first file. This results in smaller data transfer volume and shorter data transfer time when the first file is pushed to the second business system or retrieved by the second business system. The specific compression method and requirements for the file compression process can be preset and are not limited here.
[0103] Step 4: Upload the first file to the first business system.
[0104] In this embodiment, after the file compression process is completed, the compressed first file is uploaded to the first business system, ready to be pushed to the second business system or retrieved by the second business system later. After the first file is uploaded to the first business system, the upload address of the first file can be obtained. At this time, the upload address can be used as the storage address of the first file in the first business system and recorded in the file identifier of the first file.
[0105] In some embodiments, compressing a file to be compressed to obtain a first file may include: identifying the file type of the file to be compressed, which may include image or document types; when the file type is image, compressing the file to be compressed to obtain a first file with an image resolution smaller than the file to be compressed, i.e., compressing the file to be compressed by reducing resolution; when the file type is document, compressing the file to be compressed to obtain a first file with a preset compression format, i.e., compressing the file to be compressed by generating a compressed archive, thereby ensuring more reasonable file compression. Preset compression formats include, for example, zip, rar, 7z, etc.
[0106] In some embodiments, to reduce the writing cost of the first file synchronization module, some code in the first file synchronization module can be implemented in a reused manner. For example, the downloading of the file to be compressed, the uploading of the first file, the downloading of the first file, the uploading of the second file, and the downloading of the first file are all executed based on the same preset file handler (FileHandler) in the first file synchronization module. Specifically, the first file synchronization module abstracts several virtual classes: AbstractCompressFileHandler (abstract compressed document handler), AbstractCompressPicHandler (abstract compressed image handler), AbstractPullFileHandler (abstract pull file handler), AbstractPushFileHandler (abstract push file handler), etc. These virtual classes are used to implement functions such as downloading the file to be compressed, uploading the first file, downloading the first file, uploading the second file, and downloading the first file. The implementation of these virtual classes can be based on the FileHandler in the BaseHandler (basic handler) virtual class, which is inherited by these virtual classes. It can be seen that by reusing FileHandler, the writing cost for implementing functions such as downloading the file to be compressed, uploading the first file, downloading the first file, uploading the second file, and downloading the first file can be reduced.
[0107] In some embodiments, the configuration of the first file synchronization module can be set and modified through configuration files or configuration database tables. The operating rules for the first file synchronization module set in the configuration file and the operating rules set in the configuration database table can include configurations for file-related tasks such as file retrieval tasks, file push tasks, and file compression tasks (e.g., the timed triggering cycles of these file-related tasks). When the first file synchronization module is configured through both the configuration file and the configuration database table, configuration conflicts may occur. To address this, the file synchronization method between business systems can further include: detecting whether both the configuration file and the configuration database table of the first file synchronization module exist simultaneously in the terminal; if both exist, executing the steps of timed triggering of the file retrieval task and the timed triggering of the file push task in the first file synchronization module according to their priority. For example, if the configuration file has a higher priority than the configuration database table, then the steps for periodically triggering the file retrieval task and the file push task in the first file synchronization module will be executed according to the operating rules set in the configuration file. Conversely, if the configuration file has a lower priority than the configuration database table, then the steps for periodically triggering the file retrieval task and the file push task in the first file synchronization module will be executed according to the operating rules set in the configuration database table. The priorities of the configuration file and the configuration database table can be preset based on actual needs.
[0108] In addition to the file synchronization method for business systems described above, this application also provides a computer device, which includes:
[0109] One or more processors;
[0110] Memory; and
[0111] One or more applications, wherein the applications are stored in memory and configured to be executed by a processor, the steps of any of the above embodiments of the file synchronization method between business systems.
[0112] like Figure 5 As shown, it illustrates a structural diagram of a computer device involved in an embodiment of this application. This computer device can be a terminal or a server. Specifically:
[0113] The computer device may include components such as a processor 501 with one or more processing cores, a storage unit 502 with one or more computer-readable storage media, a power supply 503, and an input unit 504. Those skilled in the art will understand that... Figure 5 The computer device structure shown does not constitute a limitation on the computer device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:
[0114] The processor 501 is the control center of the computer device. It connects various parts of the computer device via various interfaces and lines, and performs various functions and processes data by running or executing software programs and / or modules stored in the storage unit 502, and by calling data stored in the storage unit 502, thereby providing overall monitoring of the computer device. Optionally, the processor 501 may include one or more processing cores; preferably, the processor 501 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into the processor 501.
[0115] Storage unit 502 can be used to store software programs and modules. Processor 501 executes various functional applications and data processing by running the software programs and modules stored in storage unit 502. Storage unit 502 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, storage unit 502 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, storage unit 502 may also include a memory controller to provide processor 501 with access to storage unit 502.
[0116] The computer equipment also includes a power supply 503 that supplies power to the various components. Preferably, the power supply 503 can be logically connected to the processor 501 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 503 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0117] The computer device may also include an input unit 504, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0118] Although not shown, the computer device may also include a display unit, etc., which will not be described in detail here. Specifically, in the embodiments of this application, the processor 501 in the computer device loads the executable files corresponding to the processes of one or more applications into the storage unit 502 according to the following instructions, and the processor 501 runs the applications stored in the storage unit 502 to realize various functions, as follows:
[0119] The system periodically triggers a file retrieval task in the first file synchronization module. When the file retrieval task is triggered, a second file retrieval command is sent to the second remote interface. This remote interface calls the second file query interface set in the second business system and uses it to query the second file to be retrieved from the second business system to the first business system. This second file is embedded as a dependency package into the second file synchronization module of the second business system, including the second remote interface. The system receives the second file retrieved by the second remote interface and stores it in the first business system. A successful storage message for the second file is sent to the second remote interface. This remote interface calls the second synchronization callback interface set in the second business system and uses it to change the file status of the second file in the second business system from the first status to the second status.
[0120] The file synchronization method between business systems provided in this application embeds a first file synchronization module into a first business system as a dependency package, and a second file synchronization module into a second business system as a dependency package. By periodically triggering the file retrieval task in the first file synchronization module, the second remote interface in the second file synchronization module is used to call the second file query interface and the second synchronization callback interface in the second business system to actively retrieve files from the second business system to the first business system. This decouples the file retrieval function between different business systems from the business systems themselves, and only requires setting a few interfaces for calling in the business systems, without having to write file retrieval functions separately for each business system, thereby reducing the file retrieval cost between business systems.
[0121] Therefore, embodiments of this application provide a computer-readable storage medium, which may include: read-only memory (ROM), random access memory (RAM), a disk, or an optical disk, etc. The computer-readable storage medium stores multiple instructions that can be loaded by a processor to execute steps in any of the file synchronization methods between business systems provided in embodiments of this application. For example, the instructions may execute the following steps:
[0122] The system periodically triggers a file retrieval task in the first file synchronization module. When the file retrieval task is triggered, a second file retrieval command is sent to the second remote interface. This remote interface calls the second file query interface set in the second business system and uses it to query the second file to be retrieved from the second business system to the first business system. This second file is embedded as a dependency package into the second file synchronization module of the second business system, including the second remote interface. The system receives the second file retrieved by the second remote interface and stores it in the first business system. A successful storage message for the second file is sent to the second remote interface. This remote interface calls the second synchronization callback interface set in the second business system and uses it to change the file status of the second file in the second business system from the first status to the second status.
[0123] Furthermore, embodiments of this application also provide a computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform a file synchronization method between business systems as described in any of the preceding claims.
[0124] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0125] The foregoing has provided a detailed description of a file synchronization method, device, and storage medium between business systems provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for file synchronization between business systems, characterized in that, The method is applied to a terminal, the terminal including a first business system and a first file synchronization module, the first file synchronization module being embedded into the first business system as a dependency package, the method including: The file retrieval task in the first file synchronization module is triggered periodically. When the file retrieval task is triggered, a second file retrieval instruction is sent to the second remote interface to call the second file query interface set in the second business system through the second remote interface, and to query the second file to be retrieved from the second business system to the first business system using the second file query interface. The second remote interface is set in the second file synchronization module, and the second file synchronization module is embedded in the second business system in the form of a dependency package. Receive the second file retrieved from the second remote interface and store the second file in the first business system; Send a successful storage message for the second file to the second remote interface, so as to call the second synchronous callback interface set in the second business system through the second remote interface, and use the second synchronous callback interface to change the file status of the second file in the second business system from the first status to the second status; The first business system includes a first file query interface and a first synchronization callback interface. The first file synchronization module includes a first remote interface. The method further includes: When the first remote interface receives the first file retrieval instruction, it calls the first file query interface and uses the first file query interface to query the first file to be retrieved from the first business system to the second business system; The first file is sent back to the second file synchronization module; When the first remote interface receives the storage success message of the first file sent by the second file synchronization module, it calls the first synchronization callback interface set in the first business system and uses the first synchronization callback interface to change the file status of the first file in the first business system from the first status to the second status. The dependency package used when the first file synchronization module is embedded into the first business system is the same as the dependency package used when the second file synchronization module is embedded into the second business system.
2. The file synchronization method between business systems as described in claim 1, characterized in that, The method further includes: Obtain the service call mode of the first file synchronization module; When the service call mode is a one-way call, the task status of the file retrieval task is set to the enabled state so that the file retrieval task can be triggered periodically.
3. The file synchronization method between business systems as described in claim 2, characterized in that, The first business system is equipped with a first file query interface and a first synchronization callback interface, and the method further includes: When the service call mode is a one-way call, the task status of the file push task in the first file synchronization module is set to the enabled state so as to trigger the file push task at regular intervals. When the file push task is triggered, the first file query interface is called to query the first file to be pushed to the second business system in the first business system and obtain the file identifier of the first file. The first file is downloaded based on the file identifier, the first file is sent to the second remote interface to invoke the second remote interface, and the first file is stored in the second business system using the second remote interface; Upon receiving the successful storage message of the first file from the second remote interface, the first synchronization callback interface is invoked to change the file status of the first file in the first business system from the first status to the second status.
4. The file synchronization method between business systems as described in claim 1, characterized in that, The step of receiving the second file pulled from the second remote interface and storing the second file in the first business system includes: Receive the second file retrieved from the second remote interface; Detect whether the second file exists in the first business system; If the second file does not exist in the first business system, the second file will be stored in the first business system. The method further includes: If the second file exists in the first business system, the second file in the first business system is updated using the second file retrieved through the second remote interface.
5. The file synchronization method between business systems as described in any one of claims 1 to 4, characterized in that, The first business system is equipped with a first file compression interface, and the method further includes: The file compression task in the first file synchronization module is triggered periodically. When the file compression task is triggered, the first file compression interface is called to query the download address of the file to be compressed in the first business system. Download the file to be compressed according to the download address, and compress the file to obtain the first file; Upload the first file to the first business system.
6. The file synchronization method between business systems as described in claim 5, characterized in that, The step of compressing the file to be compressed to obtain the first file includes: Identify the file type of the file to be compressed, which includes image type or document type; When the file type is image, the file to be compressed is compressed to obtain a first file with an image resolution smaller than that of the file to be compressed. When the file type is document, the file to be compressed is compressed to obtain the first file in a preset compression format.
7. A computer device, characterized in that, The computer device includes: One or more processors; Memory; and One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the steps in the file synchronization method between business systems according to any one of claims 1 to 6.
8. A computer-readable storage medium, characterized in that, It stores a computer program, which is loaded by a processor to perform the steps in the file synchronization method between business systems according to any one of claims 1 to 6.