A method for calculating the due date of accrual
Special symbols through enhanced cron expressions! And + solves the problem of fixed and unchanged calculation method of bank interest settlement dates, realizes flexible configuration of interest settlement frequency and rich use scenarios, and improves customer experience.
Patent Information
- Application Number
- CN202211677588.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-26
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2042-12-26
AI Technical Summary
In the existing technology, the calculation method of bank interest settlement dates is fixed and cannot be flexibly adjusted, resulting in the need to redevelop code when adding interest settlement frequency, increasing the development and testing workload and online risks, and unable to quickly give customers feedback.
Use enhanced cron expressions and add special symbols! and +, supports dynamic adjustment of date variables and interest settlement dates, and realizes flexible configuration of interest settlement frequency.
It has achieved dynamic adjustment of interest settlement dates, reduced the development and testing workload, improved the flexibility of interest settlement frequency and customer experience, and enriched the usage scenarios.
Smart Images

Figure CN115878942B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of financial computing technology, and in particular to a method for calculating an accrual due date. Background Art
[0002] In banks, when customers apply for corresponding products, such as deposits, corresponding interest will be generated. This means that banks often involve the calculation of the interest payment date and the calculation of interest after the interest payment date.
[0003] Existing banks usually calculate interest payment dates by configuring frequency enumeration. This means that after customers have applied for the corresponding products, the corresponding interest payment frequency is mostly fixed. For example, there is an interest payment frequency on the 21st of each quarter. This means that when customers pay interest, no matter when the corresponding interest payment date is, the corresponding interest payment date will usually be the 21st of the next quarter closest to the interest payment date. If you want to add a new product with a new interest payment frequency, you need to develop corresponding code to support each additional interest payment frequency. For example, if you want to pay interest on the 20th of each quarter, you need to add the corresponding code processing logic, that is, redefine the expression for paying interest on the 20th of each quarter. This makes the whole process very inflexible and it is impossible to calculate the next interest payment date based on the specified date.
[0004] Based on this, a method for calculating the interest payment due date is needed, which can calculate the next interest payment date according to the specified date, realize the dynamic adjustment of the interest payment frequency, and make the calculation of the interest payment date more flexible. Summary of the Invention
[0005] The present invention aims to provide a method for calculating the accrual due date, which can calculate the next interest payment date based on a specified date, realize dynamic adjustment of the interest payment frequency, and make the calculation of the interest payment date more flexible.
[0006] To achieve the above object, the present invention adopts the following technical solution: a method for calculating the accrual due date, comprising the following steps:
[0007] S1. Configure an enhanced cron expression based on the interest payment frequency of the product handled by the user. The enhanced cron expression adds a special symbol "!" while retaining the original special symbols. The special symbol is used to support date variables.
[0008] S2. When calculating the next interest payment date for the product handled by the user, obtain the cron configuration in the enhanced cron expression and determine whether the expression has a dynamic configuration! If so, set the read variable flag and parse the corresponding expression. Otherwise, do not set the read variable flag and parse the expression.
[0009] S3. Determine whether the variable identifier is read. If so, obtain the date corresponding to the previous interest payment date of the product handled by the user and replace the corresponding date with the dynamic configuration! Then calculate the corresponding next interest payment date. If not, obtain the date corresponding to the previous interest payment date of the product handled by the user and calculate the corresponding next interest payment date.
[0010] The principle and advantages of this solution are: In this solution, when a customer applies for a corresponding product, the corresponding enhanced cron expression will be configured according to the customer's corresponding interest payment frequency. For example, if the customer has no other requirements, then after the corresponding product is applied, the corresponding interest payment will be made on the 21st of each quarter, which is more common, that is, on the 21st of March, June, September, and December. If the customer's interest payment may change dynamically, the corresponding dynamic configuration will be performed at the beginning, that is, the corresponding symbol ! will be added to replace the corresponding month and day, for example! * ? This means that interest will be paid every month from the date of account opening, but the corresponding date of the month is not fixed.
[0011] Afterwards, when a customer needs to calculate the next interest payment date, the enhanced cron expression corresponding to the customer's product will be used to obtain the cron configuration. The expression will then be checked to see if it has a dynamic configuration! If so, the read variable flag will be set and the corresponding expression will be parsed. If not, the expression will be parsed directly. After the parsing is complete, it will be checked to see if the variable value has been read. If so, the date corresponding to the previous interest payment date of the user's product will be replaced with the dynamic configuration! For example, if the corresponding date is 2022-11-01, then 01 will replace the corresponding! In other words, the corresponding expression is replaced by! * ? becomes 1 * ? , the corresponding next interest payment point will become 2022-12-01, thus realizing dynamic adjustment of the interest payment date. If the judgment result is negative, the next interest payment point will be calculated directly according to the expression. For example, if the corresponding date is still 2022-11-01, and the corresponding expression is: 21 3,6,9,12?, then the corresponding next interest payment date will be output as 2022-10-21. Of course, if the date is 2022-11-21, the corresponding output result will still be 2022-10-21.
[0012] Compared to existing technologies, adding new interest payment frequencies usually requires adding corresponding code processing logic, which is very inflexible, increases the corresponding development and testing workload, increases the risk of online launch, and does not provide quick customer feedback. By changing the cron expression in the application, that is, adding the symbol !, this method can calculate the next interest payment date based on the specified date. This allows for greater flexibility when adding the corresponding interest payment frequency and greatly reduces the corresponding development and testing workload.
[0013] Furthermore, the enhanced cron expression also adds another special symbol +, which is located in the place where the date is located in the enhanced cron expression;
[0014] The calculation of the corresponding next interest payment date includes the following steps:
[0015] Determine whether the special symbol + exists in the enhanced cron expression. If so, determine whether the next interest payment date will be postponed.
[0016] When the judgment result is that the next interest payment date is postponed, the position of the month in the enhanced cron expression is judged to determine whether the month position is forcibly limited to a certain month. If not, the corresponding interest payment date is determined to be executed on a daily basis, and the next interest payment date executed on a daily basis is calculated; if so, the corresponding interest payment date is determined to be postponed, and the next postponed interest payment date is calculated.
[0017] Beneficial effect: In this solution, the logic of executing by day is realized by adding a special symbol +. Specifically, the corresponding new special symbol + is on the configuration position where the day is located, that is, the position where the day is located, for example! +5 * ? , after completing the judgment of !, the corresponding ! will be replaced, and then the + will be identified and judged. If there is +, it means that the corresponding interest payment date will be postponed, for example, postponed to the next 5 days. Then it will check whether the month position in the enhanced cron expression is forced to limit the month. For example, in ! + 5*?, there is no month limit, and 21+5 3, 6, 9, 12? This limits the corresponding months to March, June, September, and December, and the corresponding date must be 21+5. For such a limited month, when calculating the next interest payment date, it will be postponed by 5 days according to the calculated result. For those without a limited month, the corresponding interest payment date will be executed on a daily basis. For example, if the calculation node is November 2, then in ! + 5 * In the expression, the corresponding interest payment date will continue to be executed every five days, such as November 7th and November 12th.
[0018] Unlike the cron expression in the prior art, which cannot realize the configuration of execution once every n days, this application not only realizes the logic of execution once every n days by adding a special symbol + to the date configuration bit, but also makes the expression's interest payment frequency richer and more varied, so that the corresponding usage scenarios will be richer and the customer experience will be better. At the same time, it also realizes the adjustment of the limited interest payment frequency, greatly increasing the possibility of changes in the interest payment frequency. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 This is a flowchart of a method for calculating an accrual due date in a first embodiment of the present invention. DETAILED DESCRIPTION
[0020] The following is further described in detail through specific implementation methods:
[0021] The embodiment is basically as shown in the attached Figure 1 A method for calculating an accrual due date includes the following steps:
[0022] S1. Configure an enhanced cron expression based on the interest payment frequency corresponding to the product the user is applying for. While retaining the original special symbols, the enhanced cron expression adds a new special symbol, "!", which is used to support date variables. In this embodiment, the enhanced cron expression not only adds the special symbol "!" but also removes the corresponding hour, minute, and second symbols, effectively eliminating the ability to configure the expression for hours, minutes, and seconds.
[0023] In this embodiment, for example, if the corresponding interest payment frequency is quarterly, then the corresponding enhanced cron expression is: 21 3, 6, 9, 12?, and if it is configured, for example, monthly interest payment configuration! * ? .
[0024] S2. When calculating the next interest payment date for the product handled by the user, obtain the cron configuration in the enhanced cron expression and determine whether the expression has a dynamic configuration! If so, set the read variable flag and parse the corresponding expression. Otherwise, do not set the read variable flag and parse the expression.
[0025] In this embodiment, the corresponding cron configuration will be obtained according to the enhanced cron expression, and then it will be determined whether there is a dynamic configuration in the expression! ;
[0026] When the judgment result is existence, for example, the configuration is! * ? , it will set the read variable flag, that is, needSetDay = TRUE. The parsed result is: needSetDay = TRUE, expression: ! * ? ;
[0027] If the result of the judgment is that it does not exist, for example, the configuration is 21 3, 6, 9, 12?, the read variable flag will be set to needSetDay = FALSE. The parsed result is: needSetDay = FALSE, expression: 21 3, 6, 9, 12?.
[0028] S3. Determine whether the variable identifier is read. If so, obtain the date corresponding to the previous interest payment date of the product handled by the user and replace the corresponding date with the dynamic configuration! Then calculate the corresponding next interest payment date. If not, obtain the date corresponding to the previous interest payment date of the product handled by the user and calculate the corresponding next interest payment date.
[0029] In this embodiment, after parsing is complete, it is determined whether the variable value is read, that is, whether needSetDay is TRUE. If so, the date corresponding to the next interest payment date for the product handled by the user is obtained and replaced with the corresponding date in the dynamic configuration. Specifically, if ! is in the position of the day, the value corresponding to the day is replaced. If ! is in the position of the month, the value corresponding to the month is replaced. For example, if the calculation node date is 2022-11-01, the enhanced cron expression is: ! * ? , then when replacing, ! will be replaced with 01, and the final expression is: 1 * ? , that is, interest is paid on the 1st of each month, so the calculation result of the next interest payment date is 2022-12-01.
[0030] If it is FALSE, it means that the corresponding enhanced cron expression does not have dynamic configuration! Therefore, regardless of whether the corresponding calculation node (date) is 2022-11-01 or 2022-11-25, the corresponding next interest payment date will be determined according to the corresponding strong cron expression. For example, if the corresponding enhanced cron expression is: 21 3, 6, 9, 12?, the calculated result for the next interest payment date for both dates is 2022-12-21.
[0031] The enhanced cron expression also adds another special symbol +, which is located in the place where the date is located in the enhanced cron expression;
[0032] The calculation of the corresponding next interest payment date includes the following steps:
[0033] Determine whether the special symbol + exists in the enhanced cron expression. If so, determine whether the next interest payment date will be postponed.
[0034] When the judgment result is that the next interest payment date is postponed, the position of the month in the enhanced cron expression is judged to determine whether the month position is forcibly limited to a certain month. If not, the corresponding interest payment date is determined to be executed on a daily basis, and the next interest payment date executed on a daily basis is calculated; if so, the corresponding interest payment date is determined to be postponed, and the next postponed interest payment date is calculated.
[0035] In this embodiment, since another special symbol + is added, there are more corresponding changes in the enhanced cron expression, for example! +7 * ?, 21+5 3, 6, 9, 12?; these are all expressions after adding +.
[0036] When making a specific judgment, the first step is to determine whether + exists. If not, the calculation result is generated according to the previous calculation. If it exists, for example, +7 * ? , because there is ! and the corresponding month position is * This means that the corresponding month in this expression is not strictly limited. Therefore, when calculating the interest payment date, assuming the current calculation node is 2022-11-01, the corresponding interest payment date outputs are: 2022-11-01, 2022-11-08, 2022-11-15, 2022-11-22, 2022-11-29, 2022-12-06, and so on. This implements the logic of executing interest payment every 7 days. If the corresponding expression is 21+5 3, 6, 9, 12?, the corresponding interest payment date outputs are fixed as: 3-26, 6-26, 9-26, 12-26, thus implementing the adjustment of this fixed interest payment frequency. That is, customers can change the interest payment date according to their actual situation, greatly expanding the use cases of the corresponding interest payment frequency.
[0037] The above is only an embodiment of the present invention, and the common knowledge such as the specific technical solutions and / or characteristics in the solution are not described in detail here. It should be pointed out that for those skilled in the art, without departing from the technical solution of the present invention, several variations and improvements can be made, which should also be regarded as the scope of protection of the present invention, and these will not affect the effect of the implementation of the present invention and the practicality of the patent. The scope of protection required by this application shall be based on the content of its claims, and the specific implementation methods and other records in the description can be used to interpret the content of the claims.
Claims
1. A method for calculating an accrual due date, characterized in that: The following steps are involved: S1. Configure an enhanced cron expression based on the interest payment frequency of the product handled by the user. The enhanced cron expression adds a special symbol "!" while retaining the original special symbols. The special symbol is used to support date variables. S2. When calculating the next interest payment date for the product handled by the user, obtain the cron configuration in the enhanced cron expression and determine whether the expression contains the dynamic configuration special symbol! If so, set the read variable flag and parse the corresponding expression. Otherwise, do not set the read variable flag and parse the expression. S3. Determine whether the variable identifier is read. If so, obtain the date corresponding to the previous interest payment date for the product handled by the user, replace the special symbol ! with the corresponding date, and calculate the corresponding next interest payment date. If not, obtain the date corresponding to the previous interest payment date for the product handled by the user, and calculate the corresponding next interest payment date.
2. The method for calculating the accrual due date according to claim 1, characterized in that: The enhanced cron expression also adds another special symbol +, which is located in the place of the date in the enhanced cron expression; The calculation of the corresponding next interest payment date includes the following steps: Determine whether the special symbol + exists in the enhanced cron expression. If so, determine whether the next interest payment date will be postponed. When the judgment result is that the next interest payment date is postponed, the position of the month in the enhanced cron expression is judged to determine whether the month position is forcibly limited to a certain month. If not, the corresponding interest payment date is determined to be executed on a daily basis, and the next interest payment date executed on a daily basis is calculated; if so, the corresponding interest payment date is determined to be postponed, and the next postponed interest payment date is calculated.
Citation Information
Patent Citations
A method and system for automatically inputting data based on target symbols
CN109542899A
Settlement method and device, storage medium and computer equipment
CN114155078A