Government affair form anti-shake method and system based on hybrid lock strategy

By adopting hybrid locking strategy and AOP technology in the government form system, the problem of repeated form submission in complex network environments is solved, system security and performance are improved, and data consistency and user experience are ensured.

CN118885490AActive Publication Date: 2024-11-01上海通办信息服务有限公司
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410858583.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2024-11-01
Estimated Expiration
2044-06-28

AI Technical Summary

Technical Problem

The existing government form system is prone to repeated form submission in complex network environments, resulting in data redundancy and business logic confusion, and traditional solutions may fail in complex environments.

Method used

Adopt the anti-shake method of government affairs form based on hybrid lock strategy. By defining lock types and lock rules, combining AOP technology and Redis distributed locks, long-term locks, short-term locks and hybrid locks are generated to prevent repeated submissions of forms and at the back end. Control the front-end page display and optimize the lock renewal mechanism to deal with complex network environments.

Benefits of technology

It significantly improves the security and stability of government form submission, eliminates data conflicts and business errors, improves system performance and user experience, and provides more refined control and business adaptability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118885490A_ABST
    Figure CN118885490A_ABST
Patent Text Reader

Abstract

The invention provides a government affair form anti-shake method and device based on a hybrid lock strategy, and solves the problem of failure of repeated submission of a form in a complex network environment. (1) by fusing AOP interface anti-shake, Redis short-term lock and database long-term lock, the safety and stability of government affair form submission are remarkably improved, data conflicts and service errors caused by repeated form submission are effectively eradicated, and the safety and stability of the system are improved; (2) by introducing a Redis distributed lock, the form submission processing speed and concurrency capability are greatly improved, consumption of invalid requests to system resources is reduced, and meanwhile, a lock renewal mechanism also provides more refined control for coping with a complex network environment, and system performance and response speed are optimized; and (3) the mixed lock strategy endows the system with extremely strong service adaptability and expansibility, and accurate and matched repeated submission prevention protection can be obtained no matter simple and rapid daily form submission or special forms with tedious processes and long time consumption, so that the government affair informatization service level and the satisfaction degree of the masses are greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of government services, and in particular to a government service form anti-shake method and system based on a hybrid lock strategy. Background Art

[0002] Existing government form systems often face the problem of duplicate form submissions when processing high-concurrency submissions, which may not only lead to data redundancy, but also cause confusion in business logic. Traditional solutions generally prevent duplicate submissions through client control (such as button disabling) or adding unique identifiers on the server side, but these methods may be at risk of failure in complex network environments. Summary of the invention

[0003] The present invention provides a government form anti-shake method and system based on a hybrid lock strategy to solve the problem of form repeated submission failure in a complex network environment.

[0004] In a first aspect, the present invention provides a government affairs form anti-shake method based on a hybrid lock strategy, which specifically includes the following steps:

[0005] Step S1, define lock type and lock rules;

[0006] Step S2: receiving the form request submitted by the front end;

[0007] Step S3, determining whether the requested form is an anti-duplicate form, if the form is a common form, executing step S4, if the form is an anti-duplicate form, executing step S5;

[0008] Step S4: When the form is a common form, it is controlled by the background controller and displayed on the front end;

[0009] Step S5: when the form is an anti-duplicate form, determine whether the anti-duplicate form is a long-term anti-duplicate form. If the anti-duplicate form is a long-term anti-duplicate form, execute step S6; if the anti-duplicate form is a short-term anti-duplicate form, execute step S7;

[0010] Step S6: When the form is a long-term anti-duplicate form, a long-term lock is generated by the background interceptor and stored in a database or file, and then step S8 is executed;

[0011] Step S7: When the form is a short-term anti-duplicate form, a short-term lock or a hybrid lock is generated by the background interceptor and put into redis and session, and then step S8 is executed;

[0012] Step S8: Use the background controller to control the front-end page to display and take out the lock and put it into the hidden domain.

[0013] Preferably, the initial states of the long-term lock, the short-term lock and the hybrid lock are all locked states.

[0014] Preferably, both the long-term lock and the short-term lock are set with an effective time and a maximum renewal number. When any of the long-term lock and the short-term lock exceeds its set effective time or reaches the maximum renewal number, the state of the lock automatically changes to an unlocked state.

[0015] Preferably, the hybrid lock combines a short-term lock and a long-term lock. The hybrid lock will first adopt a high-performance short-term lock. When the short-term lock exceeds its set validity period and maximum renewal times, and the processing status of the corresponding form has not yet been completed, the hybrid lock will automatically convert to a long-term lock.

[0016] Preferably, in step S2, when the form request is continuously triggered within a certain period of time, the backend does not need to process the request generated by each trigger, but only processes the request after the last trigger as the submitted form request through the interface debouncing technology combined with AOP (Aspect Oriented Programming) technology. This can effectively solve the business process anomalies caused by repeated submission of requests, improve user experience, and technically separate the interface debouncing function from the business logic to improve the modularity of the code.

[0017] Preferably, when the form request is not submitted for the first time, in addition to step S1 and step S2, the following steps are also included:

[0018] Step S9, determining whether the requested form is an anti-duplicate form, if the form is a common form, executing step S4, if the form is an anti-duplicate form, executing step S10;

[0019] Step S10, determining whether the form is a long-term anti-duplicate form, if the form is a long-term anti-duplicate form, executing steps S11 to S14, if the form is a short-term anti-duplicate form, executing steps S15 to S22;

[0020] Step S11: When the form is a long-term anti-duplicate form, determine whether the session is expired. If the session is not expired, execute step S12; if the session is expired, execute step S13;

[0021] Step S12: If the session has not expired, when the long-term anti-duplicate form is submitted at the front end, the long-term lock requests the back end, and the back end checks the status of the long-term lock. If the long-term lock is in a locked state, repeated submission of the form is prohibited. If the long-term lock is in an unlocked state, step S8 is executed;

[0022] Step S13: If the session expires, when the long-term anti-duplicate form is submitted on the front end, a lock is generated by the submitted information, and the hard disk is checked to see if there is an identical long-term lock. If there is an identical long-term lock, the identical long-term lock is loaded into the session and step S14 is executed. If there is no identical long-term lock, step S8 is executed.

[0023] Step S14: by checking the status of the same long-term lock, if the same long-term lock is in a locked state, prohibiting repeated submission of the form; if the same long-term lock is in an unlocked state, executing step S8;

[0024] Step S15: When the form is a short-term anti-duplicate form, determine whether the session is expired. If the session is not expired and the lock type is a short-term lock, execute step S16; if the session is expired and the lock type is a short-term lock, execute step S17;

[0025] Step S16: If the session has not expired, when the short-term anti-duplicate form is submitted at the front end, the short-term lock requests the back end, and the back end checks the status of the short-term lock. If the short-term lock is in a locked state, repeated submission of the form is prohibited. If the short-term lock is in an unlocked state, step S8 is executed;

[0026] Step S17: If the session expires, when the short-term anti-duplicate form is submitted at the front end, a short-term lock is generated by the submitted information, and the hard disk is checked to see if there is an identical short-term lock. If there is an identical short-term lock, the identical short-term lock is loaded into the session and step S18 is executed. If there is no identical short-term lock, step S8 is executed.

[0027] Step S18: by checking the state of the same short-term lock, if the same short-term lock is in a locked state, prohibiting repeated submission of the form; if the same short-term lock is in an unlocked state, executing step S8;

[0028] Step S19: When the form is a short-term anti-duplicate form, determine whether the session is expired. If the session is not expired and the lock type is a hybrid lock, execute step S20; if the session is expired and the lock type is a hybrid lock, execute step S21;

[0029] Step S20: If the session has not expired, when the short-term anti-duplicate form is submitted at the front end, the hybrid lock requests the back end, and the back end checks the state of the hybrid lock. If the hybrid lock is in a locked state, repeated submission of the form is prohibited. If the hybrid lock is in an unlocked state, step S8 is executed.

[0030] Step S21: If the session expires, when the short-term anti-duplicate form is submitted on the front end, a hybrid lock is generated based on the submitted information, and the hard disk is checked to see if there is an identical hybrid lock. If there is an identical hybrid lock, the identical hybrid lock is loaded into the session and step S22 is executed. If there is no identical hybrid lock, step S8 is executed.

[0031] Step S22: Check the state of the same hybrid lock. If the same hybrid lock is in a locked state, prohibit repeated submission of the form. If the same hybrid lock is in an unlocked state, execute step S8.

[0032] In a second aspect, the present invention further provides a government form anti-shake system based on a hybrid lock strategy, which specifically includes the following modules:

[0033] Lock definition module, used to define lock types and lock rules;

[0034] A form receiving module, connected to the lock definition module, for receiving a form request submitted by a front end;

[0035] A first judgment module, connected to the form receiving module, for judging whether the requested form is an anti-duplicate form;

[0036] A common form processing module, connected to the first judgment module, is used to display the form on the front end through the control of the background controller when the form is a non-anti-duplicate form (i.e., a common form);

[0037] A second judgment module, connected to the first judgment module, is used to judge whether the anti-duplicate form is a long-term anti-duplicate form when the form is an anti-duplicate form;

[0038] A long-term anti-duplicate form lock generation module, connected to the second judgment module, is used to generate a long-term lock through a background interceptor and store it in a database or file when the form is a long-term anti-duplicate form;

[0039] A short-term anti-duplicate form lock generation module is connected to the second judgment module and is used to generate a short-term lock or a mixed lock through a background interceptor and store it in redis and session when the form is a short-term anti-duplicate form;

[0040] The anti-duplicate form processing module is connected with the long-term anti-duplicate form lock generating module and the short-term anti-duplicate form lock generating module, and is used to control the front-end page to display through the background controller and take out the lock and put it into the hidden domain.

[0041] Preferably, the initial states of the long-term lock, the short-term lock and the hybrid lock are all locked states.

[0042] Preferably, both the long-term lock and the short-term lock are set with an effective time and a maximum renewal number. When any of the long-term lock and the short-term lock exceeds its set effective time or reaches the maximum renewal number, the state of the lock automatically changes to an unlocked state.

[0043] Preferably, the hybrid lock combines a short-term lock and a long-term lock. The hybrid lock will first adopt a high-performance short-term lock. When the short-term lock exceeds its set validity period and maximum renewal times, and the processing status of the form has not yet been completed, the hybrid lock will automatically convert to a long-term lock.

[0044] Preferably, in the form receiving module, when the form request is continuously triggered within a certain time period, through the interface anti-shake technology combined with AOP technology, the backend does not need to process the request generated by each trigger, but only processes the request after the last trigger as the submitted form request.

[0045] Preferably, when the form request is not submitted for the first time, in addition to the lock definition module, the form receiving module, the common form processing module, the first judgment module and the second judgment module, the following modules are also included:

[0046] The third judgment module is used to judge whether the session has expired when the form is a long-term anti-duplicate form;

