A government form anti-shake method and system based on a hybrid lock strategy

CN118885490BActive Publication Date: 2026-09-22上海通办信息服务有限公司
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

[0003]本发明提供一种基于混合锁策略的政务表单防抖方法及系统,以解决在复杂网络环境下,表单重复提交失效的问题

Benefits of technology

[0060]本发明提出了一种基于混合锁策略的政务表单防抖方法及装置,解决了在复杂网络环境下,表单重复提交失效的问题。(1)通过融合AOP接口防抖、Redis短期锁和数据库长期锁,本发明显著提高了政务表单提交的安全性和稳定性,有效杜绝了因表单重复提交带来的数据冲突和业务错误,提升了系统的安全性与稳定性;(2)通过引入Redis分布式锁,极大地提高了表单提交处理的速度和并发能力,减少无效请求对系统资源的消耗,同时,锁续期机制也为应对复杂网络环境提供了更为精细化的控制,优化了系统性能与响应速度;(3)混合锁策略赋予了系统极强的业务适应性和扩展性,无论是简单快速的日常表单提交,还是流程繁琐、耗时长久的特殊表单,都能够得到精准匹配的防重复提交保护,极大提升了政务信息化服务水平和群众满意度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118885490B_ABST
    Figure CN118885490B_ABST
Patent Text Reader

Abstract

The application provides a government form anti-shake method and device based on a mixed lock strategy, solves the problem of form repeated submission failure in a complex network environment.(1) By fusing AOP interface anti-shake, Redis short-term lock and database long-term lock, the application significantly improves the safety and stability of government form submission, effectively eliminates data conflicts and business errors caused by form repeated submission, and improves the safety and stability of the system;(2) By introducing Redis distributed lock, the speed and concurrency capability of form submission processing are greatly improved, the consumption of system resources by invalid requests is reduced, and the lock renewal mechanism also provides more refined control for complex network environment, and optimizes the system performance and response speed;(3) The mixed lock strategy gives the system strong business adaptability and expansibility, whether it is simple and fast daily form submission or complex and time-consuming special form, accurate anti-repeated submission protection can be obtained, and the government informatization service level and the public satisfaction are greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of government services, and in particular to a method and system for debouncing government forms based on a hybrid locking strategy. Background Technology

[0002] Existing government form systems often face the problem of duplicate form submissions when handling high-concurrency submissions. This can lead to data redundancy and even cause business logic chaos. Traditional solutions typically prevent duplicate submissions through client-side controls (such as disabling buttons) or by adding unique identifiers on the server side. However, these methods may fail in complex network environments. Summary of the Invention

[0003] This invention provides a method and system for debouncing government forms based on a hybrid locking strategy to solve the problem of repeated form submission failures in complex network environments.

[0004] In the first aspect, the present invention provides a method for debouncing government forms based on a hybrid locking strategy, specifically including the following steps:

[0005] Step S1: Define the lock type and lock rules;

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

[0007] Step S3: Determine whether the requested form is a duplicate prevention form. If the form is a normal form, proceed to step S4. If the form is a duplicate prevention form, proceed to step S5.

[0008] Step S4: When the form is a regular form, it is displayed on the front end through the backend controller.

