[go: up one dir, main page]

CN102902812A - Method for realizing remote synchronization of database - Google Patents

Method for realizing remote synchronization of database Download PDF

Info

Publication number
CN102902812A
CN102902812A CN2012104019031A CN201210401903A CN102902812A CN 102902812 A CN102902812 A CN 102902812A CN 2012104019031 A CN2012104019031 A CN 2012104019031A CN 201210401903 A CN201210401903 A CN 201210401903A CN 102902812 A CN102902812 A CN 102902812A
Authority
CN
China
Prior art keywords
database
sequence information
product
key
digest
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.)
Granted
Application number
CN2012104019031A
Other languages
Chinese (zh)
Other versions
CN102902812B (en
Inventor
陆舟
于华章
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Feitian Technologies Co Ltd
Original Assignee
Feitian Technologies Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Feitian Technologies Co Ltd filed Critical Feitian Technologies Co Ltd
Priority to CN201210401903.1A priority Critical patent/CN102902812B/en
Publication of CN102902812A publication Critical patent/CN102902812A/en
Application granted granted Critical
Publication of CN102902812B publication Critical patent/CN102902812B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Storage Device Security (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

本发明公开了一种数据库远程同步的实现方法,属于信息处理领域。所述方法包括:第一数据库根据接收到订单信息产生文摘网络传输给第二数据库,实现与第二数据库的订单信息的实时同步;以及第二数据库根据接收到的订单号和物流号更新订单信息包含的内容,并根据更新后的订单信息产生文摘网络传输给第一数据库,实现与第一数据库的更新后的订单信息的内容的实时同步。采用本发明提出的方法能够有效避免远程数据同步过程所带来的风险,同时能保障数据同步不遗漏。

The invention discloses a method for realizing remote synchronization of a database, which belongs to the field of information processing. The method includes: the first database generates a digest based on the received order information and transmits it to the second database through the network, realizing real-time synchronization with the order information of the second database; and the second database updates the order information according to the received order number and logistics number The included content is generated according to the updated order information and the abstract is transmitted to the first database through the network, so as to realize real-time synchronization with the content of the updated order information of the first database. By adopting the method proposed by the invention, the risk brought by the remote data synchronization process can be effectively avoided, and at the same time, no omission of data synchronization can be guaranteed.

Description

一种数据库远程同步的实现方法A Realization Method of Remote Synchronization of Database

技术领域 technical field

本发明涉及信息处理领域,尤其涉及一种数据库远程同步的实现方法。The invention relates to the field of information processing, in particular to a method for realizing remote synchronization of databases.

背景技术 Background technique

在日常生活中,人们需要在不同的终端设备上创建相同的信息,上述终端设备一般为电脑,现在普遍采用的方法是通过网络来实现不同终端上信息的远程同步。但是,网络远程同步数据的过程中存在数据被恶意篡改的风险,数据的安全性受到影响很可能会给用户带来重大损失,例如,两台服务器的数据库远程同步数据过程中出现数据被恶意篡改的现象,则容易导致两台服务器对应的工作流程出现不对应,直接造成经济损失。为了解决数据远程同步的安全性问题,发明人提出了一种实现方法来保障数据远程同步的安全性。In daily life, people need to create the same information on different terminal devices. The above-mentioned terminal devices are generally computers. Now the commonly used method is to realize remote synchronization of information on different terminals through the network. However, there is a risk of data being maliciously tampered with in the process of remote data synchronization on the network, and the impact of data security may cause heavy losses to users. If this phenomenon occurs, it is easy to cause the workflow corresponding to the two servers to not correspond, directly causing economic losses. In order to solve the security problem of remote data synchronization, the inventor proposes an implementation method to ensure the security of remote data synchronization.

发明内容 Contents of the invention

为解决现有技术中数据同步过程中所存在的风险问题,本发明提出了一种数据库远程同步的实现方法。In order to solve the risk problem existing in the data synchronization process in the prior art, the present invention proposes a method for implementing remote database synchronization.

本发明采用的技术方案是:一种数据库远程同步的实现方法,包括The technical scheme adopted by the present invention is: a method for realizing remote synchronization of databases, comprising

当第一数据库接收到订单信息时执行步骤S1至步骤S4;Execute steps S1 to S4 when the first database receives the order information;

步骤S1:第一数据库将接收到的订单信息保存至订单信息表,根据第一密钥和所述订单信息表中订单信息中包含的用户基本信息生成第一文摘,并向第二数据库发送第一请求数据;Step S1: The first database saves the received order information in the order information table, generates the first abstract according to the first key and the basic user information contained in the order information in the order information table, and sends the second abstract to the second database - request data;

步骤S2:所述第二数据库从接收到的所述第一请求数据中获取订单信息和第一文摘,并根据第二密钥和获取到的所述订单信息中包含的用户基本信息生成第二文摘;Step S2: The second database obtains the order information and the first abstract from the received first request data, and generates a second Abstract;

步骤S3:所述第二数据库比对所述第一文摘和所述第二文摘是否一致,是则执行下一步,否则向所述第一数据库返回包含错误码的请求响应;Step S3: The second database compares whether the first abstract is consistent with the second abstract, and if yes, executes the next step; otherwise, returns a request response containing an error code to the first database;

步骤S4:所述第二数据库将获取到的所述订单信息保存至正式列表中,并向所述第一数据库发送包含同步成功编码的请求响应;Step S4: The second database saves the obtained order information into an official list, and sends a request response containing a synchronization success code to the first database;

所述步骤S4之后还包括步骤S5:所述第二数据库为正式列表中的订单信息中包含的产品序列号字段保存产品序列号;Step S5 is also included after the step S4: the second database saves the product serial number for the product serial number field contained in the order information in the official list;

当第二数据库接收到物流号和订单号时,执行步骤S6至步骤S11;When the second database receives the logistics number and the order number, execute steps S6 to S11;

步骤S6:所述第二数据库将接收到的物流号和订单号保存至临时列表中,并根据所述订单号从正式列表中查找到与之对应的订单信息;Step S6: The second database saves the received logistics number and order number in a temporary list, and finds the corresponding order information from the official list according to the order number;

步骤S7:所述第二数据库根据第二密钥、查找到的所述订单信息中包含的用户基本信息和产品序列号、临时列表中的所述物流号生成第三文摘,并向所述第一数据库发送第二请求数据;Step S7: The second database generates a third abstract according to the second key, the basic user information contained in the found order information, the product serial number, and the logistics number in the temporary list, and sends the third abstract to the second database. A database sends the second request data;

步骤S8:所述第一数据库从接收到的所述第二请求数据中获取订单信息、物流号和第三文摘,并根据第一密钥、所述物流号、所述订单信息中包含的用户基本信息和产品序列号生成第四文摘;Step S8: The first database obtains the order information, the logistics number and the third abstract from the received second request data, and according to the first key, the logistics number, and the user information contained in the order information Basic information and product serial number to generate the fourth abstract;

步骤S9:所述第一数据库比对所述第三文摘和所述第四文摘是否一致,是则执行下一步,否则向所述第二数据库发送包含错误码的请求响应;Step S9: The first database compares whether the third abstract is consistent with the fourth abstract, and if yes, executes the next step; otherwise, sends a request response containing an error code to the second database;

步骤S10:所述第一数据库为所述订单信息表中的订单信息的物流号字段保存所述物流号,并向所述第二数据库发送包含同步成功编码的请求响应;Step S10: the first database saves the logistics number for the logistics number field of the order information in the order information table, and sends a request response containing a synchronization success code to the second database;

步骤S11:所述第二数据库将所述物流号保存至正式列表中的所述订单信息包含的物流号字段,并将临时列表中的所述订单信息删除。Step S11: the second database saves the logistics number in the logistics number field contained in the order information in the official list, and deletes the order information in the temporary list.

上述订单信息中包含有用户基本信息、订单号、产品型号字段、产品序列号字段和物流号字段,所述产品序列号字段和物流号字段初始为空。The above order information includes user basic information, order number, product model field, product serial number field and logistics number field, and the product serial number field and logistics number field are initially empty.

上述第一密钥和所述第二密钥是第一数据库和第二数据库预先协商的会话密钥。或者是:所述第一数据库和所述第二数据库中预存有根据时间命名的协商密钥文件,所述步骤S1还包括,所述第一数据库读取当前系统时间,根据当前系统时间读取相应的协商密钥文件,从所述协商密钥文件中获取第一密钥,所述步骤S2还包括,所述第二数据库读取当前系统时间,根据当前系统时间读取相应的协商密钥文件,从所述协商密钥文件中获取第二密钥。The above-mentioned first key and the second key are session keys pre-negotiated between the first database and the second database. Or: the first database and the second database pre-store the negotiation key file named according to the time, and the step S1 also includes that the first database reads the current system time, reads the current system time according to the current system time Corresponding negotiation key file, obtaining the first key from the negotiation key file, the step S2 also includes, the second database reads the current system time, and reads the corresponding negotiation key according to the current system time file, and obtain the second key from the negotiated key file.

步骤S1所述第一数据库根据第一密钥和订单信息表中订单信息中包含的用户基本信息生成第一文摘具体为:所述第一数据库将所述订单信息中的用户基本信息和所述第一密钥按预先约定的顺序拼接为一个数据串,采用预先约定的算法对所述数据串进行加密产生第一文摘;In step S1, the first database generates the first abstract according to the first key and the basic user information contained in the order information in the order information table, specifically: the first database combines the basic user information in the order information with the The first key is spliced into a data string in a pre-agreed order, and a pre-agreed algorithm is used to encrypt the data string to generate a first digest;

步骤S2所述根据第二密钥和获取到的所述订单信息中包含的用户基本信息生成第二文摘具体为:将所述订单信息中的用户基本信息和第二密钥按预先约定的顺序拼接为一个数据串,采用预先约定的算法对所述数据串进行加密产生第二文摘。The generating of the second abstract according to the second key and the acquired basic user information contained in the order information in step S2 is specifically: the user basic information and the second key in the order information are arranged in a pre-agreed order splicing into a data string, and encrypting the data string with a pre-agreed algorithm to generate a second digest.

所述步骤S2还包括,所述第二数据库验证从所述第一请求数据中获取的所述订单信息的有效性的过程,所述步骤S8还包括,所述第一数据库验证从所述第二请求数据中获取的所述订单信息的有效性的过程;验证所述订单信息的有效性的过程具体为验证所述订单信息的格式和内容是否有效。The step S2 also includes the process of the second database verifying the validity of the order information obtained from the first request data, and the step S8 further includes the first database verifying the validity of the order information obtained from the first request data. 2. The process of requesting the validity of the order information acquired in the data; the process of verifying the validity of the order information is specifically verifying whether the format and content of the order information are valid.

所述步骤S5具体为,所述第二数据库根据所述订单信息中包含的产品型号字段要求检索产品库中符合条件的最优匹配产品,将检索到的产品记录中的产品序列号字段值保存至所述订单信息的产品序列号字段中。The step S5 is specifically, the second database searches for the best matching product in the product library according to the product model field requirement contained in the order information, and saves the value of the product serial number field in the retrieved product record to the product serial number field of the order information.

所述步骤S5包括,所述第二数据库创建第一作业,创建触发器并设置触发器参数,设置调度开始时间和调度间隔时间,当监测到系统时间达到调度开始时间时,启动任务调度器调度创建的作业,并将调度开始时间增加所述调度间隔时间;所述创建的第一作业为:自动遍历正式列表中的所有订单信息,根据订单信息的产品型号字段要求检索产品库中符合条件的最优匹配产品记录,将产品记录中产品序列号字段值保存至所述订单信息的产品序列号字段中。The step S5 includes, the second database creates a first job, creates a trigger and sets trigger parameters, sets a scheduling start time and a scheduling interval time, and starts the task scheduler to schedule when the monitoring system time reaches the scheduling start time The job created, and the scheduling start time is increased by the scheduling interval; the first job created is: automatically traverse all the order information in the official list, and search for eligible products in the product library according to the product model field requirements of the order information Optimally matching the product record, saving the value of the product serial number field in the product record to the product serial number field of the order information.

所述步骤S6包括,所述第二数据库在正式列表中查找是否存在接收到的所述订单号,是则将接收到的所述物流号和订单号作为一条记录保存至临时列表中,否则不保存。The step S6 includes, the second database searches the official list for whether the received order number exists, if yes, saves the received logistics number and order number as a record in the temporary list, otherwise it does not save.

或者是所述步骤S6包括,所述第二数据库创建第二作业和第三作业,创建触发器并设置触发器参数,设置第二调度开始时间、第三调度开始时间和调度间隔时间,当监测到系统时间达到第二调度开始时间时,启动任务调度器调度创建的第二作业,并将第二调度开始时间增加所述调度间隔时间,当监测到系统时间达到第三调度开始时间时,启动任务调度器调度创建的第三作业,并将第二调度开始时间增加所述调度间隔时间;所述第二作业为,将存放订单信息的正式列表下载到指定存储空间,所述第三作业为,从所述指定存储空间获取保存订单号和物流号的临时列表。Or the step S6 includes that the second database creates a second job and a third job, creates a trigger and sets trigger parameters, sets the second scheduling start time, the third scheduling starting time and the scheduling interval time, when monitoring When the system time reaches the second scheduling start time, start the task scheduler to schedule the created second job, and add the second scheduling start time to the scheduling interval time; when it is detected that the system time reaches the third scheduling start time, start The task scheduler schedules the creation of the third job, and increases the second scheduling start time by the scheduling interval; the second job is to download the official list of order information to the designated storage space, and the third job is , to obtain a temporary list for storing order numbers and logistics numbers from the specified storage space.

步骤S4所述向所述第一数据库发送包含成功编码的请求响应之后包括,所述第一数据库接收到所述请求响应后,标记所述订单信息生效。After sending the request response containing the successful code to the first database in step S4 includes, after the first database receives the request response, marking the order information as valid.

所述步骤S11可以替换为:所述第二数据库将所述物流号保存至正式列表中的所述订单信息包含的物流号字段,并将临时列表中的所述订单信息标记为已处理。本发明所述方法还包括,当系统时间达到预设时间时,启动任务调度器调度第四作业,所述第四作业为:检索临时表中标记为已处理的订单信息并将其删除。The step S11 may be replaced by: the second database saves the logistics number in the logistics number field contained in the order information in the official list, and marks the order information in the temporary list as processed. The method of the present invention further includes, when the system time reaches the preset time, starting the task scheduler to schedule a fourth operation, the fourth operation is: retrieving and deleting the order information marked as processed in the temporary table.

所述步骤S4中当所述第二数据库接收到要更新的订单信息时包括,将所述要更新的订单信息保存到正式列表中,所述要更新的订单信息中的产品序列号字段包括旧产品序列号字段和新产品序列号字段;所述步骤S5具体为,为正式列表中的所述要更新的订单信息的产品序列号字段保存新产品序列号,将被更新的订单信息中包含的产品序列号保存到所述要更新的订单信息的旧产品序列号字段中。In the step S4, when the second database receives the order information to be updated, it includes saving the order information to be updated in the official list, and the product serial number field in the order information to be updated includes the old The product serial number field and the new product serial number field; the step S5 is specifically, saving the new product serial number for the product serial number field of the order information to be updated in the official list, which will be included in the updated order information The product serial number is stored in the old product serial number field of the order information to be updated.

步骤S7所述第二数据库根据第二密钥、查找到的所述订单信息中包含的用户基本信息和产品序列号、临时列表中的所述物流号生成第三文摘具体为,所述第二数据库将所述订单信息中的用户基本信息和产品序列号、临时列表中的所述物流号以及第二密钥按照预先约定的顺序拼接为一个数据串,并对所述数据串采用预先约定的算法产生第三文摘;In step S7, the second database generates a third abstract according to the second key, the basic user information contained in the found order information, the product serial number, and the logistics number in the temporary list. Specifically, the second The database splices the basic user information and product serial number in the order information, the logistics number in the temporary list, and the second key into a data string in a pre-agreed order, and uses the pre-agreed The algorithm generates the third abstract;

步骤S8所述根据第一密钥、所述物流号、所述订单信息中包含的用户基本信息和产品序列号生成第四文摘具体为,所述第一数据库将所述订单信息中的用户基本信息和产品序列号、所述物流号以及所述第一密钥按预先约定的顺序拼接为一个数据串,采用预先约定的算法对所述数据串进行加密产生第四文摘。In step S8, the generation of the fourth abstract according to the first key, the logistics number, the basic user information contained in the order information and the product serial number is specifically, the first database stores the basic user information contained in the order information The information and product serial number, the logistics number, and the first key are spliced into a data string in a pre-agreed order, and a pre-agreed algorithm is used to encrypt the data string to generate a fourth digest.

本发明的有益效果是:采用本发明提出的方法能够有效避免远程数据同步过程所带来的风险,同时能保障数据同步不遗漏:1)通过实时触发接口来保证数据即时同步,通过定时扫描数据来触发接口,保障数据同步无遗漏;2)能够检测出数据传输过程中是否被篡改;3)网络传输中的文摘产生的数据来源不明确也是本方法安全保障的特色。The beneficial effects of the present invention are: adopting the method proposed by the present invention can effectively avoid the risks brought by the remote data synchronization process, and at the same time ensure that data synchronization is not missed: 1) Real-time trigger interface is used to ensure instant data synchronization, and data is scanned regularly 2) It can detect whether the data has been tampered with in the process of data transmission; 3) The source of the data generated by the abstract in the network transmission is not clear is also the feature of the security guarantee of this method.