[0047] The first processing module of the long-term anti-duplicate form is used for, when the session has not expired and the long-term anti-duplicate form is submitted at the front end, the long-term lock requests the back end, and the back end checks the status of the long-term lock. If the long-term lock is in the locked state, the repeated submission of the form is prohibited. If the long-term lock is in the unlocked state, the back-end controller controls the front-end page to display and takes out the lock and puts it into the hidden domain;

[0048] The second processing module of the long-term anti-duplicate form is used to generate a lock through the submitted information when the session expires and the long-term anti-duplicate form is submitted on the front end, and to check whether the same long-term lock exists in the hard disk. If the same long-term lock exists, the same long-term lock is loaded into the session. If the same long-term lock does not exist, the background controller is used to control the front-end page to display and take out the lock and put it into the hidden domain;

[0049] The third processing module of the long-term anti-duplicate form is used to check the status of the same long-term lock in the second processing module of the long-term anti-duplicate form. If the same long-term lock is in a locked state, repeated submission of the form is prohibited. If the same long-term lock is in an unlocked state, the front-end page is controlled by the background controller to display and take out the lock and put it into the hidden domain;

[0050] The fourth judgment module is used to judge whether the session is expired when the form is a short-term anti-duplicate form;

[0051] The first short-term anti-duplicate form processing module is connected to the fourth judgment module, and is used for, if the session has not expired and the short-term anti-duplicate form includes a short-term lock, when the short-term anti-duplicate form is submitted at the front end, the short-term lock requests the back end, and the back end checks the status of the short-term lock. If the short-term lock is in a locked state, repeated submission of the form is prohibited. If the short-term lock is in an unlocked state, the back-end controller is used to control the front-end page to display and take out the lock and put it into the hidden domain;

[0052] The second processing module of the short-term anti-duplicate form is connected to the fourth judgment module, and is used for generating a short-term lock through the submitted information when the session is expired and the short-term anti-duplicate form includes a short-term lock, and checking whether the same short-term lock exists in the hard disk. If the same short-term lock exists, the same short-term lock is loaded into the session. If the same short-term lock does not exist, the background controller is used to control the front-end page to display and take out the lock and put it into the hidden domain;

[0053] The third short-term anti-duplicate form processing module is connected to the second short-term anti-duplicate form processing module, and is used to check the status of the same short-term lock after loading the same lock into the session. If the same short-term lock is in a locked state, repeated submission of the form is prohibited. If the same short-term lock is in an unlocked state, the front-end page is controlled by the background controller to display and the lock is taken out and put into the hidden domain;

[0054] The fourth processing module of the short-term anti-duplicate form is connected to the fourth judgment module, and is used for, if the session has not expired and the short-term anti-duplicate form includes a hybrid lock, when the short-term anti-duplicate form is submitted at the front end, the hybrid lock requests the back end, and the back end checks the state of the hybrid lock. If the short-term lock is in a locked state, repeated submission of the form is prohibited. If the short-term lock is in an unlocked state, the back-end controller controls the front-end page to display and takes out the lock and puts it into the hidden domain;

[0055] The fifth processing module of the short-term anti-duplicate form is connected to the fourth judgment module, and is used for generating a hybrid lock through the submitted information when the session is expired and the short-term anti-duplicate form includes a hybrid lock, and checking whether the same hybrid lock exists in the hard disk. If the same hybrid lock exists, the same hybrid lock is loaded into the session. If the same hybrid lock does not exist, the background controller is used to control the front-end page to display and take out the lock and put it into the hidden domain;

[0056] The sixth processing module of the short-term anti-duplicate form and the fifth processing module of the short-term anti-duplicate form are used to check the status of the same hybrid lock after loading the same hybrid lock into the session. If the same hybrid lock is in a locked state, repeated submission of the form is prohibited. If the same hybrid lock is in an unlocked state, the front-end page is controlled by the background controller to display it and the lock is taken out and placed in the hidden field.

[0057] In a third aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a government affairs form anti-shake method based on a hybrid lock strategy as described in any one of the first aspects of the present application.

[0058] In a fourth aspect, the present invention further provides an electronic device, comprising: a memory storing a computer program; and a processor communicatively connected to the memory, for executing, when calling the computer program, a government affairs form anti-shake method based on a hybrid lock strategy as described in any one of the first aspects of the present application.

[0059] Compared with the prior art, the present invention has the following obvious outstanding substantive features and significant advantages:

[0060] The present invention proposes a government form anti-shake method and device based on a hybrid lock strategy, which solves the problem of invalid form repeated submission in a complex network environment. (1) By integrating AOP interface anti-shake, Redis short-term lock and database long-term lock, the present invention significantly improves the security and stability of government form submission, effectively eliminates data conflicts and business errors caused by repeated form submission, and improves the security and stability of the system; (2) By introducing Redis distributed locks, the speed and concurrency of form submission processing are greatly improved, and the consumption of system resources by invalid requests is reduced. At the same time, the lock renewal mechanism also provides more refined control for coping with complex network environments, and optimizes system performance and response speed; (3) The hybrid lock strategy gives the system extremely strong business adaptability and scalability. Whether it is a simple and fast daily form submission or a special form with a complicated process and a long time, it can get accurately matched anti-duplicate submission protection, which greatly improves the level of government information service and public satisfaction. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] The accompanying drawings, which constitute part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention. In the accompanying drawings:

[0062] Figure 1 It is a flow chart of a government affairs form anti-shake method based on a hybrid lock strategy according to a preferred embodiment of the present invention.

[0063] Figure 2 It is a flowchart of a non-first submission of a form access request in a government form anti-shake method based on a hybrid lock strategy in a preferred embodiment of the present invention.

