Data modification method based on lock control mechanism
By introducing a lock control mechanism in the production management system of the nuclear power plant, using editing locks, pre-occupying locks, occupancy locks and dynamic lock management process data, the editing conflicts and business risks during the data modification process are solved, and data modification and archiving are improved Service efficiency.
Patent Information
- Application Number
- CN202310562037.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-18
- Publication Date
- 2024-11-22
Smart Images

Figure CN119003536A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data maintenance, and in particular to a data modification method based on a lock control mechanism. Background Art
[0002] The nuclear power plant production management system is mainly used for the application, approval and data maintenance of various production business processes of nuclear power plants. The data stored in the nuclear power plant production management system are mainly divided into two categories: one is basic data, which is effective data and is widely used in various production business processes; the other is process data, which is data that is being modified and not effective, and is created by copying basic data; process data is not controlled during the preparation, editing, approval and archiving process, resulting in editing conflicts and business risks. Summary of the invention
[0003] The purpose of the present invention is to provide a data modification method based on a lock control mechanism, which handles editing conflicts in the data modification process and manages business risks in the data modification process.
[0004] In order to achieve the above object, the present invention provides the following technical solutions:
[0005] A data modification method based on a lock control mechanism comprises the following steps:
[0006] S101, prepare process data;
[0007] S102, editing process data;
[0008] S103, approval process data;
[0009] S104, archiving process data;
[0010] Process data is data that is being modified and waiting to take effect. It is based on business data and adds key attribute fields to save four types of lock key information: edit lock, pre-occupied lock, occupied lock, and dynamic lock. Process data is created by copying basic data. Basic data is data that has taken effect.
[0011] The lock control mechanism includes five types of locks: pre-occupied lock, edit lock, occupied lock, static lock and dynamic lock. Among them, edit lock, pre-occupied lock, occupied lock and dynamic lock all provide locking method, unlocking method and self-lock query method. All types of locks provide lock query method. Static lock and dynamic lock both provide lock configuration rules.
[0012] The pre-occupied lock is used in the process of process data preparation and has a timeout logic to ensure the modification priority of basic data; the edit lock is used in the process of process data editing and has a timeout logic to ensure content consistency when multiple people are editing; the occupied lock is used in the process of process data approval to ensure the modification and occupation rights of basic data; static lock and dynamic lock types are used for business risk control to ensure the priority of business activities.
[0013] Further, a static lock configuration page is set for setting static lock configuration rules, and a dynamic lock configuration page is set for setting dynamic lock configuration rules; both the static lock configuration rules and the dynamic lock configuration rules are stored in the first database table;
[0014] The configuration rules of static lock and dynamic lock include the following field information: configuration identifier, configuration code, data specification, lock type, lock strategy, responsible person, interface parameters, lock party code, lock party name, lock object field set and configuration description;
[0015] The four types of lock information, namely, pre-occupied lock, edit lock, occupied lock and dynamic lock, are all stored in the second database table. The four types of lock information, namely, pre-occupied lock, edit lock, occupied lock and dynamic lock, include the following field information: lock identification, lock code, lock type, lock status, key, data code, data version, locking party identification, locking time, unlocking party identification and unlocking time.
[0016] Furthermore, static locks are used in scenarios where there are fixed business relationships and the relationship data is stable. The external business module provides a query interface, and the interface is called multiple times during the data modification process to query related information, thereby preventing business risks according to the configured rules. Dynamic locks are mainly used in scenarios where business relationships are unstable and the frequency is not high. The external business module calls the locking service based on its own business status, and retrieves the locking information from the second database table when the data is modified, thereby preventing business risks according to the configured rules.
[0017] Furthermore, the edit lock, pre-occupied lock, occupied lock and dynamic lock all provide a locking method, including the following steps:
[0018] The locking party passes in the locking parameters;
[0019] Generate key information;
[0020] Execute locking parameters and key information and write them into the second database table;
[0021] If the locking parameters and key information are written into the second database table and executed successfully, the key information is returned to the locking party and the locking is ended;
[0022] If the writing of the locking parameters and key information into the second database table fails, a lock failure is returned to the locking party, and the locking is terminated;
[0023] The locking parameters include the following field information: locking party identification, data encoding, data version and lock type.
[0024] Furthermore, the edit lock, pre-occupied lock, occupied lock and dynamic lock all provide unlocking methods, including the following steps:
[0025] The unlocking party passes in the unlocking parameters;
[0026] Searching the lock information corresponding to the unlocking parameter in the second database table;
[0027] If the lock information corresponding to the unlocking parameter is not found in the second database table, a message indicating that the unlocking has failed is returned to the unlocking party, and the unlocking is terminated;
[0028] If the lock information corresponding to the unlocking parameter is found in the second database table, the lock state of the lock information corresponding to the unlocking parameter is modified to the unlocked state in the second database table, and the historical lock information of the lock information corresponding to the unlocking parameter is deleted. The dynamic lock asynchronously triggers an archiving service, returns the unlocking success to the unlocking party, and ends the unlocking.
[0029] The unlocking parameters include the following field information: unlocking party identification, data encoding, data version, lock type and key.
[0030] Furthermore, the occupied lock provides a lock checking method, comprising the following steps:
[0031] The lock checking party passes in the lock checking parameters;
[0032] Search the lock information corresponding to the lock query parameter in the second database table;
[0033] If the lock information corresponding to the lock query parameter is found in the second database table, a lock is returned to the lock query party, and the lock query ends;
[0034] If the lock information corresponding to the lock query parameter is not found in the second database table, a signal indicating that there is no lock is returned to the lock query party, and the lock query is terminated.
[0035] Furthermore, both the edit lock and the pre-occupied lock provide a lock checking method, including the following steps:
[0036] The lock checking party passes in the lock checking parameters;
[0037] Search the lock information corresponding to the lock query parameter in the second database table;
[0038] If the lock information corresponding to the lock query parameter is found in the second database table, it is further determined whether the lock information corresponding to the lock query parameter has timed out;
[0039] If the lock information corresponding to the lock query parameter times out, the lock timeout is returned to the lock query party and the lock query ends;
[0040] If the lock information corresponding to the lock query parameter has not timed out, a return message indicating that the lock is available is sent to the lock query party, and the lock query ends;
[0041] If the lock information corresponding to the lock query parameter is not found in the second database table, a signal indicating that there is no lock is returned to the lock query party, and the lock query is terminated.
[0042] Furthermore, the dynamic lock provides a lock checking method, comprising the following steps:
[0043] The lock checking party passes in the lock checking parameters;
[0044] Search the lock configuration rules corresponding to the lock query parameters in the first database table;
[0045] If the lock configuration rule corresponding to the lock query parameter is found in the first database table, the lock information corresponding to the lock query parameter is further searched in the second database table;
[0046] If the lock information corresponding to the lock query parameter is found in the second database table, a lock is returned to the lock query party, and the lock query ends;
[0047] If the lock information corresponding to the lock query parameter is not found in the second database table, a return message "no lock" is sent to the lock query party, and the lock query is terminated;
[0048] If the lock configuration rule corresponding to the lock query parameter is not found in the first database table, a signal indicating that there is no lock is returned to the lock query party, and the lock query is terminated.
[0049] Furthermore, the static lock provides a lock checking method, including the following steps:
[0050] The lock checking party passes in the lock checking parameters;
[0051] Search the lock configuration rules corresponding to the lock query parameters in the first database table;
[0052] If the lock configuration rule corresponding to the lock query parameter is found in the first database table, the query interface provided by the external business module is called to query the lock query parameter association information;
[0053] If the lock query parameter association information is found, a lock is returned to the lock query party, and the lock query ends;
[0054] If no lock query parameter associated information is found, a signal indicating that the lock is unlocked is returned to the lock query party, and the lock query is terminated.
[0055] Furthermore, the lock query parameters include the following field information: lock type, data encoding and data version.
[0056] Furthermore, the self-lock checking method uses the self-lock checking parameters passed by the self-lock checking party to verify that the owner of the lock is the owner, including the following steps:
[0057] Check the self-lock method and pass in the self-lock parameters;
[0058] Search the second database table for lock information corresponding to the lock parameter itself;
[0059] If the lock information corresponding to the self-lock query parameter is found in the second database table, the self-lock query is returned to the self-lock query party, and the self-lock query is terminated;
[0060] If the lock information corresponding to the self-lock query parameter is not found in the second database table, a message indicating that the self-lock query is not a self-lock is returned to the self-lock query party, and the self-lock query is terminated;
[0061] The self-lock parameter query includes the following field information: key, lock type, data encoding and data version.
[0062] Further, S101, preparing process data, includes the following steps:
[0063] The preparer selects a basic data from the basic database; checks in sequence whether the basic data is associated with a static lock, an occupied lock, and a pre-occupied lock;
[0064] If there is no lock on this basic data or the lock has timed out, a lock is pre-occupied on this basic data;
[0065] After successfully pre-occupying the lock on this basic data, copy this basic data, create a process data, and modify the content as needed;
[0066] According to the primary key attribute field information defined in this process data, check the duplicate of this process data in the basic database;
[0067] After the duplicate check of this process data is passed, the lock is applied to this process data;
[0068] After the lock is successfully occupied on this process data, the pre-occupied lock of this basic data is released, the process data is saved, written into the process database, and the process data is set to the preparing state.
[0069] Further, S102, editing process data, includes the following steps:
[0070] Query the process data in the preparation state from the process database, select a piece of process data in the preparation state, and check whether the process data in the preparation state is associated with an edit lock;
[0071] If the process data in the preparation state is not locked or the lock has timed out, edit the process data in the preparation state;
[0072] After the editing lock is successfully applied to the process data in the preparation state, the process data in the preparation state can be modified as needed;
[0073] According to the primary key attribute field information defined in the process data in the preparation state of this article, check the duplication of the process data in the preparation state of this article in the basic database;
[0074] After the duplicate check of the process data in the preparation state of this article is passed, check the editing lock of the process data in the preparation state of this article;
[0075] When the key information of the process data in the preparation state is consistent with the key information in the second database table, the process data in the preparation state is updated and the editing lock of the process data in the preparation state is released.
[0076] Furthermore, S103, approving process data, includes the following steps:
[0077] Select the process data that needs to be approved from the process database and modify them in batches to the approval status;
[0078] Approve process data in the approval status according to the management process;
[0079] After the process data in the approval status is approved, it will be batch modified to the archiving status;
[0080] Add the process data in the archived state to the archive queue and asynchronously trigger an archive service.
[0081] Further, S104, archiving process data, includes the following steps:
[0082] Check the status of the archiving service. If the archiving service is not started, it will be set to the archiving status.
[0083] Traverse the process data in the archive queue and archive them one by one;
[0084] After the traversal archive is completed, the post-archive service is in the archive completion state;
[0085] Archiving a single process data in the archiving queue includes the following steps: determining whether the process data is associated with a static lock and a dynamic lock in turn; if the process data is not associated with a dynamic lock and a dynamic lock, checking for duplicates in the basic database; if the process data passes the duplicate check, updating the basic data corresponding to the process data, and modifying the process data to the archived state.
[0086] The present invention provides a computer device, comprising a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the data modification method based on the lock control mechanism when executing the computer-readable instructions.
[0087] The present invention provides a computer-readable storage medium, on which computer-readable instructions are stored. When the computer-readable instructions are executed, the steps of the data modification method based on the lock control mechanism are implemented.
[0088] Beneficial technical effects of the present invention:
[0089] The data modification method, computer device and storage medium based on the lock control mechanism of the present invention modify data based on the lock control mechanism. During the data modification process, the lock control mechanism intervention timing and response processing logic are clarified to manage business risks during the data modification process and handle editing conflicts during the data modification process. In the archiving service, asynchronous, exclusive and event-triggered methods are used to improve the archiving efficiency and reduce the computing load peak during the archiving period. BRIEF DESCRIPTION OF THE DRAWINGS
[0090] Figure 1 A schematic diagram of a data modification method based on a lock control mechanism according to an embodiment of the present invention;
[0091] Figure 2 The figure is a schematic diagram of the structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0092] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of this application; the terms used in the specification of the application are only for the purpose of describing specific embodiments and are not intended to limit this application; the term "including" and any variation thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of this application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0093] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0094] The technical solution of the present invention is clearly and completely described below in conjunction with the accompanying drawings and specific embodiments.
[0095] See also Figure 1 This embodiment provides a data modification method based on a lock control mechanism, comprising the following steps:
[0096] Step S101, preparing process data;
[0097] Step S102, editing process data;
[0098] Step S103, approval process data;
[0099] Step S104, archiving process data;
[0100] Process data refers to data that is being modified and waiting to take effect. For example, process data refers to data that is being modified and waiting to take effect in the production management system of a nuclear power plant. It is used to save the modified content or approval process and does not affect the production business process. Process data is created by copying basic data. Basic data refers to data that has taken effect. For example, basic data refers to the final effective data in the production management system of a nuclear power plant and is widely used in various production business processes. Process data adds key attribute fields to business data to save four types of lock key information: edit lock, pre-occupied lock, occupied lock and dynamic lock.
[0101] The lock control mechanism includes five types of locks: pre-occupied lock, edit lock, occupied lock, static lock and dynamic lock. Among them, edit lock, pre-occupied lock, occupied lock and dynamic lock all provide locking method, unlocking method and self-lock query method, and all types of locks provide lock query method; static lock and dynamic lock both provide lock configuration rules; pre-occupied lock is used in the process data preparation process, and has timeout invalidation logic to ensure the modification priority of basic data; edit lock is used in the process data editing process, and has timeout invalidation logic to ensure content consistency when multiple people edit; occupied lock is used in the process data approval process to ensure the modification and occupation rights of basic data; static lock and dynamic lock types are used for business risk control to ensure the priority of business activities.
[0102] In this embodiment, the static lock configuration page is used to set the static lock configuration rules, and the dynamic lock configuration page is used to set the dynamic lock configuration rules; the static lock configuration rules and the dynamic lock configuration rules are both stored in the first database table;
[0103] The configuration rules of static lock and dynamic lock include the following field information: configuration identifier, configuration code, data specification, lock type, lock strategy, responsible person, interface parameters, lock party code, lock party name, lock object field set and configuration description;
[0104] The four types of lock information, namely, pre-occupied lock, edit lock, occupied lock and dynamic lock, are all stored in the second database table. The four types of lock information, namely, pre-occupied lock, edit lock, occupied lock and dynamic lock, include the following field information: lock identification, lock code, lock type, lock status, key, data code, data version, locking party identification, locking time, unlocking party identification and unlocking time.
[0105] In this embodiment, static locks are used in scenarios where there are fixed business relationships and the relationship data is stable. The external business module provides a query interface, and the interface is called multiple times during the data modification process to query related information, thereby preventing business risks according to the configured rules. Dynamic locks are mainly used in scenarios where business relationships are unstable and the frequency is not high. The external business module calls the locking service based on its own business status, and retrieves the locking information from the second database table when the data is modified, thereby preventing business risks according to the configured rules.
[0106] In this embodiment, the edit lock, pre-occupied lock, occupied lock and dynamic lock all provide a locking method, including the following steps:
[0107] The locking party passes in the locking parameters;
[0108] Generate key information;
[0109] Execute locking parameters and key information and write them into the second database table;
[0110] If the locking parameters and key information are written into the second database table and executed successfully, the key information is returned to the locking party and the locking is ended;
[0111] If the writing of the locking parameters and key information into the second database table fails, a lock failure is returned to the locking party, and the locking is terminated;
[0112] The locking parameters include the following field information: locking party identification, data encoding, data version and lock type.
[0113] In this embodiment, the edit lock, pre-occupied lock, occupied lock and dynamic lock all provide unlocking methods, including the following steps:
[0114] The unlocking party passes in the unlocking parameters;
[0115] Searching the lock information corresponding to the unlocking parameter in the second database table;
[0116] If the lock information corresponding to the unlocking parameter is not found in the second database table, a message indicating that the unlocking has failed is returned to the unlocking party, and the unlocking is terminated;
[0117] If the lock information corresponding to the unlocking parameter is found in the second database table, the lock state of the lock information corresponding to the unlocking parameter is modified in the second database table to the unlocked state, the historical lock information of the lock information corresponding to the unlocking parameter is deleted, and the unlocking success is returned to the unlocking party to end the unlocking;
[0118] The unlocking parameters include the following field information: unlocking party identification, data encoding, data version, lock type and key.
[0119] In this embodiment, the dynamic lock provides an unlocking method, including the following steps:
[0120] The lock checking party passes in the lock checking parameters;
[0121] Search the lock configuration rules corresponding to the lock query parameters in the first database table;
[0122] If the lock configuration rule corresponding to the lock query parameter is found in the first database table, the lock information corresponding to the lock query parameter is further searched in the second database table;
[0123] If the lock information corresponding to the lock query parameter is found in the second database table, a lock is returned to the lock query party, and the lock query ends;
[0124] If the lock information corresponding to the lock query parameter is not found in the second database table, a return message "no lock" is sent to the lock query party, and the lock query is terminated;
[0125] If the lock configuration rule corresponding to the lock query parameter is not found in the first database table, a return "no lock" is sent to the lock query party, and the lock query is terminated;
[0126] The lock query parameters include the following field information: lock type, data encoding and data version.
[0127] In this embodiment, the static lock provides a lock checking method, including the following steps:
[0128] The lock checking party passes in the lock checking parameters;
[0129] Search the lock configuration rules corresponding to the lock query parameters in the first database table;
[0130] If the lock configuration rule corresponding to the lock query parameter is found in the first database table, the query interface provided by the external business module is called to query the lock query parameter association information;
[0131] If the lock query parameter association information is found, a lock is returned to the lock query party, and the lock query ends;
[0132] If no lock query parameter associated information is found, a message indicating that there is no lock is returned to the lock query party, and the lock query ends;
[0133] The lock query parameters include the following field information: lock type, data encoding and data version.
[0134] In this embodiment, the occupied lock provides a lock checking method, including the following steps:
[0135] The lock checking party passes in the lock checking parameters;
[0136] Search the lock information corresponding to the lock query parameter in the second database table;
[0137] If the lock information corresponding to the lock query parameter is found in the second database table, a lock is returned to the lock query party, and the lock query ends;
[0138] If the lock information corresponding to the lock query parameter is not found in the second database table, a return message "no lock" is sent to the lock query party, and the lock query is terminated;
[0139] The lock query parameters include the following field information: lock type, data encoding and data version.
[0140] In this embodiment, both the edit lock and the pre-occupied lock provide a lock checking method, including the following steps:
[0141] The lock checking party passes in the lock checking parameters;
[0142] Search the lock information corresponding to the lock query parameter in the second database table;
[0143] If the lock information corresponding to the lock query parameter is found in the second database table, it is further determined whether the lock information corresponding to the lock query parameter has timed out;
[0144] If the lock information corresponding to the lock query parameter times out, the lock timeout is returned to the lock query party and the lock query ends;
[0145] If the lock information corresponding to the lock query parameter has not timed out, a return message indicating that the lock is available is sent to the lock query party, and the lock query ends;
[0146] If the lock information corresponding to the lock query parameter is not found in the second database table, a return message "no lock" is sent to the lock query party, and the lock query is terminated;
[0147] The lock query parameters include the following field information: lock type, data encoding and data version.
[0148] In this embodiment, the self-lock checking method uses the self-lock checking parameters passed by the self-lock checking party to verify that the owner of the lock is the owner, including the following steps:
[0149] Check the self-lock method and pass in the self-lock parameters;
[0150] Search the second database table for lock information corresponding to the lock parameter itself;
[0151] If the lock information corresponding to the self-lock query parameter is found in the second database table, the self-lock query is returned to the self-lock query party, and the self-lock query is terminated;
[0152] If the lock information corresponding to the self-lock query parameter is not found in the second database table, a message indicating that the self-lock query is not a self-lock is returned to the self-lock query party, and the self-lock query is terminated;
[0153] The self-lock parameter query includes the following field information: key, lock type, data encoding and data version.
[0154] In this embodiment, S101, preparing process data, includes the following steps:
[0155] S1011, the preparation party selects a basic data from the basic database; checks in turn whether the basic data is associated with a static lock, an occupied lock, and a pre-occupied lock; if the basic data is not locked or the lock has timed out, execute S1012; if the basic data is locked, return the lock to the preparation party, and execute S1016;
[0156] S1012, pre-occupy the lock on the basic data; if the pre-occupy lock on the basic data is successful, copy the basic data, create a process data, and execute S1013; if the pre-occupy lock on the basic data fails, return the failure of pre-occupying the lock to the preparer, and execute S1016;
[0157] S1013, modify the process data of this item as needed, and execute S1014;
[0158] S1014. Check the data for duplicates in the basic database according to the data coding and data version field information defined in the process data. If the data for duplicates passes the check, save the data and execute S1015. If the data for duplicates fails the check, return the check failure to the preparer and return to S1013.
[0159] S1015, lock the current process data, and release the pre-occupied lock of the current basic data; if the lock is successfully occupied on the current process data, release the pre-occupied lock on the current basic data, save the current process data, write it into the process database, set the current process data to the preparation state, and execute S1016; if the lock is not successfully occupied on the current process data, return the failure of the lock to the preparation party, invalidate the current process data, release the pre-occupied lock on the current basic data, and execute S1016;
[0160] S1016, end.
[0161] Further, S102, editing process data, includes the following steps:
[0162] S1021, query the process data in the preparation state from the process database, select a piece of process data in the preparation state, and check whether the process data in the preparation state is associated with an edit lock; if the process data in the preparation state is not associated with an edit lock or the associated edit lock has timed out, execute S1022; if the process data in the preparation state is associated with an edit lock, return the edit lock to the editor, and execute S1026;
[0163] S1022, applying an edit lock to the process data in the preparation state; if applying the edit lock to the process data in the preparation state is successful, executing S1023; if applying the edit lock to the process data in the preparation state fails, returning a prompt indicating that the applying the edit lock failed to the editor, and executing S1026;
[0164] S1023, modify the process data in the preparation state as needed, and execute S1024;
[0165] S1024, according to the primary key field information such as the data code and data version defined in the process data of this preparation state, check the duplication of the process data of this preparation state in the basic database; if the duplication check of the process data of this preparation state passes, execute S1025; if the duplication check of the process data of this preparation state fails, return to S1023;
[0166] S1025, checking the editing lock of the process data in the preparation state. If the key information of the process data in the preparation state is consistent with the key information in the second database table, the process data in the preparation state is updated, the editing lock of the process data in the preparation state is released, and S1026 is executed; if the key information of the process data in the preparation state does not match the key information in the second database table, a prompt is returned to the editor, and S1026 is executed;
[0167] S1026, end.
[0168] Furthermore, S103, approving process data, includes the following steps:
[0169] S1031, select process data that needs to be approved from the process database, modify them in batches to the approval status, and execute S1032;
[0170] S1032, review the process data in the approval status according to the management process; if the process data in the approval status is approved, the process data in the approval status is batch modified to the archived status, and S1033 is executed; if the process data in the approval status is not approved, the approval initiator is prompted that the process data is not approved, the process data in the approval status is batch modified to the unarchived status, and S1034 is executed;
[0171] S1033, adding the process data in the archiving state to the archiving queue, asynchronously triggering an archiving service, and executing S1034;
[0172] S1034, end.
[0173] Further, S104, archiving process data, includes the following steps:
[0174] S1041, check the status of the archiving service; when the archiving service status is not started, change the archiving service status to the archiving status, start the archiving service, and execute S1042; when the archiving service status is the archiving status, execute S1044;
[0175] S1042, traverse the process data in the archive queue, archive them one by one, and execute S1043;
[0176] S1043, after the traversal and archiving are completed, the archiving service status is changed to the archiving end status, and S1044 is executed;
[0177] S1044, end.
[0178] Furthermore, in S1042, the process data in the archive queue is traversed and archived one by one, including the following steps:
[0179] S10421, get the first process data in the archive queue, and execute step S10422;
[0180] S10422, check whether the process data in the archive queue is associated with a static lock; if the process data in the archive queue is associated with a static lock, modify the process data in the archive queue to be in an unarchived state, obtain the next process data in the archive queue, and return to S10422; if the process data in the archive queue is not associated with a static lock, further execute S10423;
[0181] S10423, check whether the process data in the archive queue is associated with a dynamic lock; if the process data in the archive queue is not associated with a dynamic lock, execute S10424; if the process data in the archive queue is associated with a dynamic lock, modify the process data in the archive queue to an unarchived state, obtain the next process data in the archive queue, and return to S10422;
[0182] S10424, check the process data in the archive queue for duplicates in the basic database; if the process data in the archive queue passes the duplicate check, update the basic data corresponding to the process data in the archive queue, modify the process data in the archive queue to be archived, and execute S10425; if the process data in the archive queue fails the duplicate check, modify the process data in the archive queue to be unarchived, and execute S10425;
[0183] S10425, determine whether the process data in the archive queue is the last process data in the archive queue; if the process data in the archive queue is the last process data in the archive queue, end the traversal archiving of the process data in the archive queue, modify the archiving service to the archiving end state, and execute S10426; if the process data in the archive queue is not the last process data in the archive queue, get the next process data in the archive queue, and return to S10422;
[0184] S10426, end.
[0185] The data modification method based on the lock control mechanism provided in this embodiment modifies data based on the lock control mechanism, manages business risks in the data modification process, and handles editing conflicts in the data modification process; in the archiving service, asynchronous, exclusive and event-triggered methods are used to improve the archiving efficiency and reduce the computing load peak during the archiving period.
[0186] refer to Figure 2 As an implementation of the above method, the present invention provides an embodiment of a computer device, and the computer device embodiment corresponds to the embodiment of the above method.
[0187] The computer device described in this embodiment includes a memory 201, a processor 202 and a network interface 203 that are interconnected and communicated through a system bus. It should be noted that the figure only shows a computer device with components 201-203, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application-specific integrated circuits, programmable gate arrays, digital processors, embedded devices, etc.
[0188] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.
[0189] The memory 201 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory, random access memory, static random access memory, read-only memory, electrically erasable programmable read-only memory, programmable read-only memory, magnetic memory, disk, optical disk, etc. In some embodiments, the memory 201 can be an internal storage unit of the computer device, such as a hard disk or memory of the computer device. In other embodiments, the memory 201 can also be an external storage device of the computer device, such as a plug-in hard disk, smart memory card, secure digital card, flash memory card, etc. equipped on the computer device. Of course, the memory 201 can also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the memory 201 is generally used to store the operating system and various application software installed on the computer device, such as the computer-readable instructions of the above method, etc. In addition, the memory 201 can also be used to temporarily store various types of data that have been output or are to be output.
[0190] The processor 202 may be a central processing unit, a controller, a microcontroller, a microprocessor, or other data processing chip in some embodiments. The processor 202 is generally used to control the overall operation of the computer device. In this embodiment, the processor 202 is used to run the computer-readable instructions stored in the memory 201 or process data, such as computer-readable instructions for running the above method.
[0191] The network interface 203 may include a wireless network interface or a wired network interface. The network interface 203 is generally used to establish a communication connection between the computer device and other electronic devices.
[0192] The computer device proposed in this embodiment modifies data based on a lock control mechanism, manages business risks during data modification, and handles editing conflicts during data modification. In archiving services, asynchronous, exclusive, and event-triggered methods are used to improve archiving efficiency and reduce computing load peaks during archiving.
[0193] As an implementation of the above method, the present invention provides an embodiment of a computer-readable storage medium, and the embodiment of the computer-readable storage medium corresponds to the embodiment of the above method.
[0194] The computer-readable storage medium described in this embodiment stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the above method.
[0195] The computer-readable storage medium proposed in this embodiment modifies data based on a lock control mechanism, manages business risks during data modification, and handles editing conflicts during data modification. In the archiving service, asynchronous, exclusive, and event-triggered methods are used to improve archiving efficiency and reduce the computing load peak during archiving.
[0196] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.
Claims
1. A data modification method based on lock control mechanism, It is characterized in that The steps include: Step S101, preparing process data; Step S102, editing process data; Step S103, approval process data; Step S104, archiving process data; Process data refers to data that is being modified and waiting to take effect. It is based on business data and saves four types of lock key information: edit lock, pre-occupied lock, occupied lock, and dynamic lock. Process data is created by copying basic data. Basic data refers to data that has already taken effect; The lock control mechanism includes five types of locks: pre-occupied lock, edit lock, occupied lock, static lock and dynamic lock. Among them, edit lock, pre-occupied lock, occupied lock and dynamic lock all provide locking method, unlocking method and self-lock query method. All types of locks provide lock query method. Static lock and dynamic lock both provide lock configuration rules. The pre-occupied lock is used in the process of preparing process data, and has a timeout logic to ensure the modification priority of basic data; the edit lock is used in the process of editing process data, and has a timeout logic to ensure the consistency of content when multiple people edit; The occupation lock is used in the process data approval process to ensure the modification and occupation rights of the basic data; the static lock and dynamic lock types are used for business risk control to ensure the priority of business activities.
2. According to the data modification method based on the lock control mechanism described in claim 1, It is characterized in that Setting a static lock configuration page is used to set static lock configuration rules, and setting a dynamic lock configuration page is used to set dynamic lock configuration rules; both static lock configuration rules and dynamic lock configuration rules are stored in the first database table; The configuration rules of static lock and dynamic lock include the following field information: configuration identifier, configuration code, data specification, lock type, lock strategy, responsible person, interface parameters, lock party code, lock party name, lock object field set and configuration description; The four types of lock information, namely, pre-occupied lock, edit lock, occupied lock and dynamic lock, are all stored in the second database table. The four types of lock information, namely, pre-occupied lock, edit lock, occupied lock and dynamic lock, include the following field information: lock identification, lock code, lock type, lock status, key, data code, data version, locking party identification, locking time, unlocking party identification and unlocking time.
3. According to the data modification method based on the lock control mechanism described in claim 2, It is characterized in that Static locks are used in scenarios where there are fixed business relationships and the relationship data is stable. The external business module provides a query interface. The interface is called multiple times during the data modification process to query related information, and business risks are prevented according to the configured rules. Dynamic locks are mainly used in scenarios where business relationships are unstable and the frequency is not high. The external business module calls the locking service based on its own business status. When the data is modified, the locking information is retrieved from the second database table, and business risks are prevented according to the configured rules.
4. According to the data modification method based on the lock control mechanism described in claim 3, It is characterized in that The edit lock, pre-occupied lock, occupied lock and dynamic lock all provide locking methods, including the following steps: The locking party passes in the locking parameters; Generate key information; Execute locking parameters and key information and write them into the second database table; If the locking parameters and key information are written into the second database table and executed successfully, the key information is returned to the locking party and the locking is ended; If the writing of the locking parameters and key information into the second database table fails, a lock failure is returned to the locking party, and the locking is terminated; The locking parameters include the following field information: locking party identification, data encoding, data version and lock type.
5. According to the data modification method based on the lock control mechanism described in claim 3, It is characterized in that The edit lock, pre-occupied lock, occupied lock and dynamic lock all provide unlocking methods, including the following steps: The unlocking party passes in the unlocking parameters; Searching the lock information corresponding to the unlocking parameter in the second database table; If the lock information corresponding to the unlocking parameter is not found in the second database table, a message indicating that the unlocking has failed is returned to the unlocking party, and the unlocking is terminated; If the lock information corresponding to the unlocking parameter is found in the second database table, the lock state of the lock information corresponding to the unlocking parameter is modified to the unlocked state in the second database table, and the historical lock information of the lock information corresponding to the unlocking parameter is deleted. The dynamic lock asynchronously triggers an archiving service, returns the unlocking success to the unlocking party, and ends the unlocking. The unlocking parameters include the following field information: unlocking party identification, data encoding, data version, lock type and key.
6. According to the data modification method based on the lock control mechanism of claim 3, It is characterized in that Dynamic lock provides a lock checking method, including the following steps: The lock checking party passes in the lock checking parameters; Search the lock configuration rules corresponding to the lock query parameters in the first database table; If the lock configuration rule corresponding to the lock query parameter is found in the first database table, the lock information corresponding to the lock query parameter is further searched in the second database table; If the lock information corresponding to the lock query parameter is found in the second database table, a lock is returned to the lock query party, and the lock query ends; If the lock information corresponding to the lock query parameter is not found in the second database table, a return message "no lock" is sent to the lock query party, and the lock query is terminated; If the lock configuration rule corresponding to the lock query parameter is not found in the first database table, a return "no lock" is sent to the lock query party, and the lock query is terminated; The lock query parameters include the following field information: lock type, data encoding and data version.
7. A data modification method based on a lock control mechanism according to claim 3, It is characterized in that Static lock provides a lock checking method, including the following steps: The lock checking party passes in the lock checking parameters; Search the lock configuration rules corresponding to the lock query parameters in the first database table; If the lock configuration rule corresponding to the lock query parameter is found in the first database table, the query interface provided by the external business module is called to query the lock query parameter association information; If the lock query parameter association information is found, a lock is returned to the lock query party, and the lock query ends; If no lock query parameter associated information is found, a message indicating that there is no lock is returned to the lock query party, and the lock query ends; The lock query parameters include the following field information: lock type, data encoding and data version.
8. According to the data modification method based on the lock control mechanism described in claim 2, It is characterized in that The occupied lock provides a lock query method, including the following steps: The lock checking party passes in the lock checking parameters; Search the lock information corresponding to the lock query parameter in the second database table; If the lock information corresponding to the lock query parameter is found in the second database table, a lock is returned to the lock query party, and the lock query ends; If the lock information corresponding to the lock query parameter is not found in the second database table, a return message "no lock" is sent to the lock query party, and the lock query is terminated; The lock query parameters include the following field information: lock type, data encoding and data version.
9. A data modification method based on a lock control mechanism according to claim 2, It is characterized in that Both the edit lock and the pre-empted lock provide a lock check method, which includes the following steps: The lock checking party passes in the lock checking parameters; Search the lock information corresponding to the lock query parameter in the second database table; If the lock information corresponding to the lock query parameter is found in the second database table, it is further determined whether the lock information corresponding to the lock query parameter has timed out; If the lock information corresponding to the lock query parameter times out, the lock timeout is returned to the lock query party and the lock query ends; If the lock information corresponding to the lock query parameter has not timed out, a return message indicating that the lock is available is sent to the lock query party, and the lock query ends; If the lock information corresponding to the lock query parameter is not found in the second database table, a return message "no lock" is sent to the lock query party, and the lock query is terminated; The lock query parameters include the following field information: lock type, data encoding and data version.
10. A data modification method based on a lock control mechanism according to claim 2, It is characterized in that The self-lock checking method uses the self-lock checking parameters passed by the self-lock checking method to verify that the owner of the lock is the owner himself, including the following steps: Check the self-lock method and pass in the self-lock parameters; Search the second database table for lock information corresponding to the lock parameter itself; If the lock information corresponding to the self-lock query parameter is found in the second database table, the self-lock query is returned to the self-lock query party, and the self-lock query is terminated; If the lock information corresponding to the self-lock query parameter is not found in the second database table, a message indicating that the self-lock query is not a self-lock is returned to the self-lock query party, and the self-lock query is terminated; The self-lock parameter query includes the following field information: key, lock type, data encoding and data version.
11. A data modification method based on a lock control mechanism according to claim 1, It is characterized in that S101, preparing process data, includes the following steps: The preparer selects a basic data from the basic database; checks in sequence whether the basic data is associated with a static lock, an occupied lock, and a pre-occupied lock; If there is no lock on this basic data or the lock has timed out, a lock is pre-occupied on this basic data; After successfully pre-occupying the lock on this basic data, copy this basic data, create a process data, and modify the content as needed; According to the primary key attribute field information defined in this process data, check the duplicate of this process data in the basic database; After the duplicate check of this process data is passed, the lock is applied to this process data; After the lock is successfully occupied on this process data, the pre-occupied lock of this basic data is released, the process data is saved, written into the process database, and the process data is set to the preparing state.
12. A data modification method based on a lock control mechanism according to claim 11, It is characterized in that S102, editing process data, includes the following steps: Query the process data in the preparation state from the process database, select a piece of process data in the preparation state, and check whether the process data in the preparation state is associated with an edit lock; If the process data in the preparation state is not locked or the lock has timed out, edit the process data in the preparation state; After the editing lock is successfully applied to the process data in the preparation state, the process data in the preparation state can be modified as needed; According to the primary key attribute field information defined in the process data in the preparation state of this article, the process data in the preparation state of this article is checked for duplication in the basic database; After the duplicate check of the process data in the preparation state of this article is passed, check the editing lock of the process data in the preparation state of this article; When the key information of the process data in the preparation state is consistent with the key information in the second database table, the process data in the preparation state is updated and the editing lock of the process data in the preparation state is released.
13. A data modification method based on a lock control mechanism according to claim 12, It is characterized in that S103, approval process data, includes the following steps: Select the process data that needs to be approved from the process database and modify them in batches to the approval status; Approve process data in the approval status according to the management process; After the process data in the approval status is approved, it will be batch modified to the archiving status; Add the process data in the archived state to the archive queue and asynchronously trigger an archive service.
14. A data modification method based on a lock control mechanism according to claim 13, It is characterized in that S104, archiving process data, includes the following steps: Check the status of the archiving service. If the archiving service is not started, it will be set to the archiving status. Traverse the process data in the archive queue and archive them one by one; After the traversal archive is completed, the post-archive service is in the archive completion state; Archiving a single process data in the archiving queue includes the following steps: determining whether the process data is associated with a static lock and a dynamic lock in turn; if the process data is not associated with a dynamic lock and a dynamic lock, checking for duplicates in the basic database; if the process data passes the duplicate check, updating the basic data corresponding to the process data, and modifying the process data to the archived state.
15. A computer device comprising a memory and a processor, wherein the memory stores computer-readable instructions. It is characterized in that When the processor executes the computer-readable instructions, the steps of the data modification method described in any one of claims 1-14 are implemented.
16. A computer-readable storage medium having computer-readable instructions stored thereon, It is characterized in that When the computer-readable instructions are executed, the steps of the data modification method described in any one of claims 1-14 are implemented.