附图说明 Description of drawings

图1是实施例1提供的一种数据库远程同步的实现方法流程图;Fig. 1 is a flow chart of a method for realizing remote synchronization of a database provided in Embodiment 1;

图2是实施例2提供的一种数据库其中一方的数据同步流程图;Fig. 2 is a data synchronization flowchart of one of the databases provided in Embodiment 2;

图3是实施例3提供的一种更新订单信息的流程图。FIG. 3 is a flow chart of updating order information provided by Embodiment 3. FIG.

具体实施方式 Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.

本发明实施例中数据库远程同步的实现方法以远程同步数据库中的订单信息为例进行详细介绍。The implementation method of database remote synchronization in the embodiment of the present invention is described in detail by taking the remote synchronization of order information in the database as an example.

实施例1Example 1

本实施例提供的一种数据库远程同步的实现方法,可以实现第一数据库和第二数据库的订单信息的实时同步,如图1所示,包括以下步骤:A method for realizing remote synchronization of databases provided in this embodiment can realize real-time synchronization of order information of the first database and the second database, as shown in FIG. 1 , including the following steps:

步骤1:第一数据库接收用户申请的订单信息;Step 1: the first database receives the order information applied by the user;

具体地,所述订单信息中包含有用户基本信息、订单号、产品型号字段、产品序列号字段和物流号字段,所述产品序列号字段和物流号字段初始为空,第一数据库将接收到的订单信息保存至订单信息表。Specifically, the order information includes user basic information, order number, product model field, product serial number field, and logistics number field. The product serial number field and logistics number field are initially empty, and the first database will receive Save the order information to the order information table.