[0064] Figure 3 It is a structural schematic diagram of a government affairs form anti-shake system based on a hybrid lock strategy according to a preferred embodiment of the present invention.

[0065] Figure 4 It is a schematic diagram of the system structure when a form access request is not submitted for the first time in a government form anti-shake system based on a hybrid lock strategy in a preferred embodiment of the present invention.

[0066] Figure 5 It is a flow chart of a government affairs form anti-shake method based on a hybrid lock strategy according to a preferred embodiment of the present invention.

[0067] Figure 6 It is a schematic diagram of an anti-shake system for government affairs forms based on a hybrid lock strategy according to a preferred embodiment of the present invention. DETAILED DESCRIPTION

[0068] The present invention provides a government form anti-shake method and system based on a hybrid lock strategy. In order to make the purpose, technical solution and effect of the present invention clearer and more specific, the present invention is further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0069] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0070] Embodiment 1:

[0071] like Figure 1-Figure 2 As shown, the government affairs form anti-shake method based on the hybrid lock strategy described in this embodiment specifically includes the following steps:

[0072] Step S1, define lock type and lock rules.

[0073] Optionally, the lock types include long-term locks, short-term locks and mixed locks.

[0074] Among them, the initial states of the long-term lock, short-term lock and hybrid lock are all locked states.

[0075] Optionally, both the long-term lock and the short-term lock are set with an effective time and a maximum renewal number. When either the long-term lock or the short-term lock exceeds its set effective time or reaches the maximum renewal number, the state of the lock automatically changes to an unlocked state.

[0076] Optionally, the hybrid lock combines a short-term lock and a long-term lock. The hybrid lock will first use a high-performance short-term lock. When the short-term lock exceeds its set validity period and maximum renewal times, and the processing status of the form is still not completed, the hybrid lock will automatically convert to a long-term lock.

[0077] Step S2: receiving the form request submitted by the front end.

[0078] Step S3: determine whether the requested form is an anti-duplicate form. If the form is a common form, execute step S4; if the form is an anti-duplicate form, execute step S5.

[0079] Step S4: When the form is a common form, it is controlled by the background controller and displayed on the front end.

[0080] Step S5: when the form is an anti-duplicate form, determine whether the anti-duplicate form is a long-term anti-duplicate form. If the anti-duplicate form is a long-term anti-duplicate form, execute step S6; if the anti-duplicate form is a short-term anti-duplicate form, execute step S7.

[0081] Step S6: When the form is a long-term anti-duplicate form, a long-term lock is generated by the background interceptor and stored in a database or file, and then step S8 is executed.

[0082] Step S7: When the form is a short-term anti-duplicate form, a short-term lock or a hybrid lock is generated by the background interceptor and put into redis and session, and then step S8 is executed.

[0083] Step S8: Use the background controller to control the front-end page to display and take out the lock and put it into the hidden domain.

[0084] Optionally, when the form request is not the first form access request, in addition to steps S1 and S2, steps S9 to S22 are also included.

[0085] Step S9, determining whether the request form is an anti-duplicate form, if the form is a common form, executing step S4, if the form is an anti-duplicate form, executing step S10.

[0086] Step S10, determine whether the form is a long-term anti-duplicate form, if the form is a long-term anti-duplicate form, execute steps S11 to S14, if the form is a short-term anti-duplicate form, execute steps S15 to S22.

[0087] Step S11: When the form is a long-term anti-duplicate form, determine whether the session is expired. If the session is not expired, execute step S12; if the session is expired, execute step S13.

[0088] Step S12: If the session has not expired, when the long-term anti-duplicate form is submitted at the front end, the long-term lock requests the back end, and the status of the long-term lock is checked by the back end. If the long-term lock is in a locked state, repeated submission of the form is prohibited. If the long-term lock is in an unlocked state, step S8 is executed.

[0089] Step S13: If the session expires, when the long-term anti-duplicate form is submitted on the front end, a lock is generated by the submitted information, and the hard disk is checked to see if there is an identical long-term lock. If there is an identical long-term lock, the identical long-term lock is loaded into the session and step S14 is executed. If there is no identical long-term lock, step S8 is executed.

[0090] Step S14: by checking the state of the same long-term lock, if the same long-term lock is in a locked state, prohibiting repeated submission of the form; if the same long-term lock is in an unlocked state, executing step S8.

[0091] Step S15: When the form is a short-term anti-duplicate form, determine whether the session is expired. If the session is not expired and the lock type is a short-term lock, execute step S16; if the session is expired and the lock type is a short-term lock, execute step S17.

[0092] Step S16: If the session has not expired, when the short-term anti-duplicate form is submitted at the front end, the short-term lock requests the back end, and the back end checks the status of the short-term lock. If the short-term lock is in a locked state, repeated submission of the form is prohibited. If the short-term lock is in an unlocked state, step S8 is executed.

[0093] Step S17: If the session expires, when a short-term anti-duplication form is submitted on the front end, a short-term lock is generated based on the submitted information, and the hard disk is checked for the presence of the same short-term lock. If the same short-term lock exists, the same short-term lock is loaded into the session and step S18 is executed. If the same short-term lock does not exist, step S8 is executed.

[0094] Step S18: by checking the status of the same short-term lock, if the same short-term lock is in a locked state, prohibiting repeated submission of the form; if the same short-term lock is in an unlocked state, executing step S8.

[0095] Step S19: When the form is a short-term anti-duplicate form, determine whether the session is expired. If the session is not expired and the lock type is a hybrid lock, execute step S20; if the session is expired and the lock type is a hybrid lock, execute step S21.