[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, proceed to step S6. If the anti-duplicate form is a short-term anti-duplicate form, proceed to step S7.

[0010] Step S6: When the form is a long-term anti-duplicate form, after generating a long-term lock through the background interceptor and putting it into the database or file, proceed to step S8.

[0011] Step S7: When the form is a short-lived anti-duplicate form, generate a short-lived lock or a hybrid lock through the background interceptor and put it into Redis and session, then execute step S8;

[0012] Step S8: Control the front-end page to display the lock through the back-end controller and put the lock into the hidden field.

[0013] Preferably, the initial state of the long-term lock, the short-term lock, and the hybrid lock is a locked state.

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

[0015] Preferably, the hybrid lock combines short-term and long-term locks. The hybrid lock first uses a high-performance short-term lock. When the short-term lock exceeds its set validity period and maximum number of renewals, and the processing status of the corresponding form is still not completed, the hybrid lock automatically converts into a long-term lock.

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

[0017] Preferably, when the form request is not the first submission, in addition to steps S1-S2, the following steps are also included:

[0018] Step S9: Determine whether the requested form is a duplicate prevention form. If the form is a normal form, proceed to step S4. If the form is a duplicate prevention form, proceed to step S10.

[0019] Step S10: Determine whether the form is a long-term anti-duplicate form. If the form is a long-term anti-duplicate form, proceed to steps S11-S14. If the form is a short-term anti-duplicate form, proceed to steps S15-S22.

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

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

[0022] Step S13: If the session expires, when submitting a long-term anti-duplicate form on the front end, a lock is generated based on the submitted information, and the disk is checked to see if there is a matching long-term lock. If there is a matching long-term lock, the matching long-term lock is loaded into the session and step S14 is executed. If there is no matching 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, the form is prohibited from being submitted repeatedly; if the same long-term lock is in an unlocked state, then step S8 is executed.

[0024] Step S15: When the form is a short-lived anti-duplicate form, determine whether the session has expired. If the session has not expired and the lock type is a short-lived lock, then proceed to step S16. If the session has expired and the lock type is a short-lived lock, then proceed to step S17.

[0025] Step S16: If the session has not expired, when the short-term anti-duplicate form is submitted on the front end, the short-term lock requests the back end. The back end checks the status of the short-term lock. If the short-term lock is in a locked state, the form is prohibited from being submitted repeatedly. If the short-term lock is in an unlocked state, then step S8 is executed.

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

[0027] Step S18: By checking the status of the same short-term lock, if the same short-term lock is in a locked state, the form is prohibited from being submitted repeatedly; if the same short-term lock is in an unlocked state, then step S8 is executed.

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

[0029] Step S20: If the session has not expired, when the short-term anti-duplicate form is submitted on the front end, the hybrid lock requests the back end to check the status of the hybrid lock. If the hybrid lock is in a locked state, the form is prohibited from being submitted repeatedly. If the hybrid lock is in an unlocked state, then step S8 is executed.

[0030] Step S21: If the session expires, when submitting a short-term anti-duplicate form on the front end, a hybrid lock is generated based on the submitted information, and the disk is checked to see if the same hybrid lock exists. If the same hybrid lock exists, the same hybrid lock is loaded into the session and step S22 is executed. If the same hybrid lock does not exist, step S8 is executed.

[0031] Step S22: By checking the state of the same hybrid lock, if the same hybrid lock is in a locked state, the form is prohibited from being submitted repeatedly; if the same hybrid lock is in an unlocked state, then step S8 is executed.

[0032] Secondly, the present invention also provides a government form debouncing system based on a hybrid locking strategy, specifically including the following modules:

[0033] The lock definition module is used to define lock types and lock rules;

[0034] The form receiving module, connected to the lock definition module, is used to receive form requests submitted by the front end;

[0035] The first judgment module, connected to the form receiving module, is used to determine whether the requested form is an anti-duplicate form;

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

[0037] The second judgment module, connected to the first judgment module, is used to determine 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 is connected to the second judgment module. When the form is a long-term anti-duplicate form, it generates a long-term lock through a background interceptor and puts it into a database or file.

[0039] A short-term anti-duplicate form lock generation module is connected to the second judgment module. When the form is a short-term anti-duplicate form, it generates a short-term lock or a hybrid lock through the background interceptor and puts it into Redis and session.

[0040] The anti-duplicate form processing module is connected to the long-term anti-duplicate form lock generation module and the short-term anti-duplicate form lock generation module. It is used to control the front-end page to display the form through the back-end controller and retrieve the lock and put it into the hidden field.

[0041] Preferably, the initial state of the long-term lock, the short-term lock, and the hybrid lock is a locked state.

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

[0043] Preferably, the hybrid lock combines short-term and long-term locks. The hybrid lock first uses a high-performance short-term lock. When the short-term lock exceeds its set validity period and maximum number of renewals, and the form's processing status is still not completed, the hybrid lock automatically switches to a long-term lock.

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

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

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

[0047] The first processing module for long-term anti-duplicate forms is used to request the backend to use the long-term lock when the long-term anti-duplicate form is submitted on the frontend before the session expires. The backend checks the status of the long-term lock. If the long-term lock is in a locked state, the form is prohibited from being submitted repeatedly. If the long-term lock is in an unlocked state, the backend controller controls the frontend page to display the form and retrieves the lock and puts it into the hidden domain.

[0048] The second processing module for long-term anti-duplicate forms is used to generate a lock based on the submitted information when the session expires and the long-term anti-duplicate form is submitted on the front end. It then checks the hard drive to see if there is a matching long-term lock. If there is a matching long-term lock, it loads the matching long-term lock into the session. If there is no matching long-term lock, it controls the front-end page to display the lock through the back-end controller and retrieves the lock and puts it into the hidden domain.

[0049] The third processing module for long-term anti-duplicate forms is used to check the status of the same long-term lock in the second processing module for long-term anti-duplicate forms. If the same long-term lock is locked, the form is prohibited from being submitted repeatedly. If the same long-term lock is unlocked, the front-end page is controlled by the back-end controller to display the form and the lock is taken out and placed in the hidden field.

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

[0051] The first processing module for short-term anti-duplicate forms, connected to the fourth judgment module, is used to, 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 on the front end, request the back end to check the status of the short-term lock. If the short-term lock is in a locked state, the form is prohibited from being submitted repeatedly. If the short-term lock is in an unlocked state, the front end page is controlled by the back end controller to display the form and the lock is retrieved and placed in a hidden field.

[0052] The second processing module for short-term anti-duplicate forms, connected to the fourth judgment module, is used to generate a short-term lock based on the submitted information when the short-term anti-duplicate form is submitted on the front end if the session has expired and the short-term anti-duplicate form includes a short-term lock. It then checks the hard drive to see if there is a matching short-term lock. If there is a matching short-term lock, it loads the matching short-term lock into the session. If there is no matching short-term lock, it controls the front-end page to display the lock through the back-end controller and retrieves the lock and puts it into the hidden domain.

[0053] The third processing module for short-term anti-duplicate forms, connected to the second processing module for short-term anti-duplicate forms, 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 locked, the form is prohibited from being submitted repeatedly. If the same short-term lock is unlocked, the front-end page is controlled by the back-end controller to display the form and the lock is retrieved and placed in the hidden field.

[0054] The fourth processing module for short-term anti-duplicate forms, connected to the fourth judgment module, is used to request the backend when the short-term anti-duplicate form is submitted on the frontend if the session has not expired and the short-term anti-duplicate form includes a hybrid lock. The backend checks the status of the hybrid lock. If the short-term lock is in a locked state, the form is prohibited from being submitted repeatedly. If the short-term lock is in an unlocked state, the backend controller controls the frontend page to display the form and retrieves the lock and puts it into the hidden domain.

[0055] The fifth processing module for short-term anti-duplicate forms, connected to the fourth judgment module, is used to generate a hybrid lock based on the submitted information when the short-term anti-duplicate form is submitted on the front end if the session has expired and the short-term anti-duplicate form includes a hybrid lock. It then checks the hard drive to see if the same hybrid lock exists. If the same hybrid lock exists, it loads the same hybrid lock into the session. If the same hybrid lock does not exist, it controls the front-end page to display the lock through the back-end controller and retrieves the lock and puts it into the hidden domain.

[0056] The sixth processing module for short-term anti-duplicate forms, together with the fifth processing module for short-term anti-duplicate forms, is 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, the form is prohibited from being submitted repeatedly. If the same hybrid lock is in an unlocked state, the front-end page is controlled by the back-end controller to display the form and the lock is retrieved and placed in the hidden field.

[0057] Thirdly, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the government form debouncing method based on a hybrid locking strategy as described in any one of the first aspects of this application.

[0058] Fourthly, the present invention also provides an electronic device, the electronic device comprising: a memory storing a computer program; and a processor communicatively connected to the memory, which, when the computer program is invoked, executes the government form debouncing method based on a hybrid locking strategy as described in any one of the first aspects of this application.

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

[0060] This invention proposes a method and device for debouncing government forms based on a hybrid locking strategy, which solves the problem of form submission failure due to duplicate submissions in complex network environments. (1) By integrating AOP interface debouncing, Redis short-term locks and database long-term locks, this invention significantly improves the security and stability of government form submissions, effectively eliminates data conflicts and business errors caused by duplicate form submissions, and enhances 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 provides more refined control for dealing with complex network environments, and optimizes system performance and response speed; (3) The hybrid locking strategy gives the system strong business adaptability and scalability. Whether it is a simple and fast daily form submission or a special form with a complicated process and long time consumption, it can obtain accurate matching protection against duplicate submissions, which greatly improves the level of government information services and public satisfaction. Attached Figure Description

[0061] The accompanying drawings, which constitute a part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an undue limitation of the invention. In the drawings:

[0062] Figure 1 This is a flowchart of a government form debouncing method based on a hybrid locking strategy, according to a preferred embodiment of the present invention.

[0063] Figure 2 This is a flowchart illustrating a non-first-time form access request submission in a government form debouncing method based on a hybrid locking strategy according to a preferred embodiment of the present invention.

[0064] Figure 3 This is a schematic diagram of a government form debouncing system based on a hybrid locking strategy, according to a preferred embodiment of the present invention.

[0065] Figure 4 This is a schematic diagram of the system structure of a government form debouncing system based on a hybrid locking strategy, according to a preferred embodiment of the present invention, when a form access request is submitted for the first time.

[0066] Figure 5 This is a schematic diagram of a government form debouncing method based on a hybrid locking strategy according to a preferred embodiment of the present invention.

[0067] Figure 6 This is a schematic diagram of a debouncing system for government forms based on a hybrid locking strategy, according to a preferred embodiment of the present invention. Detailed Implementation

[0068] This invention provides a method and system for debouncing government forms based on a hybrid locking strategy. To make the objectives, technical solutions, and effects of this invention clearer and more explicit, the invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only for explaining the invention and are not intended to limit the invention.

[0069] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be used interchangeably where appropriate. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products, or apparatuses.

[0070] Example 1:

[0071] like Figures 1-2 As shown in the figure, the government form debouncing method based on a hybrid locking strategy described in this embodiment specifically includes the following steps:

[0072] Step S1: Define the lock type and lock rules.

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

[0074] The initial state of the long-term lock, short-term lock, and hybrid lock is a locked state.

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

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

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

[0078] Step S3: Determine whether the requested form is a duplicate prevention form. If the form is a normal form, proceed to step S4. If the form is a duplicate prevention form, proceed to step S5.

[0079] Step S4: When the form is a regular form, it is displayed on the front end through the backend controller.

[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, proceed to step S6. If the anti-duplicate form is a short-term anti-duplicate form, proceed to step S7.

[0081] Step S6: When the form is a long-term anti-duplicate form, after generating a long-term lock through the background interceptor and putting it into the database or file, proceed to step S8.

[0082] Step S7: When the form is a short-lived anti-duplicate form, generate a short-lived lock or a hybrid lock through the background interceptor and put it into Redis and session, then execute step S8.

[0083] Step S8: Control the front-end page to display the lock through the back-end controller and put the lock into the hidden field.

[0084] Optionally, when the form request is not the first time a form access request has been submitted, in addition to steps S1-S2, steps S9-S22 are also included.

[0085] Step S9: Determine whether the request form is an anti-duplicate form. If the form is a normal form, proceed to step S4. If the form is an anti-duplicate form, proceed to 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, proceed to steps S11-S14. If the form is a short-term anti-duplicate form, proceed to steps S15-S22.

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

[0088] Step S12: If the session has not expired, when the long-term anti-duplicate form is submitted on the front end, the long-term lock requests the back end. The back end checks the status of the long-term lock. If the long-term lock is in a locked state, the form is prohibited from being submitted repeatedly. If the long-term lock is in an unlocked state, then step S8 is executed.

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

[0090] Step S14: By checking the status of the same long-term lock, if the same long-term lock is in a locked state, the form is prohibited from being submitted repeatedly; if the same long-term lock is in an unlocked state, then step S8 is executed.

[0091] Step S15: When the form is a short-lived anti-duplicate form, determine whether the session has expired. If the session has not expired and the lock type is a short-lived lock, then proceed to step S16. If the session has expired and the lock type is a short-lived lock, then proceed to step S17.

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

[0093] Step S17: If the session expires, when submitting a short-term anti-duplicate form on the front end, a short-term lock is generated based on the submitted information, and the disk is checked to see if there is a matching short-term lock. If there is a matching short-term lock, the matching short-term lock is loaded into the session and step S18 is executed. If there is no matching short-term lock, step S8 is executed.

[0094] Step S18: By checking the status of the same short-lived lock, if the same short-lived lock is in a locked state, the form is prohibited from being submitted repeatedly; if the same short-lived lock is in an unlocked state, then step S8 is executed.

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

[0096] Step S20: If the session has not expired, when the short-term anti-duplicate form is submitted on the front end, the hybrid lock requests the back end to check the status of the hybrid lock. If the short-term lock is in a locked state, the form is prohibited from being submitted repeatedly. If the short-term lock is in an unlocked state, then step S8 is executed.

[0097] Step S21: If the session expires, when submitting a short-term anti-duplicate form on the front end, a hybrid lock is generated based on the submitted information, and the disk is checked to see if the same hybrid lock exists. If the same hybrid lock exists, it is loaded into the session and step S22 is executed. If the same hybrid lock does not exist, step S8 is executed.

[0098] Step S22: By checking the state of the same hybrid lock, if the same hybrid lock is in a locked state, the form is prohibited from being submitted repeatedly; if the same hybrid lock is in an unlocked state, then step S8 is executed.

[0099] Example 2:

[0100] like Figures 3-4 As shown in this embodiment, a government form debouncing system based on a hybrid locking strategy specifically includes the following modules:

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

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

[0103] The initial state of the long-term lock, short-term lock, and hybrid lock is a locked state.

[0104] Both the long-term lock and the short-term lock are set with an effective time and a maximum number of renewals. When either the long-term lock or the short-term lock exceeds its set effective time or reaches the maximum number of renewals, the lock's state automatically changes to an unlocked state.

[0105] The hybrid lock combines short-term and long-term locks. The hybrid lock first uses a high-performance short-term lock. When the short-term lock exceeds its validity period and maximum number of renewals, if the form status is not yet in the completed state, the hybrid lock automatically switches to a long-term lock.

[0106] The form receiving module, connected to the lock definition module, is used to submit form requests.

[0107] The first judgment module, connected to the form receiving module, is used to determine whether the requested form is a duplicate prevention form.

[0108] The ordinary form processing module, connected to the first judgment module, is used to display the form on the front end through the backend controller when the form is a non-anti-duplicate form (i.e., an ordinary form).

[0109] The second judgment module, connected to the first judgment module, is used to determine 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. When the form is a long-term anti-duplicate form, it generates a long-term lock through the background interceptor and puts it into the database or file.

[0111] The short-term anti-duplicate form lock generation module is connected to the second judgment module. When the form is a short-term anti-duplicate form, it generates a short-term lock or a hybrid lock through the background interceptor and puts it into Redis and session.

[0112] The anti-duplicate form processing module is connected to the long-term anti-duplicate form lock generation module and the short-term anti-duplicate form lock generation module. It is used to control the front-end page to display the form through the back-end controller and retrieve the lock and put it into the hidden field.

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

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

[0115] The first processing module for long-term anti-duplicate forms is used to request a long-term lock from the backend when the long-term anti-duplicate form is submitted on the frontend before the session expires. The backend checks the status of the long-term lock. If the long-term lock is locked, the form is prohibited from being submitted repeatedly. If the long-term lock is unlocked, the backend controller controls the frontend page to display the form and retrieves the lock and puts it into the hidden domain.

[0116] The second processing module for long-term anti-duplicate forms is used to generate a lock based on the submitted information when the session expires and the long-term anti-duplicate form is submitted on the front end. It then checks the hard drive to see if there is a matching long-term lock. If there is a matching long-term lock, it loads the matching long-term lock into the session. If there is no matching long-term lock, the backend controller controls the front-end page to display the lock and retrieves it into the hidden domain.

[0117] The third processing module for long-term anti-duplicate forms is used to check the status of the same long-term lock in the second processing module for long-term anti-duplicate forms. If the same long-term lock is locked, the form is prohibited from being submitted repeatedly. If the same long-term lock is unlocked, the front-end page is controlled by the back-end controller to display the form and the lock is retrieved and placed in the hidden field.

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

[0119] The first processing module for short-term anti-duplicate forms, connected to the fourth judgment module, is used to, 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 on the front end, request the back end to check the status of the short-term lock. If the short-term lock is in a locked state, the form is prohibited from being submitted repeatedly. If the short-term lock is in an unlocked state, the back end controller controls the front end page to display the form and retrieves the lock and puts it into a hidden field.

[0120] The second processing module for short-term anti-duplicate forms, connected to the fourth judgment module, is used to generate a short-term lock based on the submitted information when the short-term anti-duplicate form is submitted on the front end if the session has expired and the short-term anti-duplicate form includes a short-term lock. It then checks the hard drive to see if there is an identical short-term lock. If there is an identical short-term lock, it loads the identical short-term lock into the session. If there is no identical short-term lock, it controls the front-end page to display the lock through the back-end controller and retrieves the lock and puts it into the hidden domain.

[0121] The third processing module for short-term anti-duplicate forms, connected to the second processing module for short-term anti-duplicate forms, 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 locked, the form is prohibited from being submitted repeatedly. If the same short-term lock is unlocked, the front-end page is controlled by the back-end controller to display the form and the lock is retrieved and placed in the hidden field.

[0122] The fourth processing module for short-term anti-duplicate forms, connected to the fourth judgment module, is used to request the hybrid lock from the backend when the short-term anti-duplicate form is submitted on the frontend if the session has not expired and the short-term anti-duplicate form includes a hybrid lock. The backend checks the status of the hybrid lock. If the short-term lock is in a locked state, the form is prohibited from being submitted repeatedly. If the short-term lock is in an unlocked state, the backend controller controls the frontend page to display the form and retrieves the lock and puts it into a hidden domain.

[0123] The fifth processing module for short-term anti-duplicate forms, connected to the fourth judgment module, is used to generate a hybrid lock based on the submitted information when the short-term anti-duplicate form is submitted on the front end if the session has expired and the short-term anti-duplicate form includes a hybrid lock. The module then checks the hard drive to see if the same hybrid lock exists. If the same hybrid lock exists, it is loaded into the session. If the same hybrid lock does not exist, the front-end page is controlled by the back-end controller to display the lock and the lock is retrieved and placed in the hidden domain.

[0124] The sixth processing module for short-term anti-duplicate forms, together with the fifth processing module for short-term anti-duplicate forms, is 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, the form is prohibited from being submitted repeatedly. If the same hybrid lock is in an unlocked state, the front-end page is controlled by the back-end controller to display the form and the lock is retrieved and placed in the hidden field.

[0125] Example 3:

[0126] like Figure 5 The diagram shown is a flowchart of a government form debouncing method based on a hybrid locking strategy as described in this embodiment.

[0127] First, define the lock type and lock rules, such as defining the lock type as: long-term lock, short-term lock, and hybrid lock.

[0128] The long-term lock, short-term lock, and hybrid lock all have set validity periods and a maximum number of renewals. When a lock exceeds its validity period, its validity can be extended by renewing the lock.

[0129] Hybrid locks combine the characteristics of short-term and long-term locks. In the short term, they exhibit the characteristics of short-term locks, using distributed locks to improve performance. Once the validity period of a short-term lock is exceeded or the maximum number of renewals for a short-term lock is exceeded, the hybrid lock exhibits the characteristics of a long-term lock, thus extending the lock's validity period.

[0130] After a user submits an access form request, the system first determines the form type of the URL corresponding to the method annotation by using anti-duplicate interception, and then classifies the form into a regular form and an anti-duplicate form.

[0131] When the form is a regular form, the front-end display is directly controlled by the back-end controller.

[0132] When the form is a duplicate prevention form, it will further determine whether the duplicate prevention form is long-term or short-term. Long-term duplicate prevention forms generate long-term locks through the background interceptor, while short-term duplicate prevention forms generate short-term locks or mixed locks through the background interceptor.

[0133] Long-term locks are stored on the hard drive, while short-term or mixed locks are stored in Redis and the session.

[0134] When a request to access the form is submitted for the first time, the system checks whether the session has expired and whether the lock is locked in order to perform the corresponding operation, as described in Example 1.

[0135] Example 4:

[0136] like Figure 6 The image shows a schematic diagram of the form's debounce system.

[0137] The forms submitted by both Normal Form Submission 1 and Normal Form Submission 2 are normal forms.

[0138] The form submitted under Anti-Duplicate Form 1 is an Anti-Duplicate Form with Hybrid Locking.

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

[0140] Normal form submission 1 and normal form submission 2 are directly submitted to the form receiving system, and the forms remain unlocked even after normal form submission 1 and normal form submission 2 have requested to submit the forms N times.

[0141] For forms designed to prevent duplicate submissions, the initial form request is always submitted directly to the form receiving system. When the form is not being submitted for the first time and is in a locked state, the system needs to read the configuration after submission and then start the application and load the rules based on that configuration.

[0142] from Figure 4 As can be seen, the lengths displayed for short-term and long-term locks indicate the effective time of the short-term lock. Hybrid locks include both short-term and long-term locks, meaning that when a short-term lock fails, it is converted into a long-term lock.

[0143] The specific embodiments of the present invention have been described in detail above, but they are merely 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 to the present invention are also within the scope of the present invention. Therefore, all equivalent transformations and modifications made without departing from the spirit and scope of the present invention should be covered within the scope of the present invention.

Claims

1. A method for debouncing government forms based on a hybrid locking strategy, characterized in that, Specifically, the steps include the following: Step S1: Define the lock type and lock rules; Step S2: Receive the form request submitted by the front end; Step S3: Determine whether the requested form is a duplicate prevention form. If the form is a normal form, proceed to step S4. If the form is a duplicate prevention form, proceed to step S5. Step S4: When the form is a regular form, it is displayed on the front end through the backend controller. 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, proceed to step S6. If the anti-duplicate form is a short-term anti-duplicate form, proceed to step S7. Step S6: When the form is a long-term anti-duplicate form, after generating a long-term lock through the background interceptor and putting it into the database or file, proceed to step S8. Step S7: When the form is a short-lived anti-duplicate form, generate a short-lived lock or a hybrid lock through the background interceptor and put it into Redis and session, then execute step S8; Step S8: Control the front-end page to display the lock through the back-end controller and put the lock into the hidden field; When the form request is not the first time a form access request has been submitted, in addition to steps S1-S2, the following steps are also included: Step S9: Determine whether the requested form is a duplicate prevention form. If the form is a normal form, proceed to step S4. If the form is a duplicate prevention form, proceed to step S10. Step S10: Determine whether the form is a long-term anti-duplicate form. If the form is a long-term anti-duplicate form, proceed to steps S11-S14. If the form is a short-term anti-duplicate form, proceed to steps S15-S22. Step S11: When the form is a long-term anti-duplicate form, determine whether the session has expired. If the session has not expired, proceed to step S12; if the session has expired, proceed to step S13. Step S12: If the session has not expired, when the long-term anti-duplicate form is submitted on the front end, the long-term lock requests the back end and checks the status of the long-term lock through the back end. If the long-term lock is in a locked state, the form is prohibited from being submitted repeatedly. If the long-term lock is in an unlocked state, then step S8 is executed. Step S13: If the session expires, when submitting a long-term anti-duplicate form on the front end, a lock is generated based on the submitted information, and the disk is checked to see if there is a matching long-term lock. If there is a matching long-term lock, the matching long-term lock is loaded into the session and step S14 is executed. If there is no matching 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, the form is prohibited from being submitted repeatedly; if the same long-term lock is in an unlocked state, then step S8 is executed. Step S15: When the form is a short-lived anti-duplicate form, determine whether the session has expired. If the session has not expired and the lock type is a short-lived lock, then proceed to step S16. If the session has expired and the lock type is a short-lived lock, then proceed to step S17. Step S16: If the session has not expired, when the short-term anti-duplicate form is submitted on the front end, the short-term lock requests the back end. The back end checks the status of the short-term lock. If the short-term lock is in a locked state, the form is prohibited from being submitted repeatedly. If the short-term lock is in an unlocked state, then step S8 is executed. Step S17: If the session expires, when submitting the short-term anti-duplicate form on the front end, a short-term lock is generated based on the submitted information, and the disk is checked to see if there is a matching short-term lock. If there is a matching short-term lock, the matching short-term lock is loaded into the session and step S18 is executed. If there is no matching short-term lock, step S8 is executed. Step S18: By checking the status of the same short-term lock, if the same short-term lock is in a locked state, the form is prohibited from being submitted repeatedly; if the same short-term lock is in an unlocked state, then step S8 is executed. Step S19: When the form is a short-term anti-duplicate form, determine whether the session has expired. If the session has not expired and the lock type is a hybrid lock, then proceed to step S20. If the session has expired and the lock type is a hybrid lock, then proceed to step S21. Step S20: If the session has not expired, when the short-term anti-duplicate form is submitted on the front end, the hybrid lock requests the back end to check the status of the hybrid lock. If the hybrid lock is in a locked state, the form is prohibited from being submitted repeatedly. If the hybrid lock is in an unlocked state, then step S8 is executed. Step S21: If the session expires, when submitting a short-term anti-duplicate form on the front end, a hybrid lock is generated based on the submitted information, and the disk is checked to see if the same hybrid lock exists. If the same hybrid lock exists, the same hybrid lock is loaded into the session and step S22 is executed. If the same hybrid lock does not exist, step S8 is executed. Step S22: By checking the state of the same hybrid lock, if the same hybrid lock is in a locked state, the form is prohibited from being submitted repeatedly; if the same hybrid lock is in an unlocked state, then step S8 is executed.

2. The method for debouncing government forms based on a hybrid locking strategy according to claim 1, characterized in that, In step S1, the initial state of the long-term lock, the short-term lock, and the hybrid lock is all locked.

3. The method for debouncing government forms based on a hybrid locking strategy according to claim 2, characterized in that, Both the long-term lock and the short-term lock are set with an effective time and a maximum number of renewals. When either the long-term lock or the short-term lock exceeds its set effective time or reaches the maximum number of renewals, the lock's state automatically changes to an unlocked state.

4. The method for debouncing government forms based on a hybrid locking strategy according to claim 3, characterized in that, The hybrid lock combines short-term and long-term locks. The hybrid lock first uses a high-performance short-term lock. When the short-term lock exceeds its set validity period and maximum number of renewals, and the processing status of the corresponding form is still not completed, the hybrid lock automatically converts into a long-term lock.

5. The method for debouncing government forms based on a hybrid locking strategy according to claim 1, characterized in that, In step S2, when the form request is triggered continuously within a certain time period, the backend does not need to process each triggered request through interface debouncing technology combined with AOP technology. Instead, it only processes the request after the last trigger as the submitted form request.

6. A system for debouncing government forms based on a hybrid locking strategy, characterized in that, The method for debouncing government forms based on a hybrid locking strategy as described in claim 1 specifically includes the following modules: The lock definition module is used to define lock types and lock rules; The form receiving module, connected to the lock definition module, is used to receive form requests submitted by the front end; The first judgment module is connected to the form receiving module and is used to determine whether the requested form is an anti-duplicate form; A standard form processing module, connected to the first judgment module, is used to display the form on the front end through a backend controller when the form is a standard form. The second judgment module, connected to the first judgment module, is used to determine 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 is connected to the second judgment module. When the form is a long-term anti-duplicate form, it generates a long-term lock through a background interceptor and puts it into a database or file. A short-term anti-duplicate form lock generation module is connected to the second judgment module. When the form is a short-term anti-duplicate form, it generates a short-term lock or a hybrid lock through the background interceptor and puts it into Redis and session. The anti-duplicate form processing module is connected to the long-term anti-duplicate form lock generation module and the short-term anti-duplicate form lock generation module. It is used to control the front-end page to display the form through the back-end controller and retrieve the lock and put it into the hidden field.

7. A system for debouncing government forms based on a hybrid locking strategy according to claim 6, characterized in that, When the form request is not the first time a form access request has been submitted, in addition to the lock definition module, form request submission module, ordinary form processing module, first judgment module, and second judgment module, the following modules are also included: The third judgment module is used to determine whether the session has expired when the form is a long-term anti-duplicate form; The first processing module for long-term anti-duplicate forms is used to request the backend to use the long-term lock when the long-term anti-duplicate form is submitted on the frontend before the session expires. The backend checks the status of the long-term lock. If the long-term lock is in a locked state, the form is prohibited from being submitted repeatedly. If the long-term lock is in an unlocked state, the backend controller controls the frontend page to display the form and retrieves the lock and puts it into the hidden domain. The second processing module for long-term anti-duplicate forms is used to generate a lock based on the submitted information when the session expires and the long-term anti-duplicate form is submitted on the front end. It then checks the hard drive to see if there is a matching long-term lock. If there is a matching long-term lock, it loads the matching long-term lock into the session. If there is no matching long-term lock, it controls the front-end page to display the lock through the back-end controller and retrieves the lock and puts it into the hidden domain. The third processing module for long-term anti-duplicate forms is used to check the status of the same long-term lock in the second processing module for long-term anti-duplicate forms. If the same long-term lock is locked, the form is prohibited from being submitted repeatedly. If the same long-term lock is unlocked, the front-end page is controlled by the back-end controller to display the form and the lock is taken out and placed in the hidden field. The fourth judgment module is used to determine whether the session has expired when the form is a short-term anti-duplicate form; The first processing module for short-term anti-duplicate forms, connected to the fourth judgment module, is used to, 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 on the front end, request the back end to check the status of the short-term lock. If the short-term lock is in a locked state, the form is prohibited from being submitted repeatedly. If the short-term lock is in an unlocked state, the front end page is controlled by the back end controller to display the form and the lock is retrieved and placed in a hidden field. The second processing module for short-term anti-duplicate forms, connected to the fourth judgment module, is used to generate a short-term lock based on the submitted information when the short-term anti-duplicate form is submitted on the front end if the session has expired and the short-term anti-duplicate form includes a short-term lock. It then checks the hard drive to see if there is a matching short-term lock. If there is a matching short-term lock, it loads the matching short-term lock into the session. If there is no matching short-term lock, it controls the front-end page to display the lock through the back-end controller and retrieves the lock and puts it into the hidden domain. The third processing module for short-term anti-duplicate forms is connected to the second processing module for short-term anti-duplicate forms. It 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 locked, the form is prohibited from being submitted repeatedly. If the same short-term lock is unlocked, the front-end page is controlled by the back-end controller to display the form and the lock is taken out and placed in the hidden field. The fourth processing module for short-term anti-duplicate forms, connected to the fourth judgment module, is used to request the backend when the short-term anti-duplicate form is submitted on the frontend if the session has not expired and the short-term anti-duplicate form includes a hybrid lock. The backend checks the status of the hybrid lock. If the short-term lock is in a locked state, the form is prohibited from being submitted repeatedly. If the short-term lock is in an unlocked state, the backend controller controls the frontend page to display the form and retrieves the lock and puts it into the hidden domain. The fifth processing module for short-term anti-duplicate forms, connected to the fourth judgment module, is used to generate a hybrid lock based on the submitted information when the short-term anti-duplicate form is submitted on the front end if the session has expired and the short-term anti-duplicate form includes a hybrid lock. It then checks the hard drive to see if there is a matching hybrid lock. If there is a matching hybrid lock, it loads the matching hybrid lock into the session. If there is no matching hybrid lock, it controls the front-end page to display the lock through the back-end controller and retrieves the lock and puts it into the hidden domain. The sixth processing module for short-term anti-duplicate forms, together with the fifth processing module for short-term anti-duplicate forms, is 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, the form is prohibited from being submitted repeatedly. If the same hybrid lock is in an unlocked state, the front-end page is controlled by the back-end controller to display the form and the lock is retrieved and placed in the hidden field.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements a method for debouncing government forms based on a hybrid locking strategy as described in any one of claims 1-5.

9. An electronic device, characterized in that, The system 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 debouncing government forms based on a hybrid locking strategy as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Digital assistant user interface and response mode

    CN112099720A

  • System for organizing document data

    US20220043772A1