本实施例中第一数据库接收到用户申请的订单信息之前包括,第一数据库与第二数据库协商产生一对会话密钥,即第一密钥和第二密钥,第一数据库存储所述第一密钥,第二数据库存储所述第二密钥。In this embodiment, before the first database receives the order information requested by the user, the first database negotiates with the second database to generate a pair of session keys, that is, the first key and the second key, and the first database stores the second session key. a key, and the second database stores the second key.

步骤2:第一数据库根据第一密钥和订单信息中的用户基本信息产生第一文摘;Step 2: the first database generates the first abstract according to the first key and the basic user information in the order information;

具体为:将订单信息中的用户基本信息和第一密钥按预先约定的顺序拼接为一个数据串,采用预先约定的算法对该数据串进行加密产生第一文摘。Specifically: splicing the basic user information and the first key in the order information into a data string in a pre-agreed order, and encrypting the data string with a pre-agreed algorithm to generate the first digest.

本实施例中,所述订单信息中的用户基本信息具体包括收货人姓名、住址、电话等信息。In this embodiment, the basic user information in the order information specifically includes consignee name, address, phone number and other information.

优选的,将订单信息中的用户基本信息和第一密钥按先后顺序拼接为一个数据串,用MD5算法对该数据串进行计算得到第一文摘。除此之外,还可以采用SHA1算法对该数据串进行加密产生第一文摘,从而达到对传输的同步数据进行保护的目的。Preferably, the basic user information in the order information and the first key are sequentially spliced into a data string, and the MD5 algorithm is used to calculate the data string to obtain the first digest. In addition, the SHA1 algorithm can also be used to encrypt the data string to generate the first digest, so as to achieve the purpose of protecting the transmitted synchronous data.

步骤3:第一数据库将订单信息与第一文摘封装为第一请求数据并发送至第二数据库。Step 3: The first database packages the order information and the first abstract into first request data and sends it to the second database.

具体地,第一数据库和第二数据库之间的相互调用采用URL请求路径的方式,本实施例中优选的,将订单信息与第一文摘封装为URL第一请求数据发送至第二数据库。Specifically, the mutual calling between the first database and the second database adopts a URL request path. In this embodiment, preferably, the order information and the first abstract are packaged as URL first request data and sent to the second database.

步骤4:第二数据库接收第一请求数据从中获取订单信息和第一文摘,根据第二密钥和订单信息中的用户基本信息产生第二文摘;Step 4: The second database receives the first request data to obtain the order information and the first abstract, and generates the second abstract according to the second key and the basic user information in the order information;

具体地,第二数据库接收到URL第一请求数据,从中读取到订单信息和第一文摘,将订单信息中的用户基本信息和第二密钥按预先约定的顺序拼接为一个数据串,采用预先约定的算法对该数据串进行加密产生第二文摘。优选的,将订单信息和第二密钥按先后顺序拼接为一个数据串,用MD5算法对该数据串进行计算得到第二文摘。除此之外,还可以采用SHA1算法对该数据串进行加密产生第二文摘,从而达到对传输的同步数据进行保护的目的。Specifically, the second database receives the first URL request data, reads the order information and the first abstract from it, and splices the basic user information and the second key in the order information into a data string in a pre-agreed order, using A pre-agreed algorithm encrypts the data string to generate a second digest. Preferably, the order information and the second key are sequentially spliced into a data string, and the MD5 algorithm is used to calculate the data string to obtain the second digest. In addition, the SHA1 algorithm can also be used to encrypt the data string to generate the second digest, so as to achieve the purpose of protecting the transmitted synchronous data.

优选的,还可以设置第一数据库和第二数据库间隔一定时间重新协商一次密钥,例如间隔时间为1个月,具体实现方式为:在第一数据库和第二数据库中预存一些协商密钥文件,协商密钥文件的文件名用月份表示,步骤2还包括,第一数据库读取当前系统时间,根据当前系统时间读取相应月份的协商密钥文件,从该文件中获取第一密钥,相应的步骤4还包括,第二数据库读取当前系统时间,根据当前系统时间读取相应月份的协商密钥文件,从该文件中获取第二密钥。Preferably, it is also possible to set the first database and the second database to renegotiate the key at a certain time interval, for example, the interval is 1 month, and the specific implementation method is: pre-store some negotiation key files in the first database and the second database , the file name of the negotiated key file is represented by the month, step 2 also includes that the first database reads the current system time, reads the negotiated key file of the corresponding month according to the current system time, and obtains the first key from the file, Corresponding step 4 also includes that the second database reads the current system time, reads the negotiation key file of the corresponding month according to the current system time, and obtains the second key from the file.

进一步的,本实施例中步骤4还可以具体为以下步骤:Further, step 4 in this embodiment may also specifically be the following steps:

步骤4-1:第二数据库验证URL第一请求数据中订单信息的有效性,如有效则继续步骤4-2,否则执行步骤4-3;Step 4-1: The second database verifies the validity of the order information in the first URL request data, if valid, proceed to step 4-2, otherwise execute step 4-3;

本实施例中具体地,验证URL第一请求数据中订单信息的有效性具体为验证所述订单信息的格式和内容是否有效,例如,验证订单信息中包含的用户名是否符合预设格式,验证订单信息中包含的手机号长度是否有效。Specifically in this embodiment, verifying the validity of the order information in the first request data of the URL is specifically verifying whether the format and content of the order information are valid, for example, verifying whether the user name contained in the order information conforms to the preset format, verifying Whether the length of the mobile phone number included in the order information is valid.

步骤4-2:第二数据库接收URL第一请求数据中的订单信息,按照预先约定的顺序将订单信息中的用户基本信息与第二密钥拼接为一个数据串,并用此数据串采用预先约定的算法产生第二文摘。Step 4-2: The second database receives the order information in the first URL request data, splices the basic user information in the order information and the second key into a data string according to the pre-agreed order, and uses this data string to adopt the pre-agreed The algorithm produces the second digest.

步骤4-3:第二数据库向第一数据库返回一个请求响应Response。Response封装了数据有效性验证失败的错误码,跳转执行步骤1。Step 4-3: The second database returns a request response Response to the first database. Response encapsulates the error code of data validity verification failure, and skips to step 1.

例如,错误码2000017表示缺少产品型号参数。For example, error code 2000017 indicates that the product model parameter is missing.

步骤5:第二数据库比对第二文摘与第一文摘是否一致,是则执行步骤7,否则执行步骤6;Step 5: The second database compares whether the second abstract is consistent with the first abstract, if yes, execute step 7, otherwise execute step 6;

步骤6:第二数据库向第一数据库返回一个包含错误码的请求响应Response。Response封装了数据同步验证失败的错误码,然后返回执行步骤1;Step 6: The second database returns a request response Response including an error code to the first database. Response encapsulates the error code of data synchronization verification failure, and then returns to step 1;

例如,错误码2000000表示验签文摘失败。For example, error code 2000000 indicates that the signature verification digest failed.

步骤7:第二数据库保存URL请求数据中的订单信息到正式列表中;Step 7: the second database saves the order information in the URL request data to the official list;

步骤8:第二数据库向第一数据库发送包含同步成功编码的请求响应;Step 8: the second database sends a request response containing a synchronization success code to the first database;

本实施例中具体地,第二数据库保存订单信息完成后向第一数据库返回一个请求响应Response,Response封装了数据同步成功的编码。至此,第一数据库与第二数据库完成订单信息中用户基本信息的数据同步。Specifically, in this embodiment, after the second database finishes saving the order information, it returns a request response Response to the first database, and the Response encapsulates a code indicating that the data synchronization is successful. So far, the first database and the second database have completed the data synchronization of the user's basic information in the order information.