[0096] Step S20: If the session has not expired, when the short-term anti-duplicate form is submitted at the front end, the hybrid lock requests the back end, and the back end checks the status of the hybrid lock. If the short-term lock is in a locked state, repeated submission of the form is prohibited. If the short-term lock is in an unlocked state, step S8 is executed.

[0097] Step S21: If the session expires, when a short-term anti-duplicate form is submitted on the front end, a hybrid lock is generated based on the submitted information, and the hard disk is checked to see if there is an identical hybrid lock. If there is an identical hybrid lock, the identical hybrid lock is loaded into the session and step S22 is executed. If there is no identical hybrid lock, step S8 is executed.

[0098] Step S22: Check the state of the same hybrid lock. If the same hybrid lock is in a locked state, prohibit repeated submission of the form. If the same hybrid lock is in an unlocked state, execute step S8.

[0099] Embodiment 2:

[0100] like Figure 3-Figure 4 As shown, the government form anti-shake system based on the hybrid lock strategy described in this embodiment specifically includes the following modules:

[0101] The lock definition module is used to define lock types and lock rules.

[0102] Optionally, the lock types include long-term locks, short-term locks and mixed locks.

[0103] Among them, the initial states of the long-term lock, short-term lock and hybrid lock are all locked states.

[0104] Among them, both the long-term lock and the short-term lock are set with an effective time and a maximum renewal number. When any of the long-term lock and the short-term lock exceeds its set effective time or reaches the maximum renewal number, the state of the lock automatically changes to an unlocked state.

[0105] Among them, the hybrid lock combines a short-term lock and a long-term lock. The hybrid lock will first use a high-performance short-term lock. When the short-term lock exceeds the effective time and the maximum number of renewals, if the form status is not in the completed state, the hybrid lock will automatically convert to a long-term lock.

[0106] The form receiving module is connected to the lock definition module and is used to submit a form request.

[0107] The first judging module is connected to the form receiving module and is used to judge whether the request form is an anti-duplicate form.

[0108] The common form processing module is connected to the first judgment module and is used to display the form on the front end through the control of the background controller when the form is a non-anti-duplicate form (ie, a common form).

[0109] The second judgment module is connected to the first judgment module, and is used to judge whether the anti-duplicate form is a long-term anti-duplicate form when the form is an anti-duplicate form.

[0110] The long-term anti-duplicate form lock generation module is connected to the second judgment module and is used to generate a long-term lock through a background interceptor and store it in a database or file when the form is a long-term anti-duplicate form.

[0111] The short-term anti-duplicate form lock generation module is connected to the second judgment module and is used to generate a short-term lock or a mixed lock through a background interceptor and put it into redis and session when the form is a short-term anti-duplicate form.

[0112] The anti-duplicate form processing module is connected with the long-term anti-duplicate form lock generating module and the short-term anti-duplicate form lock generating module, and is used to control the front-end page to display through the background controller and take out the lock and put it into the hidden domain.

[0113] Optionally, when the form request is not the first form access request, in addition to the lock definition module, the form receiving module, the common form processing module, the first judgment module and the second judgment module, the following modules are also included:

[0114] The third judgment module is used to judge whether the session is expired when the form is a long-term anti-duplicate form.

[0115] The first processing module of the long-term anti-duplicate form is used for submitting the long-term anti-duplicate form on the front end when the session has not expired. The long-term lock requests the back end, and the status of the long-term lock is checked by the back end. If the long-term lock is in a locked state, repeated submission of the form is prohibited. If the long-term lock is in an unlocked state, the front-end page is controlled by the background controller to display it and the lock is taken out and placed in the hidden field.

[0116] The second processing module of the long-term anti-duplicate form is used to generate a lock through the submitted information when the session expires and the long-term anti-duplicate form is submitted on the front end, and to check whether the same long-term lock exists in the hard disk. If the same long-term lock exists, the same long-term lock is loaded into the session. If the same long-term lock does not exist, the background controller is used to control the front-end page for display and take out the lock and put it into the hidden field.

[0117] The third processing module of the long-term anti-duplicate form is used to check the status of the same long-term lock in the second processing module of the long-term anti-duplicate form. If the same long-term lock is in a locked state, repeated submission of the form is prohibited. If the same long-term lock is in an unlocked state, the front-end page is controlled by the background controller to display it and take out the lock and put it into the hidden field.

[0118] The fourth judgment module is used to judge whether the session is expired when the form is a short-term anti-duplicate form.

[0119] The first processing module of the short-term anti-duplicate form is connected to the fourth judgment module. If the session has not expired and the short-term anti-duplicate form includes a short-term lock, when the short-term anti-duplicate form is submitted at the front end, the short-term lock requests the back end, and the back end checks the status of the short-term lock. If the short-term lock is in a locked state, repeated submission of the form is prohibited. If the short-term lock is in an unlocked state, the background controller controls the front end page to display it and takes out the lock and puts it into the hidden field.

[0120] The second processing module of the short-term anti-duplicate form is connected to the fourth judgment module. If the session expires and the short-term anti-duplicate form includes a short-term lock, when the short-term anti-duplicate form is submitted at the front end, a short-term lock is generated through the submitted information, and the hard disk is checked for the existence of the same short-term lock. If the same short-term lock exists, the same short-term lock is loaded into the session. If the same short-term lock does not exist, the front-end page is controlled by the background controller to display it and the lock is taken out and placed in the hidden domain.

[0121] The third processing module of the short-term anti-duplicate form is connected to the second processing module of the short-term anti-duplicate form, and is used to check the status of the same short-term lock after loading the same lock into the session. If the same short-term lock is in a locked state, repeated submission of the form is prohibited. If the same short-term lock is in an unlocked state, the front-end page is controlled by the background controller to display it and the lock is taken out and placed in the hidden field.

[0122] The fourth processing module of the short-term anti-duplicate form is connected to the fourth judgment module. If the session has not expired and the short-term anti-duplicate form includes a hybrid lock, when the short-term anti-duplicate form is submitted at the front end, the hybrid lock requests the back end, and the back end checks the status of the hybrid lock. If the short-term lock is in a locked state, repeated submission of the form is prohibited. If the short-term lock is in an unlocked state, the background controller controls the front end page to display it and takes out the lock and puts it into the hidden domain.

[0123] The fifth processing module of the short-term anti-duplicate form is connected to the fourth judgment module. If the session expires and the short-term anti-duplicate form includes a hybrid lock, when the short-term anti-duplicate form is submitted at the front end, a hybrid lock is generated through the submitted information, and the hard disk is checked for the existence of the same hybrid lock. If the same hybrid lock exists, the same hybrid lock is loaded into the session. If the same hybrid lock does not exist, the background controller is used to control the front-end page for display and the lock is taken out and placed in the hidden domain.

[0124] The sixth processing module of the short-term anti-duplicate form and the fifth processing module of the short-term anti-duplicate form are used to check the status of the same hybrid lock after loading the same hybrid lock into the session. If the same hybrid lock is in a locked state, repeated submission of the form is prohibited. If the same hybrid lock is in an unlocked state, the front-end page is controlled by the background controller to display it and the lock is taken out and placed in the hidden field.

[0125] Embodiment 3:

[0126] like Figure 5 The figure shows a flow chart of a government affairs form anti-shake method based on a hybrid lock strategy described in this embodiment.

[0127] First, customize the lock type and lock rules, such as defining the lock types as: long-term lock, short-term lock, and mixed lock.

[0128] Among them, the long-term lock, short-term lock and mixed lock are all set with effective time and maximum renewal times. When the lock exceeds the effective time, the effective time of the lock can be extended by renewing the effective time of the lock.

[0129] For hybrid locks, hybrid locks combine the characteristics of short-term locks and long-term locks. That is, in a short period of time, hybrid locks exhibit the characteristics of short-term locks, and distributed locks are used to improve the performance of the lock. When the effective time of the short-term lock and the maximum number of renewals of the short-term lock are exceeded, the hybrid lock exhibits the characteristics of a long-term lock, thereby extending the effective time of the lock.

[0130] After the user submits an access form request, the form type corresponding to the method annotation of the URL is first determined through anti-duplicate interception, and the form is divided into a normal form and an anti-duplicate form.

[0131] When the form is a normal form, the front end is directly controlled by the background controller for display.

[0132] When the form is an anti-duplicate form, it will continue to determine whether the anti-duplicate form is long-term or short-term. The long-term anti-duplicate form generates a long-term lock through the background interceptor, and the short-term anti-duplicate form generates a short-term lock or a mixed lock through the background interceptor.

[0133] Among them, long-term locks are stored in the hard disk, and short-term locks or mixed locks are stored in redis and session.

[0134] When a request to access a form is not submitted for the first time, it is checked whether the session is expired and whether the lock is locked to perform corresponding operations, as described in Example 1.

[0135] Embodiment 4:

[0136] like Figure 6 The figure shows a schematic diagram of the anti-shake system of the form.

[0137] The forms submitted by normal form submission 1 and normal form submission 2 are normal forms.

[0138] The form submitted by anti-duplicate form 1 is an anti-duplicate form with a mixed lock.

[0139] The forms submitted by Anti-Duplicate Form 2 and Anti-Duplicate Form 3 are anti-duplicate forms with long-term locks.

[0140] The ordinary form submission 1 and the ordinary form submission 2 are directly submitted to the form acceptance system, and the ordinary form submission 1 and the ordinary form submission 2 are requested to submit the form N times, and the form always remains in an unlocked state.

[0141] For anti-duplicate forms, the first time a form request is submitted, the form request is directly submitted to the form acceptance system. When the form is not submitted for the first time and the form is in the lock period, after submitting the form request, the configuration needs to be read, and the program needs to be started according to the configuration to load the rules.

[0142] from Figure 4 It can be seen that the length displayed for the short-term lock and the long-term lock indicates the effective time of the short-term lock. The hybrid lock includes both the short-term lock and the long-term lock, that is, when the short-term lock fails, the short-term lock is converted to the long-term lock.

[0143] The specific embodiments of the present invention are described in detail above, but they are only examples, and the present invention is not limited to the specific embodiments described above. For those skilled in the art, any equivalent modifications and substitutions made to the present invention are also within the scope of the present invention. Therefore, the equalization changes and modifications made without departing from the spirit and scope of the present invention should be included in the scope of the present invention.

Claims

1. A method for anti-shaking government forms based on a hybrid lock strategy, characterized in that: The specific steps include: Step S1, define lock type and lock rules; Step S2: receiving the form request submitted by the front end; Step S3, determining whether the requested form is an anti-duplicate form, if the form is a common form, executing step S4, if the form is an anti-duplicate form, executing step S5; Step S4: When the form is a common form, it is controlled by the background controller and displayed on the front end; Step S5: when the form is an anti-duplicate form, determine whether the anti-duplicate form is a long-term anti-duplicate form. If the anti-duplicate form is a long-term anti-duplicate form, execute step S6; if the anti-duplicate form is a short-term anti-duplicate form, execute step S7; Step S6: When the form is a long-term anti-duplicate form, a long-term lock is generated by the background interceptor and stored in a database or file, and then step S8 is executed; Step S7: When the form is a short-term anti-duplicate form, a short-term lock or a hybrid lock is generated by the background interceptor and put into redis and session, and then step S8 is executed; Step S8: Use the background controller to control the front-end page to display and take out the lock and put it into the hidden domain.

