CN117453822A - Cross-environment data synchronization method, device and equipment - Google Patents
Cross-environment data synchronization method, device and equipment Download PDFInfo
- Publication number
- CN117453822A CN117453822A CN202311474728.3A CN202311474728A CN117453822A CN 117453822 A CN117453822 A CN 117453822A CN 202311474728 A CN202311474728 A CN 202311474728A CN 117453822 A CN117453822 A CN 117453822A
- Authority
- CN
- China
- Prior art keywords
- synchronized
- entity
- imported
- data
- database
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/17—Details of further file system functions
- G06F16/178—Techniques for file synchronisation in file systems
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
- G06F16/2282—Tablespace storage structures; Management thereof
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
- G06F16/2365—Ensuring data consistency and integrity
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/25—Integrating or interfacing systems involving database management systems
- G06F16/258—Data format conversion from or to a database
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/602—Providing cryptographic facilities or services
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/04—Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
- H04L63/0428—Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1095—Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Computer Security & Cryptography (AREA)
- Computing Systems (AREA)
- Software Systems (AREA)
- Computer Hardware Design (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Health & Medical Sciences (AREA)
- Bioethics (AREA)
- General Health & Medical Sciences (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
技术领域Technical field
本申请涉及数据同步领域,尤其涉及一种跨环境的数据同步方法、装置及设备。The present application relates to the field of data synchronization, and in particular, to a cross-environment data synchronization method, device and equipment.
背景技术Background technique
在电商领域,商品中心系统用于管理商品数据。但商品中心系统在不同环境中的数据同步受限于网络隔离,即生产环境中的商品中心系统的数据库与非生产环境中的商品中心的数据库的网络不连通,导致生产环境中的商品中心系统的商品数据与非生产环境中的商品中心的商品数据无法直接同步。In the field of e-commerce, the product center system is used to manage product data. However, the data synchronization of the commodity center system in different environments is limited by network isolation, that is, the database of the commodity center system in the production environment is not connected to the network of the commodity center database in the non-production environment, resulting in the commodity center system in the production environment being disconnected. The product data of cannot be directly synchronized with the product data of the product center in a non-production environment.
目前,对于生产环境中的商品中心系统的商品数据与非生产环境中的商品中心的商品数据的同步方式,通常是需要用户从导出环境中的商品中心系统下载待同步的数据后,利用预设的特定的模板,将待同步的数据填充至预设的特定的模板中,再导入至导入环境中的商品中心系统中。Currently, the synchronization method between the product data of the product center system in the production environment and the product data of the product center in the non-production environment usually requires the user to download the data to be synchronized from the product center system in the export environment and use the preset Fill the specific template to be synchronized with the preset specific template, and then import it into the product center system in the import environment.
但是上述方式中,需要将待同步的数据人工转换为特定的模板中的格式,导致数据同步的效率低。However, in the above method, the data to be synchronized needs to be manually converted into the format in a specific template, resulting in low efficiency of data synchronization.
发明内容Contents of the invention
本申请提供一种跨环境的数据同步方法、装置及设备,用以解决数据同步效率低的技术问题。This application provides a cross-environment data synchronization method, device and equipment to solve the technical problem of low data synchronization efficiency.
第一方面,本申请提供一种跨环境的数据同步方法,所述方法应用于第一系统的服务端,包括:In the first aspect, this application provides a cross-environment data synchronization method. The method is applied to the server of the first system and includes:
获取导入请求,其中,所述导入请求用于指示获取待同步的文件;并根据所述导入请求,获取待同步的文件;Obtain an import request, wherein the import request is used to instruct to obtain the file to be synchronized; and obtain the file to be synchronized according to the import request;
根据所述待同步的文件,确定所述第一系统的数据库的多个待导入的实体;其中,每一待导入的实体表征每一数据;所述待导入的实体具有属性和属性值;According to the files to be synchronized, multiple entities to be imported in the database of the first system are determined; wherein each entity to be imported represents each data; the entities to be imported have attributes and attribute values;
若确定多个待导入的实体中包括预设的第一数据表中的全部实体,则将所述待导入的实体的标识转换为所述第一数据表中对应的实体的标识,得到转换后的待导入的实体;其中,所述第一数据表中包括所述第一系统的数据库的指定实体和指定实体的标识;If it is determined that the multiple entities to be imported include all entities in the preset first data table, then the identifier of the entity to be imported is converted into the identifier of the corresponding entity in the first data table, and the converted entity is obtained. entities to be imported; wherein the first data table includes the designated entity of the database of the first system and the identification of the designated entity;
根据转换后的待导入的实体的标识,将转换后的待导入的实体存储至所述第一系统的数据库中。According to the identification of the converted entity to be imported, the converted entity to be imported is stored in the database of the first system.
可选地,所述导入请求中携带有导入参数;所述导入参数包括导入类型、以及导入类型所对应的导入信息;若确定多个待导入的实体中包括预设的第一数据表中的全部实体,则将所述待导入的实体的标识转换为所述第一数据表中对应的实体的标识,得到转换后的待导入的实体,包括:Optionally, the import request carries import parameters; the import parameters include the import type and the import information corresponding to the import type; if it is determined that the multiple entities to be imported include the preset first data table All entities, then convert the identifier of the entity to be imported into the identifier of the corresponding entity in the first data table to obtain the converted entity to be imported, including:
若确定多个待导入的实体中包括预设的第一数据表中的全部实体,且,所述导入类型为更新类型,则根据预设的匹配规则和更新类型对应的导入信息,确定所述待导入的实体对应的所述第一系统的数据库中的数据的数量;If it is determined that the multiple entities to be imported include all entities in the preset first data table, and the import type is an update type, then the import information corresponding to the preset matching rules and the update type is determined. The number of data in the database of the first system corresponding to the entity to be imported;
在确定所述待导入的实体对应的所述第一系统的数据库中的数据的数量为一个时,则将所述待导入的实体的标识转换为所述第一数据表中对应的实体的标识,得到转换后的待导入的实体;When it is determined that the number of data in the database of the first system corresponding to the entity to be imported is one, the identifier of the entity to be imported is converted into the identifier of the corresponding entity in the first data table. , get the converted entity to be imported;
在确定所述待导入的实体对应的所述第一系统的数据库中的数据的数量大于一时,则将所述待导入的实体对应的所述第一系统的数据库中的数据输出至所述第一系统的客户端,并获取用户选择的最终对应的所述第一系统的数据库中的数据;利用所述最终对应的所述第一系统的数据库中的数据,更新所述待同步的文件;并重复执行所述根据所述待同步的文件,确定所述第一系统的数据库的多个待导入的实体的步骤。When it is determined that the number of data in the database of the first system corresponding to the entity to be imported is greater than one, then the data in the database of the first system corresponding to the entity to be imported is output to the third system. A client of a system, and obtains the data in the database of the first system that is finally selected by the user; and uses the data in the database of the first system that is finally corresponding to update the files to be synchronized; And repeat the step of determining multiple entities to be imported into the database of the first system based on the files to be synchronized.
可选地,述方法还包括:Optionally, the method also includes:
若确定多个待导入的实体中包括预设的第一数据表中的全部实体,且,所述导入类型为新增类型,则根据新增类型对应的导入信息,将所述待导入的实体的标识转换为所述第一数据表中对应的实体的标识,得到转换后的待导入的实体。If it is determined that the multiple entities to be imported include all entities in the preset first data table, and the import type is a new type, then the entities to be imported will be imported according to the import information corresponding to the new type. The identifier is converted into the identifier of the corresponding entity in the first data table, and the converted entity to be imported is obtained.
可选地,所述导入请求中携带有导入参数和待同步的文件;根据所述导入请求,获取待同步的文件,包括:Optionally, the import request carries import parameters and files to be synchronized; according to the import request, obtaining the files to be synchronized includes:
将所述待同步的文件上传至所述第一系统对应的第一中间系统;Upload the files to be synchronized to the first intermediate system corresponding to the first system;
接收所述第一中间系统返回的所述待同步的文件的存储地址,并根据所述第一系统的客户端发送的导入参数,和所述待同步的文件的存储地址,生成导入日志;Receive the storage address of the file to be synchronized returned by the first intermediate system, and generate an import log according to the import parameters sent by the client of the first system and the storage address of the file to be synchronized;
根据所述导入日志中的待同步的文件的存储地址,从所述第一系统对应的第一中间系统中下载所述待同步的文件。According to the storage address of the file to be synchronized in the import log, the file to be synchronized is downloaded from the first intermediate system corresponding to the first system.
可选地,所述待同步的文件中包括待同步的目标商品的数据;根据所述待同步的文件,确定所述第一系统的数据库的多个待导入的实体,包括:Optionally, the file to be synchronized includes data of the target commodity to be synchronized; according to the file to be synchronized, multiple entities to be imported into the database of the first system are determined, including:
对所述待同步的文件进行解密,得到每一解密后的数据;其中,每一所述解密后的数据为每一待同步的实体;所述待同步的实体为第二系统的数据库的实体;所述待同步的实体具有属性和属性值;Decrypt the file to be synchronized to obtain each decrypted data; wherein each decrypted data is each entity to be synchronized; the entity to be synchronized is an entity of the database of the second system ;The entity to be synchronized has attributes and attribute values;
根据预设的第二数据表,将待同步的实体,转换为所述第一系统的数据库的待导入的实体;其中,所述第二数据表中包括所述第二系统的数据库的待同步的实体与所述第一系统的数据库的待导入的实体的对应关系。According to the preset second data table, the entities to be synchronized are converted into entities to be imported into the database of the first system; wherein the second data table includes the entities to be synchronized into the database of the second system. The corresponding relationship between the entity and the entity to be imported in the database of the first system.
可选地,在根据预设的第二数据表,将待同步的实体,转换为所述第一系统的数据库的待导入的实体之后,所述方法还包括:Optionally, after converting the entities to be synchronized into entities to be imported into the database of the first system according to the preset second data table, the method further includes:
根据预设的第三数据表,对所述第一系统的数据库的待导入的实体进行过滤处理。According to the preset third data table, the entities to be imported in the database of the first system are filtered.
可选地,所述方法还包括:Optionally, the method also includes:
若确定多个待导入的实体中不包括预设的第一数据表中的任一实体,则向所述第一系统的客户端返回提示信息,所述提示信息表征数据的导入失败。If it is determined that the multiple entities to be imported do not include any entity in the preset first data table, prompt information is returned to the client of the first system, and the prompt information indicates that the import of data has failed.
可选地,根据转换后的待导入的实体的标识,将转换后的待导入的实体存储至所述第一系统的数据库中,包括:Optionally, storing the converted entity to be imported in the database of the first system according to the identification of the converted entity to be imported includes:
根据预设的第四数据表和转换后的待导入的实体的标识,生成为多个数据集合;其中,所述第四数据表包括预设的数据集合、转换后的待导入的实体的标识、以及第一系统的数据库的数据表,三者之间的对应关系;所述数据集合中包括多个转换后的待导入的实体;Multiple data sets are generated according to the preset fourth data table and the converted identification of the entity to be imported; wherein the fourth data table includes the preset data set and the converted identification of the entity to be imported. , and the data table of the database of the first system, and the corresponding relationship between the three; the data set includes a plurality of converted entities to be imported;
基于与所述数据集合对应的线程,将所述数据集合中的多个转换后的待导入的实体存储至对应的所述第一系统的数据库的数据表中。Based on the thread corresponding to the data set, a plurality of converted entities to be imported in the data set are stored in the corresponding data table of the database of the first system.
第二方面,一种跨环境的数据同步方法,所述方法应用于第二系统的服务端,包括:In the second aspect, a cross-environment data synchronization method is applied to the server of the second system, including:
接收所述第二系统的客户端发起的导出请求,其中,所述导出请求用于指示需导出待同步的目标商品的数据,所述导出请求中携带有导出参数;并基于所述导出参数生成导出日志;Receive an export request initiated by the client of the second system, wherein the export request is used to indicate that the data of the target commodity to be synchronized needs to be exported, and the export request carries export parameters; and generates based on the export parameters Export log;
根据所述导出日志,生成待处理消息,并将所述待处理消息发送至预设消息队列中;其中,所述消息队列中包括至少一个待处理消息;Generate messages to be processed according to the export log, and send the messages to be processed to a preset message queue; wherein the message queue includes at least one message to be processed;
获取所述预设消息队列中的待处理消息;并根据所获取的待处理消息,从预设数据库中获取数据;其中,所述预设数据库包括至少一个商品的数据;Obtain the messages to be processed in the preset message queue; and obtain data from the preset database according to the acquired messages to be processed; wherein the preset database includes data of at least one commodity;
根据所获取的数据生成待同步的文件,并将所述待同步的文件发送给所述第二系统的客户端;Generate a file to be synchronized based on the acquired data, and send the file to be synchronized to the client of the second system;
其中,所述待同步的文件为第一方面中任一项所述的待同步的文件。Wherein, the file to be synchronized is the file to be synchronized according to any one of the first aspects.
可选地,所述导出参数包括待同步的目标商品的标识;所述导出日志中包括导出日志的标识、导出参数以及导出状态;所述导出状态表征导出数据是否成功。Optionally, the export parameters include the identification of the target product to be synchronized; the export log includes the identification of the export log, the export parameters and the export status; the export status represents whether the export data is successful.
可选地,将所述待处理消息发送至消息队列中,包括:Optionally, sending the pending message to the message queue includes:
基于所述导出日志的标识为消息主键、所述导出参数为消息体,将所述待处理消息发送至消息队列中。Based on the identification of the export log as the message primary key and the export parameter as the message body, the message to be processed is sent to the message queue.
可选地,根据所获取的数据生成待同步的文件,包括:Optionally, generate files to be synchronized based on the obtained data, including:
对所述获取的数据进行加密,得到加密后的数据;Encrypt the obtained data to obtain encrypted data;
对所述加密后的数据进行封装,得到所述待同步的文件。The encrypted data is encapsulated to obtain the file to be synchronized.
可选地,将所述待同步的文件发送给所述第二系统的客户端,包括:Optionally, sending the file to be synchronized to the client of the second system includes:
将所述待同步的文件上传至与所述第二系统对应的第二中间系统中;Upload the files to be synchronized to the second intermediate system corresponding to the second system;
接收所述第二中间系统返回的所述待同步的文件的存储地址,并将所述待同步的文件的存储地址写入所述导出日志中,确定所述导出状态为导出成功;其中,所述存储地址用于获取待同步的文件;Receive the storage address of the file to be synchronized returned by the second intermediate system, and write the storage address of the file to be synchronized into the export log, and determine that the export status is export successful; wherein, The above storage address is used to obtain the file to be synchronized;
根据所述待同步的文件的存储地址,从所述第二中间系统中下载所述待同步的文件;并将所述待同步的文件发送给所述第二系统的客户端。Download the file to be synchronized from the second intermediate system according to the storage address of the file to be synchronized; and send the file to be synchronized to the client of the second system.
第三方面,本申请提供一种跨环境的数据同步装置,所述装置应用于第一系统的服务端,包括:In the third aspect, this application provides a cross-environment data synchronization device, which is applied to the server of the first system and includes:
获取单元,用于获取导入请求,其中,所述导入请求用于指示获取待同步的文件;并根据所述导入请求,获取待同步的文件;An acquisition unit, configured to acquire an import request, where the import request is used to instruct the acquisition of files to be synchronized; and to acquire the files to be synchronized according to the import request;
确定单元,用于根据所述待同步的文件,确定所述第一系统的数据库的多个待导入的实体;其中,每一待导入的实体表征每一数据;所述待导入的实体具有属性和属性值;Determining unit, configured to determine multiple entities to be imported in the database of the first system according to the files to be synchronized; wherein each entity to be imported represents each data; the entities to be imported have attributes and attribute values;
转换单元,用于在确定多个待导入的实体中包括预设的第一数据表中的全部实体时,将所述待导入的实体的标识转换为所述第一数据表中对应的实体的标识,得到转换后的待导入的实体;其中,所述第一数据表中包括所述第一系统的数据库的指定实体和指定实体的标识;A conversion unit configured to convert the identification of the entity to be imported into the identification of the corresponding entity in the first data table when it is determined that the multiple entities to be imported include all entities in the preset first data table. Identify, obtain the converted entity to be imported; wherein, the first data table includes the designated entity of the database of the first system and the identification of the designated entity;
存储单元,用于根据转换后的待导入的实体的标识,将转换后的待导入的实体存储至所述第一系统的数据库中。A storage unit configured to store the converted entity to be imported into the database of the first system according to the identification of the converted entity to be imported.
第四方面,本申请提供一种跨环境的数据同步装置,所述装置应用于第二系统的服务端,包括:In the fourth aspect, this application provides a cross-environment data synchronization device, which is applied to the server of the second system and includes:
接收单元,用于接收所述第二系统的客户端发起的导出请求,其中,所述导出请求用于指示需导出待同步的目标商品的数据,所述导出请求中携带有导出参数;并基于所述导出参数生成导出日志;A receiving unit configured to receive an export request initiated by the client of the second system, wherein the export request is used to indicate that the data of the target commodity to be synchronized needs to be exported, and the export request carries export parameters; and based on The export parameters generate export logs;
生成单元,用于根据所述导出日志,生成待处理消息,并将所述待处理消息发送至预设消息队列中;其中,所述消息队列中包括至少一个待处理消息;A generation unit configured to generate messages to be processed according to the export log, and send the messages to be processed to a preset message queue; wherein the message queue includes at least one message to be processed;
获取单元,用于获取所述预设消息队列中的待处理消息;并根据所获取的待处理消息,从预设数据库中获取数据;其中,所述预设数据库包括至少一个商品的数据;An acquisition unit, configured to acquire messages to be processed in the preset message queue; and to acquire data from a preset database according to the acquired messages to be processed; wherein the preset database includes data of at least one commodity;
发送单元,用于根据所获取的数据生成待同步的文件,并将所述待同步的文件发送给所述第二系统的客户端;A sending unit, configured to generate a file to be synchronized based on the acquired data, and send the file to be synchronized to the client of the second system;
其中,所述待同步的文件为第一方面中任一项所述的待同步的文件。Wherein, the file to be synchronized is the file to be synchronized according to any one of the first aspects.
第五方面,本申请提供一种电子设备,包括:处理器,以及与所述处理器通信连接的存储器;In a fifth aspect, this application provides an electronic device, including: a processor, and a memory communicatively connected to the processor;
所述存储器存储计算机执行指令;The memory stores computer execution instructions;
所述处理器执行所述存储器存储的计算机执行指令,以实现如第一方面或第二方面中任一项所述的方法。The processor executes the computer execution instructions stored in the memory to implement the method as described in any one of the first aspect or the second aspect.
第六方面,本申请提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机执行指令,所述计算机执行指令被处理器执行时用于实现如第一方面或第二方面中任一项所述的方法。In a sixth aspect, the present application provides a computer-readable storage medium in which computer-executable instructions are stored, and when executed by a processor, the computer-executable instructions are used to implement the first aspect or the second aspect. any one of the methods.
本申请提供的跨环境的数据同步方法、装置及设备,通过将待同步的文件中的数据,转换为第一系统的数据库中的实体,并根据预设的第一数据表,实现了数据准确性校验和待同步的文件中的数据标识与数据库中的实体的标识的替换,根据该转换后的待导入的实体的标识,能够直接将该转换后的待导入的实体存储于第一系统的数据库中。该方法相较于现有技术中人工利用特定的模板处理数据后才能进行存储而言,无需人为地使用特定的模板进行数据填充便可以实现待同步的文件中的数据与数据库中的数据的格式的转换,将待同步的文件中的数据存储至数据库中,提高了数据同步的效率。The cross-environment data synchronization method, device and equipment provided by this application achieves data accuracy by converting the data in the files to be synchronized into entities in the database of the first system, and based on the preset first data table. The data identity in the file to be synchronized is verified and replaced with the identity of the entity in the database. According to the identity of the converted entity to be imported, the converted entity to be imported can be directly stored in the first system. in the database. Compared with the existing technology where data can be stored only after manually using a specific template to process the data, this method can achieve the format of the data in the file to be synchronized and the data in the database without manually using a specific template for data filling. conversion to store the data in the files to be synchronized into the database, improving the efficiency of data synchronization.
附图说明Description of the drawings
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本申请的实施例,并与说明书一起用于解释本申请的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
图1为本申请提供的一种应用场景的示意图;Figure 1 is a schematic diagram of an application scenario provided by this application;
图2为本申请提供的一种跨环境的数据同步方法的流程示意图;Figure 2 is a schematic flow chart of a cross-environment data synchronization method provided by this application;
图3为本申请提供的一种跨环境的数据同步方法的流程示意图;Figure 3 is a schematic flow chart of a cross-environment data synchronization method provided by this application;
图4为本申请提供的一种跨环境的数据同步方法的流程示意图;Figure 4 is a schematic flow chart of a cross-environment data synchronization method provided by this application;
图5为本申请提供的一种跨环境的数据同步方法的流程示意图;Figure 5 is a schematic flow chart of a cross-environment data synchronization method provided by this application;
图6为本申请提供的一种跨环境的数据同步装置的结构示意图;Figure 6 is a schematic structural diagram of a cross-environment data synchronization device provided by this application;
图7为本申请提供的一种跨环境的数据同步装置的结构示意图;Figure 7 is a schematic structural diagram of a cross-environment data synchronization device provided by this application;
图8为本申请提供的一种跨环境的数据同步装置的结构示意图;Figure 8 is a schematic structural diagram of a cross-environment data synchronization device provided by this application;
图9为本申请提供的一种跨环境的数据同步装置的结构示意图;Figure 9 is a schematic structural diagram of a cross-environment data synchronization device provided by this application;
图10为本申请提供的一种电子设备的结构示意图。Figure 10 is a schematic structural diagram of an electronic device provided by this application.
通过上述附图,已示出本申请明确的实施例,后文中将有更详细的描述。这些附图和文字描述并不是为了通过任何方式限制本申请构思的范围,而是通过参考特定实施例为本领域技术人员说明本申请的概念。Through the above-mentioned drawings, clear embodiments of the present application have been shown, which will be described in more detail below. These drawings and text descriptions are not intended to limit the scope of the present application's concepts in any way, but are intended to illustrate the application's concepts for those skilled in the art with reference to specific embodiments.
具体实施方式Detailed ways
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。Exemplary embodiments will be described in detail herein, examples of which are illustrated in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with this application. Rather, they are merely examples of apparatus and methods consistent with aspects of the application as detailed in the appended claims.
首先,对本申请涉及的名词进行解释:First, let’s explain the terms involved in this application:
生产环境:是指用于部署和运营软件产品的环境。Production environment: refers to the environment used to deploy and operate software products.
非生产环境:是指对软件产品进行开发、测试等的环境Non-production environment: refers to the environment where software products are developed, tested, etc.
现有技术中,商品中心系统在不同环境中的数据同步受限于网络隔离,即生产环境中的商品中心系统的数据库与非生产环境中的商品中心的数据库的网络不连通,导致生产环境中的商品中心系统的商品数据与非生产环境中的商品中心的商品数据无法直接同步。In the existing technology, the data synchronization of the commodity center system in different environments is limited by network isolation, that is, the database of the commodity center system in the production environment is not connected to the network of the database of the commodity center in the non-production environment, resulting in the failure of the commodity center system in the production environment. The product data of the product center system cannot be directly synchronized with the product data of the product center in a non-production environment.
目前,对于生产环境中的商品中心系统的商品数据与非生产环境中的商品中心的商品数据的同步方式,通常是需要用户从导出环境中的商品中心系统下载待同步的数据后,利用预设的特定的模板,将待同步的数据填充至预设的特定的模板中,再导入至导入环境中的商品中心系统中。Currently, the synchronization method between the product data of the product center system in the production environment and the product data of the product center in the non-production environment usually requires the user to download the data to be synchronized from the product center system in the export environment and use the preset Fill the specific template to be synchronized with the preset specific template, and then import it into the product center system in the import environment.
但是上述方式中,需要将待同步的数据人工转换为特定的模板中的格式,导致数据同步的效率低。However, in the above method, the data to be synchronized needs to be manually converted into the format in a specific template, resulting in low efficiency of data synchronization.
有鉴于此,本申请提供一种跨环境的数据同步方法,基于待同步的文件,将待同步的文件中的数据的标识转换为导入环境的数据库中的实体的标识,即可根据实体的标识,将待同步的文件中的数据存储至该导入环境的数据库中。该方式无需人工地利用特定的模板对待导入的数据进行处理,提高了数据同步的效率。In view of this, this application provides a cross-environment data synchronization method. Based on the file to be synchronized, the identification of the data in the file to be synchronized is converted into the identification of the entity in the database of the imported environment. That is, according to the identification of the entity , store the data in the file to be synchronized into the database of the imported environment. This method does not require manual use of specific templates to process the data to be imported, which improves the efficiency of data synchronization.
图1为本申请提供的一种应用场景的示意图。如图1所示,包括第一系统、第一系统对应的第一中间系统,第二系统,以及,第二系统对应的第二中间系统。Figure 1 is a schematic diagram of an application scenario provided by this application. As shown in Figure 1, it includes a first system, a first intermediate system corresponding to the first system, a second system, and a second intermediate system corresponding to the second system.
上述第一系统和第二系统可以是商品中心系统,也可以是其他业务系统。上述第一系统和第二系统分别部署于不同的环境中。例如,上述第一系统部署于生产环境中,上述第二系统部署于非生产环境中。需说明,本申请仅是以第一系统为用于数据导入的系统,第二系统为用于数据导出的系统为例进行说明,对第一系统和第二系统所位于的环境不做限定。The above-mentioned first system and second system may be commodity center systems or other business systems. The above-mentioned first system and second system are respectively deployed in different environments. For example, the above-mentioned first system is deployed in a production environment, and the above-mentioned second system is deployed in a non-production environment. It should be noted that this application only takes the first system as a system for data import and the second system as a system for data export as an example, and does not limit the environments in which the first system and the second system are located.
以第一系统为例,该第一系统可以包括服务端和客户端,上述第一系统的服务端可以部署于服务器或者服务器集群中,用于处理第一系统的业务逻辑;上述第一系统的客户端可以是全球广域网(World Wide Web,web)版的客户端,也可以是应用程序(Application,app)版的客户端,本申请对此不做限定。上述第一系统的客户端用于显示上述第一系统的服务端的前端显示界面,并接收用户触发的指令,该第一系统的客户端可以部署于电子设备上,例如手机、计算机、平板等。可选的,该第一系统还可以包括第一系统的数据库,用于存储第一系统的业务数据。上述第二系统的结构与之类似,在此不再赘述。Taking the first system as an example, the first system may include a server and a client. The server of the first system may be deployed in a server or a server cluster to process the business logic of the first system; The client may be a World Wide Web (Web) version client or an application (Application, app) version client, which is not limited in this application. The client of the first system is used to display the front-end display interface of the server of the first system and receive instructions triggered by the user. The client of the first system can be deployed on electronic devices, such as mobile phones, computers, tablets, etc. Optionally, the first system may also include a database of the first system, used to store business data of the first system. The structure of the above-mentioned second system is similar and will not be described again here.
需说明,上述第一系统的客户端和第二系统的客户端部署于同一台电子设备上。It should be noted that the client of the first system and the client of the second system are deployed on the same electronic device.
上述第一系统对应的第一中间系统,用于存储第一系统的待同步的文件,例如可以是对象存储(Object Storage Service,OSS)等云存储系统。上述第二中间系统与之类似,在此不再赘述。需说明,本申请对上述第一系统对应的第一中间系统与第二系统对应的第二中间系统的形式不做限定,二者可以相同,也可以不同。The first intermediate system corresponding to the above-mentioned first system is used to store files to be synchronized in the first system, and may be, for example, a cloud storage system such as Object Storage Service (OSS). The above-mentioned second intermediate system is similar and will not be described again here. It should be noted that this application does not limit the form of the first intermediate system corresponding to the first system and the second intermediate system corresponding to the second system. They may be the same or different.
下面以具体地实施例对本申请的技术方案以及本申请的技术方案如何解决上述技术问题进行详细说明。下面这几个具体的实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例中不再赘述。下面将结合附图,对本申请的实施例进行描述。The technical solution of the present application and how the technical solution of the present application solves the above technical problems will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of the present application will be described below with reference to the accompanying drawings.
图2为本申请提供的一种跨环境的数据同步方法的流程示意图,该方法应用于上述第一系统的服务端。如图2所示,该方法包括:Figure 2 is a schematic flowchart of a cross-environment data synchronization method provided by this application. This method is applied to the server of the above-mentioned first system. As shown in Figure 2, the method includes:
S101、第一系统的服务端获取导入请求,其中,该导入请求用于指示获取待同步的文件;并根据该导入请求,获取待同步的文件。S101. The server of the first system obtains an import request, where the import request is used to instruct to obtain the file to be synchronized; and obtains the file to be synchronized according to the import request.
示例性地,上述导入请求可以是用户通过上述第一系统的客户端触发的。For example, the above-mentioned import request may be triggered by the user through the client of the above-mentioned first system.
一个示例中,上述导入请求中携带有该待同步的文件,根据该导入请求即可获取到该待同步的文件;另一个示例中,上述导入请求中携带有该待同步文件的存储地址,上述第一系统的服务端可以根据该存储地址,从上述第一系统对应的第一中间系统中获取该待同步的文件。In one example, the above-mentioned import request carries the file to be synchronized, and the file to be synchronized can be obtained according to the import request; in another example, the above-mentioned import request carries the storage address of the file to be synchronized, and the above-mentioned The server of the first system can obtain the file to be synchronized from the first intermediate system corresponding to the first system according to the storage address.
S102、第一系统的服务端根据待同步的文件,确定第一系统的数据库的多个待导入的实体。S102. The server of the first system determines multiple entities to be imported in the database of the first system based on the files to be synchronized.
其中,每一待导入的实体表征每一数据;上述待导入的实体具有属性和属性值。Among them, each entity to be imported represents each data; the above-mentioned entity to be imported has attributes and attribute values.
示例性地,上述第一系统的数据库中包括多个实体,该多个实体与该待同步的文件中的各数据具有对应关系。For example, the database of the first system includes multiple entities, and the multiple entities have a corresponding relationship with each data in the file to be synchronized.
一个示例中,上述第一系统的服务端,可以根据该待同步的文件,以及,预设的数据与实体间的对应关系表,将上述待同步的文件中的各数据,转换为该第一系统的数据库的多个待导入的实体。另一个示例中,上述待同步的文件的预设字段表征该第一系统的数据库的预设实体,上述第一系统的服务端,可以根据该待同步的文件,以及,预设的预设字段与实体的对应关系表,将上述待同步的文件中的各数据,转换为该第一系统的数据库的多个待导入的实体。In one example, the server of the first system can convert each data in the file to be synchronized into the first file according to the file to be synchronized and the preset correspondence table between data and entities. Multiple entities to be imported from the system's database. In another example, the preset field of the file to be synchronized represents the default entity of the database of the first system. The server of the first system can use the file to be synchronized and the preset preset field. The corresponding relationship table with entities converts each data in the above-mentioned files to be synchronized into multiple entities to be imported into the database of the first system.
例如,上述待同步的文件中包括:{商品名称:电脑1234,标识:A1,数量:10台},待导入的实体为:{商品名称:电脑,标识:A1,数量:10台}。For example, the above files to be synchronized include: {Product name: Computer 1234, ID: A1, Quantity: 10 units}, and the entities to be imported are: {Product name: Computer, ID: A1, Quantity: 10 units}.
S103、第一系统的服务端若确定多个待导入的实体中包括预设的第一数据表中的全部实体,则将待导入的实体的标识转换为第一数据表中对应的实体的标识,得到转换后的待导入的实体。S103. If the server of the first system determines that the multiple entities to be imported include all entities in the preset first data table, it converts the identifiers of the entities to be imported into the identifiers of the corresponding entities in the first data table. , get the converted entity to be imported.
其中,上述第一数据表中包括第一系统的数据库的指定实体和指定实体的标识。Wherein, the above-mentioned first data table includes the designated entity of the database of the first system and the identifier of the designated entity.
示例性地,上述第一数据表中的全部实体是指该第一系统所必需的数据,即,该第一数据表中的全部实体是不可缺少的数据,该步骤可以判断待导入的实体中是否缺少必需数据,若缺少必需数据,认为该次待导入的数据出现错误。上述转换后的待导入的实体的名称和标识均与上述第一系统的数据库中的对应实体的名称和标识一致。For example, all entities in the above-mentioned first data table refer to data necessary for the first system, that is, all entities in the first data table are indispensable data. This step can determine the data in the entities to be imported. Is the required data missing? If necessary data is missing, it is considered that there is an error in the data to be imported. The name and identifier of the converted entity to be imported are consistent with the name and identifier of the corresponding entity in the database of the first system.
一个示例中,上述第一系统的服务端可以根据上述第一数据表中的实体,遍历该多个待导入的实体,确定上述第一数据表中的全部实体是否属于该多个待导入的实体。可选的,若确定多个待导入的实体中不包括预设的第一数据表中的全部实体,则向第一系统的客户端输出导入失败的提示信息。若确定多个待导入的实体中包括预设的第一数据表中的全部实体,则根据上述第一数据表,将待导入的实体的标识转换为第一数据表中对应的实体的标识,得到转换后的待导入的实体。In one example, the server of the first system may traverse the multiple entities to be imported based on the entities in the first data table, and determine whether all entities in the first data table belong to the multiple entities to be imported. . Optionally, if it is determined that the multiple entities to be imported do not include all entities in the preset first data table, a prompt message indicating that the import fails is output to the client of the first system. If it is determined that the multiple entities to be imported include all entities in the preset first data table, then according to the above-mentioned first data table, the identifier of the entity to be imported is converted into the identifier of the corresponding entity in the first data table, Get the converted entity to be imported.
例如,上述待同步的文件中包括:{商品名称:电脑1234,标识:A1,数量:10台},待导入的实体为:{商品名称:电脑,标识:A1,数量:10台},转换后的待导入的实体为:{商品名称:电脑,标识:B1,数量:10台}。For example, the above files to be synchronized include: {Product name: Computer 1234, ID: A1, Quantity: 10 units}, and the entities to be imported are: {Product name: Computer, ID: A1, Quantity: 10 units}, conversion The final entities to be imported are: {Product name: Computer, Identification: B1, Quantity: 10 units}.
需说明,在前述步骤S102中,虽然将该待同步文件中的数据,转换为该第一系统的数据库中的实体,但该数据对应的标识并未进行转换,因此,该步骤S103在对多个待导入的实体完成校验后,将多个待导入的实体的标识,转换为第一系统的数据库中的对应实体的标识,便于后续的存储过程,提高数据同步效率。It should be noted that in the aforementioned step S102, although the data in the file to be synchronized is converted into entities in the database of the first system, the identifier corresponding to the data is not converted. Therefore, in step S103, the After each entity to be imported is verified, the identifiers of the multiple entities to be imported are converted into identifiers of corresponding entities in the database of the first system to facilitate subsequent storage processes and improve data synchronization efficiency.
S104、第一系统的服务端根据转换后的待导入的实体的标识,将转换后的待导入的实体存储至第一系统的数据库中。S104. The server of the first system stores the converted entity to be imported in the database of the first system according to the converted identification of the entity to be imported.
示例性地,如前述所说,上述转换后的待导入的实体的标识与上述第一系统的数据库中对应实体的标识一致,因此,可以根据该转换后的待导入的实体的标识,确定该第一系统的数据库中对应实体的位置,将该转换后的待导入的实体的属性和属性值存储至该第一系统的数据库中。For example, as mentioned above, the identity of the converted entity to be imported is consistent with the identity of the corresponding entity in the database of the first system. Therefore, the identity of the entity to be imported can be determined based on the converted identity of the entity to be imported. The location of the corresponding entity in the database of the first system is stored in the database of the first system.
在本实施例中,通过将待同步的文件中的数据,转换为第一系统的数据库中的实体,并根据预设的第一数据表,实现了数据准确性校验和待同步的文件中的数据标识与数据库中的实体的标识的替换,根据该转换后的待导入的实体的标识,能够直接将该转换后的待导入的实体存储于第一系统的数据库中。该方法相较于现有技术中人工利用特定的模板处理数据后才能进行存储而言,无需人为地使用特定的模板进行数据填充便可以实现待同步的文件中的数据与数据库中的数据的格式的转换,将待同步的文件中的数据存储至数据库中,提高了数据同步的效率。In this embodiment, by converting the data in the files to be synchronized into entities in the database of the first system, and based on the preset first data table, data accuracy verification and the data in the files to be synchronized are implemented. The data identifier is replaced with the identifier of the entity in the database. According to the converted identifier of the entity to be imported, the converted entity to be imported can be directly stored in the database of the first system. Compared with the existing technology where data can be stored only after manually using a specific template to process the data, this method can achieve the format of the data in the file to be synchronized and the data in the database without manually using a specific template for data filling. conversion to store the data in the files to be synchronized into the database, improving the efficiency of data synchronization.
图3为本申请提供的一种跨环境的数据同步方法的流程示意图,该方法应用于上述第二系统的服务端。如图3所示,该方法包括:Figure 3 is a schematic flowchart of a cross-environment data synchronization method provided by this application. This method is applied to the server of the above-mentioned second system. As shown in Figure 3, the method includes:
S201、第二系统的服务端接收第二系统的客户端发起的导出请求,其中,该导出请求用于指示需导出待同步的目标商品的数据,该导出请求中携带有导出参数;并基于该导出参数生成导出日志。S201. The server of the second system receives an export request initiated by the client of the second system. The export request is used to indicate that the data of the target commodity to be synchronized needs to be exported. The export request carries export parameters; and based on the Export parameters generate export logs.
示例性地,上述第二系统的客户端接收用户触发的导出请求,并将该导出请求发送至上述第二系统的服务端。For example, the client of the second system receives the export request triggered by the user, and sends the export request to the server of the second system.
一个示例中,上述导出参数中包括待同步的目标商品的标识,根据该导出参数,和预设的文件生成函数,生成导出日志。另一个示例中,上述导出参数中包括待同步的目标商品的名称和标识,根据该导出参数,和预设的文件生成函数,生成导出日志。In one example, the above export parameters include the identification of the target product to be synchronized, and the export log is generated based on the export parameters and the preset file generation function. In another example, the above-mentioned export parameters include the name and identification of the target product to be synchronized, and the export log is generated based on the export parameters and the preset file generation function.
一个示例中,上述导出日志中可以包括导出日志的标识和导出参数;也可以是包括导出日志的标识、导出参数和导出状态。该导出状态可以用于表征导出数据是否成功,例如该导出状态可以是导出中,或者是成功。该方式可以利用导出日志直观地看出数据是否导出成功,提高数据同步的便捷性。In one example, the export log may include the export log's identifier and export parameters; it may also include the export log's identifier, export parameters, and export status. The export status can be used to indicate whether the export data is successful. For example, the export status can be exporting or successful. This method can use the export log to intuitively see whether the data is exported successfully, improving the convenience of data synchronization.
S202、第二系统的服务端根据导出日志,生成待处理消息,并将待处理消息发送至消息队列中;其中,所述消息队列中包括至少一个待处理消息。S202. The server of the second system generates a message to be processed according to the export log, and sends the message to be processed to a message queue; wherein the message queue includes at least one message to be processed.
一个示例中,可以是将该导出日志的标识作为消息主键,导出参数作为消息体,生成该待处理消息,并该待处理消息发送至上述消息队列中。也可以是预设该导出日志对应的消息主键,将导出日志标识和导出参数共同作为消息体,生成该待处理消息,并该待处理消息发送至上述消息队列中。In one example, the identifier of the export log can be used as the primary key of the message, the export parameters can be used as the message body, the message to be processed can be generated, and the message to be processed can be sent to the above message queue. It is also possible to preset the message primary key corresponding to the export log, use the export log identifier and the export parameters together as the message body, generate the message to be processed, and send the message to be processed to the above message queue.
示例性地,可以将上述第二系统的服务端划分为第一模块和第二模块,上述第一模块、第二模块和消息队列的服务器共同组成该第二系统的消息队列。该第一模块可以作为该消息队列的生产者,用于根据导出日志生成待处理消息。该第二模块作为消费者,用于从该消息队列中获取消息进行处理。需说明,本申请不限定第二系统的服务端的划分方式。上述消息队列的服务器可以是该第二系统的服务端中的服务器,也可以是位于云端的其他服务器,本申请在此不做限定。For example, the server of the second system can be divided into a first module and a second module, and the first module, the second module and the message queue server together form the message queue of the second system. The first module can serve as a producer of the message queue and is used to generate messages to be processed according to the export log. The second module serves as a consumer and is used to obtain messages from the message queue for processing. It should be noted that this application does not limit the division method of the server side of the second system. The server of the above message queue may be a server in the server of the second system, or may be another server located in the cloud, which is not limited in this application.
S203、第二系统的服务端获取预设消息队列中的待处理消息;并根据所获取的待处理消息,从预设数据库中获取数据;其中,上述预设数据库包括至少一个商品的数据。S203. The server of the second system obtains the messages to be processed in the preset message queue; and obtains data from the preset database according to the obtained messages to be processed; wherein the above-mentioned preset database includes data of at least one commodity.
示例性地,如前述所说,上述待处理消息中包括导出参数,该导出参数中可以包括待同步的目标商品的标识,因此,可以根据该待处理消息,从该第二系统的预设数据库中获取该待同步的目标商品的数据。For example, as mentioned above, the above-mentioned message to be processed includes export parameters, and the export parameters may include the identification of the target product to be synchronized. Therefore, according to the message to be processed, the preset database of the second system can be Obtain the data of the target product to be synchronized.
使用消息队列的方式进行数据导出,可以实现大量数据的异步导出。示例性地,若是不使用消息队列进行数据导出,用户在使用第二系统的客户端的前端显示界面触发导出请求后,需停留在该界面直至数据导出成功;而该步骤用户无需在该界面进行等待,同时,还可以导出其他商品的数据,便于大量数据的导出,提高了数据导出的效率,即数据同步的效率。Using message queue for data export can realize asynchronous export of large amounts of data. For example, if the message queue is not used for data export, after the user triggers the export request using the front-end display interface of the client of the second system, he needs to stay on this interface until the data export is successful; and the user does not need to wait on this interface for this step. , at the same time, the data of other products can also be exported, which facilitates the export of large amounts of data and improves the efficiency of data export, that is, the efficiency of data synchronization.
S204、第二系统的服务端根据所获取的数据生成待同步的文件,并将待同步的文件发送给第二系统的客户端。S204. The server of the second system generates a file to be synchronized based on the acquired data, and sends the file to be synchronized to the client of the second system.
其中,上述待同步的文件为前述实施例中所提到的待同步的文件。Wherein, the above-mentioned files to be synchronized are the files to be synchronized mentioned in the previous embodiment.
示例性地,根据所获取的数据,和预设的文件生成函数,生成该待同步的文件。并将该待同步的文件发送至该第二系统的客户端。For example, the file to be synchronized is generated based on the acquired data and a preset file generation function. And the file to be synchronized is sent to the client of the second system.
一个示例中,上述第二系统的服务端可以直接将该待同步的文件发送至该第二系统的客户端;也可以是该第二系统的服务端将该待同步的文件上传至该第二系统对应的第二中间系统中,并接收该第二中间系统返回的存储地址,根据该存储地址从该第二中间系统中下载该待同步的文件,并将该存储地址记录于该导出日志中。In one example, the server of the second system can directly send the file to be synchronized to the client of the second system; or the server of the second system can upload the file to be synchronized to the second system. In the second intermediate system corresponding to the system, receive the storage address returned by the second intermediate system, download the file to be synchronized from the second intermediate system according to the storage address, and record the storage address in the export log .
在本实施例中,通过利用消息队列的方式,第二系统的服务端获取待同步的目标商品的数据,并生成待同步的文件,发送至第二系统的客户端进行存储,以便于后续的数据导入。该方法使用消息队列的方式进行数据的导出,可以同时进行多组待同步的目标商品的数据的导出,减少了等待时间,提高了数据同步的效率。In this embodiment, by using the message queue, the server of the second system obtains the data of the target product to be synchronized, generates the file to be synchronized, and sends it to the client of the second system for storage, so as to facilitate subsequent data import. This method uses a message queue to export data, and can export data of multiple groups of target products to be synchronized at the same time, reducing waiting time and improving data synchronization efficiency.
图4为本申请提供的一种跨环境的数据同步方法的流程示意图。如图4所示,该方法包括:Figure 4 is a schematic flowchart of a cross-environment data synchronization method provided by this application. As shown in Figure 4, the method includes:
S301、第二系统的客户端向第二系统的服务端发送导出请求。S301. The client of the second system sends an export request to the server of the second system.
相应地,第二系统的服务端接收第二系统的客户端发起的导出请求,其中,该导出请求用于指示需导出待同步的目标商品的数据,该导出请求中携带有导出参数。Correspondingly, the server of the second system receives an export request initiated by the client of the second system, where the export request is used to indicate that the data of the target commodity to be synchronized needs to be exported, and the export request carries export parameters.
S302、第二系统的服务端基于该导出参数生成导出日志。S302. The server of the second system generates an export log based on the export parameter.
该步骤的说明可以参考前述步骤S201,在此不再赘述。For description of this step, reference may be made to the aforementioned step S201, which will not be described again here.
S303、第二系统的服务端根据导出日志,生成待处理消息,并将待处理消息发送至消息队列中;其中,该消息队列中包括至少一个待处理消息。S303. The server of the second system generates a message to be processed according to the export log, and sends the message to be processed to a message queue; wherein the message queue includes at least one message to be processed.
该步骤的说明可以参考前述步骤S202,在此不再赘述。For description of this step, reference may be made to the aforementioned step S202, which will not be described again here.
S304、第二系统的服务端获取该预设消息队列中的待处理消息;并根据所获取的待处理消息,从预设数据库中获取数据;其中,该预设数据库包括至少一个商品的数据。S304. The server of the second system obtains the messages to be processed in the preset message queue; and obtains data from the preset database according to the obtained messages to be processed; wherein the preset database includes data of at least one commodity.
该步骤的说明可以参考前述步骤S203,在此不再赘述。For description of this step, reference may be made to the aforementioned step S203, which will not be described again here.
S305、第二系统的服务端根据所获取的数据生成待同步的文件,并将该待同步的文件发送给第二系统的客户端。S305. The server of the second system generates a file to be synchronized based on the acquired data, and sends the file to be synchronized to the client of the second system.
该步骤的说明可以参考前述步骤S204,在此不再赘述。For description of this step, reference may be made to the aforementioned step S204, which will not be described again here.
S306、第一系统的客户端向第一系统的服务端发送导入请求。S306. The client of the first system sends an import request to the server of the first system.
相应地,第一系统的服务端获取导入请求,其中,该导入请求用于指示获取待同步的文件。Correspondingly, the server of the first system obtains an import request, where the import request is used to indicate obtaining the file to be synchronized.
S307、第一系统的服务端根据该导入请求,获取待同步的文件。S307. The server of the first system obtains the file to be synchronized according to the import request.
示例性地,如前述所说,上述第一系统的客户端与上述第二系统的客户端部署于同一台电子设备上,因此,上述第一系统的客户端所在的电子设备上存储有该待同步的文件。上述第一系统的客户端可以接收用户触发的待同步的文件,生成该导入请求,该导入请求中包括待同步的文件。For example, as mentioned above, the client of the first system and the client of the second system are deployed on the same electronic device. Therefore, the electronic device where the client of the first system is located stores the to-be-used information. Synchronized files. The client of the above-mentioned first system can receive the files to be synchronized triggered by the user and generate the import request, and the import request includes the files to be synchronized.
S308、第一系统的服务端根据该待同步的文件,确定该第一系统的数据库的多个待导入的实体。S308. The server of the first system determines multiple entities to be imported in the database of the first system based on the file to be synchronized.
其中,每一待导入的实体表征每一数据;该待导入的实体具有属性和属性值。Among them, each entity to be imported represents each data; the entity to be imported has attributes and attribute values.
该步骤的说明可以参考前述步骤S102,在此不再赘述。For description of this step, reference may be made to the aforementioned step S102, which will not be described again here.
S309、第一系统的服务端若确定多个待导入的实体中包括预设的第一数据表中的全部实体,则将所述待导入的实体的标识转换为所述第一数据表中对应的实体的标识,得到转换后的待导入的实体。S309. If the server of the first system determines that the multiple entities to be imported include all entities in the preset first data table, it converts the identifiers of the entities to be imported into the corresponding entities in the first data table. The identifier of the entity is used to obtain the converted entity to be imported.
其中,上述第一数据表中包括上述第一系统的数据库的指定实体和指定实体的标识。The first data table includes the designated entity of the database of the first system and the identifier of the designated entity.
该步骤的说明可以参考前述步骤S103,在此不再赘述。For description of this step, reference may be made to the aforementioned step S103, which will not be described again here.
S310、第一系统的服务端根据转换后的待导入的实体的标识,将转换后的待导入的实体存储至第一系统的数据库中。S310. The server of the first system stores the converted entity to be imported in the database of the first system according to the converted identification of the entity to be imported.
该步骤的说明可以参考前述步骤S104,在此不再赘述。For description of this step, reference may be made to the aforementioned step S104, which will not be described again here.
在本实施例中,第二系统的服务端将第二系统中待同步的目标商品的数据,利用消息队列的方式,从第二系统的数据库中导出,并生成了待同步的文件,发送至第二系统的客户端所在的电子设备存储;位于同一台电子设备的第一系统的客户端响应于用户触发的待同步的文件,将待同步的文件发送至第一系统的服务端进行处理,第一系统的服务端将该待同步的文件中的数据转换为第一系统的数据库中的实体的标识,根据该实体的标识,将待同步的文件中的数据存储于该第一系统的数据库中。该方式相较于现有技术中利用特定的模板进行数据导入的方式而言,不仅可以从第二系统的数据库中同时导出多组待同步的目标商品的数据,还可以便捷性地导入至第一系统的数据库中,提高了数据同步效率。In this embodiment, the server of the second system exports the data of the target commodity to be synchronized in the second system from the database of the second system using the message queue, generates the file to be synchronized, and sends it to The electronic device where the client of the second system is located is stored; the client of the first system, which is located on the same electronic device, responds to the file to be synchronized triggered by the user and sends the file to be synchronized to the server of the first system for processing. The server of the first system converts the data in the file to be synchronized into the identity of the entity in the database of the first system, and stores the data in the file to be synchronized in the database of the first system according to the identity of the entity. middle. Compared with the existing method of using specific templates for data import, this method can not only export multiple sets of data of target commodities to be synchronized from the database of the second system at the same time, but also conveniently import it to the third system. In the database of one system, the efficiency of data synchronization is improved.
图5为本申请提供的一种跨环境的数据同步方法的流程示意图。如图5所示,该方法包括:Figure 5 is a schematic flowchart of a cross-environment data synchronization method provided by this application. As shown in Figure 5, the method includes:
S401、第二系统的服务端接收第二系统的客户端发起的导出请求,其中,该导出请求用于指示需导出待同步的目标商品的数据,该导出请求中携带有导出参数;并基于该导出参数生成导出日志。S401. The server of the second system receives an export request initiated by the client of the second system. The export request is used to indicate that the data of the target commodity to be synchronized needs to be exported. The export request carries export parameters; and based on the Export parameters generate export logs.
上述导出参数包括待同步的目标商品的标识;上述导出日志中包括导出日志的标识、导出参数以及导出状态;上述导出状态表征导出数据是否成功。The above-mentioned export parameters include the identification of the target product to be synchronized; the above-mentioned export log includes the identification of the export log, the export parameters and the export status; the above-mentioned export status indicates whether the export data is successful.
示例性地,生成该导出日志后,将该导出日志的导出状态设置为导出中。For example, after the export log is generated, the export status of the export log is set to exporting.
该步骤的说明可以参考前述步骤S201。For description of this step, please refer to the aforementioned step S201.
S402、第二系统的服务端基于该导出日志的标识为消息主键、导出参数为消息体,生成该待处理消息。S402. The server of the second system generates the message to be processed based on the export log identifier being the message primary key and the export parameter being the message body.
需说明,本申请不限定如何生成该待处理消息的形式,具体可以参考现有技术。It should be noted that this application does not limit how to generate the form of the message to be processed. For details, please refer to the existing technology.
S403、第二系统的服务端将该待处理消息发送至消息队列中;其中,该消息队列中包括至少一个待处理消息。S403. The server of the second system sends the message to be processed to a message queue; wherein the message queue includes at least one message to be processed.
例如,可以是前述第二系统的第一模块,将该待处理消息发送至该消息队列的服务器进行存储。For example, the first module of the aforementioned second system may send the message to be processed to the server of the message queue for storage.
S404、第二系统的服务端获取预设消息队列中的待处理消息;并根据所获取的待处理消息,从预设数据库中获取数据;其中,上述预设数据库包括至少一个商品的数据。S404. The server of the second system obtains the messages to be processed in the preset message queue; and obtains data from the preset database according to the obtained messages to be processed; wherein the above-mentioned preset database includes data of at least one commodity.
例如,可以是前述第二系统的第二模块,定时获取该消息队列的服务器中的数据。该步骤的说明,可以参考前述步骤S203。For example, it can be the second module of the aforementioned second system that regularly obtains data from the server of the message queue. For description of this step, please refer to the aforementioned step S203.
S405、第二系统的服务端对获取的数据进行加密,得到加密后的数据。S405. The server of the second system encrypts the acquired data and obtains encrypted data.
该步骤可以提高数据的安全性。例如可以采用Cipher加密算法、非对称加密等加密算法进行加密,不申请在此不做限定。以使用Cipher加密算法为例,该加密算法需要设置密钥和随机数种子。该第二系统的配置中心预设该加密算法的密钥;随机数可以通过SHA1PRNG算法生成,该算法使用SHA-1散列函数对种子数据进行哈希计算,把计算结果作为随机数生成器的种子。This step can improve the security of your data. For example, encryption algorithms such as Cipher encryption algorithm and asymmetric encryption can be used for encryption, and the application is not limited here. Take the Cipher encryption algorithm as an example. This encryption algorithm requires setting a key and a random number seed. The configuration center of the second system presets the key of the encryption algorithm; the random number can be generated by the SHA1PRNG algorithm, which uses the SHA-1 hash function to hash the seed data and uses the calculation result as the random number generator. seed.
可选的,若该数据是多个目标商品的数据,则分别对该多个目标商品的数据进行加密。Optionally, if the data is data of multiple target products, the data of the multiple target products are encrypted respectively.
S406、第二系统的服务端对加密后的数据进行封装,得到该待同步的文件。S406. The server of the second system encapsulates the encrypted data to obtain the file to be synchronized.
例如,第二系统的额服务端根据预设的文件封装接口,将该加密后的数据封装成文件。For example, the server of the second system encapsulates the encrypted data into a file according to a preset file encapsulation interface.
可选的,若该数据是多个目标商品的数据,则分别对加密后的数据进行封装,得到多个文件。Optionally, if the data is data for multiple target products, encrypt the encrypted data separately to obtain multiple files.
S407、第二系统的服务端将该待同步的文件上传至与第二系统对应的第二中间系统中。S407. The server of the second system uploads the file to be synchronized to the second intermediate system corresponding to the second system.
需说明,本申请不限定该第二系统的服务端与第二中间系统的通信方式。It should be noted that this application does not limit the communication method between the server of the second system and the second intermediate system.
S408、第二系统的服务端接收第二中间系统返回的该待同步的文件的存储地址,并将待同步的文件的存储地址写入待导出日志中,确定该导出状态为导出成功。S408. The server of the second system receives the storage address of the file to be synchronized returned by the second intermediate system, writes the storage address of the file to be synchronized into the log to be exported, and determines that the export status is export successful.
其中,上述存储地址用于获取待同步的文件。Among them, the above storage address is used to obtain the file to be synchronized.
S409、第二系统的服务端根据该待同步的文件的存储地址,从第二中间系统中下载待同步的文件;并将待同步的文件发送给第二系统的客户端。S409. The server of the second system downloads the file to be synchronized from the second intermediate system according to the storage address of the file to be synchronized; and sends the file to be synchronized to the client of the second system.
该步骤可以便于异步导出待同步的目标商品数据,在导出数据后,只需确定导出日志,以及,导出日志中的导出状态,便可以确定数据是否导出成功,并可以根据导出日志中的文件存储地址,从第二中间系统中下载该待同步的文件,无需在导出界面进行等待,提高了数据同步效率。This step can facilitate the asynchronous export of target product data to be synchronized. After exporting the data, you only need to determine the export log and the export status in the export log to determine whether the data was successfully exported and store it based on the file in the export log. Address, download the file to be synchronized from the second intermediate system, without waiting in the export interface, which improves data synchronization efficiency.
S410、第一系统的服务端获取导入请求,其中,该导入请求用于指示获取待同步的文件。S410. The server of the first system obtains an import request, where the import request is used to indicate obtaining the file to be synchronized.
例如,上述导入请求中携带有导入参数和待同步的文件。For example, the above import request carries import parameters and files to be synchronized.
S411、第一系统的服务端将待同步的文件上传至该第一系统对应的第一中间系统。S411. The server of the first system uploads the files to be synchronized to the first intermediate system corresponding to the first system.
该步骤可以便于后续处理时获取该待同步的文件。需说明,本申请不限定该第一系统的服务端与第一中间系统的通信方式。This step can facilitate subsequent processing to obtain the file to be synchronized. It should be noted that this application does not limit the communication method between the server of the first system and the first intermediate system.
S412、第一系统的服务端接收第一中间系统返回的该待同步的文件的存储地址,并根据该第一系统的客户端发送的导入参数,和待同步的文件的存储地址,生成导入日志。S412. The server of the first system receives the storage address of the file to be synchronized returned by the first intermediate system, and generates an import log according to the import parameters sent by the client of the first system and the storage address of the file to be synchronized. .
示例性地,上述导入日志中可以包括导入日志的标识、该待同步的文件的存储地址和导入参数。For example, the above-mentioned import log may include the identification of the import log, the storage address of the file to be synchronized, and the import parameters.
S413、第一系统的服务端根据该导入日志中的待同步的文件的存储地址,从该第一系统对应的第一中间系统中下载该待同步的文件。S413. The server of the first system downloads the file to be synchronized from the first intermediate system corresponding to the first system according to the storage address of the file to be synchronized in the import log.
S414、第一系统的服务端对该待同步的文件进行解密,得到每一解密后的数据。S414. The server of the first system decrypts the file to be synchronized and obtains each decrypted data.
上述待同步的文件中包括待同步的目标商品的数据;其中,每一解密后的数据为每一待同步的实体;待同步的实体为第二系统的数据库的实体;待同步的实体具有属性和属性值。The above-mentioned files to be synchronized include data of target commodities to be synchronized; wherein, each decrypted data is each entity to be synchronized; the entities to be synchronized are entities of the database of the second system; the entities to be synchronized have attributes. and attribute values.
示例性地,可以采用前述步骤S405所使用的加密算法对应的解密算法进行解密。例如,使用Cipher加密算法进行加密,可以从该第一系统的配置中心获取该加密算法的密钥。For example, the decryption algorithm corresponding to the encryption algorithm used in step S405 can be used for decryption. For example, if the Cipher encryption algorithm is used for encryption, the key of the encryption algorithm can be obtained from the configuration center of the first system.
S415、第一系统的服务端根据预设的第二数据表,将待同步的实体,转换为第一系统的数据库的待导入的实体。S415. The server of the first system converts the entities to be synchronized into entities to be imported into the database of the first system according to the preset second data table.
其中,上述第二数据表中包括第二系统的数据库的待同步的实体与第一系统的数据库的待导入的实体的对应关系。The above-mentioned second data table includes a correspondence relationship between entities to be synchronized in the database of the second system and entities to be imported in the database of the first system.
示例性地,表1为第二数据表的内容示例。Illustratively, Table 1 is an example of the content of the second data table.
表1Table 1
S416、第一系统的服务端根据预设的第三数据表,对第一系统的数据库的待导入的实体进行过滤处理。S416. The server of the first system filters the entities to be imported in the database of the first system according to the preset third data table.
应理解,上述待导入的实体中可能存在冗余的数据,该冗余的数据是指该第一系统的数据库中不需要存储的数据,因此,为了提高后续的存储效率,可以对该待导入的实体进行过滤。It should be understood that there may be redundant data in the entities to be imported. The redundant data refers to data that does not need to be stored in the database of the first system. Therefore, in order to improve subsequent storage efficiency, the entities to be imported can be Entities are filtered.
一个示例中,上述第三数据表中包括冗余的待导入的实体,因此,可以遍历该待导入的实体,若该待导入的实体存在于该第三数据表中,则将该待导入的实体删除;也可以是上述第三数据表中包括上述第一系统的数据库所需的实体,遍历上述待导入的实体,若该待导入的实体不存在与该第三数据表中,则将该待导入的实体删除。In one example, the above-mentioned third data table includes redundant entities to be imported. Therefore, the entities to be imported can be traversed. If the entities to be imported exist in the third data table, the entities to be imported are Entity deletion; it may also be that the above-mentioned third data table includes the entities required by the database of the above-mentioned first system, and the above-mentioned entities to be imported are traversed. If the entities to be imported do not exist in the third data table, then the entities to be imported are The entities to be imported are deleted.
S417、第一系统的服务端确定多个待导入的实体中是否包括预设的第一数据表中的全部实体。S417. The server of the first system determines whether the multiple entities to be imported include all entities in the preset first data table.
其中,上述第一数据表中包括第一系统的数据库的指定实体和指定实体的标识。Wherein, the above-mentioned first data table includes the designated entity of the database of the first system and the identifier of the designated entity.
若确定多个待导入的实体中包括预设的第一数据表中的全部实体,说明上述待导入的实体校验正确,则执行步骤S418;若确定多个待导入的实体中不包括预设的第一数据表中的任一实体,说明上述待导入的实体校验错误,则执行步骤S421。If it is determined that the multiple entities to be imported include all entities in the preset first data table, it means that the verification of the entities to be imported is correct, then step S418 is executed; if it is determined that the multiple entities to be imported do not include the preset entities. If any entity in the first data table indicates that the entity to be imported has a verification error, step S421 is executed.
S418、第一系统的服务端将待导入的实体的标识转换为第一数据表中对应的实体的标识,得到转换后的待导入的实体。S418. The server of the first system converts the identifier of the entity to be imported into the identifier of the corresponding entity in the first data table, and obtains the converted entity to be imported.
可选的,上述导入请求中携带有导入参数;上述导入参数包括导入类型、以及导入类型所对应的导入信息。该导入类型例如可以是新增、更新等,该导入类型对应的导入信息,以导入类型为新增为例,该导入信息例如可以是该待同步的目标商品的分类信息;若该导入类型为更新时,该导入信息例如可以是该待同步的目标商品的标识,或者是,该待同步的目标商品的分类信息。Optionally, the above import request carries import parameters; the above import parameters include the import type and the import information corresponding to the import type. The import type can be, for example, new, update, etc. The import information corresponding to the import type, taking the import type as new as an example, the import information can be, for example, the classification information of the target product to be synchronized; if the import type is When updating, the imported information may be, for example, the identification of the target product to be synchronized, or the classification information of the target product to be synchronized.
示例性地,上述第一系统的客户端接收用户输入的待同步的文件、导入类型,以及该导入类型所对应的导入信息。可选的,上述预设的第一数据表中还可以包括该第一系统的数据库中的其他商品信息,例如分类信息,商品名称等。在上述第一系统的服务端接收到上述第一系统的客户端发送的上述导入请求后,在确定多个待导入的实体中包括预设的第一数据表中的全部实体后,根据该导入请求,以及,预设的第一数据表,对上述第一系统的数据库中的数据进行匹配,可能会存在下述几种情况:Illustratively, the client of the first system receives the files to be synchronized, the import type, and the import information corresponding to the import type input by the user. Optionally, the above-mentioned preset first data table may also include other product information in the database of the first system, such as classification information, product names, etc. After the server of the above-mentioned first system receives the above-mentioned import request sent by the client of the above-mentioned first system, after determining that the multiple entities to be imported include all entities in the preset first data table, according to the import To request and match the preset first data table to the data in the database of the above-mentioned first system, the following situations may exist:
第一种情况:若上述导入类型为更新类型,则根据预设的匹配规则和更新类型对应的导入信息,确定该待导入的实体对应的上述第一系统的数据库中的数据的数量;The first situation: If the above-mentioned import type is an update type, then according to the preset matching rules and the import information corresponding to the update type, the amount of data in the database of the above-mentioned first system corresponding to the entity to be imported is determined;
(1)在确定该待导入的实体对应的上述第一系统的数据库中的数据的数量为一个时,则将待导入的实体的标识转换为第一数据表中对应的实体的标识,得到转换后的待导入的实体。(1) When it is determined that the number of data in the database of the first system corresponding to the entity to be imported is one, then the identifier of the entity to be imported is converted into the identifier of the corresponding entity in the first data table, and the conversion is obtained The entities to be imported later.
示例性地,上述预设的匹配规则例如可以是匹配待同步的目标商品的标识,也可以是匹配待同步的目标商品的标识和名称,本申请再次不做限定。在确定该待导入的实体对应的上述第一系统的数据库中的数据的数量为一个时,说明待导入的实体可以和上述第一系统的数据库中的数据进行唯一匹配,因此,对将该待导入的实体的标识转换为第一数据表中的对应的实体的标识。For example, the above-mentioned preset matching rules may be, for example, matching the identifier of the target product to be synchronized, or may be matching the identifier and name of the target product to be synchronized, which is again not limited in this application. When it is determined that the number of data in the database of the first system corresponding to the entity to be imported is one, it means that the entity to be imported can uniquely match the data in the database of the first system. Therefore, the entity to be imported can be uniquely matched with the data in the database of the first system. The identifier of the imported entity is converted into the identifier of the corresponding entity in the first data table.
(2)在确定该待导入的实体对应的第一系统的数据库中的数据的数量大于一时,则将该待导入的实体对应的第一系统的数据库中的数据输出至第一系统的客户端,并获取用户选择的最终对应的第一系统的数据库中的数据;利用最终对应的第一系统的数据库中的数据,更新待同步的文件;并重复执行根据待同步的文件,确定第一系统的数据库的多个待导入的实体的步骤。(2) When it is determined that the number of data in the database of the first system corresponding to the entity to be imported is greater than one, then output the data in the database of the first system corresponding to the entity to be imported to the client of the first system , and obtain the data in the database of the final corresponding first system selected by the user; use the data in the database of the final corresponding first system to update the files to be synchronized; and repeat the execution to determine the first system based on the files to be synchronized. Steps for multiple entities to be imported from the database.
示例性地,在确定多个待导入的实体对应的上述第一系统的数据库中的数据的数量大于一个时,说明待导入的实体与上述第一系统的数据库中的数据不能进行唯一匹配,因此,无法确定上述第一系统的数据库中的待更新的数据,需要将匹配到的该待导入的实体对应的第一系统的数据库中的数据输出至第一系统的客户端,以便让用户通过上述第一系统的客户端进行选择,并通过第一系统的客户端返回用户确定的最终对应的第一系统的数据库中的数据,并利用最终对应的第一系统的数据库中的数据,更新待同步的文件中的对应的数据项。例如,根据上述预设的匹配规则,匹配到了2条不同的数据为别为数据1和数据2,最终对应的第一系统的数据库中的数据为数据1,则根据数据1修改上述待同步的文件中对应的待同步的实体的属性值为数据1对应的数值,返回执行S415。再次执行该步骤时,根据预设的匹配规则,该更新后的待导入的实体可以唯一匹配到待第一系统的数据库中的数据,得到转换后的实体。For example, when it is determined that the number of data in the database of the first system corresponding to multiple entities to be imported is greater than one, it means that the entities to be imported cannot uniquely match the data in the database of the first system. Therefore, , the data to be updated in the database of the first system cannot be determined, and the matched data in the database of the first system corresponding to the entity to be imported needs to be output to the client of the first system, so that the user can pass the above The client of the first system makes a selection, and returns the final corresponding data in the database of the first system determined by the user through the client of the first system, and uses the final corresponding data in the database of the first system to update the data to be synchronized The corresponding data item in the file. For example, according to the above preset matching rules, two different pieces of data are matched, namely data 1 and data 2. Finally, the corresponding data in the database of the first system is data 1, then the above to be synchronized is modified according to data 1. The attribute value of the corresponding entity to be synchronized in the file is the value corresponding to data 1, and returns to execution S415. When this step is performed again, according to the preset matching rules, the updated entity to be imported can be uniquely matched to the data in the database of the first system to obtain the converted entity.
需说明,若前述步骤中上述待同步的文件未进行存储,可以返回执行步骤使13,从上述第一系统对应的第一中间系统中下载该待同步的文件后再进行更新。It should be noted that if the file to be synchronized is not stored in the previous steps, you can return to step 13 to download the file to be synchronized from the first intermediate system corresponding to the first system and then update it.
第二种情况:若确定多个待导入的实体中包括预设的第一数据表中的全部实体,且,导入类型为新增类型,则根据新增类型对应的导入信息,将待导入的实体的标识转换为第一数据表中对应的实体的标识,得到转换后的待导入的实体。Second case: If it is determined that the multiple entities to be imported include all entities in the preset first data table, and the import type is a new type, then according to the import information corresponding to the new type, the entities to be imported will be The identity of the entity is converted into the identity of the corresponding entity in the first data table, and the converted entity to be imported is obtained.
示例性地,若上述导入类型为新增时,说明上述第一系统的数据库中不存在该待导入的实体的历史数据,因此,可以根据该新增类型对应的导入信息,将待导入的实体的标识转换为该第一数据表中对应的实体的标识,得到转换后的待导入的实体的标识。例如,上述导入信息为分类信息,可以根据该分类信息,确定上述第一数据表中该分类信息对应的实体的标识,将该待导入的实体,转换为该分类信息对应的实体的标识。For example, if the above-mentioned import type is new, it means that there is no historical data of the entity to be imported in the database of the above-mentioned first system. Therefore, the entity to be imported can be added according to the import information corresponding to the new type. The identifier is converted into the identifier of the corresponding entity in the first data table, and the converted identifier of the entity to be imported is obtained. For example, the above-mentioned imported information is classification information. According to the classification information, the identifier of the entity corresponding to the classification information in the above-mentioned first data table can be determined, and the entity to be imported can be converted into the identifier of the entity corresponding to the classification information.
S419、第一系统的服务端根据预设的第四数据表和转换后的待导入的实体的标识,生成为多个数据集合。S419. The server of the first system generates multiple data sets based on the preset fourth data table and the converted identifier of the entity to be imported.
其中,上述第四数据表包括预设的数据集合、转换后的待导入的实体的标识、以及第一系统的数据库的数据表,三者之间的对应关系;上述数据集合中包括多个转换后的待导入的实体。Among them, the above-mentioned fourth data table includes a preset data set, the converted identification of the entity to be imported, and the data table of the database of the first system, and the corresponding relationship between the three; the above-mentioned data set includes multiple transformations The entities to be imported later.
示例性地,上述第四数据表可以如表2所示。For example, the above fourth data table may be as shown in Table 2.
表2Table 2
S420、第一系统的服务端基于与上述数据集合对应的线程,将上述数据集合中的多个转换后的待导入的实体存储至对应的上述第一系统的数据库的数据表中。S420. The server of the first system stores the multiple converted entities to be imported in the data set into the corresponding data table of the database of the first system based on the thread corresponding to the data set.
示例性地,上述数据集合对应的线程可以是该第一系统的服务端为该数据集合临时分配的,也可以是预设的该数据集合对应的线程,例如在上述第四数据表中该可以包括数据集合线程的对应关系。该方式可以实现并行存储,提高数据同步效率。For example, the thread corresponding to the data set may be temporarily allocated by the server of the first system to the data set, or may be a preset thread corresponding to the data set. For example, the thread corresponding to the data set may be in the fourth data table. Includes correspondence between data collection threads. This method can achieve parallel storage and improve data synchronization efficiency.
可选的,若上述第一系统所部署的环境为生产环境,即将非生产环境中的第二系统的数据同步至生产环境中的第一系统,则在生产环境中的第一系统的数据同步成功前,该版本的第一系统中同步后的数据库中商品的状态设置为下架状态。Optionally, if the environment where the first system is deployed is a production environment, that is, the data of the second system in the non-production environment is synchronized to the first system in the production environment, and the data of the first system in the production environment is synchronized. Before success, the status of the products in the synchronized database in the first system of this version is set to the off-shelf status.
S421、第一系统的服务端向第一系统的客户端返回提示信息,上述提示信息表征数据的导入失败。S421. The server of the first system returns prompt information to the client of the first system. The above prompt information indicates that the import of data has failed.
示例性地,上述提示信息的形式可是文字信息,也可以是声光报警信息等,本申请在此不做限定。For example, the above prompt information may be in the form of text information, or may be sound and light alarm information, etc., which is not limited in this application.
可选的,上述第一系统和第二系统可以设置有定时清理缓存,以便更新为同步后的数据。Optionally, the above-mentioned first system and second system can be configured to periodically clear caches so that they can be updated with synchronized data.
在本实施例中,先利用第二系统的服务端将第二系统中待同步的目标商品的数据,利用消息队列的方式,从第二系统的数据库中导出,加密封装后生成了待同步的文件,发送至第二系统的客户端所在的电子设备存储;再利用位于同一台电子设备的第一系统的客户端响应于用户触发的待同步的文件,将待同步的文件发送至第一系统的服务端进行处理,第一系统的服务端将该待同步的文件中的数据进行了解密、过滤、校验和匹配处理后转换为第一系统的数据库中的实体的标识,根据该实体的标识,将待同步的文件中的数据并行存储于该第一系统的数据库中。该方式相较于现有技术中利用特定的模板进行数据导入的方式而言,将位于不同环境的第一系统和第二系统,通过部署有第一系统的客户端和第二系统的客户端的电子设备实现了跨环境的数据同步,不仅可以从第二系统的数据库中同时导出多组待同步的目标商品的数据,还可以并行地导入至第一系统的数据库中,提高了数据同步效率,同时,还能够提高数据同步的安全性。In this embodiment, the server of the second system is first used to export the data of the target product to be synchronized in the second system from the database of the second system using the message queue, and then encrypted and encapsulated to generate the data of the target product to be synchronized. The file is sent to the electronic device where the client of the second system is located for storage; and then the client of the first system located on the same electronic device is used to respond to the file to be synchronized triggered by the user and send the file to be synchronized to the first system. The server of the first system performs processing. The server of the first system decrypts, filters, verifies and matches the data in the file to be synchronized and then converts it into an identifier of an entity in the database of the first system. According to the entity's identification, and store the data in the files to be synchronized in the database of the first system in parallel. Compared with the existing method of using a specific template for data import, this method will use the first system and the second system located in different environments to deploy the client of the first system and the client of the second system. The electronic device realizes cross-environment data synchronization. It can not only export multiple sets of target product data to be synchronized from the database of the second system at the same time, but also import it into the database of the first system in parallel, improving the efficiency of data synchronization. At the same time, it can also improve the security of data synchronization.
图6为本申请提供的一种跨环境的数据同步装置的结构示意图。该装置应用于第一系统的服务端,如图6所示,该装置50包括:Figure 6 is a schematic structural diagram of a cross-environment data synchronization device provided by this application. The device is applied to the server of the first system. As shown in Figure 6, the device 50 includes:
获取单元51,用于获取导入请求,其中,所述导入请求用于指示获取待同步的文件;并根据所述导入请求,获取待同步的文件;The acquisition unit 51 is used to obtain an import request, where the import request is used to instruct the acquisition of files to be synchronized; and to acquire the files to be synchronized according to the import request;
确定单元52,用于根据所述待同步的文件,确定所述第一系统的数据库的多个待导入的实体;其中,每一待导入的实体表征每一数据;所述待导入的实体具有属性和属性值;Determining unit 52, configured to determine multiple entities to be imported in the database of the first system according to the files to be synchronized; wherein each entity to be imported represents each data; the entity to be imported has Properties and property values;
转换单元53,用于在确定多个待导入的实体中包括预设的第一数据表中的全部实体时,将所述待导入的实体的标识转换为所述第一数据表中对应的实体的标识,得到转换后的待导入的实体;其中,所述第一数据表中包括所述第一系统的数据库的指定实体和指定实体的标识;The conversion unit 53 is configured to convert the identification of the entity to be imported into the corresponding entity in the first data table when it is determined that the multiple entities to be imported include all entities in the preset first data table. The identification of the converted entity to be imported is obtained; wherein the first data table includes the designated entity of the database of the first system and the identification of the designated entity;
存储单元54,用于根据转换后的待导入的实体的标识,将转换后的待导入的实体存储至所述第一系统的数据库中。The storage unit 54 is configured to store the converted entity to be imported into the database of the first system according to the identification of the converted entity to be imported.
本申请提供的跨环境的数据同步装置,可以执行上述方法实施例中的跨环境的数据同步方法,其实现原理和技术效果类似,在此不再赘述。The cross-environment data synchronization device provided by this application can execute the cross-environment data synchronization method in the above method embodiment. Its implementation principles and technical effects are similar and will not be described again here.
图7为本申请提供的一种跨环境的数据同步装置的结构示意图。该装置应用于第一系统的服务端,如图7所示,该装置60包括:Figure 7 is a schematic structural diagram of a cross-environment data synchronization device provided by this application. The device is applied to the server of the first system. As shown in Figure 7, the device 60 includes:
获取单元61,用于获取导入请求,其中,所述导入请求用于指示获取待同步的文件;并根据所述导入请求,获取待同步的文件;The acquisition unit 61 is used to obtain an import request, where the import request is used to instruct the acquisition of files to be synchronized; and to acquire the files to be synchronized according to the import request;
确定单元62,用于根据所述待同步的文件,确定所述第一系统的数据库的多个待导入的实体;其中,每一待导入的实体表征每一数据;所述待导入的实体具有属性和属性值;Determining unit 62, configured to determine multiple entities to be imported in the database of the first system according to the files to be synchronized; wherein each entity to be imported represents each data; the entity to be imported has Properties and property values;
转换单元63,用于在确定多个待导入的实体中包括预设的第一数据表中的全部实体时,将所述待导入的实体的标识转换为所述第一数据表中对应的实体的标识,得到转换后的待导入的实体;其中,所述第一数据表中包括所述第一系统的数据库的指定实体和指定实体的标识;The conversion unit 63 is configured to convert the identification of the entity to be imported into the corresponding entity in the first data table when it is determined that the multiple entities to be imported include all entities in the preset first data table. The identification of the converted entity to be imported is obtained; wherein the first data table includes the designated entity of the database of the first system and the identification of the designated entity;
存储单元64,用于根据转换后的待导入的实体的标识,将转换后的待导入的实体存储至所述第一系统的数据库中。The storage unit 64 is configured to store the converted entity to be imported into the database of the first system according to the identification of the converted entity to be imported.
一个示例中,上述导入请求中携带有导入参数;所述导入参数包括导入类型、以及导入类型所对应的导入信息;上述转换单元63,包括:In one example, the above-mentioned import request carries import parameters; the import parameters include the import type and the import information corresponding to the import type; the above-mentioned conversion unit 63 includes:
确定模块631,用于当确定多个待导入的实体中包括预设的第一数据表中的全部实体,且,所述导入类型为更新类型时,根据预设的匹配规则和更新类型对应的导入信息,确定所述待导入的实体对应的所述第一系统的数据库中的数据的数量;The determination module 631 is configured to, when it is determined that the multiple entities to be imported include all entities in the preset first data table, and the import type is an update type, according to the preset matching rules and the update type corresponding Import information to determine the amount of data in the database of the first system corresponding to the entity to be imported;
第一转换模块632,用于在确定所述待导入的实体对应的所述第一系统的数据库中的数据的数量为一个时,则将所述待导入的实体的标识转换为所述第一数据表中对应的实体的标识,得到转换后的待导入的实体;在确定所述待导入的实体对应的所述第一系统的数据库中的数据的数量大于一时,则将所述待导入的实体对应的所述第一系统的数据库中的数据输出至所述第一系统的客户端,并获取用户选择的最终对应的所述第一系统的数据库中的数据;利用所述最终对应的所述第一系统的数据库中的数据,更新所述待同步的文件;并重复执行所述根据所述待同步的文件,确定所述第一系统的数据库的多个待导入的实体的步骤。The first conversion module 632 is configured to convert the identification of the entity to be imported into the first system when it is determined that the number of data in the database of the first system corresponding to the entity to be imported is one. The identification of the corresponding entity in the data table is used to obtain the converted entity to be imported; when it is determined that the number of data in the database of the first system corresponding to the entity to be imported is greater than one, the entity to be imported is The data in the database of the first system corresponding to the entity is output to the client of the first system, and the final corresponding data in the database of the first system selected by the user is obtained; using the final corresponding data update the files to be synchronized based on the data in the database of the first system; and repeatedly execute the step of determining multiple entities to be imported into the database of the first system based on the files to be synchronized.
一个示例中,上述确定模块631,用于当确定多个待导入的实体中包括预设的第一数据表中的全部实体,且,所述导入类型为新增类型时,根据新增类型对应的导入信息,将所述待导入的实体的标识转换为所述第一数据表中对应的实体的标识,得到转换后的待导入的实体。In one example, the above-mentioned determination module 631 is configured to determine that the multiple entities to be imported include all entities in the preset first data table, and the import type is a new type, corresponding to the new type. Import information, convert the identifier of the entity to be imported into the identifier of the corresponding entity in the first data table, and obtain the converted entity to be imported.
一个示例中,导入请求中携带有导入参数和待同步的文件;上述获取单元61,包括:In one example, the import request carries import parameters and files to be synchronized; the above-mentioned acquisition unit 61 includes:
上传模块611,用于将所述待同步的文件上传至所述第一系统对应的第一中间系统;The upload module 611 is used to upload the file to be synchronized to the first intermediate system corresponding to the first system;
接收模块612,用于接收所述第一中间系统返回的所述待同步的文件的存储地址,并根据所述第一系统的客户端发送的导入参数,和所述待同步的文件的存储地址,生成导入日志;The receiving module 612 is configured to receive the storage address of the file to be synchronized returned by the first intermediate system, and to receive the storage address of the file to be synchronized according to the import parameters sent by the client of the first system and the storage address of the file to be synchronized. , generate import log;
下载模块613,用于根据所述导入日志中的待同步的文件的存储地址,从所述第一系统对应的第一中间系统中下载所述待同步的文件。The download module 613 is configured to download the file to be synchronized from the first intermediate system corresponding to the first system according to the storage address of the file to be synchronized in the import log.
一个示例中,所述待同步的文件中包括待同步的目标商品的数据;上述确定单元62,包括,In one example, the file to be synchronized includes data of the target commodity to be synchronized; the above-mentioned determination unit 62 includes,
解密模块621,用于对所述待同步的文件进行解密,得到每一解密后的数据;其中,每一所述解密后的数据为每一待同步的实体;所述待同步的实体为第二系统的数据库的实体;所述待同步的实体具有属性和属性值;The decryption module 621 is used to decrypt the file to be synchronized to obtain each decrypted data; wherein each decrypted data is each entity to be synchronized; the entity to be synchronized is the third entity. Entities in the database of the two systems; the entities to be synchronized have attributes and attribute values;
第二转换模块623,根据预设的第二数据表,将待同步的实体,转换为所述第一系统的数据库的待导入的实体;其中,所述第二数据表中包括所述第二系统的数据库的待同步的实体与所述第一系统的数据库的待导入的实体的对应关系。The second conversion module 623 converts entities to be synchronized into entities to be imported into the database of the first system according to the preset second data table; wherein the second data table includes the second Correspondence between entities to be synchronized in the database of the system and entities to be imported in the database of the first system.
一个示例中,上述装置还可以包括过滤单元65,用于根据预设的第三数据表,对所述第一系统的数据库的待导入的实体进行过滤处理。In one example, the above device may further include a filtering unit 65 for filtering entities to be imported in the database of the first system according to a preset third data table.
一个示例中,上述转换单元63中的确定模块631,还可以用于当确定多个待导入的实体中不包括预设的第一数据表中的任一实体时,向所述第一系统的客户端返回提示信息,所述提示信息表征数据的导入失败。In one example, the determination module 631 in the above-mentioned conversion unit 63 can also be used to, when it is determined that the plurality of entities to be imported does not include any entity in the preset first data table, to the first system. The client returns prompt information, which indicates that the data import has failed.
一个示例中,上述存储单元64,包括:In one example, the above-mentioned storage unit 64 includes:
生成模块641,用于根据预设的第四数据表和转换后的待导入的实体的标识,生成为多个数据集合;其中,所述第四数据表包括预设的数据集合、转换后的待导入的实体的标识、以及第一系统的数据库的数据表,三者之间的对应关系;所述数据集合中包括多个转换后的待导入的实体;The generation module 641 is configured to generate multiple data sets according to the preset fourth data table and the converted identification of entities to be imported; wherein the fourth data table includes the preset data set, the converted The correspondence between the identification of the entity to be imported and the data table of the database of the first system; the data set includes multiple converted entities to be imported;
存储模块642,用于基于与所述数据集合对应的线程,将所述数据集合中的多个转换后的待导入的实体存储至对应的所述第一系统的数据库的数据表中。The storage module 642 is configured to store multiple converted entities to be imported in the data set into the corresponding data table of the database of the first system based on the thread corresponding to the data set.
本申请提供的跨环境的数据同步装置,可以执行上述方法实施例中的跨环境的数据同步方法,其实现原理和技术效果类似,在此不再赘述。The cross-environment data synchronization device provided by this application can execute the cross-environment data synchronization method in the above method embodiment. Its implementation principles and technical effects are similar and will not be described again here.
图8为本申请提供的一种跨环境的数据同步装置的结构示意图。该装置应用于第二系统的服务端,如图8所示,该装置70包括:Figure 8 is a schematic structural diagram of a cross-environment data synchronization device provided by this application. This device is applied to the server of the second system. As shown in Figure 8, the device 70 includes:
接收单元71,用于接收所述第二系统的客户端发起的导出请求,其中,所述导出请求用于指示需导出待同步的目标商品的数据,所述导出请求中携带有导出参数;并基于所述导出参数生成导出日志;The receiving unit 71 is configured to receive an export request initiated by the client of the second system, wherein the export request is used to indicate that the data of the target commodity to be synchronized needs to be exported, and the export request carries export parameters; and Generate an export log based on the export parameters;
生成单元72,用于根据所述导出日志,生成待处理消息,并将所述待处理消息发送至消息队列中;其中,所述消息队列中包括至少一个待处理消息;Generating unit 72, configured to generate a message to be processed according to the export log, and send the message to be processed to a message queue; wherein the message queue includes at least one message to be processed;
获取单元73,用于获取所述预设消息队列中的待处理消息;并根据所获取的待处理消息,从预设数据库中获取数据;其中,所述预设数据库包括至少一个商品的数据;The acquisition unit 73 is used to acquire messages to be processed in the preset message queue; and to acquire data from a preset database according to the acquired messages to be processed; wherein the preset database includes data of at least one commodity;
发送单元74,用于根据所获取的数据生成待同步的文件,并将所述待同步的文件发送给所述第二系统的客户端;A sending unit 74, configured to generate a file to be synchronized based on the acquired data, and send the file to be synchronized to the client of the second system;
其中,所述待同步的文件为前述任一项所述的待同步的文件。Wherein, the file to be synchronized is the file to be synchronized as described in any of the preceding items.
本申请提供的跨环境的数据同步装置,可以执行上述方法实施例中的跨环境的数据同步方法,其实现原理和技术效果类似,在此不再赘述。The cross-environment data synchronization device provided by this application can execute the cross-environment data synchronization method in the above method embodiment. Its implementation principles and technical effects are similar and will not be described again here.
图9为本申请提供的一种跨环境的数据同步装置的结构示意图。该装置应用于第二系统的服务端,如图9所示,该装置80包括:Figure 9 is a schematic structural diagram of a cross-environment data synchronization device provided by this application. This device is applied to the server of the second system. As shown in Figure 9, the device 80 includes:
接收单元81,用于接收所述第二系统的客户端发起的导出请求,其中,所述导出请求用于指示需导出待同步的目标商品的数据,所述导出请求中携带有导出参数;并基于所述导出参数生成导出日志;The receiving unit 81 is configured to receive an export request initiated by the client of the second system, wherein the export request is used to indicate that the data of the target commodity to be synchronized needs to be exported, and the export request carries export parameters; and Generate an export log based on the export parameters;
生成单元82,用于根据所述导出日志,生成待处理消息,并将所述待处理消息发送至消息队列中;其中,所述消息队列中包括至少一个待处理消息;Generating unit 82, configured to generate a message to be processed according to the export log, and send the message to be processed to a message queue; wherein the message queue includes at least one message to be processed;
获取单元83,用于获取所述预设消息队列中的待处理消息;并根据所获取的待处理消息,从预设数据库中获取数据;其中,所述预设数据库包括至少一个商品的数据;The acquisition unit 83 is used to acquire the messages to be processed in the preset message queue; and to acquire data from the preset database according to the acquired messages to be processed; wherein the preset database includes data of at least one commodity;
发送单元84,用于根据所获取的数据生成待同步的文件,并将所述待同步的文件发送给所述第二系统的客户端;A sending unit 84, configured to generate a file to be synchronized based on the acquired data, and send the file to be synchronized to the client of the second system;
其中,所述待同步的文件为前述任一项所述的待同步的文件。Wherein, the file to be synchronized is the file to be synchronized as described in any of the preceding items.
一个示例中,所述导出参数包括待同步的目标商品的标识;所述导出日志中包括导出日志的标识、导出参数以及导出状态;所述导出状态表征导出数据是否成功。In one example, the export parameters include the identification of the target product to be synchronized; the export log includes the identification of the export log, the export parameters, and the export status; the export status indicates whether the export data is successful.
一个示例中,生成单元82,用于基于所述导出日志的标识为消息主键、所述导出参数为消息体,生成所述待处理消息。In one example, the generating unit 82 is configured to generate the message to be processed based on the identifier of the export log being the message primary key and the export parameter being the message body.
一个示例中,上述发送单元84,包括:In one example, the above sending unit 84 includes:
加密模块841,用于对所述获取的数据进行加密,得到加密后的数据;The encryption module 841 is used to encrypt the obtained data to obtain encrypted data;
封装模块842,用于对所述加密后的数据进行封装,得到所述待同步的文件。The encapsulation module 842 is used to encapsulate the encrypted data to obtain the file to be synchronized.
一个示例中,上述发送单元84,包括:In one example, the above sending unit 84 includes:
上传模块843,用于将所述待同步的文件上传至与所述第二系统对应的第二中间系统中;Upload module 843, used to upload the file to be synchronized to the second intermediate system corresponding to the second system;
接收模块844,用于接收所述第二中间系统返回的所述待同步的文件的存储地址,并将所述待同步的文件的存储地址写入所述导出日志中,确定所述导出状态为导出成功;其中,所述存储地址用于获取待同步的文件;The receiving module 844 is configured to receive the storage address of the file to be synchronized returned by the second intermediate system, and write the storage address of the file to be synchronized into the export log, and determine that the export status is The export is successful; where the storage address is used to obtain the file to be synchronized;
发送模块845,用于根据所述待同步的文件的存储地址,从所述第二中间系统中下载所述待同步的文件;并将所述待同步的文件发送给所述第二系统的客户端。Sending module 845, configured to download the file to be synchronized from the second intermediate system according to the storage address of the file to be synchronized; and send the file to be synchronized to the client of the second system end.
本申请提供的跨环境的数据同步装置,可以执行上述方法实施例中的跨环境的数据同步方法,其实现原理和技术效果类似,在此不再赘述。The cross-environment data synchronization device provided by this application can execute the cross-environment data synchronization method in the above method embodiment. Its implementation principles and technical effects are similar and will not be described again here.
图10为本申请提供的一种电子设备的结构示意图。如图10所示,该电子设备可以包括至少一个处理器901、存储器902,例如可以是计算机、平板电脑等具有处理能力的电子设备。Figure 10 is a schematic structural diagram of an electronic device provided by this application. As shown in FIG. 10 , the electronic device may include at least one processor 901 and a memory 902 , and may be, for example, a computer, a tablet, or other electronic device with processing capabilities.
存储器902,用于存储程序。具体地,程序可以包括程序代码,程序代码包括计算机操作指令。存储器902可能包含高速RAM存储器,也可能还包括非易失性存储器(non-volatile memory),例如至少一个磁盘存储器。Memory 902 is used to store programs. Specifically, the program may include program code, which includes computer operating instructions. The memory 902 may include high-speed RAM memory, and may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
处理器901用于执行存储器902存储的计算机执行指令,以实现前述方法实施例所描述的跨环境的数据同步方法。其中,处理器901可能是一个中央处理器(CentralProcessing Unit,简称为CPU),或者是特定集成电路(Application Specific IntegratedCircuit,简称为ASIC),或者是被配置成实施本申请实施例的一个或多个集成电路。The processor 901 is configured to execute computer execution instructions stored in the memory 902 to implement the cross-environment data synchronization method described in the foregoing method embodiments. The processor 901 may be a central processing unit (Central Processing Unit, CPU for short), an application specific integrated circuit (ASIC for short), or one or more processors configured to implement the embodiments of the present application. integrated circuit.
该电子设备900还可以包括通信接口903,以通过通信接口903可以与外部设备进行通信交互。该外部设备例如可以是计算机、平板电脑、手机等。The electronic device 900 may also include a communication interface 903 to communicate and interact with external devices through the communication interface 903 . The external device may be, for example, a computer, a tablet, a mobile phone, etc.
在具体实现上,如果通信接口903、存储器902和处理器901独立实现,则通信接口903、存储器902和处理器901可以通过总线相互连接并完成相互间的通信。总线可以是工业标准体系结构(Industry Standard Architecture,简称为ISA)总线、外部设备互连(Peripheral Component,简称为PCI)总线或扩展工业标准体系结构(Extended IndustryStandard Architecture,简称为EISA)总线等。总线可以分为地址总线、数据总线、控制总线等,但并不表示仅有一根总线或一种类型的总线。In terms of specific implementation, if the communication interface 903, the memory 902 and the processor 901 are implemented independently, the communication interface 903, the memory 902 and the processor 901 can be connected to each other through a bus and complete mutual communication. The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into address bus, data bus, control bus, etc., but it does not mean that there is only one bus or one type of bus.
可选的,在具体实现上,如果通信接口903、存储器902和处理器901集成在一块芯片上实现,则通信接口903、存储器902和处理器901可以通过内部接口完成通信。Optionally, in terms of specific implementation, if the communication interface 903, the memory 902 and the processor 901 are integrated on one chip, the communication interface 903, the memory 902 and the processor 901 can complete communication through the internal interface.
本申请还提供了一种计算机可读存储介质,该计算机可读存储介质可以包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random AccessMemory)、磁盘或者光盘等各种可以存储程序代码的介质,具体的,该计算机可读存储介质中存储有计算机执行指令,该计算机执行指令用于上述实施例中的跨环境的数据同步方法。This application also provides a computer-readable storage medium. The computer-readable storage medium may include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory) , magnetic disks, optical disks, and other media that can store program codes. Specifically, the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used for the cross-environment data synchronization method in the above embodiment.
本申请还提供一种计算机程序产品,该计算机程序产品包括执行指令,该执行指令存储在可读存储介质中。电子设备900的至少一个处理器可以从可读存储介质读取该执行指令,至少一个处理器执行该执行指令使得电子设备900实施上述的各种实施方式提供的跨环境的数据同步方法。The application also provides a computer program product, the computer program product includes execution instructions, and the execution instructions are stored in a readable storage medium. At least one processor of the electronic device 900 can read the execution instruction from the readable storage medium, and the at least one processor executes the execution instruction so that the electronic device 900 implements the cross-environment data synchronization method provided by the various embodiments described above.
本申请还提供一种芯片,所述芯片上存储有计算机程序,所述计算机程序被所述芯片执行时,实现各种实施方式提供的跨环境的数据同步方法。This application also provides a chip. A computer program is stored on the chip. When the computer program is executed by the chip, the cross-environment data synchronization method provided by various embodiments is implemented.
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于可选实施例,所涉及的动作和模块并不一定是本申请所必须的。It should be noted that for the sake of simple description, the foregoing method embodiments are expressed as a series of action combinations. However, those skilled in the art should know that the present application is not limited by the described action sequence. Because in accordance with this application, certain steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily necessary for this application.
进一步需要说明的是,虽然流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,流程图中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些子步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。It should be further noted that although the steps in the flowchart are shown in sequence as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated in this article, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least some of the steps in the flow chart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but may be executed at different times. The execution of these sub-steps or stages The sequence is not necessarily sequential, but may be performed in turn or alternately with other steps or sub-steps of other steps or at least part of the stages.
应该理解,上述的装置实施例仅是示意性的,本申请的装置还可通过其它的方式实现。例如,上述实施例中单元/模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。例如,多个单元、模块或组件可以结合,或者可以集成到另一个系统,或一些特征可以忽略或不执行。It should be understood that the above device embodiments are only illustrative, and the device of the present application can also be implemented in other ways. For example, the division of units/modules in the above embodiment is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units, modules or components may be combined, or may be integrated into another system, or some features may be omitted or not performed.
另外,若无特别说明,在本申请各个实施例中的各功能单元/模块可以集成在一个单元/模块中,也可以是各个单元/模块单独物理存在,也可以两个或两个以上单元/模块集成在一起。上述集成的单元/模块既可以采用硬件的形式实现,也可以采用软件程序模块的形式实现。In addition, unless otherwise specified, each functional unit/module in each embodiment of the present application can be integrated into one unit/module, or each unit/module can exist physically alone, or there can be two or more units/modules. Modules are integrated together. The above integrated units/modules can be implemented in the form of hardware or software program modules.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。上述实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围In the above embodiments, each embodiment is described with its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. The technical features of the above embodiments can be combined in any way. To simplify the description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, all possible combinations should be used. considered to be within the scope of this manual
本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本申请的其它实施方案。本申请旨在涵盖本申请的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本申请的一般性原理并包括本申请未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本申请的真正范围和精神由下面的权利要求书指出。Other embodiments of the present application will be readily apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary technical means in the technical field that are not disclosed in this application. . It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
应当理解的是,本申请并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本申请的范围仅由所附的权利要求书来限制。It is to be understood that the present application is not limited to the precise structures described above and illustrated in the accompanying drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.
Claims (17)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202311474728.3A CN117453822A (en) | 2023-11-07 | 2023-11-07 | Cross-environment data synchronization method, device and equipment |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202311474728.3A CN117453822A (en) | 2023-11-07 | 2023-11-07 | Cross-environment data synchronization method, device and equipment |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN117453822A true CN117453822A (en) | 2024-01-26 |
Family
ID=89587121
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202311474728.3A Pending CN117453822A (en) | 2023-11-07 | 2023-11-07 | Cross-environment data synchronization method, device and equipment |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN117453822A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN118152475A (en) * | 2024-03-04 | 2024-06-07 | 浪潮通用软件有限公司 | A data synchronization method and device under physical isolation environment of internal and external networks |
-
2023
- 2023-11-07 CN CN202311474728.3A patent/CN117453822A/en active Pending
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN118152475A (en) * | 2024-03-04 | 2024-06-07 | 浪潮通用软件有限公司 | A data synchronization method and device under physical isolation environment of internal and external networks |
| CN118152475B (en) * | 2024-03-04 | 2025-02-11 | 浪潮通用软件有限公司 | A data synchronization method and device under physical isolation environment of internal and external networks |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11533187B2 (en) | Device birth certificate | |
| CN105260668B (en) | A kind of file encrypting method and electronic equipment | |
| CN110612697B (en) | Method and system for data storage layer indexing for efficient information retrieval | |
| US9858360B2 (en) | System and method for controlling manufacturing of an item | |
| US10454910B2 (en) | Management apparatus, computer program product, system, device, method, information processing apparatus, and server | |
| CN109067732B (en) | IoT device and data access system, method and computer-readable storage medium | |
| CN108009440A (en) | Date storage method, querying method, device, storage medium and computer equipment | |
| US12099637B2 (en) | Secure device programming system with hardware security module and security interop layer | |
| JP2015526757A (en) | Generation and verification of alternative data with a specific format | |
| JP2019504426A (en) | Method and apparatus for generating random character string | |
| CN110598433A (en) | Anti-counterfeiting information processing method and device based on block chain | |
| CN113051622A (en) | Index construction method, device, equipment and storage medium | |
| CN103903042A (en) | Data flow encryption SD card | |
| US20150096058A1 (en) | Information processing apparatus | |
| CN113468574B (en) | A method and device for uploading blockchain data | |
| CN109408486B (en) | File distribution method and system, distribution server and file generation device | |
| CN117453822A (en) | Cross-environment data synchronization method, device and equipment | |
| CN113836169B (en) | A data processing method, device and medium based on Clickhouse | |
| CN111130788B (en) | Data processing method and system, data reading method and iSCSI server | |
| CN108985109B (en) | Data storage method and device | |
| CN110515591B (en) | Random number generation method and device based on block chain | |
| CN115018035A (en) | Data processing method, device and electronic device for electronic label | |
| CN116366289A (en) | Safety supervision method and device for remote sensing data of unmanned aerial vehicle | |
| CN116527249A (en) | Virtual power plant offer method, device and equipment based on blockchain and national cryptographic algorithm | |
| CN115577048A (en) | Data synchronization process encryption method, device, computer equipment and storage medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |