Data processing method, device and equipment based on domain-driven design, and medium
By using the domain-driven design approach, data change events are constructed and domain boundary analysis is performed, which solves the problems of data update accuracy and timeliness, realizes cross-domain synchronous updates and automated data analysis, and improves the accuracy and timeliness of data processing.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-29
- Publication Date
- 2026-03-20
AI Technical Summary
As business structures become more complex and data volumes surge, existing technologies struggle to ensure the accuracy and timeliness of data updates, making it difficult for data analysis systems to respond promptly to business needs after updates.
By employing a domain-driven design approach, data change events are constructed and domain boundary analysis is performed to identify multiple domain identifiers for the target data. Corresponding domain data update tasks are then constructed and executed to achieve cross-domain synchronous updates and data analysis.
It improves the accuracy and timeliness of data updates, reduces errors from manual updates, enhances the automation level of data processing, and ensures the timeliness and accuracy of data analysis results.
Smart Images

Figure CN115269625B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the field of big data and database technology, and in particular, to a data processing method, device, equipment, medium and program product based on domain-driven design. BACKGROUND
[0002] With the rapid development of technology and the continuous expansion of the actual business needs of enterprises and other institutions, more and more institutions build data analysis systems by means of server hosts, data storage devices and other IT equipment, so as to update and query relevant data in time through the data analysis system, thereby improving the timeliness of relevant data analysis. However, with the increasing complexity of business structure and the explosive growth of relevant data, the accuracy and timeliness of relevant data update are reduced, and it is difficult to perform subsequent business work in time based on the updated data. SUMMARY
[0003] In view of the above problems, the present disclosure provides a data processing method, device, equipment, medium and program product based on domain-driven design.
[0004] According to a first aspect of the present disclosure, a data processing method based on domain-driven design is provided, comprising:
[0005] In response to detecting an update operation on target data, a data change event is constructed according to the target data;
[0006] Performing domain boundary analysis on the data change event to determine N domain identifiers possessed by the target data, N being a positive integer greater than 1;
[0007] Based on the data change event and the N domain identifiers, a domain data update task corresponding to each of the domain identifiers is constructed, obtaining N domain data update tasks;
[0008] According to the N domain data update tasks, update the first domain data corresponding to the N domain identifiers in the first database respectively, obtaining the first target domain data updated after the N domain identifiers respectively, wherein the domain boundary corresponding to the domain identifier is determined by the domain-driven design method; and
[0009] According to the first target domain data, generate a target domain report corresponding to each of the N domain identifiers.
[0010] According to an embodiment of the present disclosure, the data change event includes M, M being a positive integer greater than 1;
[0011] Based on the data change event and the N domain identifiers, constructing N domain data update tasks corresponding to each of the domain identifiers comprises:
[0012] based on the asynchronous message queue, asynchronously sending M data change events to a change event registry; and
[0013] In a case where a target data change event of the M data change events is listened to in the change event registry, based on the target data change event and a target domain identifier corresponding to the target data change event, generating a data update task corresponding to the target domain identifier, until generating other N-1 domain data update tasks corresponding to other N-1 domain identifiers respectively.
[0014] According to an embodiment of the present disclosure, according to the N domain data update tasks, updating the first domain data corresponding to the N domain identifiers in the first database respectively, obtaining updated first target domain data of the N domain identifiers respectively includes:
[0015] According to the N domain data update tasks, determining target data and data update operations corresponding to each of the N domain identifiers;
[0016] Based on the target data and the data update operations corresponding to each of the N domain identifiers, generating data update statements corresponding to each of the N domain identifiers; and
[0017] In the first database, executing the data update statements corresponding to each of the domain identifiers in the target domain corresponding to each of the domain identifiers respectively, generating updated first target domain data of each of the N domain identifiers.
[0018] According to an embodiment of the present disclosure, according to the N domain data update tasks, updating the first domain data corresponding to the N domain identifiers in the first database respectively, obtaining updated first target domain data of the N domain identifiers respectively includes:
[0019] According to the N domain data update tasks, updating the second domain data corresponding to the N domain identifiers in the second database respectively, obtaining updated second target domain data of the N domain identifiers in the second database respectively;
[0020] Using the N second target domain data in the second database, updating the first domain data corresponding to the N domain identifiers in the first database respectively, obtaining updated first target domain data of the N domain identifiers respectively.
[0021] According to an embodiment of the present disclosure, using the N second target domain data in the second database, updating the first domain data corresponding to the N domain identifiers in the first database respectively, obtaining updated first target domain data of the N domain identifiers respectively includes:
[0022] According to the N second target field data in the second database, N second change query statements are generated for the N second target field data respectively;
[0023] The N second change query statements are written into a second change log to obtain a target second change log;
[0024] In a case where the target second change log is generated, the N second change query statements are synchronized to the first database to obtain N first change query statements; and
[0025] The N first change query statements are executed in the first database to obtain N updated first target field data of the N field identifiers respectively.
[0026] According to an embodiment of the present disclosure, the data processing method based on the domain-driven design further comprises:
[0027] In response to a query request for a target query item, L target query field identifiers corresponding to the target query item in the query request are determined according to the query request;
[0028] Target query instructions corresponding to the L target query field identifiers respectively are generated according to the target query item;
[0029] According to the L target query instructions, target query field reports associated with the target query item are respectively called from storage areas of the L target query field identifiers in the first database to obtain L target query field reports; and
[0030] The L target query field reports are generated in an interactive page.
[0031] A second aspect of the present disclosure provides a data processing apparatus based on a domain-driven design, comprising:
[0032] A first construction module is configured to construct a data change event according to target data in response to detecting an update operation for the target data;
[0033] A first determination module is configured to perform domain boundary analysis on the data change event to determine N field identifiers possessed by the target data, N being a positive integer greater than 1;
[0034] A second construction module is configured to construct a field data update task corresponding to each of the N field identifiers based on the data change event and the N field identifiers to obtain N field data update tasks;
[0035] a first updating module, configured to update, according to N data updating tasks of the above-mentioned domains, the first domain data corresponding to the N domain identifiers respectively in the first database, to obtain the first target domain data of the N domain identifiers after the update respectively, wherein the domain boundary corresponding to the domain identifier is determined by the domain-driven design method; and
[0036] a target domain report generation module, configured to generate the target domain report corresponding to the N domain identifiers respectively according to the first target domain data.
[0037] A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors execute the above-mentioned domain-driven design-based data processing method.
[0038] A fourth aspect of the present disclosure further provides a computer-readable storage medium having stored executable instructions, which, when executed by a processor, cause the processor to execute the above-mentioned domain-driven design-based data processing method.
[0039] A fifth aspect of the present disclosure further provides a computer program product comprising a computer program, which, when executed by a processor, implements the above-mentioned domain-driven design-based data processing method.
[0040] According to the domain-driven design-based data processing method and device provided by the present disclosure, after detecting the update operation on the target data, by constructing the data change event and performing the domain boundary analysis on the data change event, the N target domains that can be affected by the target data after the update operation can be clearly and accurately determined, so as to construct the domain data updating task for the domain identifier corresponding to the N target domains respectively, and then update the first domain data in the target domain represented by the N domain identifiers respectively according to the N domain data updating tasks, so that the first target domain data of the N domain identifiers can be synchronously updated with the update operation on the target data, and at the same time, based on the domain boundary of the N domain identifiers, the update operation on the target data is synchronized to different target domains, thereby reducing the technical problems of low data update accuracy and poor update effectiveness caused by manually updating the data in each domain after the target data update operation, and improving the effectiveness of data update. At the same time, according to the first target domain data after the update, the target domain report corresponding to the N domain identifiers respectively can be generated, which can realize the automatic generation of the data analysis result for the update operation on the target data, thereby realizing the technical effect of improving the automation level of data processing, and providing effectiveness guarantee for the related users to query the data analysis result corresponding to each domain identifier in time. BRIEF DESCRIPTION OF DRAWINGS
[0041] The above and other objects, features and advantages of the present disclosure will become more apparent from the following description when taken in conjunction with the accompanying drawings, in which:
[0042] Figure 1 An application scenario diagram of the data processing method and device based on a domain-driven design according to an embodiment of the present disclosure is schematically shown;
[0043] Figure 2 A flowchart of the data processing method based on a domain-driven design according to an embodiment of the present disclosure is schematically shown;
[0044] Figure 3 A flowchart of constructing a domain data update task corresponding to each domain identifier based on a data change event and N domain identifiers according to an embodiment of the present disclosure is schematically shown;
[0045] Figure 4 A flowchart of updating first domain data corresponding to N domain identifiers in a first database respectively according to N domain data update tasks, to obtain updated first target domain data of the N domain identifiers respectively according to an embodiment of the present disclosure is schematically shown;
[0046] Figure 5 A flowchart of updating first domain data corresponding to N domain identifiers in a first database respectively according to N domain data update tasks, to obtain updated first target domain data of the N domain identifiers according to another embodiment of the present disclosure is schematically shown;
[0047] Figure 6 An application scenario diagram of the data processing method based on a domain-driven design according to an embodiment of the present disclosure is schematically shown;
[0048] Figure 7 A flowchart of the data processing method based on a domain-driven design according to another embodiment of the present disclosure is schematically shown;
[0049] Figure 8 An application scenario diagram of the data processing method based on a domain-driven design according to another embodiment of the present disclosure is schematically shown;
[0050] Figure 9 A structural block diagram of the data processing device based on a domain-driven design according to an embodiment of the present disclosure is schematically shown;
[0051] Figure 10 A block diagram of an electronic device suitable for implementing the data processing method based on a domain-driven design according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0052] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood, however, that the description is merely exemplary and is not intended to limit the scope of the present disclosure. In the following detailed description of the embodiments, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the present disclosure. However, it would be apparent to those skilled in the art that the embodiments, or one or more embodiments, can be practiced without these specific details. In other instances, well-known structures and
[0053] The terms used herein are merely used to describe specific embodiments and are not intended to limit the present disclosure. The terms "include", "comprise" and the like used herein indicate the presence of the described features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0054] All terms used herein, including technical and scientific terms, have the same meanings as those generally understood by a person skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having meanings consistent with the context of the specification, and should not be interpreted in an idealized or overly formal manner.
[0055] In the case of using expressions similar to "at least one of A, B, and C, etc.", it should be generally interpreted as having the meaning of including at least one of the items listed, but not limited to the items listed (e.g., "a system having at least one of A, B, and C" should include, but not be limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B together, a system having A and C together, a system having B and C together, and / or a system having A, B, and C together, etc.).
[0056] In the technical solutions of the present disclosure, the collection, storage, use, processing, transmission, provision, disclosure, and application of user personal information comply with relevant laws and regulations, necessary security measures are taken, and do not violate public order and good customs.
[0057] In the technical solutions of the present disclosure, the authorization or consent of the user is obtained before the user's personal information is acquired or collected.
[0058] In the related art, in the case of merging and analyzing data related to a business, the data is updated based on a timing transmission task, or the updated business data is merged based on ETL (Extract-Transform-Load, data warehouse technology), and then new data generated by the merging is used for data analysis. The timeliness of data merging in the related art is poor, and it is difficult to meet the timeliness requirements of actual cross-business field data merging. The maintenance cost of the related method such as the timing task or the ETL method is high, and with the increase of the data merging task, there is a risk of too high server load affecting other businesses.
[0059] Embodiments of this disclosure provide a data processing method based on domain-driven design, comprising: in response to detecting an update operation on target data, constructing a data change event based on the target data; performing domain boundary analysis on the data change event to determine N domain identifiers of the target data, where N is a positive integer greater than 1; constructing a domain data update task corresponding to each domain identifier based on the data change event and the N domain identifiers, thereby obtaining N domain data update tasks; updating the first domain data corresponding to each of the N domain identifiers in a first database according to the N domain data update tasks, thereby obtaining the updated first target domain data for each of the N domain identifiers, wherein the domain boundary corresponding to the domain identifier is determined by the domain-driven design method; and generating a target domain report corresponding to each of the N domain identifiers based on the first target domain data.
[0060] According to embodiments of this disclosure, after detecting an update operation on target data, by constructing a data change event and performing domain boundary analysis on the data change event, the N target domains that the updated target data can affect can be clearly and accurately determined. Domain data update tasks are then constructed for the domain identifiers corresponding to each of the N target domains. Based on these N domain data update tasks, the first domain data in the target domain represented by each of the N domain identifiers is updated respectively. This synchronizes the obtained first target domain data for each of the N domain identifiers with the update operation on the target data. Simultaneously, based on the domain boundaries of each of the N domain identifiers, the update operation on the target data is synchronized to different target domains. This reduces the technical problem of low data update accuracy and poor update timeliness caused by manually updating the data in each domain after the target data update operation, thus improving the timeliness of data updates. Furthermore, based on the updated first target domain data, target domain reports corresponding to each of the N domain identifiers are generated. This enables the automated generation of data analysis results for the update operation on the target data, thereby improving the automation level of data processing and providing timely assurance for relevant users to query the data analysis results corresponding to each domain identifier.
[0061] Figure 1 The illustration shows an application scenario of a data processing method and apparatus based on domain-driven design according to an embodiment of the present disclosure.
[0062] like Figure 1As shown, the application scenario 100 according to this embodiment can include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is a medium for providing a communication link between the terminal devices 101, 102, 103 and the server 105. The network 104 can include various connection types, such as wired, wireless communication links, or fiber optic cables, and the like.
[0063] A user can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send messages, and the like. Various communication client applications can be installed on the terminal devices 101, 102, 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, and the like (only as examples).
[0064] The terminal devices 101, 102, 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0065] The server 105 can be a server providing various services, such as a background management server providing support for websites browsed by users using the terminal devices 101, 102, 103 (only as an example). The background management server can analyze and process received user requests and the like, and feed back the processing results (such as web pages, information, or data, and the like obtained or generated according to user requests) to the terminal devices.
[0066] It should be noted that the data processing method based on domain-driven design provided by the embodiments of the present disclosure can generally be executed by the server 105. Accordingly, the data processing apparatus based on domain-driven design provided by the embodiments of the present disclosure can generally be arranged in the server 105. The data processing method based on domain-driven design provided by the embodiments of the present disclosure can also be executed by a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and / or the server 105. Accordingly, the data processing apparatus based on domain-driven design provided by the embodiments of the present disclosure can also be arranged in a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and / or the server 105.
[0067] It should be understood that Figure 1 The number of terminal devices, networks, and servers in the application scenario 100 is only illustrative. According to the needs of implementation, there can be any number of terminal devices, networks, and servers.
[0068] The following will be described based on Figure 1 the scenario described above, by Figures 2-8The data processing method based on the domain-driven design according to the embodiments of the present disclosure is described in detail.
[0069] Figure 2 A flowchart of the data processing method based on the domain-driven design according to the embodiments of the present disclosure is schematically shown.
[0070] As shown in Figure 2 The data processing method based on the domain-driven design of the embodiments includes operations S210-S250.
[0071] In operation S210, in response to detecting an update operation on target data, a data change event is constructed according to the target data.
[0072] In operation S220, the data change event is subjected to domain boundary analysis, and it is determined that the target data has N domain identifiers, N being a positive integer greater than 1.
[0073] In operation S230, based on the data change event and the N domain identifiers, a domain data update task corresponding to each domain identifier is constructed, and N domain data update tasks are obtained.
[0074] In operation S240, according to the N domain data update tasks, the first domain data corresponding to the N domain identifiers in the first database is updated respectively, and N updated first target domain data corresponding to the N domain identifiers are obtained, wherein the domain boundary corresponding to the domain identifier is determined by the domain-driven design method.
[0075] In operation S250, according to the first target domain data, N target domain reports corresponding to the N domain identifiers are generated.
[0076] According to the embodiments of the present disclosure, the update operation of the target data can include the change input of a specific business matter by a related user, the target data can usually be contained in multiple domains, and by analyzing the attribute information and other effective information of the target data, N domain identifiers can represent N domains to which the target data belongs.
[0077] According to an embodiment of the present disclosure, the domain-driven design method can include a domain-driven design (DDD) method in the related art. After the design principles of domain experts are used to design the corresponding domain objects (i.e., first domain data) of each domain, the domain identification corresponding to each first domain data can be obtained. For example, a data analysis model can be constructed based on the domain-driven design method, so as to determine the domain boundary corresponding to the domain identification, and determine the domain identification corresponding to each of the first domain data and / or the target data according to the domain boundary. Determining the domain boundary corresponding to the domain identification based on the domain-driven design method can make the first domain data within the domain boundary highly thematic and highly aggregated, and reduce the complexity of subsequent domain division for the target data.
[0078] According to an embodiment of the present disclosure, the data change event can be an event message containing the target data and the domain identification corresponding to the target data. By listening to the data change event, subsequent processing operations can be performed in a timely manner for the update operation of the target data, so that the domain data update task corresponding to each domain identification is constructed according to the data change event and the N domain identifications. The target data corresponding to the update operation can be quickly divided according to the domain boundary, and the N domain data update tasks are used to update the first domain data corresponding to the N domain identifications respectively, so that the first target domain data corresponding to each domain identification can be updated synchronously with the update operation.
[0079] According to an embodiment of the present disclosure, after detecting the update operation on the target data, by constructing the data change event and performing domain boundary analysis on the data change event, the N target domains that can be affected by the target data after the update operation can be clearly and accurately determined. Then, the domain data update task corresponding to each domain identification of the N target domains is constructed, and the first domain data in the target domain represented by each of the N domain identifications is updated according to the N domain data update tasks. The first target domain data of each of the N domain identifications can be synchronized with the update operation on the target data, and the update operation of the target data can be synchronized to different target domains based on the domain boundary of each of the N domain identifications. Thus, the technical problems of low data update accuracy and poor update effectiveness caused by manual update of data in each domain after the update operation of the target data are reduced, and the update effectiveness of data update is improved. According to the first target domain data after the update, the target domain report corresponding to each of the N domain identifications can be generated, so that the data analysis result of the update operation on the target data can be automatically generated, thereby improving the automation level of data processing and providing effectiveness guarantee for the related user to query the data analysis result corresponding to each domain identification in time.
[0080] According to an embodiment of the present disclosure, the data change events include M, M is a positive integer greater than 1.
[0081] Figure 3 A flowchart for constructing N field data update tasks corresponding to each field identification based on the data change events and the N field identifications is schematically shown according to an embodiment of the present disclosure.
[0082] As shown in operation S230, constructing N field data update tasks corresponding to each field identification based on the data change events and the N field identifications includes operations S310-S320. Figure 3
[0083] In operation S310, based on the asynchronous message queue, the M data change events are asynchronously sent to the change event registry.
[0084] In operation S320, in a case where a target data change event in the M data change events in the change event registry is listened to, based on the listened target data change event and a target field identification corresponding to the target data change event, a data update task corresponding to the target field identification is generated, until other N-1 field data update tasks corresponding to other N-1 field identifications are generated.
[0085] According to an embodiment of the present disclosure, the target data change event can be an event message listened to from the M data change events, the M data change events are stored based on the change event registry, the event registry can also be listened to based on an event listener in the related art, the target data change event corresponding to the update operation can be responded in time after the related user performs the update operation on the target data by listening to the event registry, and the target field identification and the target data change event are processed based on the related program to quickly generate the field data update tasks corresponding to the N field identifications respectively.
[0086] According to an embodiment of the present disclosure, in a case where the data change events include M, the M data change events are sent through the asynchronous message queue, a plurality of target data change events in the M data change events can be processed in parallel, thereby improving the processing efficiency of the data change events, and further improving the generation efficiency of the field data update tasks.
[0087] According to an embodiment of the present disclosure, by sending the corresponding field data update tasks into the field boundary corresponding to each field identification, at least part of the related art can be avoided by periodically acquiring update data to complete data synchronization, the data merging demand across fields is reduced, the computing resource consumption is reduced, and at the same time the update operation on the target data is realized, the data synchronization update across fields is completed in time, and the timeliness of the cross-field data synchronization is improved.
[0088] Figure 4 A flowchart is shown for updating the first target domain data of the N domain identifications respectively according to the N domain data update tasks according to an embodiment of the present disclosure.
[0089] As shown in Figure 4 Operation S240 can include operations S410-S430.
[0090] In operation S410, the target data corresponding to each domain identification and the data update operation are determined according to the N domain data update tasks.
[0091] In operation S420, the data update statements corresponding to the N domain identifications are generated based on the target data and the data update operation corresponding to each domain identification.
[0092] In operation S430, the data update statements corresponding to the domain identifications are executed in the target domain corresponding to each domain identification in the first database to generate the updated first target domain data of the N domain identifications.
[0093] According to an embodiment of the present disclosure, the data update operation can include operation types such as addition, deletion, and replacement in related technologies, and the domain identification of the target data can determine the operation type of the data within the domain boundary corresponding to the domain identification. The corresponding data update statement can be generated according to the data update operation and the target data with the corresponding operation type, so that the first domain data within the domain boundary of the domain identification corresponding to the data update statement can be updated in the first database by executing the data update statement to obtain the updated first target domain data, thereby realizing the synchronous update of the first domain data across the domain boundary, reducing the number of manual operations for data merging across the domain, and improving the data update efficiency across the domain boundary.
[0094] It should be noted that the data update statement can include a query statement (i.e., a SQL statement) in related technologies, but is not limited thereto, and can also include a statement constructed based on other programming languages, for example, a data update statement can be constructed based on a C language or other programming languages. Embodiments of the present disclosure do not limit the specific type of the data update statement, as long as the first domain data can be updated to the first target domain data, and a person skilled in the art can design according to actual needs.
[0095] Figure 5Fig. 6 shows a flowchart of updating the first target domain data of the first database according to the N domain data update tasks according to another embodiment of the present disclosure.
[0096] As shown in Fig. 6, operation S240 of updating the first target domain data of the first database according to the N domain data update tasks can include operations S510-S520. Figure 5
[0097] In operation S510, the second target domain data of the second database is updated according to the N domain data update tasks.
[0098] In operation S520, the first target domain data of the first database is updated according to the N second target domain data of the second database.
[0099] According to an embodiment of the present disclosure, the second database can be divided into the corresponding domain boundaries based on the same or similar method as the above-mentioned embodiments, and the domain boundaries in the second database can be the same as the domain boundaries in the first database, and the data storage formats of the first database and the second database can be the same, so that when the second target domain data of the second database is obtained, the updated second target domain data can be obtained from the domain boundaries of the second database through the related data synchronization technology, and the first target domain data can be obtained by updating the first domain data in the corresponding domain boundaries of the corresponding domain identifier using the second target domain data, which can realize the cross-domain boundary data update synchronization operation in the first database.
[0100] Further, the second target domain data stored in the second database can realize the writing operation from the updating operation of the target data to the second target domain data, and the first database can also generate the corresponding target domain report according to the first target domain data of each domain identifier, that is, the reading operation of the updated target data can be realized by using the first target domain data of each domain identifier of the first database, and the reading and writing operations of the database can be fully decoupled, so as to improve the overall execution efficiency of the database.
[0101] According to an embodiment of this disclosure, operation S520, which uses N second target domain data from the second database to update the first domain data of each of the N domain identifiers in the first database, to obtain the updated first target domain data of each of the N domain identifiers, may include the following operations:
[0102] Based on N second target domain data in the second database, generate N second change query statements for each of the second target domain data; write the N second change query statements to the second change log to obtain the target second change log; upon detecting the generation of the target second change log, synchronize the N second change query statements to the first database to obtain N first change query statements; and execute the N first change query statements in the first database to obtain the updated first target domain data for each of the N domain identifiers.
[0103] According to embodiments of this disclosure, the first change query statement and the second change query statement may include SQL statements in related technologies. The second change query statement can be written into a Binlog file in related technologies to form a Binlog log file. This allows the second change query statement to be synchronized to the first database in a timely and accurate manner when the generation of the second change log is detected, thereby obtaining the corresponding first change query statement. The first change query statement is then used to achieve the synchronous update of the second target domain data and the first target domain data, avoiding technical problems such as synchronization failure caused by abnormal situations such as database failure.
[0104] Figure 6 The diagram illustrates an application scenario of a domain-driven design-based data processing method according to an embodiment of the present disclosure.
[0105] like Figure 6 As shown, this application scenario may include clients 601 and 602. Users can perform update operations on target data by operating client 601. After detecting an update operation, the domain aggregation service layer 610 can construct a data change event based on the target data and determine the N domain identifiers of the target data accordingly. Given domain identifiers "Domain A" and "Domain B", it can generate a domain data update task for each domain identifier based on these domain identifiers and the target data, and send the Domain A data update task to the Domain A boundary storage area 631 in the second database 630, so that the Domain A data update task can be executed at the domain boundary to obtain the second target domain data corresponding to Domain A. Similarly, using the same or similar method, a Domain B data update task can be sent to the Domain B boundary storage area 632 in the second database 630 to obtain the updated second target domain data corresponding to Domain B.
[0106] Further, since the first database 640 and the second database 630 have the same domain boundary division, based on the method provided in the above embodiment, or based on a data synchronization method in the related art, such as a change data capture method, the respective second target domain data in the A domain boundary storage area 631 and the B domain boundary storage area 632 in the second database 630 are respectively synchronized to the A domain boundary storage area 641 and the B domain boundary storage area 642 in the first database 640, thereby realizing cross-domain synchronization of the target data.
[0107] Meanwhile, the report generation service layer can also extract the first target domain data in the respective domain boundary from the A domain boundary storage area 641 and the B domain boundary storage area 642 in the first database 640, and generate a target domain report for the A domain and / or the B domain. Then, based on an automated rule or a query request of the corresponding client 602, the corresponding target domain report can be sent to the client 602.
[0108] Figure 7 An illustrative flowchart of a data processing method based on a domain-driven design according to another embodiment of the present disclosure is shown.
[0109] As Figure 7 shown, the data processing method based on the domain-driven design further includes operations S710-S740.
[0110] In operation S710, in response to a query request for a target query item, L target query domain identifiers corresponding to the target query item in the query request are determined according to the query request.
[0111] In operation S720, L target query instructions corresponding to the L target query domain identifiers are generated according to the target query item.
[0112] In operation S730, L target query domain reports associated with the target query item are respectively retrieved from the respective storage areas of the L target query domain identifiers in the first database according to the L target query instructions, to obtain the L target query domain reports.
[0113] In operation S740, the L target query domain reports are generated in an interactive page.
[0114] According to an embodiment of the present disclosure, the target query item can include a table item for data with a domain identifier. Based on the service layer driven by the domain, the domain boundary analysis can be performed according to the target query item, and then the L target query domain identifiers corresponding to the target query item are determined.
[0115] According to an embodiment of the present disclosure, the first database can have N field identifications each corresponding to a storage area, and L target query field identifications can be contained in the N field identifications. According to the target query field identification of each target query instruction, the target query instruction corresponding to the target query field identification can be sent to the first database, the target field report already generated in the field storage area corresponding to the target query field identification is called by using the target query instruction, that is, the first target field data in the target query field space corresponding to the target query field identification is called, and the target query field report corresponding to each target query field identification is generated according to the first target field data, so that the target query field report can be quickly called according to the query request of the user while synchronizing the data across the field boundary in time, and at least part of the technical problems of the related art, such as the waste of computing resources and the long report calling time caused by processing the data that needs to be synchronized according to the query request of the user, are avoided. At the same time, at least part of the technical problems of low query efficiency caused by the inter-table query from different reports of the database are also avoided.
[0116] It should be noted that the data processing method based on the field-driven design provided by the embodiments of the present disclosure can also combine the L target query field reports into one report to facilitate the user to view.
[0117] It should be understood that the L target query field reports can be combined to delete the repeated data correspondingly, and the data amount of the combined report is saved.
[0118] Figure 8 An application scenario diagram of the data processing method based on the field-driven design according to another embodiment of the present disclosure is schematically shown.
[0119] As Figure 8As shown, the application scenario can include a data processing apparatus 800 constructed based on a domain-driven design. The data processing apparatus can include a statistical table service request operation layer 810 and a domain distribution layer 820. The statistical table service request operation layer 810 can determine, according to a query request for a target query item generated by a user through a client operation, that the target query item corresponds to target query domain identifiers “A domain” and “B domain”. Then, according to the target query domain identifiers and the target query item, a target query instruction corresponding to each target query domain identifier is constructed. The domain distribution layer 820 can send the target query instruction to a first database 830, so as to retrieve corresponding target query domain reports from the storage space of the corresponding target query domain identifier by using the target query instruction. For example, the A target query domain report can be retrieved from the A domain identifier storage area 831 of the first database 830 by using the A domain target query instruction, and the B target query domain report can be retrieved from the B domain identifier storage area 832 correspondingly. Further, the A target query domain report and the B target query domain report retrieved can be displayed in an interactive page, and the query result of the query request can be returned in time.
[0120] Based on the above-mentioned data processing method based on the domain-driven design, the present disclosure further provides a data processing apparatus based on the domain-driven design. The following will be described in detail in combination with Figure 9 the apparatus.
[0121] Figure 9 The structure block diagram of the data processing apparatus based on the domain-driven design according to the embodiment of the present disclosure is schematically shown.
[0122] As Figure 9 shown, the data processing apparatus based on the domain-driven design 900 of the embodiment includes a first construction module 910, a first determination module 920, a second construction module 930, a first update module 940, and a target domain report generation module 950.
[0123] The first construction module 910 is configured to construct a data change event according to target data in response to detecting an update operation for the target data.
[0124] The first determination module 920 is configured to perform domain boundary analysis on the data change event, and determine N domain identifiers possessed by the target data, N being a positive integer greater than 1.
[0125] The second construction module 930 is configured to construct a domain data update task corresponding to each domain identifier based on the data change event and the N domain identifiers, to obtain N domain data update tasks.
[0126] The first updating module 940 is configured to update the first domain data corresponding to each of the N domain identifiers respectively according to the N domain data updating tasks, to obtain updated first target domain data of the N domain identifiers respectively.
[0127] The target domain report generation module 950 is configured to generate a target domain report corresponding to each of the N domain identifiers according to the first target domain data.
[0128] According to an embodiment of the present disclosure, the data change events include M, M is a positive integer greater than 1.
[0129] The second construction module includes a first sending unit and a first task generation unit.
[0130] The first sending unit is configured to send the M data change events to the change event registry asynchronously based on an asynchronous message queue.
[0131] The first task generation unit is configured to, in a case where a target data change event in the M data change events in the change event registry is listened to, generate a data updating task corresponding to a target domain identifier based on the listened target data change event and the target domain identifier corresponding to the target data change event, until other N-1 domain data updating tasks corresponding to other N-1 domain identifiers are generated.
[0132] According to an embodiment of the present disclosure, the first updating module includes a first determination unit, a data updating statement generation unit and a first updating unit.
[0133] The first determination unit is configured to determine target data and a data updating operation corresponding to each of the N domain identifiers according to the N domain data updating tasks.
[0134] The data updating statement generation unit is configured to generate a data updating statement corresponding to each of the N domain identifiers based on the target data and the data updating operation corresponding to each of the N domain identifiers.
[0135] The first updating unit is configured to execute the data updating statement corresponding to each of the N domain identifiers in a target domain corresponding to each of the N domain identifiers in the first database respectively, to generate updated first target domain data of the N domain identifiers respectively.
[0136] According to an embodiment of the present disclosure, the first updating module includes a second updating unit and a third updating unit.
[0137] The second updating unit is configured to update the N pieces of second domain data corresponding to the N pieces of domain identification in the second database respectively according to the N pieces of domain data update tasks, to obtain updated second target domain data corresponding to the N pieces of domain identification in the second database.
[0138] The third updating unit is configured to update the N pieces of first domain data corresponding to the N pieces of domain identification in the first database respectively by using the N pieces of second target domain data in the second database, to obtain updated first target domain data corresponding to the N pieces of domain identification.
[0139] According to an embodiment of the present disclosure, the third updating unit comprises a change query statement generation subunit, a writing subunit, a synchronization subunit and a change query statement execution subunit.
[0140] The change query statement generation subunit is configured to generate a second change query statement corresponding to each of the N pieces of second target domain data according to the N pieces of second target domain data in the second database.
[0141] The writing subunit is configured to write the N pieces of second change query statements into a target second change log to obtain a second change log.
[0142] The synchronization subunit is configured to synchronize the N pieces of second change query statements to the first database to obtain N pieces of first change query statements when it is detected that the target second change log is generated.
[0143] The change query statement execution subunit is configured to execute the N pieces of first change query statements in the first database to obtain updated first target domain data corresponding to the N pieces of domain identification.
[0144] According to an embodiment of the present disclosure, the data processing apparatus based on domain-driven design further comprises a second determination module, a target query instruction generation module, a calling module and a report generation module.
[0145] The second determination module is configured to determine L pieces of target query domain identification corresponding to a target query item in a query request according to the query request in response to the query request for the target query item.
[0146] The target query instruction generation module is configured to generate a target query instruction corresponding to each of the L pieces of target query domain identification according to the target query item.
[0147] The calling module is configured to call a target query domain report associated with the target query item from a storage area corresponding to each of the L pieces of target query domain identification in the first database according to the L pieces of target query instruction to obtain L pieces of target query domain report.
[0148] The report generation module is configured to generate the L pieces of target query domain report in an interactive page.
[0149] According to an embodiment of the present disclosure, any of the first constructing module 910, the first determining module 920, the second constructing module 930, the first updating module 940 and the target domain report generating module 950 can be combined in one module, or any of them can be split into multiple modules. Alternatively, at least part of the function of one or more of these modules can be combined with at least part of the function of other modules, and implemented in one module. According to an embodiment of the present disclosure, at least one of the first constructing module 910, the first determining module 920, the second constructing module 930, the first updating module 940 and the target domain report generating module 950 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on chip, a system on board, a system on package, an application specific integrated circuit (ASIC), or any other reasonable way of hardware or firmware that can be integrated or packaged with a circuit, or implemented in any one of software, hardware and firmware or in a proper combination of any of them. Alternatively, at least one of the first constructing module 910, the first determining module 920, the second constructing module 930, the first updating module 940 and the target domain report generating module 950 can be at least partially implemented as a computer program module that can perform corresponding functions when it is run.
[0150] Figure 10 A block diagram of an electronic device suitable for implementing the data processing method based on the domain driven design according to an embodiment of the present disclosure is schematically shown.
[0151] As shown in Figure 10 The electronic device 1000 according to an embodiment of the present disclosure includes a processor 1001 that can perform various appropriate actions and processes according to programs stored in a read only memory (ROM) 1002 or loaded from a storage portion 1008 into a random access memory (RAM) 1003. The processor 1001 can include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a special purpose microprocessor (e.g., an application specific integrated circuit (ASIC)), and the like. The processor 1001 can also include an on-board memory for cache use. The processor 1001 can include a single processing unit or multiple processing units for performing different actions of the method processes according to embodiments of the present disclosure.
[0152] In the RAM 1003, various programs and data required for the operation of the electronic device 1000 are stored. The processor 1001, the ROM 1002, and the RAM 1003 are connected to each other via the bus 1004. The processor 1001 performs various operations of the method flow according to the embodiments of the present disclosure by executing the programs in the ROM 1002 and / or the RAM 1003. It should be noted that the programs can also be stored in one or more memories other than the ROM 1002 and the RAM 1003. The processor 1001 can also perform various operations of the method flow according to the embodiments of the present disclosure by executing the programs stored in the one or more memories.
[0153] According to an embodiment of the present disclosure, the electronic device 1000 can further include an input / output (I / O) interface 1005, which is also connected to the bus 1004. The electronic device 1000 can further include one or more of the following components connected to the I / O interface 1005: an input part 1006 including a keyboard, a mouse, etc.; an output part 1007 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage part 1008 including a hard disk, etc.; and a communication part 1009 including a network interface card such as a LAN card, a modem, etc. The communication part 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the I / O interface 1005 as necessary. A removable medium 1011 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is mounted on the drive 1010 as necessary, so that a computer program read out therefrom is installed in the storage part 1008 as necessary.
[0154] The present disclosure also provides a computer readable storage medium, which can be included in the device / apparatus / system described in the above embodiments; or can exist separately without being assembled into the device / apparatus / system. The above computer readable storage medium carries one or more programs, when the one or more programs are executed, the method according to the embodiments of the present disclosure is implemented.
[0155] According to an embodiment of the present disclosure, the computer readable storage medium can be a nonvolatile computer readable storage medium, for example, can include, but is not limited to, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any appropriate combination thereof. In the present disclosure, the computer readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device. For example, according to an embodiment of the present disclosure, the computer readable storage medium can include one or more memories such as the ROM 1002 and / or the RAM 1003 described above and / or one or more memory chips other than the ROM 1002 and the RAM 1003.
[0156] Embodiments of the present disclosure also include a computer program product that includes a computer program containing program codes for executing the methods shown in the flowcharts. When the computer program product is run in a computer system, the program codes are used to cause the computer system to implement the methods provided by the embodiments of the present disclosure.
[0157] The above-described functions defined in the system / apparatus / module / unit of the embodiments of the present disclosure are performed when the computer program is executed by the processor 1001. According to an embodiment of the present disclosure, the above-described system, apparatus, module, unit, etc. can be implemented by the computer program modules.
[0158] In one embodiment, the computer program can rely on a tangible storage medium such as an optical storage device, a magnetic storage device, etc. In another embodiment, the computer program can also be transmitted, distributed, and / or downloaded in the form of a signal over a network medium and installed and / or installed from the removable medium 1011 through the communication part 1009. The program codes contained in the computer program can be transmitted using any appropriate network medium, including but not limited to wireless, wired, etc., or any appropriate combination thereof.
[0159] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1009 and / or installed from the removable medium 1011. When the computer program is executed by the processor 1001, the above-described functions defined in the system of the embodiments of the present disclosure are performed. According to an embodiment of the present disclosure, the above-described system, apparatus, device, module, unit, etc. can be implemented by computer program modules.
[0160] According to embodiments of this disclosure, program code for executing the computer programs provided in embodiments of this disclosure can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, languages such as Java, C++, Python, "C", or similar programming languages. The program code can execute entirely on a user's computing device, partially on a user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0161] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0162] Those skilled in the art will understand that the features described in the various embodiments and / or claims of this disclosure can be combined or combined in various ways, even if such combinations or combinations are not explicitly described in this disclosure. In particular, the features described in the various embodiments and / or claims of this disclosure can be combined or combined in various ways without departing from the spirit and teachings of this disclosure. All such combinations and / or combinations fall within the scope of this disclosure.
[0163] The above describes embodiments of the present disclosure. However, these embodiments are merely for illustrative purposes, and are not intended to limit the scope of the present disclosure. Although each embodiment is described above separately, this does not mean that the measures in each embodiment cannot be used advantageously in combination. The scope of the present disclosure is defined by the appended claims and their equivalents. Those skilled in the art can make various substitutions and modifications without departing from the scope of the present disclosure, and these substitutions and modifications should all fall within the scope of the present disclosure.
Claims
1. A data processing method based on domain-driven design, comprising: In response to detecting an update operation for target data, a data change event is constructed based on the target data; Perform domain boundary analysis on the data change event to determine N domain identifiers of the target data, where N is a positive integer greater than 1; Based on the data change event and N domain identifiers, a domain data update task corresponding to each domain identifier is constructed, resulting in N domain data update tasks; Based on N domain data update tasks, the first domain data corresponding to each of the N domain identifiers in the first database is updated respectively, resulting in the updated first target domain data for each of the N domain identifiers. The domain boundary corresponding to each domain identifier is determined by a domain-driven design method. Based on the first target domain data, generate N target domain reports corresponding to each of the domain identifiers. Specifically, based on the N domain data update tasks, the first domain data of each of the N domain identifiers in the first database is updated respectively, resulting in the updated first target domain data for each of the N domain identifiers, including: The N domain data update tasks are respectively sent to the domain boundary storage areas corresponding to the N domain identifiers in the second database to update the second domain data corresponding to the N domain identifiers, thereby obtaining the updated second target domain data for each of the N domain identifiers in the second database; and The second target domain data in the domain boundary storage area of the second database are synchronized to the corresponding domain boundary storage area in the first database, so as to use the N second target domain data in the second database to update the first domain data of the N domain identifiers in the first database, thereby obtaining the updated first target domain data of the N domain identifiers.
2. The data processing method according to claim 1, wherein, The data change events include M events, where M is a positive integer greater than 1; Based on the data change event and N domain identifiers, constructing a domain data update task corresponding to each domain identifier includes: Based on the asynchronous message queue, M data change events are asynchronously sent to the change event registry; as well as If a target data change event is detected among M data change events in the change event registry, a data update task corresponding to the target domain identifier is generated based on the detected target data change event and the target domain identifier corresponding to the target data change event, until N-1 other domain data update tasks corresponding to each of the other domain identifiers are generated.
3. The data processing method according to claim 1, wherein, Using N second target domain data from the second database, the first domain data of each of the N domain identifiers in the first database are updated respectively, resulting in the updated first target domain data for each of the N domain identifiers, including: Based on N second target domain data in the second database, generate a second change query statement for each of the N second target domain data. Write N second change query statements into the second change log to obtain the target second change log; Upon detecting the generation of the target's second change log, N second change query statements are synchronized to the first database, resulting in N first change query statements; and Execute N first change query statements in the first database to obtain the updated first target domain data for each of the N domain identifiers.
4. The data processing method according to claim 1 further includes: In response to a query request for a target query item, L target query domain identifiers corresponding to the target query item in the query request are determined based on the query request. Based on the target query item, generate L target query instructions corresponding to each of the target query domain identifiers; Based on the L target query instructions, the target query domain reports associated with the target query items are retrieved from the storage areas of the L target query domain identifiers in the first database, thereby obtaining the L target query domain reports. as well as L reports on the target query domain are generated on the interactive page.
5. A data processing device based on domain-driven design, comprising: The first construction module is configured to construct a data change event based on the target data in response to the detection of an update operation on the target data; The first determining module is used to perform domain boundary analysis on the data change event and determine N domain identifiers of the target data, where N is a positive integer greater than 1; The second construction module is used to construct a domain data update task corresponding to each of the domain identifiers based on the data change event and N domain identifiers, thereby obtaining N domain data update tasks. The first update module is configured to update the first domain data corresponding to each of the N domain identifiers in the first database according to the N domain data update tasks, thereby obtaining the updated first target domain data for each of the N domain identifiers, wherein the domain boundary corresponding to the domain identifier is determined by a domain-driven design method; and The target domain report generation module is used to generate N target domain reports corresponding to each of the domain identifiers based on the first target domain data. Specifically, based on the N domain data update tasks, the first domain data of each of the N domain identifiers in the first database is updated respectively, resulting in the updated first target domain data for each of the N domain identifiers, including: The N domain data update tasks are respectively sent to the domain boundary storage areas corresponding to the N domain identifiers in the second database to update the second domain data corresponding to the N domain identifiers, thereby obtaining the updated second target domain data for each of the N domain identifiers in the second database; and The second target domain data in the domain boundary storage area of the second database are synchronized to the corresponding domain boundary storage area in the first database, so as to use the N second target domain data in the second database to update the first domain data of the N domain identifiers in the first database, thereby obtaining the updated first target domain data of the N domain identifiers.
6. An electronic device, comprising: One or more processors; Storage device for storing one or more programs. Wherein, when the one or more programs are executed by the one or more processors, the one or more processors perform the method according to any one of claims 1 to 4.
7. A computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, cause the processor to perform the method according to any one of claims 1 to 4.
8. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Data processing method, device, equipment and medium
CN111708804A