步骤9:第一数据库接收第二数据库的成功Response消息后,标记订单信息生效。Step 9: After receiving the successful Response message from the second database, the first database marks the order information as valid.

步骤10:第二数据库为正式列表中的订单信息的产品序列号字段保存产品序列号;Step 10: the second database saves the product serial number for the product serial number field of the order information in the official list;

具体地,第二数据库遍历正式列表中的所有订单信息,根据订单信息中的产品型号字段要求检索产品库中符合条件的最优匹配产品,若检索到则将检索到的产品记录中的产品序列号字段值保存至此订单信息的序列号字段中;若未检索到则第二数据库向外发送保存产品序列号失败的提醒。Specifically, the second database traverses all the order information in the official list, searches for the best matching product in the product library according to the product model field requirements in the order information, and if it is retrieved, the product sequence in the retrieved product record No. field value is stored in the serial number field of the order information; if not retrieved, the second database sends out a reminder that the product serial number failed to be saved.

优选的,还可以使用quartz调度器实现任务调度,设定调度的开始时间及调度的间隔时间,比如间隔24小时,具体实现方式为:创建quartz作业,创建触发器并设置触发器的参数,设置调度开始时间和调度间隔时间,例如,设置调度开始时间为am8:00,设置调度间隔时间为12小时,当监测到系统时间达到调度开始时间时,启动quartz调度器调度创建的quartz作业,并将调度开始时间增加所述间隔时间作为下一次调度开始时间。本实施例中创建的quartz作业具体为:自动遍历正式列表中的所有订单信息,根据订单信息的产品型号字段要求检索产品库中符合条件的最优匹配产品记录,将产品记录中产品序列号字段值保存至此订单信息中的产品序列号字段中。Preferably, the quartz scheduler can also be used to implement task scheduling, set the start time of scheduling and the interval of scheduling, such as an interval of 24 hours, the specific implementation method is: create a quartz job, create a trigger and set the parameters of the trigger, set Scheduling start time and scheduling interval time, for example, set the scheduling start time to am8:00, set the scheduling interval time to 12 hours, when the monitoring system time reaches the scheduling start time, start the quartz job created by the quartz scheduler and schedule The scheduling start time is added to the interval time as the next scheduling start time. The quartz job created in this embodiment is specifically: automatically traverse all order information in the official list, search for the best matching product record that meets the conditions in the product library according to the product model field requirements of the order information, and insert the product serial number field in the product record The value is saved to the Product Serial Number field in this order message.

配套的优先方案还有针对产品库未出售(匹配)的存量预警使用quartz任务调度,即创建多个quartz作业,所述quartz作业还包括:第二数据库查询库存表中剩余的库存量,当检索出库存量少于预设的数值时,向产品中心人员发送邮箱及手机短信提醒。The supporting priority scheme also uses quartz task scheduling for unsold (matched) inventory warnings in the product library, that is, creating multiple quartz jobs. The quartz job also includes: the second database queries the remaining inventory in the inventory table. When retrieving When the out-of-stock quantity is less than the preset value, an email and SMS reminder will be sent to the product center personnel.

步骤11:第二数据库接收产品发货人员输入的物流号和订单号并保存至临时列表中;Step 11: The second database receives the logistics number and order number input by the product delivery personnel and saves them in the temporary list;

具体地,第二数据库接收到产品发货人员输入的物流号和订单号,通过订单号检索订单信息正式列表中有无此订单号,如果有则将产品发货人员输入的物流号与订单号保存至临时列表中;如果订单信息正式列表中无此订单号,则继续接收产品发货人员输入的下一条订单号和物流号。Specifically, the second database receives the logistics number and order number input by the product delivery personnel, and searches through the order number to see if there is such an order number in the official list of order information, and if so, the logistics number and order number entered by the product delivery personnel Save it to the temporary list; if there is no such order number in the official list of order information, continue to receive the next order number and logistics number entered by the product delivery personnel.

本实施例中具体地,所述产品发货人员为登录到当前系统即第二数据库的订单操作人员,因此系统获取物流号是在订单操作人员登录的状态下完成的。临时列表中所存的每条记录的订单号也确保了在正式列表中有对应的订单号。Specifically, in this embodiment, the product dispatcher is an order operator who logs into the current system, that is, the second database, so the system obtains the logistics number under the condition that the order operator logs in. The order number of each record stored in the temporary list also ensures that there is a corresponding order number in the official list.

进一步的,还可以设定第二数据库使用quartz任务调度,实现第二数据库每天定时将订单信息下载到产品发货人员的邮箱或其它存储空间,具体实现方式同步骤10所述,不同的是本步骤中创建并调用的quartz作业为下载订单信息到产品发货人员的邮箱或其他存储空间。Furthermore, it is also possible to set the second database to use quartz task scheduling to realize that the second database regularly downloads the order information to the mailbox or other storage space of the product delivery personnel every day. The specific implementation method is the same as that described in step 10, except that this The quartz job created and called in the step is to download the order information to the mailbox or other storage space of the product delivery personnel.

更进一步的,产品发货人员不用登录系统,只把每个订单的物流号与订单号保存到邮箱或其它存储空间,第二数据库使用quartz任务调度,设定调度的开始时间及调度的间隔时间,比如间隔24小时,则第二数据库每天定时从产品发货人员的邮箱或其它存储空间读取所有物流号及对应订单号,第二数据库通过订单号检索订单信息正式列表中有无此订单号,如果有则将读取到的物流号与订单号保存至临时列表中,若在订单信息正式列表中未检索到订单号的则不作保存。quartz任务调度的创建过程同步骤10所述,通过quartz任务调度器实现定时调用所创建的作业,例如,可以实现第二数据库每天早上8点自动将订单信息下载到产品发货人员指定的邮箱或存储空间,每天晚上8点自动从所述指定的邮箱或存储空间获取订单号与对应物流号。采用这种方式,产品发货人员不需要登录系统也可以获取到订单列表,在为订单信息绑定物流号后也不需要登录系统导入物流号,系统可以自动获取到物流号,节省了人工登录操作的步骤。Furthermore, the product delivery personnel do not need to log in to the system, but only save the logistics number and order number of each order in the mailbox or other storage space, and the second database uses quartz task scheduling to set the start time of scheduling and the scheduling interval , such as at an interval of 24 hours, the second database reads all logistics numbers and corresponding order numbers from the mailbox or other storage space of the product delivery personnel regularly every day, and the second database uses the order number to search whether there is such an order number in the official list of order information , if there is, save the read logistics number and order number in the temporary list, if the order number is not retrieved in the official list of order information, it will not be saved. The creation process of the quartz task scheduler is the same as that described in step 10. The created job can be invoked regularly through the quartz task scheduler. For example, the second database can automatically download the order information to the mailbox specified by the product delivery person or The storage space automatically obtains the order number and corresponding logistics number from the designated mailbox or storage space every night at 8 o'clock. In this way, product delivery personnel can obtain the order list without logging in to the system. After binding the logistics number to the order information, there is no need to log in to the system to import the logistics number. The system can automatically obtain the logistics number, saving manual login. Operation steps.

步骤12:第二数据库根据临时列表中的订单号从正式列表中查询出与之对应的订单信息。Step 12: The second database queries the corresponding order information from the official list according to the order number in the temporary list.

具体地,第二数据库根据临时列表中的订单号在正式列表中检索相同的订单号,并将该订单号所对应的订单信息作为查找到的订单信息。Specifically, the second database retrieves the same order number in the official list according to the order number in the temporary list, and uses the order information corresponding to the order number as the found order information.

本步骤还可以是第二数据库定时获取临时列表记录,从中提取物流号和订单号,并根据订单号从正式列表中查询出订单信息。In this step, the second database may regularly obtain the temporary list records, extract the logistics number and order number from them, and query the order information from the official list according to the order number.

具体地,本步骤定时通过quartz任务调度实现,具体过程同步骤10所述,不同的是本步骤中,设置的间隔时间为24小时,创建并调用的quartz作业为:获取临时列表记录,从中提取物流号和订单号,并根据订单号从正式列表中查询出订单信息。Specifically, the timing of this step is realized through quartz task scheduling. The specific process is the same as that described in step 10. The difference is that in this step, the interval time is set to 24 hours, and the quartz job created and called is: obtain the temporary list record, extract from it Logistics number and order number, and query the order information from the official list according to the order number.

本步骤包含即时与定时的二种方式,即时能够保障第一时间获取物流号后及时去同步至第一数据库,定时能够保障获取物流号后能够无遗漏的同步至第一数据库。This step includes two methods of instant and timing. Immediately can ensure that the logistics number is obtained at the first time and then synchronized to the first database in time, and timing can ensure that after obtaining the logistics number, it can be synchronized to the first database without omission.

步骤13:第二数据库根据订单信息中的用户基本信息和产品序列号、临时列表中的物流号以及第二密钥产生第三文摘;Step 13: The second database generates a third abstract according to the basic user information and product serial number in the order information, the logistics number in the temporary list, and the second key;

具体地,将订单信息中的用户基本信息、产品序列号、物流号和第二密钥按照预先约定的顺序拼接为一个数据串,并对此数据串采用预先约定的算法产生第三文摘。Specifically, the user's basic information, product serial number, logistics number and second key in the order information are spliced into a data string in a pre-agreed order, and a pre-agreed algorithm is used to generate a third abstract for this data string.

本实施例中优选的,将订单信息中的用户基本信息、产品序列号、物流号和第二密钥顺序拼接成一个数据串,对该数据串采用MD5计算生成第三文摘,也可以与第一数据库预先约定采用其他算法,如SHA1等算法。Preferably in this embodiment, the basic information of the user, the product serial number, the logistics number and the second key in the order information are sequentially spliced into a data string, and the data string is calculated using MD5 to generate a third abstract, which can also be combined with the first A database pre-agrees to use other algorithms, such as SHA1 and other algorithms.

步骤14:第二数据库将订单信息、物流号和第三文摘封装成第二请求数据发送至第一数据库;Step 14: The second database encapsulates the order information, logistics number and third abstract into second request data and sends it to the first database;

具体地,第二数据库将订单信息、物流号与第三文摘封装为URL第二请求数据发送至第一数据库。Specifically, the second database encapsulates the order information, the logistics number and the third abstract into URL second request data and sends it to the first database.

步骤15:第一数据库接收第二请求数据,从中获取订单信息、物流号和第三文摘,根据订单信息中的用户基本信息和产品序列号、接收到的物流号以及第一密钥产生第四文摘;Step 15: The first database receives the second request data, obtains the order information, logistics number and third abstract from it, and generates the fourth Abstract;

具体地,第一数据库接收到URL第二请求数据,从中读取到订单信息、物流号和第三文摘,将订单信息中的用户基本信息和产品序列号、物流号和第一密钥按预先约定的顺序拼接为一个数据串,采用预先约定的算法对该数据串进行加密产生第四文摘。优选的,将订单信息中的用户基本信息和产品序列号、物流号和第一密钥按先后顺序拼接为一个数据串,用MD5算法对该数据串进行计算得到第四文摘。Specifically, the first database receives the second URL request data, reads the order information, logistics number and third abstract from it, and stores the basic user information, product serial number, logistics number and first key in the order information in advance The agreed sequence is spliced into a data string, and a pre-agreed algorithm is used to encrypt the data string to generate the fourth digest. Preferably, the basic user information in the order information, the product serial number, the logistics number and the first key are spliced into a data string in sequence, and the data string is calculated using the MD5 algorithm to obtain the fourth digest.

本实施例中具体地,步骤15中还包括验证从URL第二请求数据中获取的订单信息的有效性,具体验证过程同步骤4相同,在此不再赘述。Specifically, in this embodiment, step 15 also includes verifying the validity of the order information obtained from the second request data of the URL, and the specific verification process is the same as step 4, and will not be repeated here.

步骤16:第一数据库比对第四文摘与第三文摘是否一致,是则执行步骤18,否则执行步骤17;Step 16: The first database compares whether the fourth abstract is consistent with the third abstract, if yes, execute step 18, otherwise execute step 17;

步骤17:第一数据库向第二数据库发送包含错误码的请求响应;跳转执行步骤12;Step 17: The first database sends a request response containing an error code to the second database; jump to step 12;

具体地:第一数据库向第二数据库返回一个请求响应Response,Response封装了数据同步失败的错误码;然后返回执行步骤12;Specifically: the first database returns a request response Response to the second database, and the Response encapsulates the error code of data synchronization failure; then returns to step 12;

优选的,还可以设置计数器记录同步失败的次数,当某个订单连续3次同步数据失败,向指定维护人员发送邮件或手机短信提醒。Preferably, a counter can also be set to record the number of synchronization failures. When an order fails to synchronize data for 3 consecutive times, an email or SMS reminder will be sent to the designated maintenance personnel.

具体的计数器为同步失败一次后保存1至此订单的标识字段中,再次同步失败后将2更新至此订单的标识字段中,依次更新至3后发送邮件或手机短信提醒。The specific counter is to save 1 to the identification field of this order after a synchronization failure once, update 2 to the identification field of this order after another synchronization failure, and send an email or SMS reminder after updating to 3 in turn.

步骤18:第一数据库将物流号保存到订单信息的物流号字段,并将订单信息更新至订单信息表;Step 18: The first database saves the logistics number in the logistics number field of the order information, and updates the order information to the order information table;

步骤19:第一数据库向第二数据库发送包含同步成功编码的请求响应;Step 19: the first database sends a request response containing a synchronization success code to the second database;

具体地,第一数据库向第二数据库发送一个请求响应Response,Response封装了数据同步成功的编码;至此,第一数据库和第二数据库完成物流号的同步。用户可以激活使用产品。Specifically, the first database sends a request response Response to the second database, and the Response encapsulates the code of successful data synchronization; so far, the first database and the second database complete the synchronization of logistics numbers. Users can activate and use the product.

步骤20:第二数据库将物流号保存到正式列表中订单信息的物流号字段;Step 20: the second database stores the logistics number in the logistics number field of the order information in the official list;

优选的,还可以设定第二数据库使用quartz任务调度,设定调度的开始时间及调度的间隔时间,比如间隔24小时,实现第二数据库每天检索订单信息正式列表是否有超过预定天数仍未绑定物流号的订单信息,当监测到满足条件的订单信息存在时,向指定的产品发货人员邮箱或手机提醒发货。Preferably, it is also possible to set the second database to use quartz task scheduling, set the start time of scheduling and the interval of scheduling, such as an interval of 24 hours, to realize whether the official list of order information retrieved by the second database every day has exceeded the predetermined number of days and has not yet been bound. Order information with a specified logistics number. When the existence of order information that meets the conditions is detected, the email or mobile phone of the designated product delivery personnel will be reminded to deliver the goods.

步骤21:第二数据库将临时列表中的该条订单信息标记为已处理;Step 21: the second database marks the order information in the temporary list as processed;

步骤22:第二数据库定时清除临时列表中标记为已处理的订单信息。Step 22: The second database periodically clears the order information marked as processed in the temporary list.

具体地,本步骤通过quartz任务调度实现,具体过程同步骤10所述,不同的是本步骤中,设置的间隔时间为24小时,创建并调用的quartz作业为:检索订单临时表中标识为已处理的订单信息记录,将其删除。Specifically, this step is implemented through quartz task scheduling, and the specific process is the same as that described in step 10. The difference is that in this step, the interval time is set to 24 hours, and the quartz job created and called is: retrieve the order marked as already in the temporary table Processed order information records, delete them.

实施例2Example 2

如图2所示,在实施例1的基础上以数据同步过程中第二数据库执行的操作为例进行详细描述,具体如下:As shown in Figure 2, on the basis of Embodiment 1, the operation performed by the second database in the data synchronization process is taken as an example to describe in detail, as follows:

步骤201:接收第一请求数据从中获取订单信息和第一文摘;Step 201: Receive the first request data and obtain the order information and the first abstract therefrom;

例如,接收到的第一请求数据为URL请求数据,具体为:http://IP:port/application/notify?address=101103&amount=1024&area=lufu&buyer_alias=eb25cf0249971db8cf57c683efe1e5c2&city=sheng&country=china&input_charset=GBK&invoice_title=galenzhang&invoice_type=nornal&need_invoice=1&out_trade_no=20000005012011102498749808&partner=2000000501&phone=0755-12345667&product_model=10001&prov=guang&recv_name=zhang&sign=E10ADC3949BA59ABBE56E057F20F883E&transaction_id=1212419701201112210078541998&zip_code=Ty%23%2Bs%2B例如,接收到的第一请求数据为URL请求数据,具体为:http://IP:port/application/notify?address=101103&amount=1024&area=lufu&buyer_alias=eb25cf0249971db8cf57c683efe1e5c2&city=sheng&country=china&input_charset=GBK&invoice_title=galenzhang&invoice_type=nornal&need_invoice=1&out_trade_no =20000005012011102498749808&partner=2000000501&phone=0755-12345667&product_model=10001&prov=guang&recv_name=zhang&sign=E10ADC3949BA59ABBE56E057F20F883E&transaction_id=1212419701201112210078541998&zip_code=Ty%23%2Bs%2B

其中包含的第一文摘为:E10ADC3949BA59ABBE56E057F20F883E,包含的订单信息中的用户基本信息有收件人所在国、收件人地址、收件人电话等。The first abstract contained in it is: E10ADC3949BA59ABBE56E057F20F883E, and the basic user information contained in the order information includes the recipient's country, recipient's address, recipient's phone number, etc.

步骤202:判断订单信息是否有效,是则执行下一步,否则返回执行步骤201;Step 202: Determine whether the order information is valid, if yes, execute the next step, otherwise return to execute step 201;