2. According to claim 1, a method for anti-shaking of government affairs forms based on a hybrid lock strategy is characterized in that: In step S1, the initial states of the long-term lock, short-term lock and hybrid lock are all locked.

3. According to claim 2, a method for anti-shaking of government affairs forms based on a hybrid lock strategy is characterized in that: Both the long-term lock and the short-term lock are set with an effective time and a maximum renewal number. When any of the long-term lock and the short-term lock exceeds its set effective time or reaches the maximum renewal number, the state of the lock is automatically converted to an unlocked state.

4. According to claim 3, a method for anti-shaking of government affairs forms based on a hybrid lock strategy is characterized in that: The hybrid lock combines a short-term lock and a long-term lock. The hybrid lock will first use a high-performance short-term lock. When the short-term lock exceeds its set validity period and maximum renewal times, and the processing status of the corresponding form has not yet been completed, the hybrid lock will automatically convert to a long-term lock.

5. According to claim 1, a method for anti-shaking of government affairs forms based on a hybrid lock strategy is characterized in that: In step S2, when the form request is continuously triggered within a certain period of time, through the interface anti-shake technology combined with AOP technology, the backend does not need to process the request generated by each trigger, but only processes the request after the last trigger as the submitted form request.

6. According to claim 1, a method for anti-shaking of government affairs forms based on a hybrid lock strategy is characterized in that: When the form request is not the first form access request, in addition to step S1 and step S2, the following steps are also included: Step S9, determining whether the requested form is an anti-duplicate form, if the form is a common form, executing step S4, if the form is an anti-duplicate form, executing step S10; Step S10, determining whether the form is a long-term anti-duplicate form, if the form is a long-term anti-duplicate form, executing steps S11 to S14, if the form is a short-term anti-duplicate form, executing steps S15 to S22; Step S11: When the form is a long-term anti-duplicate form, determine whether the session is expired. If the session is not expired, execute step S12; if the session is expired, execute step S13; Step S12: If the session has not expired, when the long-term anti-duplicate form is submitted at the front end, the long-term lock requests the back end, and the back end checks the status of the long-term lock. If the long-term lock is in a locked state, repeated submission of the form is prohibited. If the long-term lock is in an unlocked state, step S8 is executed; Step S13: If the session expires, when the long-term anti-duplicate form is submitted on the front end, a lock is generated by the submitted information, and the hard disk is checked to see if there is an identical long-term lock. If there is an identical long-term lock, the identical long-term lock is loaded into the session and step S14 is executed. If there is no identical long-term lock, step S8 is executed. Step S14: by checking the status of the same long-term lock, if the same long-term lock is in a locked state, prohibiting repeated submission of the form; if the same long-term lock is in an unlocked state, executing step S8; Step S15: When the form is a short-term anti-duplicate form, determine whether the session is expired. If the session is not expired and the lock type is a short-term lock, execute step S16; if the session is expired and the lock type is a short-term lock, execute step S17; Step S16: If the session has not expired, when the short-term anti-duplicate form is submitted at the front end, the short-term lock requests the back end, and the back end checks the status of the short-term lock. If the short-term lock is in a locked state, repeated submission of the form is prohibited. If the short-term lock is in an unlocked state, step S8 is executed; Step S17: If the session expires, when the short-term anti-duplicate form is submitted at the front end, a short-term lock is generated by the submitted information, and the hard disk is checked to see if there is an identical short-term lock. If there is an identical short-term lock, the identical short-term lock is loaded into the session and step S18 is executed. If there is no identical short-term lock, step S8 is executed. Step S18: by checking the state of the same short-term lock, if the same short-term lock is in a locked state, prohibiting repeated submission of the form; if the same short-term lock is in an unlocked state, executing step S8; Step S19: When the form is a short-term anti-duplicate form, determine whether the session is expired. If the session is not expired and the lock type is a hybrid lock, execute step S20; if the session is expired and the lock type is a hybrid lock, execute step S21; Step S20: If the session has not expired, when the short-term anti-duplicate form is submitted at the front end, the hybrid lock requests the back end, and the back end checks the state of the hybrid lock. If the hybrid lock is in a locked state, repeated submission of the form is prohibited. If the hybrid lock is in an unlocked state, step S8 is executed. Step S21: If the session expires, when the short-term anti-duplicate form is submitted on the front end, a hybrid lock is generated based on the submitted information, and the hard disk is checked to see if there is an identical hybrid lock. If there is an identical hybrid lock, the identical hybrid lock is loaded into the session and step S22 is executed. If there is no identical hybrid lock, step S8 is executed. Step S22: Check the state of the same hybrid lock. If the same hybrid lock is in a locked state, prohibit repeated submission of the form. If the same hybrid lock is in an unlocked state, execute step S8.

