A data synchronization method and apparatus
By obtaining the coded flag bits of the organization to which the user belongs, the data synchronization between the headquarters and branches is realized based on the default data source information, solving the data synchronization problem under data isolation, ensuring data consistency and security.
Patent Information
- Application Number
- CN202210452954.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-27
- Publication Date
- 2025-08-05
- Estimated Expiration
- 2042-04-27
AI Technical Summary
In banking institutions with the total score management model, how to achieve data synchronization between headquarters institutions and each branch based on data isolation of different branches.
By obtaining the organization code mark of the organization to which the user belongs, determining that it is a branch, establish a connection with the database of the headquarters based on the default data source information, and submit the data operation content to the database of the headquarters and the user belongs to the user to the database to which the user belongs to realize data synchronization.
Based on the data isolation of branches, data synchronization between headquarters and branches is achieved, ensuring data consistency and security.
Smart Images

Figure CN114860843B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data synchronization method and device. Background Art
[0002] For banking institutions with a headquarter-branch management model, the top-down structure can be headquarters-branch-sub-branch institutions. Due to vertical management needs, the headquarters requires each branch to report information for unified collection.
[0003] However, how to achieve data synchronization between the headquarters and branches on the basis of data isolation between different branches becomes a problem. Summary of the Invention
[0004] This application provides the following technical solutions:
[0005] On one hand, the present application provides a data synchronization method based on a bank information system, wherein the bank information system includes a headquarters and at least one branch, each branch corresponds to a database, each branch corresponds to a different database, and the headquarters structure and each branch have different organization code flags. The method includes:
[0006] Responding to a user's access request, obtaining the institution code flag of the user's institution from the user's access request;
[0007] Using the institution code flag of the institution to which the user belongs as the target institution code flag in the target data source information in the dynamic data source instance, the dynamic data source instance also includes default data source information, and the default data source information corresponds to the database of the headquarters institution;
[0008] If it is determined based on the institution code flag of the institution to which the user belongs that the institution to which the user belongs is a branch, responding to the data operation request of the user and determining the data operation type and data operation content of the user;
[0009] If the data operation type indicates that data in the database needs to be modified, and based on the data operation content, it is determined that synchronization with the headquarters organization is required, a connection is established with the database of the headquarters organization based on the information of the default data source, and based on the target organization code flag, a connection is established with the database of the organization to which the user belongs, and the data operation content is submitted to the database of the headquarters organization and the database of the organization to which the user belongs.
[0010] Optionally, the method further includes:
[0011] If it is determined based on the organization code flag of the organization to which the user belongs that the organization to which the user belongs is a headquarters organization, responding to the data operation request of the user and determining the data operation type and data operation content of the user;
[0012] If the data operation type indicates that data in the database of the first branch needs to be modified, the target organization code flag is modified to the organization code flag of the first branch;
[0013] Based on the information of the default data source, a connection is established with the database of the headquarters organization; based on the organization code flag of the first branch organization, a connection is established with the database of the first branch organization; and the data operation content is submitted to the database of the headquarters organization and the database of the first branch organization.
[0014] Optionally, before obtaining the user's access request, the method further includes:
[0015] In response to the user's login request, after verifying the user's authority, if the user's authority passes the verification, the user is allowed to perform corresponding access.
[0016] Optionally, modifying the target organization code flag to the organization code flag of the first branch organization includes:
[0017] Adding a first annotation to the dynamic data source instance, wherein the first annotation is used to modify the target organization code flag to an annotation parameter, wherein the annotation parameter includes the organization code flag of the first branch structure;
[0018] Based on the first annotation, the target organization code flag is modified to the organization code flag of the first branch.
[0019] Optionally, the step of using the institution code flag of the institution to which the user belongs as the target institution code flag in the target data source information in the dynamic data source instance includes:
[0020] Setting the state of the first interceptor to the effective state so that the first interceptor runs, and using the institution code flag of the institution to which the user belongs as the target institution code flag in the target data source information in the dynamic data source instance;
[0021] The establishing of a connection with the database of the headquarters organization based on the information of the default data source, establishing of a connection with the database of the organization to which the user belongs based on the target organization code flag, and submitting the data operation content to the database of the headquarters organization and the database of the organization to which the user belongs includes:
[0022] Set the status of the second interceptor to the effective state so that the second interceptor runs, establishes a connection with the database of the headquarters organization based on the information of the default data source, establishes a connection with the database of the organization to which the user belongs based on the target organization code flag, and submits the data operation content to the database of the headquarters organization and the database of the organization to which the user belongs.
[0023] Optionally, the method further includes:
[0024] If the data operation type indicates that data in the database needs to be modified, and it is determined based on the data operation content that synchronization with the headquarters structure is not required, a second annotation is added, and the second annotation parameter in the second annotation is true, indicating that the second interceptor is invalid;
[0025] Based on the second annotation, setting the state of the second interceptor to an invalid state;
[0026] Based on the target institution code flag, a connection is established with the database of the institution to which the user belongs, and the data operation content is submitted to the database of the institution to which the user belongs.
[0027] A data synchronization device is based on a bank information system, wherein the bank information system includes a headquarters and at least one branch, each branch corresponding to a database, each branch corresponding to a different database, and the headquarters structure and each branch have different organization code flags. The device includes:
[0028] A first acquisition module is configured to respond to a user's access request and acquire an institution code flag of the institution to which the user belongs from the user's access request;
[0029] A first determining module is configured to use the institution code flag of the institution to which the user belongs as the target institution code flag in the target data source information in the dynamic data source instance, wherein the dynamic data source instance further includes default data source information, and the default data source information corresponds to the database of the headquarters institution;
[0030] a second confirmation module, configured to respond to the user's data operation request and determine the user's data operation type and data operation content if it is determined based on the institution code flag of the user's institution that the user's institution is a branch;
[0031] The first submission module is used to establish a connection with the database of the headquarters organization based on the information of the default data source, and to establish a connection with the database of the organization to which the user belongs based on the target organization code flag, if the data operation type indicates that the data in the database needs to be modified, and based on the data operation content, it is determined that synchronization with the headquarters organization is required. The data operation content is submitted to the database of the headquarters organization and the database of the organization to which the user belongs.
[0032] Optionally, the device further includes:
[0033] a third determining module configured to, if it is determined based on the organization code flag of the user's organization that the user's organization belongs to a headquarters organization, respond to the user's data operation request and determine the user's data operation type and data operation content;
[0034] a modification module, configured to modify the target institution code flag to the institution code flag of the first branch institution if the data operation type indicates that data in the database of the first branch institution needs to be modified;
[0035] The second submission module is used to establish a connection with the database of the headquarters based on the information of the default data source, establish a connection with the database of the first branch based on the institution code flag of the first branch, and submit the data operation content to the database of the headquarters and the database of the first branch.
[0036] Optionally, the device further includes:
[0037] The authority verification module is used to respond to the user's login request, verify the user's authority, and allow the user to perform corresponding access if the user's authority passes the verification.
[0038] Optionally, the modification module is specifically used to:
[0039] Adding a first annotation to the dynamic data source instance, wherein the first annotation is used to modify the target organization code flag to an annotation parameter, wherein the annotation parameter includes the organization code flag of the first branch structure;
[0040] Based on the first annotation, the target organization code flag is modified to the organization code flag of the first branch.
[0041] Optionally, the first determining module may be specifically configured to:
[0042] Setting the state of the first interceptor to the effective state so that the first interceptor runs, and using the institution code flag of the institution to which the user belongs as the target institution code flag in the target data source information in the dynamic data source instance;
[0043] The first submission module can be used to:
[0044] Set the status of the second interceptor to the effective state so that the second interceptor runs, establishes a connection with the database of the headquarters organization based on the information of the default data source, establishes a connection with the database of the organization to which the user belongs based on the target organization code flag, and submits the data operation content to the database of the headquarters organization and the database of the organization to which the user belongs.
[0045] Optionally, the device further includes:
[0046] an adding module configured to add a second annotation if the data operation type indicates that data in the database needs to be modified and it is determined based on the data operation content that synchronization with the headquarters structure is not required, wherein a second annotation parameter in the second annotation is true, indicating that the second interceptor is invalid;
[0047] A setting module, configured to set the state of the second interceptor to an invalid state based on the second annotation;
[0048] The third submission module is used to establish a connection with the database of the institution to which the user belongs based on the target institution code flag, and submit the data operation content to the database of the institution to which the user belongs.
[0049] In the present application, each of the branches corresponds to a database, and the databases corresponding to each branch are different, and the organization code flags of each branch are different, so as to realize data isolation of each branch structure. On this basis, the organization code flag of the organization to which the user belongs is obtained from the user's access request, and the organization code flag of the organization to which the user belongs is used as the target organization code flag in the target data source information in the dynamic data source instance. If the organization to which the user belongs is a branch, a connection can be established with the database of the headquarters organization based on the information of the default data source in the dynamic data source instance, and a connection can be established with the database of the organization to which the user belongs based on the target organization code flag, and the data operation content can be submitted to the database of the headquarters organization and the database of the organization to which the user belongs, so as to realize data synchronization between the headquarters organization and the branch organizations. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0051] Figure 1 This is a flowchart of a data synchronization method provided in Example 1 of the present application;
[0052] Figure 2 This is a flow chart of a data synchronization method provided in Example 2 of the present application;
[0053] Figure 3 This is a flowchart of a data synchronization method provided in Example 3 of the present application;
[0054] Figure 4 This is a flowchart of a data synchronization method provided in Example 4 of the present application;
[0055] Figure 5 This is a flowchart of a data synchronization method provided in Example 5 of the present application;
[0056] Figure 6 It is a structural diagram of a data synchronization device provided by this application. DETAILED DESCRIPTION
[0057] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0058] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0059] The data synchronization provided in this application is based on a bank information system, which includes a headquarters and at least one branch. Each branch corresponds to a database, and the database corresponding to each branch is different. The headquarters structure and the institution code flag of each branch are different.
[0060] For example, the headquarters organization's organization code flag is A0, and each branch organization's organization code flag is B0, B1, B2, etc. If a user accessing the bank's information system belongs to the headquarters or a branch, the user's information will include the organization code flag of the user's organization. For example, if the organization code flag of branch 1 is B0, the organization code flag of branch 2 is B1, and the organization code flag of branch 3 is B3, and the user belongs to branch 1, the user's information will include B0 for branch 1.
[0061] In the present application, the database of the headquarters or the database of the branch can be but not limited to: Oracle or MySQL. Among them, the physical table structure and digital dictionary and other resources of the database in each branch can be the same. The difference is that the database in each branch stores the data of each branch respectively, and the data stored in the database of each branch is different. Among them, the organization code flag of the headquarters or each branch can be used as the user identifier of the user accessing its database application. For example, the user of branch 1 can access the database of branch 1 based on the organization code flag B0, the user of branch 2 can access the database of branch 2 based on the organization code flag B1, and the user of the headquarters can access the database of the headquarters based on the organization code flag A0.
[0062] If the database is an Oracle database, you can also deploy a set of databases and divide the data of different institutions into different SHEMAs for logical isolation. Users of different branches access the data of their own institutions according to the institution code flag of their institutions, and cannot access data across branches. For example, if the branches include branch 1, branch 2, and branch structure 3, the Oracle database contains B0_schema, B1_schema, B2_schema, and A0_schema. B0_schema corresponds to branch 1, B1_schema corresponds to branch 2, B2_schema corresponds to branch 3, and A0_schema corresponds to the headquarters. Users of the headquarters can access A0_schema through A0, users of branch 1 can access B0_schema through B0, users of branch 2 can access B1_schema through B1, and users of branch 3 can access B2_schema through B2.
[0063] Reference Figure 1 , is a flow chart of a data synchronization method provided in Example 1 of the present application. The data synchronization method provided in the present application is applied to an application server, such as Figure 1 As shown, the method may include but is not limited to the following steps:
[0064] Step S11: respond to the user's access request and obtain the institution code flag of the institution to which the user belongs from the user's access request.
[0065] It is understandable that users of the headquarters or branches all initiate access requests through the client.
[0066] The application server can use the BS application service architecture, and accordingly, users at the headquarters and branches can initiate access requests through the same client (e.g., browser). Accordingly, the application server can be implemented based on technologies such as Vue / Java.
[0067] Of course, the application server can also use the CS application service architecture. Accordingly, the headquarters and each branch office need to deploy a client, and their users use their respective clients to initiate access requests.
[0068] Step S12: Use the institution code flag of the institution to which the user belongs as the target institution code flag in the target data source information in the dynamic data source instance. The dynamic data source instance also includes default data source information, and the default data source information corresponds to the database of the headquarters institution.
[0069] In this embodiment, a dynamic data source instance is an instance of a dynamic data source method class, which includes two properties: target data source information and default data source information. The target data source information is defined as the data source information and target organization code flag for each branch. The target organization code flag determines whether the target data source is any branch organization. The default data source is the headquarters organization's data source information.
[0070] The data source information for each branch in the default data source and target data source information can be obtained based on the application configuration file information. The application configuration file information may include, but is not limited to, the database instance name, database IP address, and database password. Accordingly, the data source information for a branch may include the database instance name, database IP address, and database password of the branch's database.
[0071] The default data source may include the database instance name, database IP address, and database password of the headquarters database.
[0072] Specifically, the state of the first interceptor can be set to the effective state but is not limited to being set so that the first interceptor runs and the institution code flag of the institution to which the user belongs is used as the target institution code flag in the target data source information in the dynamic data source instance.
[0073] Step S13: If it is determined based on the institution code flag of the institution to which the user belongs that the institution to which the user belongs is a branch, respond to the user's data operation request and determine the user's data operation type and data operation content.
[0074] Step S14: If the data operation type indicates that the data in the database needs to be modified, and based on the data operation content, it is determined that synchronization with the headquarters organization is required, a connection is established with the database of the headquarters organization based on the information of the default data source, and based on the target organization code flag, a connection is established with the database of the organization to which the user belongs, and the data operation content is submitted to the database of the headquarters organization and the database of the organization to which the user belongs.
[0075] The data operation type indicates that data in the database needs to be modified, and may include but is not limited to: the data operation type is a non-query type, such as add, delete or update type.
[0076] In this embodiment, establishing a connection with the headquarters' database based on the information of the default data source may include but is not limited to: establishing a connection with the headquarters' database based on the database instance name, database IP address and database password of the headquarters' database.
[0077] Establishing a connection with the database of the institution to which the user belongs based on the target institution code flag can be understood as: based on the target institution code flag, obtaining the data source information of the institution to which the user belongs from the target data source information, and establishing a connection with the database of the institution to which the user belongs based on the data source information of the institution to which the user belongs.
[0078] In this embodiment, it is possible but not limited to setting the status of the second interceptor to an effective state so that the second interceptor runs, establishes a connection with the database of the headquarters organization based on the information of the default data source, establishes a connection with the database of the organization to which the user belongs based on the target organization coding flag, and submits the data operation content to the database of the headquarters organization and the database of the organization to which the user belongs.
[0079] On the basis of establishing a connection with the database of the headquarters organization and the database of the organization to which the user belongs, the data operation content is submitted to the database of the headquarters organization and the database of the organization to which the user belongs.
[0080] In this embodiment, each of the branches corresponds to a database, and the databases corresponding to each branch are different, and the organization code flags of each branch are different, so as to realize data isolation of each branch structure. On this basis, the organization code flag of the organization to which the user belongs is obtained from the user's access request, and the organization code flag of the organization to which the user belongs is used as the target organization code flag in the target data source information in the dynamic data source instance. If the organization to which the user belongs is a branch, a connection can be established with the database of the headquarters organization based on the information of the default data source in the dynamic data source instance, and a connection can be established with the database of the organization to which the user belongs based on the target organization code flag, and the data operation content can be submitted to the database of the headquarters organization and the database of the organization to which the user belongs, so as to realize data synchronization between the headquarters organization and the branch.
[0081] As another optional embodiment of the present application, refer to Figure 2 , is a flow chart of a data synchronization method embodiment 2 provided by this application, which may include but is not limited to the following steps:
[0082] Step S21: respond to the user's access request and obtain the institution code flag of the institution to which the user belongs from the user's access request.
[0083] Step S22: Use the institution code flag of the institution to which the user belongs as the target institution code flag in the target data source information in the dynamic data source instance. The dynamic data source instance also includes default data source information, and the default data source information corresponds to the database of the headquarters institution.
[0084] Step S23: If it is determined based on the institution code flag of the institution to which the user belongs that the institution to which the user belongs is a branch, respond to the user's data operation request and determine the user's data operation type and data operation content.
[0085] Step S24: If the data operation type indicates that the data in the database needs to be modified, and based on the data operation content, it is determined that synchronization with the headquarters organization is required, a connection is established with the database of the headquarters organization based on the information of the default data source, and a connection is established with the database of the organization to which the user belongs based on the target organization code flag, and the data operation content is submitted to the database of the headquarters organization and the database of the organization to which the user belongs.
[0086] The detailed process of steps S21-S24 can be found in the relevant introduction of steps S11-S14 in Example 1, and will not be repeated here.
[0087] Step S25: If it is determined based on the organization code flag of the organization to which the user belongs that the organization to which the user belongs is a headquarters organization, respond to the user's data operation request and determine the user's data operation type and data operation content.
[0088] Step S26: If the data operation type indicates that the data in the database of the first branch needs to be modified, the target organization code flag is modified to the organization code flag of the first branch.
[0089] The need to modify data in the database of the first branch may include, but is not limited to, the need to add, delete, or update data in the database of the first branch.
[0090] Step S27: Establish a connection with the database of the headquarters based on the information of the default data source, establish a connection with the database of the first branch based on the institution code flag of the first branch, and submit the data operation content to the database of the headquarters and the database of the first branch.
[0091] It can be understood that if the data operation type representation needs to be queried in the database of the headquarters organization, the target organization code flag (corresponding to the organization code flag of the headquarters organization) will remain unchanged, and based on the information of the default data source or the target organization code flag, a connection will be established with the database of the headquarters organization, and the data operation content will be submitted to the database of the headquarters organization.
[0092] In this embodiment, each of the branches corresponds to a database, and the databases corresponding to each branch are different, and the organization code flags of each branch are different, thereby realizing data isolation of each branch structure. On this basis, the organization code flag of the organization to which the user belongs is obtained from the user's access request, and the organization code flag of the organization to which the user belongs is used as the target organization code flag in the target data source information in the dynamic data source instance. If the organization to which the user belongs is a branch, a connection can be established with the database of the headquarters organization based on the information of the default data source in the dynamic data source instance, and a connection can be established with the database of the organization to which the user belongs based on the target organization code flag, and the data operation content can be submitted to the database of the headquarters organization and the database of the organization to which the user belongs, thereby realizing data synchronization between the headquarters organization and the branch.
[0093] If the user's organization belongs to the headquarters organization, and if the data operation type indicates that the data in the database of the first branch organization needs to be modified, the target organization code flag will be modified to the organization code flag of the first branch organization, and a connection will be established with the database of the headquarters organization based on the information of the default data source. Based on the organization code flag of the first branch organization, a connection will be established with the database of the first branch organization, and the data operation content will be submitted to the database of the headquarters organization and the database of the first branch organization to achieve data synchronization between the headquarters organization and the branch organization.
[0094] As another optional embodiment of the present application, refer to Figure 3 , is a flow chart of Example 3 of a data synchronization method provided by this application. This example is mainly a refinement of the data synchronization method described in Example 2 above. The method may include but is not limited to the following steps:
[0095] Step S31: respond to the user's access request and obtain the institution code flag of the institution to which the user belongs from the user's access request.
[0096] Step S32: Use the institution code flag of the institution to which the user belongs as the target institution code flag in the target data source information in the dynamic data source instance. The dynamic data source instance also includes default data source information, and the default data source information corresponds to the database of the headquarters institution.
[0097] Step S33: If it is determined based on the institution code flag of the institution to which the user belongs that the institution to which the user belongs is a branch, respond to the user's data operation request and determine the user's data operation type and data operation content.
[0098] Step S34: If the data operation type indicates that the data in the database needs to be modified, and based on the data operation content, it is determined that synchronization with the headquarters organization is required, a connection is established with the database of the headquarters organization based on the information of the default data source, and a connection is established with the database of the organization to which the user belongs based on the target organization code flag, and the data operation content is submitted to the database of the headquarters organization and the database of the organization to which the user belongs.
[0099] Step S35: If it is determined based on the organization code flag of the organization to which the user belongs that the organization to which the user belongs is a headquarters organization, respond to the user's data operation request and determine the user's data operation type and data operation content.
[0100] The detailed process of steps S31-S35 can be found in the relevant introduction of steps S21-S25 in Example 2, and will not be repeated here.
[0101] Step S36: If the data operation type indicates that the data in the database of the first branch needs to be modified, a first annotation is added to the dynamic data source instance, and the first annotation is used to modify the target organization code flag to an annotation parameter, and the annotation parameter includes the organization code flag of the first branch structure.
[0102] Step S37: Based on the first annotation, modify the target organization code flag to the organization code flag of the first branch.
[0103] Steps S36-S37 are a specific implementation of step S26 in Example 2.
[0104] Step S38: Establish a connection with the database of the headquarters based on the information of the default data source, establish a connection with the database of the first branch based on the institution code flag of the first branch, and submit the data operation content to the database of the headquarters and the database of the first branch.
[0105] In this embodiment, each of the branches corresponds to a database, and the databases corresponding to each branch are different, and the organization code flags of each branch are different, thereby realizing data isolation of each branch structure. On this basis, the organization code flag of the organization to which the user belongs is obtained from the user's access request, and the organization code flag of the organization to which the user belongs is used as the target organization code flag in the target data source information in the dynamic data source instance. If the organization to which the user belongs is a branch, a connection can be established with the database of the headquarters organization based on the information of the default data source in the dynamic data source instance, and a connection can be established with the database of the organization to which the user belongs based on the target organization code flag, and the data operation content can be submitted to the database of the headquarters organization and the database of the organization to which the user belongs, thereby realizing data synchronization between the headquarters organization and the branch.
[0106] If the user's organization belongs to the headquarters organization, and if the data operation type indicates that the data in the database of the first branch organization needs to be modified, a first annotation is added to the dynamic data source instance. The first annotation is used to modify the target organization code flag to an annotation parameter. The annotation parameter includes the organization code flag of the first branch structure. Based on the first annotation, the target organization code flag is modified to the organization code flag of the first branch organization. Based on the information of the default data source, a connection is established with the database of the headquarters organization. Based on the organization code flag of the first branch organization, a connection is established with the database of the first branch organization. The data operation content is submitted to the database of the headquarters organization and the database of the first branch organization to achieve data synchronization between the headquarters organization and the branch organizations.
[0107] As another optional embodiment of the present application, refer to Figure 4 , is a flow chart of Example 4 of a data synchronization method provided by this application. This example is mainly an extension of the data synchronization method described in Example 1 above. The method may include but is not limited to the following steps:
[0108] Step S41: respond to the user's access request and obtain the institution code flag of the institution to which the user belongs from the user's access request.
[0109] Step S42: Set the status of the first interceptor to the effective state so that the first interceptor runs, and use the institution code flag of the institution to which the user belongs as the target institution code flag in the target data source information in the dynamic data source instance. The dynamic data source instance also includes default data source information, and the default data source information corresponds to the database of the headquarters organization.
[0110] Step S42 is a specific implementation of step S12 in Example 1.
[0111] Step S43: If it is determined based on the institution code flag of the institution to which the user belongs that the institution to which the user belongs is a branch, respond to the user's data operation request and determine the user's data operation type and data operation content.
[0112] Step S44: If the data operation type indicates that the data in the database needs to be modified, and based on the data operation content, it is determined that synchronization with the headquarters organization is required, the status of the second interceptor is set to the effective state so that the second interceptor runs, establishes a connection with the database of the headquarters organization based on the information of the default data source, establishes a connection with the database of the organization to which the user belongs based on the target organization code flag, and submits the data operation content to the database of the headquarters organization and the database of the organization to which the user belongs.
[0113] Step S44 is a specific implementation of step S14 in Example 1.
[0114] Step S45: If the data operation type indicates that the data in the database needs to be modified, and based on the data operation content, it is determined that synchronization with the headquarters structure is not required, a second annotation is added, and the second annotation parameter in the second annotation is true, indicating that the second interceptor is invalid.
[0115] Step S46: Based on the second annotation, set the state of the second interceptor to an invalid state.
[0116] Step S47: Based on the target institution code flag, establish a connection with the database of the institution to which the user belongs, and submit the data operation content to the database of the institution to which the user belongs.
[0117] In this embodiment, each of the branches corresponds to a database, and the databases corresponding to each branch are different, and the organization code flags of each branch are different, thereby realizing data isolation of each branch structure. On this basis, the organization code flag of the organization to which the user belongs is obtained from the user's access request, and the organization code flag of the organization to which the user belongs is used as the target organization code flag in the target data source information in the dynamic data source instance. If the organization to which the user belongs is a branch, a connection can be established with the database of the headquarters organization based on the information of the default data source in the dynamic data source instance, and a connection can be established with the database of the organization to which the user belongs based on the target organization code flag, and the data operation content can be submitted to the database of the headquarters organization and the database of the organization to which the user belongs, thereby realizing data synchronization between the headquarters organization and the branch.
[0118] If the institution to which the user belongs is a branch, and the data operation type indicates that the data in the database needs to be modified, and based on the data operation content, it is determined that synchronization with the headquarters structure is not required, then a second annotation is added, and the second annotation parameter in the second annotation is true, indicating that the second interceptor is invalid. Based on the second annotation, the state of the second interceptor is set to an invalid state, and based on the target institution code flag, a connection is established with the database of the institution to which the user belongs, and the data operation content is submitted to the database of the institution to which the user belongs, so that the data operation content is only submitted to the database of the corresponding branch.
[0119] As another optional embodiment of the present application, refer to Figure 5 , is a flow chart of Example 5 of a data synchronization method provided by this application. This example is mainly an extension of the data synchronization method described in Example 1 above. The method may include but is not limited to the following steps:
[0120] Step S51: respond to the user's login request, verify the user's authority, and if the user's authority passes the verification, allow the user to perform corresponding access.
[0121] Step S52: responding to the user's access request, obtaining the institution code flag of the user's institution from the user's access request;
[0122] Step S53: Using the institution code flag of the user's institution as the target institution code flag in the target data source information in the dynamic data source instance, wherein the dynamic data source instance also includes default data source information, and the default data source information corresponds to the database of the headquarters institution;
[0123] Step S54: If it is determined based on the institution code flag of the institution to which the user belongs that the institution to which the user belongs is a branch, respond to the user's data operation request and determine the user's data operation type and data operation content.
[0124] Step S55: If the data operation type indicates that the data in the database needs to be modified, and based on the data operation content, it is determined that synchronization with the headquarters organization is required, a connection is established with the database of the headquarters organization based on the information of the default data source, and a connection is established with the database of the organization to which the user belongs based on the target organization code flag, and the data operation content is submitted to the database of the headquarters organization and the database of the organization to which the user belongs.
[0125] The detailed process of steps S52-S55 can be found in the relevant introduction of steps S11-S14 in Example 1, and will not be repeated here.
[0126] In this embodiment, each of the branches corresponds to a database, and the databases corresponding to each branch are different, and the organization code flags of each branch are different, thereby realizing data isolation of each branch structure. On this basis, in response to the user's login request, the user's authority is verified, and if the user's authority passes the verification, the user is allowed to perform corresponding access to ensure the security of access. On this basis, the organization code flag of the user's organization is obtained from the user's access request, and the organization code flag of the user's organization is used as the target organization code flag in the target data source information in the dynamic data source instance. If the user's organization belongs to a branch, a connection can be established with the database of the headquarters organization based on the information of the default data source in the dynamic data source instance, and a connection can be established with the database of the user's organization based on the target organization code flag, and the data operation content is submitted to the database of the headquarters organization and the database of the user's organization, thereby realizing data synchronization between the headquarters organization and the branch.
[0127] Next, a data synchronization device provided by the present application is introduced. The data synchronization device introduced below and the data synchronization method introduced above can refer to each other.
[0128] See Figure 6 The data synchronization device is based on a bank information system, which includes a headquarters and at least one branch. Each branch corresponds to a database, and the databases corresponding to each branch are different. The headquarters structure and the organization code flag of each branch are different. The device includes: a first acquisition module 100, a first determination module 200, a second determination module 300 and a first submission module 400.
[0129] The first acquisition module 100 is used to respond to a user's access request and obtain the institution code flag of the institution to which the user belongs from the user's access request;
[0130] A first determining module 200 is configured to use the institution code flag of the institution to which the user belongs as the target institution code flag in the target data source information in the dynamic data source instance, wherein the dynamic data source instance further includes default data source information, and the default data source information corresponds to the database of the headquarters institution;
[0131] The second confirmation module 300 is configured to respond to the user's data operation request and determine the user's data operation type and data operation content if it is determined based on the organization code flag of the user's organization that the user's organization is a branch;
[0132] The first submission module 400 is used to establish a connection with the database of the headquarters organization based on the information of the default data source, and to establish a connection with the database of the organization to which the user belongs based on the target organization code flag, if the data operation type indicates that the data in the database needs to be modified, and based on the data operation content, it is determined that synchronization with the headquarters organization is required. The data operation content is submitted to the database of the headquarters organization and the database of the organization to which the user belongs.
[0133] In this embodiment, the data synchronization device may further include:
[0134] a third determining module configured to, if it is determined based on the organization code flag of the user's organization that the user's organization belongs to a headquarters organization, respond to the user's data operation request and determine the user's data operation type and data operation content;
[0135] a modification module, configured to modify the target institution code flag to the institution code flag of the first branch institution if the data operation type indicates that data in the database of the first branch institution needs to be modified;
[0136] The second submission module is used to establish a connection with the database of the headquarters based on the information of the default data source, establish a connection with the database of the first branch based on the institution code flag of the first branch, and submit the data operation content to the database of the headquarters and the database of the first branch.
[0137] In this embodiment, the data synchronization device may further include:
[0138] The authority verification module is used to respond to the user's login request, verify the user's authority, and allow the user to perform corresponding access if the user's authority passes the verification.
[0139] In this embodiment, the modification module can be specifically used to:
[0140] Adding a first annotation to the dynamic data source instance, wherein the first annotation is used to modify the target organization code flag to an annotation parameter, wherein the annotation parameter includes the organization code flag of the first branch structure;
[0141] Based on the first annotation, the target organization code flag is modified to the organization code flag of the first branch.
[0142] In this embodiment, the first determining module 200 may be specifically configured to:
[0143] Setting the state of the first interceptor to the effective state so that the first interceptor runs, and using the institution code flag of the institution to which the user belongs as the target institution code flag in the target data source information in the dynamic data source instance;
[0144] The first submission module 400 may be specifically used to:
[0145] Set the status of the second interceptor to the effective state so that the second interceptor runs, establishes a connection with the database of the headquarters organization based on the information of the default data source, establishes a connection with the database of the organization to which the user belongs based on the target organization code flag, and submits the data operation content to the database of the headquarters organization and the database of the organization to which the user belongs.
[0146] In this embodiment, the data synchronization device may further include:
[0147] an adding module configured to add a second annotation if the data operation type indicates that data in the database needs to be modified and it is determined based on the data operation content that synchronization with the headquarters structure is not required, wherein a second annotation parameter in the second annotation is true, indicating that the second interceptor is invalid;
[0148] A setting module, configured to set the state of the second interceptor to an invalid state based on the second annotation;
[0149] The third submission module is used to establish a connection with the database of the institution to which the user belongs based on the target institution code flag, and submit the data operation content to the database of the institution to which the user belongs.
[0150] It should be noted that each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to in detail. For the device embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0151] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.
[0152] For the convenience of description, the above devices are described as being divided into various modules according to their functions. Of course, when implementing this application, the functions of each module can be implemented in the same or multiple software and / or hardware.
[0153] Through the description of the above embodiments, it can be seen that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in various embodiments of the present application or certain parts of the embodiments.
[0154] The above is a detailed introduction to a data synchronization method and device provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, based on the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A data synchronization method, characterized in that: Based on a bank information system, the bank information system includes a headquarters and at least one branch, each branch corresponds to a database, the databases corresponding to each branch are different, and the organization code flags of the headquarters and each branch are different, the method includes: Responding to a user's access request, obtaining the institution code flag of the user's institution from the user's access request; The institution code flag of the institution to which the user belongs is used as the target institution code flag in the target data source information in the dynamic data source instance. The dynamic data source instance also includes default data source information. The default data source information corresponds to the database of the headquarters institution. The target data source information is defined as the data source information and target institution code flag of each branch. The target institution code flag is used to determine whether the target data source is any one of the branches. If it is determined based on the institution code flag of the institution to which the user belongs that the institution to which the user belongs is a branch, responding to the data operation request of the user and determining the data operation type and data operation content of the user; If the data operation type indicates that data in the database needs to be modified, and based on the data operation content, it is determined that synchronization with the headquarters organization is required, a connection is established with the database of the headquarters organization based on the information of the default data source, and based on the target organization coding flag, the data source information of the institution to which the user belongs is obtained from the target data source information, and based on the data source information of the institution to which the user belongs, a connection is established with the database of the institution to which the user belongs, and the data operation content is submitted to the database of the headquarters organization and the database of the institution to which the user belongs.
2. The method according to claim 1, characterized in that The method further comprises: If it is determined based on the organization code flag of the organization to which the user belongs that the organization to which the user belongs is a headquarters organization, responding to the data operation request of the user and determining the data operation type and data operation content of the user; If the data operation type indicates that data in the database of the first branch needs to be modified, the target organization code flag is modified to the organization code flag of the first branch; Based on the information of the default data source, a connection is established with the database of the headquarters organization; based on the organization code flag of the first branch organization, a connection is established with the database of the first branch organization; and the data operation content is submitted to the database of the headquarters organization and the database of the first branch organization.
3. The method according to claim 1, characterized in that Before responding to the user's access request, the method further includes: In response to the user's login request, after verifying the user's authority, if the user's authority passes the verification, the user is allowed to perform corresponding access.
4. The method according to claim 2, characterized in that The step of modifying the target institution code flag to the institution code flag of the first branch institution includes: Adding a first annotation to the dynamic data source instance, wherein the first annotation is used to modify the target institution code flag to an annotation parameter, wherein the annotation parameter includes the institution code flag of the first branch institution; Based on the first annotation, the target institution code flag is modified to the institution code flag of the first branch.
5. The method according to claim 1, characterized in that The step of using the institution code flag of the institution to which the user belongs as the target institution code flag in the target data source information in the dynamic data source instance includes: Setting the state of the first interceptor to the effective state so that the first interceptor runs, and using the institution code flag of the institution to which the user belongs as the target institution code flag in the target data source information in the dynamic data source instance; The establishing of a connection with the database of the headquarters organization based on the information of the default data source, establishing of a connection with the database of the organization to which the user belongs based on the target organization code flag, and submitting the data operation content to the database of the headquarters organization and the database of the organization to which the user belongs includes: Set the status of the second interceptor to the effective state so that the second interceptor runs, establishes a connection with the database of the headquarters organization based on the information of the default data source, establishes a connection with the database of the organization to which the user belongs based on the target organization code flag, and submits the data operation content to the database of the headquarters organization and the database of the organization to which the user belongs.
6. The method according to claim 5, characterized in that The method further comprises: If the data operation type indicates that data in the database needs to be modified, and it is determined based on the data operation content that synchronization with the headquarters is not required, a second annotation is added, and the second annotation parameter in the second annotation is true, indicating that the second interceptor is invalid; Based on the second annotation, setting the state of the second interceptor to an invalid state; Based on the target institution code flag, a connection is established with the database of the institution to which the user belongs, and the data operation content is submitted to the database of the institution to which the user belongs.
7. A data synchronization device, characterized in that: Based on a bank information system, the bank information system includes a headquarters and at least one branch, each branch corresponds to a database, the databases corresponding to each branch are different, and the organization code flags of the headquarters and each branch are different. The device includes: A first acquisition module is configured to respond to a user's access request and acquire an institution code flag of the institution to which the user belongs from the user's access request; A first determination module is configured to use the institution code flag of the institution to which the user belongs as the target institution code flag in the target data source information in the dynamic data source instance, wherein the dynamic data source instance further includes default data source information, the default data source information corresponding to the database of the headquarters institution, and the target data source information is defined as the data source information and target institution code flag of each branch institution, and the target data source is determined to be any one of the branches through the target institution code flag; a second confirmation module, configured to respond to the user's data operation request and determine the user's data operation type and data operation content if it is determined based on the institution code flag of the user's institution that the user's institution is a branch; The first submission module is used to establish a connection with the database of the headquarters organization based on the information of the default data source if the data operation type indicates that the data in the database needs to be modified, and based on the data operation content, it is determined that synchronization with the headquarters organization is required, obtain the data source information of the organization to which the user belongs from the target data source information based on the target organization coding flag, establish a connection with the database of the organization to which the user belongs based on the data source information of the organization to which the user belongs, and submit the data operation content to the database of the headquarters organization and the database of the organization to which the user belongs.
8. The device according to claim 7, characterized in that The device further comprises: a third determining module configured to, if it is determined based on the organization code flag of the user's organization that the user's organization belongs to a headquarters organization, respond to the user's data operation request and determine the user's data operation type and data operation content; a modification module, configured to modify the target institution code flag to the institution code flag of the first branch institution if the data operation type indicates that data in the database of the first branch institution needs to be modified; The second submission module is used to establish a connection with the database of the headquarters based on the information of the default data source, establish a connection with the database of the first branch based on the institution code flag of the first branch, and submit the data operation content to the database of the headquarters and the database of the first branch.
9. The device according to claim 7, characterized in that The device further comprises: The authority verification module is used to respond to the user's login request, verify the user's authority, and allow the user to perform corresponding access if the user's authority passes the verification.
10. The device according to claim 8, characterized in that The modification module is specifically used to: Adding a first annotation to the dynamic data source instance, wherein the first annotation is used to modify the target institution code flag to an annotation parameter, wherein the annotation parameter includes the institution code flag of the first branch institution; Based on the first annotation, the target institution code flag is modified to the institution code flag of the first branch.
Citation Information
Patent Citations
Method and system for carrying out business development of enterprise branch, and storage medium
CN107229466A
Data synchronization method, apparatus and device
CN110633321A