本实施例中,判断订单信息是否有效具体为验证所述订单信息的格式和/或内容是否有效,例如,验证订单信息中包含的用户名是否符合预设格式,验证订单信息中包含的手机号长度是否有效。In this embodiment, judging whether the order information is valid is specifically verifying whether the format and/or content of the order information is valid, for example, verifying whether the user name contained in the order information conforms to the preset format, and verifying the mobile phone number contained in the order information length is valid.

步骤203:根据预存的第二密钥和订单信息中的用户基本信息产生第二文摘;Step 203: Generate a second digest according to the pre-stored second key and the basic user information in the order information;

具体为:将订单信息中的用户基本信息和第二密钥顺序拼接为一个数据串,并用MD5算法对此数据串进行加密产生第二文摘;所述第二密钥是预先与同步数据库协商的会话密钥。Specifically: splice the basic user information and the second key in the order information into a data string, and use the MD5 algorithm to encrypt the data string to generate a second digest; the second key is pre-negotiated with the synchronization database session key.

本实施例中具体地,产生的第二文摘为:E10ADC3949BA59ABBE56E057F20F883E。Specifically, in this embodiment, the generated second abstract is: E10ADC3949BA59ABBE56E057F20F883E.

步骤204:比对第二文摘和第一文摘是否一致,是则执行下一步,否则返回执行步骤201;Step 204: Check whether the second abstract is consistent with the first abstract, if yes, execute the next step, otherwise return to step 201;

步骤205:保存订单信息到正式列表并向同步数据库发送保存成功的提醒;Step 205: Save the order information to the official list and send a reminder of successful saving to the synchronization database;

例如,保存成功的提醒的数据包格式为:For example, the packet format of a successfully saved reminder is:

Figure BDA0000228454551
Figure BDA0000228454551

步骤206:根据预先约定的规则为订单信息匹配产品;Step 206: matching products to order information according to pre-agreed rules;

本实施例中具体地,根据产品的分配标识及标号大小为订单信息匹配产品,所述预先约定的规则为优先选取分配标识为未分配且标号较小的产品为订单信息分配。Specifically, in this embodiment, products are matched to the order information according to the distribution identifier and label size of the product, and the pre-agreed rule is to preferentially select products with an unallocated distribution identifier and a smaller label for order information allocation.

优选的,还可以定时监测是否有足够的产品供匹配,实现方式为:创建quartz作业,创建触发器并设置触发器的参数,设置调度开始时间和调度间隔时间,例如,设置调度开始时间为am7:00,设置调度间隔时间为24小时,当监测到系统时间达到调度开始时间时,启动quartz调度器调度创建的quartz作业,并将调度开始时间增加所述间隔时间作为下一次调度开始时间。本实施例中创建的quartz作业具体为:当监测到可供匹配的产品个数少于预设个数时,向指定的员工邮箱发送提醒邮件或发送手机短信提醒。这样可以保证数据的持续性。Preferably, it is also possible to regularly monitor whether there are enough products for matching. The implementation method is: create a quartz job, create a trigger and set the parameters of the trigger, set the scheduling start time and scheduling interval, for example, set the scheduling start time to am7 :00, set the scheduling interval to 24 hours. When the monitoring system time reaches the scheduling start time, start the quartz scheduler to schedule the created quartz job, and add the scheduling start time to the interval as the next scheduling start time. The quartz job created in this embodiment is specifically: when it is detected that the number of products available for matching is less than the preset number, send a reminder email to the designated employee mailbox or send a mobile phone SMS reminder. This ensures data continuity.

步骤207:为正式列表中的订单信息中的产品序列号字段保存产品序列号;Step 207: Save the product serial number for the product serial number field in the order information in the official list;

具体地,第二数据库库遍历正式列表中的所有订单信息,根据订单信息中包含的产品型号字段要求检索产品库中符合条件的最优匹配产品,若检索到则将检索到的产品对应的产品序列号保存至此订单信息的序列号字段中,若未检索到则向外发送保存产品序列号失败的提醒。Specifically, the second database traverses all the order information in the official list, searches for the best matching product that meets the conditions in the product library according to the product model field requirements contained in the order information, and if retrieved, the product corresponding to the retrieved product The serial number is saved in the serial number field of the order information. If it is not retrieved, a reminder of failure to save the product serial number will be sent out.

步骤208:接收产品发货人员输入的为订单信息绑定的物流号和订单号,并将其保存在临时列表中;Step 208: Receive the logistics number and order number bound to the order information input by the product delivery personnel, and save them in the temporary list;

步骤209:获取临时列表,并从中提取物流号和订单号,根据订单号从正式列表中查询出相应的订单信息;Step 209: Obtain the temporary list, extract the logistics number and order number from it, and query the corresponding order information from the official list according to the order number;

步骤210:根据订单信息中的用户基本信息和产品序列号,与物流号、第二密钥产生第三文摘;Step 210: Generate a third abstract according to the basic user information and product serial number in the order information, logistics number, and second key;

本实施例中具体地,将订单信息中的用户基本信息和产品序列号、物流号和第二密钥顺序拼接为一个数据串,采用预先约定的MD5算法对该数据串进行加密生成第三文摘。Specifically, in this embodiment, the basic user information in the order information, the product serial number, the logistics number, and the second key are sequentially spliced into a data string, and the pre-agreed MD5 algorithm is used to encrypt the data string to generate a third digest .

步骤211:将订单信息、物流号和第三文摘封装为第二请求数据并发送给同步数据库;Step 211: Encapsulate the order information, logistics number and third abstract into the second request data and send it to the synchronization database;

例如,向同步数据库发送的第二请求数据为:http://IP:port/application/notify?address=101103&amount=1024&area=lufu&buyer_alias=eb25cf0249971db8cf57c683efe1e5c2&city=sheng&country=china&input_charset=GBK&invoice_title=galenzhang&invoice_type=nornal&need_invoice=1&out_trade_no=20000005012011102498749808&partner=2000000501&phone=0755-12345667&product_model=10001&prov=guang&recv_name=zhang&old_product_isn=1090123123&product_isn=1090123187&product_sn=FT010983&express_co=6168785922&sign=BC9ADBN7809W39A456ERE057F20MN89E&transaction_id=1212419701201112210078541998&zip_code=Ty%23%2Bs%2B例如,向同步数据库发送的第二请求数据为:http://IP:port/application/notify?address=101103&amount=1024&area=lufu&buyer_alias=eb25cf0249971db8cf57c683efe1e5c2&city=sheng&country=china&input_charset=GBK&invoice_title=galenzhang&invoice_type=nornal&need_invoice=1&out_trade_no=20000005012011102498749808&partner=2000000501&phone =0755-12345667&product_model=10001&prov=guang&recv_name=zhang&old_product_isn=1090123123&product_isn=1090123187&product_sn=FT010983&express_co=6168785922&sign=BC9ADBN7809W39A456ERE057F20MN89E&transaction_id=1212419701201112210078541998&zip_code=Ty%23%2Bs%2B

其中包含的第三文摘为:BC9ADBN7809W39A456ERE057F20MN89E。The third abstract contained therein is: BC9ADBN7809W39A456ERE057F20MN89E.

包含的物流号为:6168785922。The logistics number included is: 6168785922.

步骤212:等待接收同步数据库返回的响应;Step 212: waiting to receive the response returned by the synchronization database;

步骤213:判断接收到的响应是否包含同步成功编码,是则执行下一步,否则返回执行步骤209;Step 213: Judging whether the received response contains a synchronization success code, if yes, execute the next step, otherwise return to execute step 209;

接收到的包含同步成功编码的响应为:The received response containing the sync success code is:

Figure BDA0000228454552
Figure BDA0000228454552

步骤214:将物流号保存在正式列表中订单信息中的物流号字段;Step 214: Save the logistics number in the logistics number field in the order information in the official list;

步骤215:将订单信息在临时列表中标记为已处理;Step 215: mark the order information as processed in the temporary list;

步骤216:定时清除临时列表中标记为已处理的订单信息。Step 216: Periodically clear the order information marked as processed in the temporary list.

实施例3Example 3

在实施例1或2的基础上,进一步的,订单信息中的产品序列号字段具体包括旧产品序列号字段和新产品序列号字段。当有订单需要更新时,在保证数据同步的情况下,如图3所示,第二数据库执行的更新订单操作具体如下:On the basis of Embodiment 1 or 2, further, the product serial number field in the order information specifically includes an old product serial number field and a new product serial number field. When there is an order to be updated, in the case of ensuring data synchronization, as shown in Figure 3, the update order operation performed by the second database is as follows:

步骤301:收到要更新的订单信息保存到正式列表中;Step 301: Receive the order information to be updated and save it in the official list;

本实施例中具体地,所述更新的订单信息是有需要更新的订单时,由用户导入到正式列表中的。Specifically in this embodiment, the updated order information is imported into the official list by the user when there is an order that needs to be updated.

步骤302:为正式列表中的要更新的订单信息的产品序列号字段保存新产品序列号;Step 302: saving the new product serial number for the product serial number field of the order information to be updated in the official list;