7. According to claim 1, a system for anti-shaking of government forms based on a hybrid lock strategy is characterized in that: The modules include: Lock definition module, used to define lock types and lock rules; A form receiving module, connected to the lock definition module, for receiving a form request submitted by a front end; A first judgment module, connected to the form receiving module, for judging whether the request form is an anti-duplicate form; A common form processing module, connected to the first judgment module, for displaying the form on the front end through the control of the backend controller when the form is a common form; A second judgment module, connected to the first judgment module, is used to judge whether the anti-duplicate form is a long-term anti-duplicate form when the form is an anti-duplicate form; A long-term anti-duplicate form lock generation module, connected to the second judgment module, is used to generate a long-term lock through a background interceptor and store it in a database or file when the form is a long-term anti-duplicate form; A short-term anti-duplicate form lock generation module is connected to the second judgment module and is used to generate a short-term lock or a mixed lock through a background interceptor and store it in redis and session when the form is a short-term anti-duplicate form; The anti-duplicate form processing module is connected with the long-term anti-duplicate form lock generating module and the short-term anti-duplicate form lock generating module, and is used to control the front-end page to display through the background controller and take out the lock and put it into the hidden domain.

8. According to claim 1, a system for anti-shaking of government forms based on a hybrid lock strategy is characterized in that: When the form request is not the first form access request, in addition to the lock definition module, the form request submission module, the common form processing module, the first judgment module and the second judgment module, the following modules are also included: The third judgment module is used to judge whether the session has expired when the form is a long-term anti-duplicate form; The first processing module of the long-term anti-duplicate form is used for, when the session has not expired and the long-term anti-duplicate form is submitted at the front end, the long-term lock requests the back end, and the back end checks the status of the long-term lock. If the long-term lock is in the locked state, the repeated submission of the form is prohibited. If the long-term lock is in the unlocked state, the back-end controller controls the front-end page to display and takes out the lock and puts it into the hidden domain; The second processing module of the long-term anti-duplicate form is used to generate a lock through the submitted information when the session expires and the long-term anti-duplicate form is submitted on the front end, and to check whether the same long-term lock exists in the hard disk. If the same long-term lock exists, the same long-term lock is loaded into the session. If the same long-term lock does not exist, the background controller is used to control the front-end page to display and take out the lock and put it into the hidden domain; The third processing module of the long-term anti-duplicate form is used to check the status of the same long-term lock in the second processing module of the long-term anti-duplicate form. If the same long-term lock is in a locked state, repeated submission of the form is prohibited. If the same long-term lock is in an unlocked state, the front-end page is controlled by the background controller to display and take out the lock and put it into the hidden domain; The fourth judgment module is used to judge whether the session is expired when the form is a short-term anti-duplicate form; The first short-term anti-duplicate form processing module is connected to the fourth judgment module, and is used for, if the session has not expired and the short-term anti-duplicate form includes a short-term lock, when the short-term anti-duplicate form is submitted at the front end, the short-term lock requests the back end, and the back end checks the status of the short-term lock. If the short-term lock is in a locked state, repeated submission of the form is prohibited. If the short-term lock is in an unlocked state, the back-end controller is used to control the front-end page to display and take out the lock and put it into the hidden domain; The second processing module of the short-term anti-duplicate form is connected to the fourth judgment module, and is used for generating a short-term lock through the submitted information when the session is expired and the short-term anti-duplicate form includes a short-term lock, and checking whether the same short-term lock exists in the hard disk. If the same short-term lock exists, the same short-term lock is loaded into the session. If the same short-term lock does not exist, the background controller is used to control the front-end page to display and take out the lock and put it into the hidden domain; The third short-term anti-duplicate form processing module is connected to the second short-term anti-duplicate form processing module, and is used to check the status of the same short-term lock after loading the same lock into the session. If the same short-term lock is in a locked state, repeated submission of the form is prohibited. If the same short-term lock is in an unlocked state, the front-end page is controlled by the background controller to display and the lock is taken out and put into the hidden domain; The fourth processing module of the short-term anti-duplicate form is connected to the fourth judgment module, and is used for, if the session has not expired and the short-term anti-duplicate form includes a hybrid lock, when the short-term anti-duplicate form is submitted at the front end, the hybrid lock requests the back end, and the back end checks the state of the hybrid lock. If the short-term lock is in a locked state, repeated submission of the form is prohibited. If the short-term lock is in an unlocked state, the back-end controller controls the front-end page to display and takes out the lock and puts it into the hidden domain; The fifth processing module of the short-term anti-duplicate form is connected to the fourth judgment module, and is used for generating a hybrid lock through the submitted information when the session is expired and the short-term anti-duplicate form includes a hybrid lock, and checking whether the same hybrid lock exists in the hard disk. If the same hybrid lock exists, the same hybrid lock is loaded into the session. If the same hybrid lock does not exist, the background controller is used to control the front-end page to display and take out the lock and put it into the hidden domain; The sixth processing module of the short-term anti-duplicate form and the fifth processing module of the short-term anti-duplicate form are used to check the status of the same hybrid lock after loading the same hybrid lock into the session. If the same hybrid lock is in a locked state, repeated submission of the form is prohibited. If the same hybrid lock is in an unlocked state, the front-end page is controlled by the background controller to display it and the lock is taken out and placed in the hidden field.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements a method for anti-shaking of government affairs forms based on a hybrid lock strategy as described in any one of claims 1 to 6.

10. An electronic device, characterized in that: It includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements a method for anti-shaking of government affairs forms based on a hybrid lock strategy as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Database transaction concurrency control method for mixing optimistic locks and pessimistic locks

    CN111797107A

  • Digital assistant user interface and response mode

    CN112099720A

  • Method and device for preventing form repeated submission based on distributed cache system and computer readable storage medium

    CN117668877A

  • System for organizing document data

    US20220043772A1