具体地,在正式列表中根据更新订单信息中包含的产品型号字段要求检索产品库中符合条件的最优匹配产品,将产品对应的序列号保存至此订单信息的新产品序列号字段中。Specifically, in the official list, according to the requirements of the product model field included in the updated order information, search for the best matching product that meets the conditions in the product library, and save the serial number corresponding to the product in the new product serial number field of the order information.

步骤303:在正式列表中将原订单信息中包含的产品序列号保存到要更新的订单信息的旧产品序列号字段中;Step 303: saving the product serial number contained in the original order information in the field of the old product serial number of the order information to be updated in the official list;

步骤304:接收用户为要更新的订单信息输入的物流号和订单号并保存在临时列表中。Step 304: Receive the logistics number and order number input by the user for the order information to be updated and store them in a temporary list.

本实施例中,具体地,当有订单需要更新时,是第二数据库先收到要更新的订单信息,并发送给第一数据库实现订单信息中的用户基本信息的同步,之后的订单信息中的产品序列号和物流号的同步与实施例1或2相同,在此不再赘述。In this embodiment, specifically, when there is an order that needs to be updated, the second database first receives the order information to be updated, and sends it to the first database to realize the synchronization of the basic user information in the order information. The synchronization of the product serial number and the logistics number is the same as in embodiment 1 or 2, and will not be repeated here.

以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求的保护范围为准。The above is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Anyone skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present invention. Should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims (15)

1. the implementation method that data-base remote is synchronous is characterized in that: comprise
Execution in step S1 is to step S4 when the first database receives sequence information;
Step S1: the first database is saved to the sequence information table with the sequence information that receives, and generates the first digest according to the user basic information that comprises in the sequence information in the first key and the described sequence information table, and sends the first request msg to the second database;
Step S2: described the second database obtains sequence information and the first digest from described the first request msg that receives, and generates the second digest according to the user basic information that comprises in the second key and the described sequence information that gets access to;
Step S3: whether described the second database is compared described the first digest consistent with described the second digest, is then to carry out next step, otherwise return the request response that comprises error code to described the first database;
Step S4: the described sequence information that described the second database will get access to is saved in the formal tabulation, and sends the request response that comprises synchronous success coding to described the first database;
Also comprise step S5 after the described step S4: described the second database is preserved product ID for the product ID field that comprises in the sequence information in the formal tabulation;
When the second database received thing stream number and order number, execution in step S6 was to step S11;
Step S6: described the second database is saved to thing stream number and the order number that receives in the interim tabulation, and finds corresponding with it sequence information according to described order number from formal tabulation;
Step S7: described the second database root generates the 3rd digest according to the described thing stream number in the user basic information that comprises in the second key, the described sequence information that finds and product ID, the interim tabulation, and sends the second request msg to described the first database;
Step S8: described the first database obtains sequence information, thing stream number and the 3rd digest from described the second request msg that receives, and generates the 4th digest according to the user basic information and the product ID that comprise in the first key, described thing stream number, the described sequence information;
Step S9: whether described the first database is compared described the 3rd digest consistent with described the 4th digest, is then to carry out next step, otherwise send the request response that comprises error code to described the second database;
Step S10: described the first database is that the thing stream number field of the sequence information in the described sequence information table is preserved described thing stream number, and sends the request response that comprises synchronous success coding to described the second database;
Step S11: described the second database is saved to the thing stream number field that the described sequence information in the formal tabulation comprises with described thing stream number, and the described sequence information deletion in will temporarily tabulating.
2. the synchronous implementation method of a kind of data-base remote according to claim 1, it is characterized in that: include user basic information, order number, product type field, product ID field and thing stream number field in the described sequence information, described product ID field and thing stream number field are initially sky.
3. the synchronous implementation method of a kind of data-base remote according to claim 1, it is characterized in that: described the first key and described the second key are the session keys that the first database and the second database are consulted in advance.
4. the synchronous implementation method of a kind of data-base remote according to claim 1, it is characterized in that: prestore the arranging key file according to the time name in described the first database and described the second database, described step S1 also comprises, described the first database reads the current system time, read corresponding arranging key file according to the current system time, from described arranging key file, obtain the first key, described step S2 also comprises, described the second database reads the current system time, read corresponding arranging key file according to the current system time, from described arranging key file, obtain the second key.
5. the synchronous implementation method of a kind of data-base remote according to claim 1, it is characterized in that: described the first database root of step S1 generates the first digest according to the user basic information that comprises in the sequence information in the first key and the sequence information table and is specially: described the first database is spliced into a serial data with the user basic information in the described sequence information and described the first key by the order of making an appointment, and adopts the algorithm of making an appointment that described serial data is encrypted and produces the first digest;
The described user basic information according to comprising in the second key and the described sequence information that gets access to of step S2 generates the second digest and is specially: the user basic information in the described sequence information and the second key are spliced into a serial data by the order of making an appointment, adopt the algorithm of making an appointment that described serial data is encrypted and produce the second digest.
6. the synchronous implementation method of a kind of data-base remote according to claim 1, it is characterized in that: described step S2 also comprises, the process of the validity of the described sequence information that described the second database authentication obtains from described the first request msg, described step S8 also comprises, the process of the validity of the described sequence information that described the first database authentication obtains from described the second request msg; Whether the process of verifying the validity of described sequence information is specially the format and content of the described sequence information of checking effective.
7. the synchronous implementation method of a kind of data-base remote according to claim 1, it is characterized in that: described step S5 is specially, described the second database root requires qualified Optimum Matching product in the retrieval product library according to the product type field that comprises in the described sequence information, and the product ID field value in the product record that retrieves is saved in the product ID field of described sequence information.
8. the synchronous implementation method of a kind of data-base remote according to claim 1, it is characterized in that: described step S5 comprises, the first operation of described the second database initialize, create trigger and the trigger parameter is set, scheduling start time and dispatch interval time are set, reach scheduling during the start time when monitoring system time, the operation that the initiating task scheduler schedules creates, and will dispatch the start time and increase described dispatch interval time; The first operation of described establishment is: all sequence informations during traversal is formally tabulated automatically, product type field according to sequence information requires qualified Optimum Matching product record in the retrieval product library, and product ID field value in the product record is saved in the product ID field of described sequence information.
9. the synchronous implementation method of a kind of data-base remote according to claim 1, it is characterized in that: described step S6 comprises, described the second database searches whether there is the described order number that receives in formal tabulation, be that described thing stream number and the order number that then will receive is saved in the interim tabulation as a record, otherwise do not preserve.
10. the synchronous implementation method of a kind of data-base remote according to claim 1, it is characterized in that: described step S6 comprises, the second operation of described the second database initialize and the 3rd operation, create trigger and the trigger parameter is set, the second scheduling start time was set, the 3rd scheduling start time and dispatch interval time, reach the second scheduling during the start time when monitoring system time, the second operation that the initiating task scheduler schedules creates, and the second scheduling increased described dispatch interval time the start time, reach the 3rd scheduling during the start time when monitoring system time, the 3rd operation that the initiating task scheduler schedules creates, and the second scheduling start time increased described dispatch interval time; Described the second operation is, the formal tabulation of depositing sequence information is downloaded to designated memory space, and described the 3rd operation is to obtain the interim tabulation of preserving order number and thing stream number from described designated memory space.
11. the synchronous implementation method of a kind of data-base remote according to claim 1, it is characterized in that: step S4 is described to be comprised after described the first database transmission comprises the request response of successfully encoding, after described the first database received the described request response, the described sequence information of mark came into force.
12. the synchronous implementation method of a kind of data-base remote according to claim 1, it is characterized in that: described step S11 replaces with: described the second database is saved to the thing stream number field that the described sequence information in the formal tabulation comprises with described thing stream number, and the described sequence information in will temporarily tabulating is labeled as and processes.
13. the synchronous implementation method of a kind of data-base remote according to claim 12, it is characterized in that: described method also comprises, when system time reaches Preset Time, the 4th operation of initiating task scheduler schedules, described the 4th operation is: retrieval is labeled as the sequence information processed in the temporary table and with its deletion.
14. the synchronous implementation method of a kind of data-base remote according to claim 1, it is characterized in that: when described the second database receives the sequence information that will upgrade, comprise among the described step S4, the described sequence information that will upgrade is saved in the formal tabulation, and the product ID field in the described sequence information that will upgrade comprises old product sequence-number field and new product sequence-number field; Described step S5 is specially, preserve the new product sequence number for the product ID field of the described sequence information that will upgrade in the formal tabulation, the product ID that comprises in the sequence information that is updated is saved in the old product sequence-number field of the described sequence information that will upgrade.
15. the synchronous implementation method of a kind of data-base remote according to claim 1, it is characterized in that: described the second database root of step S7 is according to the second key, the user basic information and the product ID that comprise in the described sequence information that finds, described thing stream number in the interim tabulation generates the 3rd digest and is specially, described the second database is with the user basic information in the described sequence information and product ID, described thing stream number and the second key in the interim tabulation are spliced into a serial data according to the order of making an appointment, and adopt the algorithm of making an appointment to produce the 3rd digest to described serial data;
Described user basic information and the product ID according to comprising in the first key, described thing stream number, the described sequence information of step S8 generates the 4th digest and is specially, described the first database is spliced into a serial data with the user basic information in the described sequence information and product ID, described thing stream number and described the first key by the order of making an appointment, and adopts the algorithm of making an appointment that described serial data is encrypted and produces the 4th digest.
CN201210401903.1A 2012-10-22 2012-10-22 Method for realizing remote synchronization of database Expired - Fee Related CN102902812B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210401903.1A CN102902812B (en) 2012-10-22 2012-10-22 Method for realizing remote synchronization of database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210401903.1A CN102902812B (en) 2012-10-22 2012-10-22 Method for realizing remote synchronization of database

Publications (2)

Publication Number Publication Date
CN102902812A true CN102902812A (en) 2013-01-30
CN102902812B CN102902812B (en) 2015-05-27

Family

ID=47575044

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210401903.1A Expired - Fee Related CN102902812B (en) 2012-10-22 2012-10-22 Method for realizing remote synchronization of database

Country Status (1)

Country Link
CN (1) CN102902812B (en)

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104166739A (en) * 2014-09-05 2014-11-26 北京国双科技有限公司 Index file processing method and device for analysis database
CN104252407A (en) * 2013-11-05 2014-12-31 深圳市华傲数据技术有限公司 Method and device for recording tasks under quartz frame
CN104484481A (en) * 2014-12-26 2015-04-01 携程计算机技术(上海)有限公司 Data matching method, device and system of ticket order
CN104965880A (en) * 2015-06-12 2015-10-07 小米科技有限责任公司 Database splitting method and device
CN106846030A (en) * 2016-07-27 2017-06-13 宁波圆形网络科技有限公司 A kind of commodity prize drawing runtime and method
CN106997557A (en) * 2017-03-23 2017-08-01 深圳市创梦天地科技有限公司 Sequence information acquisition method and device
CN107038617A (en) * 2017-01-19 2017-08-11 阿里巴巴集团控股有限公司 Pay invoice pre-creates method and device
CN107103426A (en) * 2017-04-26 2017-08-29 郑州云海信息技术有限公司 Batch deletes the method and device of sequence number and multiple order number binding relationships
CN107197018A (en) * 2017-05-23 2017-09-22 北京奇艺世纪科技有限公司 A kind of method and apparatus of inter-system data synchronization
CN107491658A (en) * 2017-09-13 2017-12-19 上海联影医疗科技有限公司 Transmission method, radiotherapy system and the electric terminal of medical information
CN107563942A (en) * 2016-06-30 2018-01-09 阿里巴巴集团控股有限公司 A kind of logistics data batch processing method, logistics processing system and processing unit
CN108665352A (en) * 2018-05-10 2018-10-16 延锋彼欧(沈阳)汽车外饰系统有限公司 Customer order information emergency processing method and device
CN109684369A (en) * 2017-10-18 2019-04-26 北京京东尚科信息技术有限公司 Information updating method and device
CN109829016A (en) * 2019-01-25 2019-05-31 网宿科技股份有限公司 A kind of method of data synchronization and device
CN111858775A (en) * 2020-08-06 2020-10-30 四川长虹电器股份有限公司 Data synchronization method for remote database of Internet of things platform
CN113590716A (en) * 2021-08-09 2021-11-02 深圳市携客互联科技有限公司 ERP system-based integrated interface service data automatic synchronization method

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1741447A (en) * 2004-08-23 2006-03-01 威达电股份有限公司 Method and system for network security management
CN101110831A (en) * 2007-08-24 2008-01-23 中兴通讯股份有限公司 Digital cryptographic key protection method
CN101640682A (en) * 2009-06-04 2010-02-03 深圳市汇海科技开发有限公司 Method for improving safety of Web service

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1741447A (en) * 2004-08-23 2006-03-01 威达电股份有限公司 Method and system for network security management
CN101110831A (en) * 2007-08-24 2008-01-23 中兴通讯股份有限公司 Digital cryptographic key protection method
CN101640682A (en) * 2009-06-04 2010-02-03 深圳市汇海科技开发有限公司 Method for improving safety of Web service

Cited By (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104252407A (en) * 2013-11-05 2014-12-31 深圳市华傲数据技术有限公司 Method and device for recording tasks under quartz frame
CN104166739B (en) * 2014-09-05 2017-12-19 北京国双科技有限公司 The index document handling method and device of analytical database
CN104166739A (en) * 2014-09-05 2014-11-26 北京国双科技有限公司 Index file processing method and device for analysis database
CN104484481A (en) * 2014-12-26 2015-04-01 携程计算机技术(上海)有限公司 Data matching method, device and system of ticket order
CN104484481B (en) * 2014-12-26 2018-01-02 上海携程商务有限公司 Data matching method, the apparatus and system of ticketing service order
CN104965880A (en) * 2015-06-12 2015-10-07 小米科技有限责任公司 Database splitting method and device
CN107563942B (en) * 2016-06-30 2021-06-18 菜鸟智能物流控股有限公司 Logistics data batch processing method, logistics processing system and processing device
CN107563942A (en) * 2016-06-30 2018-01-09 阿里巴巴集团控股有限公司 A kind of logistics data batch processing method, logistics processing system and processing unit
CN106846030A (en) * 2016-07-27 2017-06-13 宁波圆形网络科技有限公司 A kind of commodity prize drawing runtime and method
CN107038617A (en) * 2017-01-19 2017-08-11 阿里巴巴集团控股有限公司 Pay invoice pre-creates method and device
CN106997557A (en) * 2017-03-23 2017-08-01 深圳市创梦天地科技有限公司 Sequence information acquisition method and device
CN106997557B (en) * 2017-03-23 2021-06-29 深圳市创梦天地科技有限公司 Order information acquisition method and device
CN107103426A (en) * 2017-04-26 2017-08-29 郑州云海信息技术有限公司 Batch deletes the method and device of sequence number and multiple order number binding relationships
CN107197018A (en) * 2017-05-23 2017-09-22 北京奇艺世纪科技有限公司 A kind of method and apparatus of inter-system data synchronization
CN107197018B (en) * 2017-05-23 2020-01-21 北京奇艺世纪科技有限公司 Method and device for data synchronization between systems
CN107491658A (en) * 2017-09-13 2017-12-19 上海联影医疗科技有限公司 Transmission method, radiotherapy system and the electric terminal of medical information
CN109684369A (en) * 2017-10-18 2019-04-26 北京京东尚科信息技术有限公司 Information updating method and device
CN108665352A (en) * 2018-05-10 2018-10-16 延锋彼欧(沈阳)汽车外饰系统有限公司 Customer order information emergency processing method and device
CN108665352B (en) * 2018-05-10 2022-04-05 延锋彼欧(沈阳)汽车外饰系统有限公司 Customer order information emergency processing method and device
CN109829016A (en) * 2019-01-25 2019-05-31 网宿科技股份有限公司 A kind of method of data synchronization and device
CN111858775A (en) * 2020-08-06 2020-10-30 四川长虹电器股份有限公司 Data synchronization method for remote database of Internet of things platform
CN113590716A (en) * 2021-08-09 2021-11-02 深圳市携客互联科技有限公司 ERP system-based integrated interface service data automatic synchronization method

Also Published As

Publication number Publication date
CN102902812B (en) 2015-05-27

Similar Documents

Publication Publication Date Title
CN102902812A (en) Method for realizing remote synchronization of database
US11569982B2 (en) Blockchain compression using summary and padding blocks
EP2863613A1 (en) Method using mobile terminal to implement cloud searching
CN106815370B (en) Method, device and system for updating resource file
CN101267299B (en) A method and system for securely display data on the webpage
CN104601325B (en) Data ciphering method, data decryption method, device, equipment and system
CN113268261B (en) Page content display method and device and electronic equipment
CN105119973B (en) User information processing method and server
CN108989040B (en) Information processing method and device based on block chain
CN111045806A (en) Method and system for realizing delay message queue
CN101472140A (en) System for distributing and requiring multimedia program and implementing method thereof
CN110597839A (en) Transaction data processing method, device, equipment and storage medium
JP2021514510A (en) Logistics tracking and source identification methods, application servers, blockchain nodes and media
TW201545532A (en) Method and device for processing call requests
CN103139761B (en) The method and communication terminal of a kind of information real-time show
CN103455599A (en) Method, equipment and system for data synchronism
CN104426975A (en) Method, equipment and system for data synchronization
CN112559819B (en) Logistics information query method and device, electronic equipment and storage medium
TWM522426U (en) Products management system for internet of things
CN105744514B (en) A kind of method and device carrying out terminal room communication
CN106341449B (en) Method of data synchronization and device
CN109213955A (en) Data processing method and relevant device
CN102724212B (en) Read-later server realization method, read-later server realization system and read-later read server
CN102724328B (en) Read later client refreshing method, system and device
CN115459927A (en) Object storage service signature generation method suitable for Flutter application

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20150527