A time period generation method, device, equipment and storage medium

By abstracting the time period generation function into a service model, the problems of large development workload and poor flexibility caused by hard coding are solved, and flexible time period generation for multiple objects and multiple business fields is achieved.

CN115063104BActive Publication Date: 2025-09-16KINGDEE SOFTWARE(CHINA) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210681447.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-16
Publication Date
2025-09-16
Estimated Expiration
2042-06-16

AI Technical Summary

Technical Problem

In the existing technology, the time period for employee holiday benefits needs to be hard-coded, resulting in a large amount of development and poor flexibility. In addition, different employees have different start dates, resulting in inconsistent generated time periods and non-reusability.

Method used

The time period generation function is abstracted into a service model, and a time period sequence is generated through configuration. It is separated from the business and supports calls from multiple objects and multiple business fields, reducing the development workload and improving functional reusability and flexibility.

Benefits of technology

By configuring and generating a time period sequence, repetitive code writing is reduced, the flexibility and functional reusability of time period generation are improved, and it is suitable for multiple objects and multiple business fields.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115063104B_ABST
    Figure CN115063104B_ABST
Patent Text Reader

Abstract

The present application relates to the field of computer technology, and discloses a time period generation method, apparatus, device and storage medium, which are applied to the server side, including: obtaining a call request from the user side, and providing a target service for generating a time period to the user side according to the call request, so that the user side can call the target service; receiving the target time period configuration information sent by the user side through the target service, and using the target service to generate a corresponding target time period sequence according to the target time period configuration information; and sending the target time period sequence to the user side. The present application abstracts the time period generation function into a service model, which can be configured to formulate time period sequences for various complex scenarios, and extracts the function from the business, eliminating the need for repeated code writing, reducing the amount of development, and supporting calls from multiple objects and multiple business fields, thereby improving functional reusability and flexibility.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a time period generation method, apparatus, device and storage medium. Background Art

[0002] A time period, also known as a cycle or time cycle, is used to define the time range or window for data statistics. Time periods are used in various industries and businesses, such as employee management and the stock market.

[0003] Especially in the employee management field, different business modules require the use of time periods. For example, calculating employee vacation time requires allocating a corresponding annual leave allowance to each employee. Existing technology typically implements this through hard-coded code. However, due to the large number of employees and the varying start dates of different employees, different time periods are generated. Furthermore, for the same employee, the previous hard-coded code becomes inapplicable after their vacation benefits change. If each employee were to have a separate hard-coded set of code, the amount of code development would increase significantly, making it less flexible, as the hard-coded code could not be reused across different employees. For example, if an employee's first month requires a year's allowance to be generated, with monthly allowances, the program would need to hard-code the annual allowance cycle. This would require further hard-coding to generate the cycle in other places. Furthermore, the hard-coded code would not be universal for other employees, as the allowances and benefits vary.

[0004] Therefore, the above technical problems are in urgent need of solution by those skilled in the art. Summary of the Invention

[0005] In view of this, the purpose of the present invention is to provide a time period generation method, apparatus, device, and storage medium that can reduce development effort while supporting multi-object and multi-business domain calls, thereby improving functional reusability and flexibility. The specific solution is as follows:

[0006] A first aspect of the present application provides a time period generation method, which is applied to a server, comprising:

[0007] Obtaining a call request from a user terminal, and providing a target service for generating a time period to the user terminal according to the call request, so that the user terminal calls the target service;

[0008] receiving target time period configuration information sent by the user terminal through the target service, and generating a corresponding target time period sequence according to the target time period configuration information using the target service;

[0009] The target time period sequence is sent to the user terminal.

[0010] Optionally, the receiving, through the target service, target time period configuration information sent by the user terminal includes:

[0011] receiving, through the target service, the target time period configuration information input by the user terminal through a preset interface on a manual interaction interface provided by the target service; wherein the target time period configuration information includes a period start date, a cycle type, a time unit, a cycle interval, and a number of cycles;

[0012] Optionally, the generating a corresponding target time period sequence according to the target time period configuration information by using the target service includes:

[0013] The target service is used to generate corresponding target time periods in sequence according to the period start date, the cycle type, the time unit, and the cycle interval according to the number of cycles, to obtain the target time period sequence containing the target time periods for the number of cycles.

[0014] Optionally, the target time period configuration information further includes a period end date;

[0015] After each generation of the target time period, the method further includes:

[0016] Determine whether the period end date of the newly generated target time period is greater than the period end date. If so, stop generating the next target time period and determine the generated target time period as a period in the target time period sequence. If not, continue generating the next target time period.

[0017] Optionally, the target time period configuration information further includes a period offset;

[0018] Before generating a corresponding target time period sequence according to the target time period configuration information using the target service, the method further includes:

[0019] The target service is used to shift the period start date forward or backward along the horizontal axis of time by the period offset units to obtain a new period start date, so that the target service generates the corresponding target time period in sequence according to the new period start date, the cycle type, the time unit, and the cycle interval according to the number of cycles.

[0020] Optionally, receiving, by the target service, the period start date input by the user terminal through a preset interface on a manual interaction interface provided by the target service, includes:

[0021] The target service receives the personnel identification of the business object input by the user terminal through the preset interface on the manual interaction interface provided by the target service, so as to obtain the corresponding period start date according to the personnel identification.

[0022] Optionally, the time period generation method, after receiving the target time period configuration information sent by the user terminal through the target service, includes:

[0023] Determine whether there is a configuration information record identical to the target time period configuration information in the cache, and if so, send the time period sequence corresponding to the identical configuration information record in the cache to the user terminal;

[0024] If not, the step of using the target service to generate the corresponding target time period sequence according to the target time period configuration information is executed, and the target time period sequence is written into the cache.

[0025] Optionally, determining whether there is a configuration information record identical to the target time period configuration information in the cache includes:

[0026] determining whether there exists a configuration identifier identical to the configuration identifier of the target time period configuration information in the cache, and if so, reading a first encrypted value from the cache; wherein the first encrypted value is an encrypted value obtained by encrypting the time period configuration information corresponding to the configuration identifier identical to the configuration identifier of the target time period configuration information using a preset encryption method;

[0027] The target time period configuration information is encrypted using the preset encryption method to obtain a second encrypted value, and it is determined whether the first encrypted value and the second encrypted value are the same. If so, it is determined that there is a configuration information record in the cache that is the same as the target time period configuration information.

[0028] Optionally, writing the target time period sequence into the cache includes:

[0029] The target time period sequence is written into the cache in a HashMap structure; wherein the Key value in the HashMap structure is the configuration identifier of the target time period sequence, and the Value value consists of the configuration identifier of the target time period sequence, the second encrypted value, and the JSON string of the target time period sequence.

[0030] A second aspect of the present application provides a time period generation method, applied to a user terminal, comprising:

[0031] Sending a call request to a server and calling a target service provided by the server for generating a time period;

[0032] Sending target time period configuration information to the server, so that the server receives the target time period configuration information through the target service and generates a corresponding target time period sequence according to the target time period configuration information using the target service;

[0033] Receive the target time period sequence sent by the server.

[0034] A third aspect of the present application provides a time period generation device, applied to a server, comprising:

[0035] an acquisition and provision module, configured to acquire a call request from a user terminal and provide a target service for generating a time period to the user terminal according to the call request, so that the user terminal can call the target service;

[0036] a receiving and generating module, configured to receive the target time period configuration information sent by the user terminal through the target service, and generate a corresponding target time period sequence according to the target time period configuration information using the target service;

[0037] A sending module is used to send the target time period sequence to the user terminal.

[0038] A fourth aspect of the present application provides an electronic device, comprising a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement the aforementioned time period generation method.

[0039] A fifth aspect of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are loaded and executed by a processor, the aforementioned time period generation method is implemented.

[0040] A sixth aspect of the present application provides a computer program product that can be directly loaded into the memory of at least one computer and includes instructions for implementing the aforementioned time period generation method.

[0041] In this application, the calling request of the user end is first obtained, and the target service for generating the time period is provided to the user end according to the calling request, so that the user end can call the target service; then the target time period configuration information sent by the user end is received through the target service, and the target service is used to generate the corresponding target time period sequence according to the target time period configuration information; finally, the target time period sequence is sent to the user end. It can be seen that this application abstracts the time period generation function into a service model, and through configuration, the time period sequence for various complex scenarios can be formulated, and the function is extracted from the business, without the need for repeated code writing, reducing the amount of development, and supporting multi-object and multi-business field calls, thereby improving functional reusability and flexibility. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0043] Figure 1 A flow chart of a time period generation method provided by this application;

[0044] Figure 2 A schematic diagram of the overall interaction between a user terminal and a server provided in this application;

[0045] Figure 3 A flow chart of a specific time period generation method provided in this application;

[0046] Figure 4 A specific configuration logic provided for this application;

[0047] Figure 5a A schematic diagram of a regular time period without intervals provided for this application;

[0048] Figure 5b A schematic diagram of a regular time period with intervals provided for this application;

[0049] Figure 5c A schematic diagram of an irregular time period without intervals provided for this application;

[0050] Figure 5d A schematic diagram of an irregular time period with intervals provided for this application;

[0051] Figure 6 A schematic diagram of the interaction process of date offset between the user end and the server end provided in this application;

[0052] Figure 7 A flow chart of a specific time period generation method provided in this application;

[0053] Figure 8 A flow chart of a specific time period generation method provided in this application;

[0054] Figure 9 A schematic diagram of a specific time period generation method provided in this application;

[0055] Figure 10 A schematic diagram of the structure of a time period generating device provided by this application;

[0056] Figure 11 The present application provides a time period for generating a structural diagram of an electronic device. DETAILED DESCRIPTION

[0057] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0058] At present, the allocation of corresponding annual leave quotas and other time periods to each employee is generally achieved through direct hard coding. However, due to the large number of employees and the different joining dates of different employees, different joining dates will result in different time periods. In addition, for the same employee, the previous hard coding will no longer apply after the change of his vacation benefits. If a set of hard coding is configured for each employee separately, the amount of code development will be greatly increased due to the non-reusability of hard coding for different employees, and the flexibility is poor. In response to the above technical defects, the present application provides a time period generation solution, which abstracts the time period generation function into a service model. Through configuration, time period sequences for various complex scenarios can be formulated, and the function can be separated from the business, eliminating the need for repeated code writing, reducing the amount of development, and supporting calls from multiple objects and multiple business fields, thereby improving functional reusability and flexibility.

[0059] Figure 1 This is a flow chart of a time period generation method provided in an embodiment of the present application. Figure 1 As shown, the time period generation method is applied to the server, including:

[0060] S11: Obtaining a call request from the user terminal, and providing the target service for generating a time period to the user terminal according to the call request, so that the user terminal can call the target service.

[0061] In this embodiment, the server first receives a call request from the client and, based on the call request, provides the client with a target service for generating a time period, allowing the client to call the target service. The client is a service provider, specifically a service module. When the client needs to generate a time period, it proactively sends a call request to the server. After the server provides the target service, the client calls the target service for generating a time period provided by the server.

[0062] As you can understand, the server provides the target service to the client in the form of a microservice. When the client calls the service, it can call the service through an interface. In other words, the target service extracts the business functions to enhance its reusability and provides the functions externally in the form of microservices, so that it can support multiple objects and multiple business domains at the same time. Figure 2 Schematic diagram of the interaction between the user end and the server end.

[0063] S12: Receive the target time period configuration information sent by the user terminal through the target service, and use the target service to generate a corresponding target time period sequence according to the target time period configuration information.

[0064] In this embodiment, once the client invokes the target service, a link is established between the client and the server, enabling interaction over this link to generate the desired time period. First, the client sends the target time period configuration information to the server. This information contains the client's configuration rules for generating the time period for the business object, including but not limited to the period start date, recurrence type, time unit, recurrence interval, and number of recurrences.

[0065] In this embodiment, the user end only needs to determine the target time period configuration information according to its own business needs and send the target time period configuration information to the server end. The target service will generate the corresponding target time period sequence according to the target time period configuration information. The user end does not need to perform complicated code development, which greatly saves development workload.

[0066] S13: Send the target time period sequence to the user end.

[0067] In this embodiment, after the target time period sequence is generated by the target service, it can be sent to the user terminal. The target time period sequence is a sequence of multiple time periods, or cyclic periods, and is essentially a result set. The individual time periods in the target time period sequence can be reassembled, i.e., the cyclic return results can be assembled and placed into the returned result set.

[0068] It can be seen that the embodiment of the present application first obtains the call request of the user end, and provides the target service for generating the time period to the user end according to the call request, so that the user end can call the target service; then, the target time period configuration information sent by the user end is received through the target service, and the target service is used to generate the corresponding target time period sequence according to the target time period configuration information; finally, the target time period sequence is sent to the user end. The embodiment of the present application abstracts the time period generation function into a service model, and through configuration, a time period sequence for various complex scenarios can be formulated, and the function is separated from the business, eliminating the need for repeated code writing, reducing the amount of development, and supporting calls from multiple objects and multiple business fields, thereby improving functional reusability and flexibility.

[0069] Figure 3 This is a flow chart of a specific time period generation method provided in the embodiment of the present application. Figure 3 As shown, the time period generation method is applied to the server, including:

[0070] S21: Obtaining a call request from the user terminal, and providing the target service for generating a time period to the user terminal according to the call request, so that the user terminal can call the target service.

[0071] In this embodiment, regarding the specific process of the above-mentioned step S21, reference may be made to the corresponding content disclosed in the above-mentioned embodiment, and no further details will be given here.

[0072] S22: Receive, through the target service, target time period configuration information input by the user terminal through a preset interface on the manual interaction interface provided by the target service; wherein the target time period configuration information includes the period start date, cycle type, time unit, cycle interval, number of cycles, period end date and period offset.

[0073] In this embodiment, the server receives, through the target service, target time period configuration information input by the user terminal via a preset interface on a manual interaction interface provided by the target service. When providing external services, the target service may present its services in the form of a manual interaction interface having multiple preset interfaces, through which the user terminal inputs the target time period configuration information. Of course, the user terminal may also transmit the target time period configuration information to the server by sending a message containing the target time period configuration information, but this embodiment is not limited to this.

[0074] In this embodiment, the target time period configuration information includes a period start date, a cycle type, a time unit, a cycle interval, a number of cycles, a period end date, and a period offset. Figure 4Different configuration logics are demonstrated, from which it can be seen that the definition model of time periods and the periodic model of cyclic cutting time are abstracted. Through configuration, time period cutting and cyclic functions in various complex scenarios can be formulated, and flexible cyclical combinations with days, weeks, months, and years as the minimum time period definition units and interspersed gaps can be realized.

[0075] The period start date and period end date represent the start and end time nodes that need to be configured for the cycle. According to the configuration information, a period can be divided into multiple time periods. The cycle type includes regular time periods without intervals ( Figure 5a ), with regular time intervals ( Figure 5b ), no interval irregular time period ( Figure 5c ) and irregular time periods ( Figure 5d ). The time unit is also the cycle unit, such as year, month, week, day, etc. The period interval refers to the configuration of the cycle type with an interval type. For the configuration of the cycle type without an interval type, the input interface of the period interval can be hidden on the manual interaction interface, or a null value can be directly entered in the interface. The number of cycles is the number of time periods you want to generate, for example, it can be set to 100 times, and it is set according to business needs. In some businesses, the input period start date is not the actual cycle period, and there is a certain time offset. The original input period start date needs to be adjusted to obtain the actual period start date. In this case, the user end also needs to enter the period offset.

[0076] S23: Use the target service to shift the period start date forward or backward along the horizontal axis of time by the period offset unit to obtain a new period start date, so that the target service can generate corresponding target time periods in sequence according to the new period start date, cycle type, time unit, and cycle interval according to the number of cycles.

[0077] In this embodiment, when the target time period configuration information includes a period offset, the server uses the target service to offset the period start date forward or backward along the horizontal time axis by the period offset unit to obtain a new period start date. The target service then generates corresponding target time periods based on the new period start date, recurrence type, time unit, and recurrence interval, in accordance with the number of recurrences. The period offset provides greater freedom in defining the start and end points of a time period. When defining the start and end points of a time period, in addition to dates offset according to certain configurable rules, reference dates such as resignation date and marriage date can also be used.

[0078] It should be noted that the user end may not directly send the period start date, but instead send the personnel ID of the business object for which a time period needs to be generated to the server end, and the server end will automatically pull the period start date of the business object based on the personnel ID. That is, the server end receives the personnel ID of the business object input by the user end through the preset interface on the manual interaction interface provided by the target service through the target service, so as to obtain the corresponding period start date based on the personnel ID. The specific offset process in this case is as follows: Figure 6 As shown. For example, when generating annual leave quotas for employees, a one-year quota is required after three months of employment, resulting in a three-month period offset. The quota management (business module) then applies the time period generator. The time period generator obtains the ID of the employee (business object) for whom the business module is generating the quota leave. Based on the employee ID, it retrieves the employee's start date (the time period start date). Assuming the employee joins on March 5, 2022, the obtained date is adjusted to June 5, 2022 (the time period start date adjustment). The resulting annual leave quota data is: June 5, 2022 - June 4, 2023, June 5, 2023 - June 4, 2024, June 5, 2024 - June 4, 2025, and so on. This example shifts the time axis backward by three months, and the same process for shifting forward is repeated.

[0079] S24: Generate corresponding target time periods in sequence according to the new period start date, cycle type, time unit, cycle interval and the number of cycles using the target service.

[0080] In this embodiment, the server uses the target service to sequentially generate the corresponding target time period based on the new period start date, recurrence type, time unit, and cycle interval according to the number of cycles. It will be appreciated that when no offset setting is required, the target service can be directly used to sequentially generate the corresponding target time period based on the period start date, recurrence type, time unit, and cycle interval according to the number of cycles.

[0081] S25: Determine whether the cycle end date of the newly generated target time period is greater than the period end date. If so, stop generating the next target time period and determine the generated target time period as a period in the target time period sequence. If not, continue generating the next target time period.

[0082] S26: Obtain a target time period sequence including target time periods of the number of cycles, and send the target time period sequence to the user end.

[0083] In the example of step S23, the server can continue looping until the configured number of loops is reached because no end date is specified, that is, no period end date is present in the target time period configuration information. If an end date is specified, after each target time period is generated, the server will determine whether the period end date of the newly generated target time period is greater than the period end date. If so, the server will stop generating the next target time period and determine the generated target time period as a period in the target time period sequence. If not, the server will continue generating the next target time period.

[0084] Figure 7 This is a flow chart of a specific time period generation method provided in the embodiment of the present application. Figure 7 As shown, the time period generation method is applied to the server, including:

[0085] S31: Obtaining a call request from the user terminal, and providing the target service for generating a time period to the user terminal according to the call request, so that the user terminal can call the target service.

[0086] S32: Receive target time period configuration information sent by the user terminal through the target service.

[0087] In this embodiment, for the specific processes of the above-mentioned steps S31 and S32, reference may be made to the corresponding contents disclosed in the above-mentioned embodiments, which will not be described in detail here.

[0088] S33: Determine whether there is a configuration information record identical to the target time period configuration information in the cache. If yes, send the time period sequence corresponding to the identical configuration information record in the cache to the user end.

[0089] S34: If not, executing the step of using the target service to generate a corresponding target time period sequence according to the target time period configuration information, and writing the target time period sequence into the cache and sending it to the user end.

[0090] In this implementation, after receiving the target time period configuration information, in order to reduce the amount of calculation and improve processing efficiency, the server can first search in the cache whether the same configuration information has flowed in before and the same time period sequence has been generated. That is, it is determined whether there is a configuration information record in the cache that is the same as the target time period configuration information. If so, the time period sequence corresponding to the same configuration information record in the cache is sent to the user end.

[0091] In this embodiment, when there is no configuration information record identical to the target time period configuration information in the cache, the server executes the step of using the target service to generate a corresponding target time period sequence according to the target time period configuration information, writes the target time period sequence into the cache, and sends it to the user end.

[0092] Figure 8 This is a flow chart of a specific time period generation method provided in the embodiment of the present application. Figure 8 As shown, the time period generation method is applied to the server, including:

[0093] S41: Obtaining a calling request from a user terminal, and providing a target service for generating a time period to the user terminal according to the calling request, so that the user terminal can call the target service.

[0094] S42: Receive target time period configuration information sent by the user terminal through the target service.

[0095] In this embodiment, for the specific processes of the above-mentioned steps S31 and S32, reference may be made to the corresponding contents disclosed in the above-mentioned embodiments, which will not be described in detail here.

[0096] S43: Determine whether there is a configuration identifier in the cache that is identical to the configuration identifier of the target time period configuration information. If so, read the first encryption value from the cache; wherein the first encryption value is an encryption value obtained by encrypting the time period configuration information corresponding to the configuration identifier that is identical to the configuration identifier of the target time period configuration information using a preset encryption method.

[0097] S44: Encrypt the target time period configuration information using a preset encryption method to obtain a second encrypted value, and determine whether the first encrypted value and the second encrypted value are the same. If so, send the time period sequence corresponding to the same configuration information record in the cache to the user end.

[0098] In this embodiment, step S43 and step S44 are specific processing steps for the process of determining whether there is a configuration information record identical to the target time period configuration information in the cache. This is applicable to the scenario where the user end triggers a retry. In this scenario, after the user end inputs the target time period configuration information once and triggers the generation of the target time period sequence, it can trigger the regeneration cycle again for the purpose of fault tolerance or for the purpose of modifying the target time period configuration information previously input. In this case, the server end first determines whether there is a configuration identifier identical to the configuration identifier of the target time period configuration information in the cache. The configuration identifier of the target time period sequence input by the user end when the regeneration cycle is triggered again is the same as the configuration identifier of the target time period configuration information input previously. At this time, the server end only needs to compare the target time period configuration information with the same configuration identifier. If the comparison results are the same, it means that the two configuration information are exactly the same. There is no need to repeatedly generate the time period sequence. It is only necessary to send the time period sequence corresponding to the same configuration information record in the cache to the user end.

[0099] In this embodiment, the method of comparing the encrypted value of the configuration information to determine whether the target time period configuration information input last time has changed is mainly carried out. Specifically, the server needs to read the first encrypted value from the cache. The first encrypted value is the encrypted value obtained by encrypting the time period configuration information corresponding to the configuration identifier identical to the configuration identifier of the target time period configuration information using a preset encryption method. For the target time period configuration information input previously, it is necessary to encrypt the target time period configuration information using a preset encryption method to obtain a second encrypted value, and determine whether the first encrypted value and the second encrypted value are the same. If so, the time period sequence corresponding to the same configuration information record in the cache is sent to the user end.

[0100] It can be understood that the first and second in the first encrypted value and the second encrypted value only serve to distinguish the entities to which the encrypted values ​​belong, and do not serve to mark the order. In addition, the preset encryption algorithm can be various encryption algorithms, which are not limited in this embodiment. For example, when the preset encryption algorithm is the information digest algorithm, the corresponding encryption value is the MD5 value. The process is as follows: Figure 9 shown.

[0101] S45: If the first encryption value and the second encryption value are different, executing the step of using the target service to generate a corresponding target time period sequence according to the target time period configuration information, and sending the target time period sequence to the user terminal.

[0102] S46: Write the target time period sequence into the cache in a HashMap structure; wherein the Key value in the HashMap structure is the configuration identifier of the target time period sequence, and the Value value consists of the configuration identifier of the target time period sequence, the second encrypted value, and the JSON string of the target time period sequence.

[0103] In this embodiment, if the first encryption value and the second encryption value are different, it means that the configuration information input twice is different. At this time, the time period sequence corresponding to the configuration information inputted last time does not exist in the cache and needs to be regenerated, that is, the step of using the target service to generate the corresponding target time period sequence according to the target time period configuration information is executed, and the target time period sequence is sent to the user end.

[0104] In this embodiment, the target time period sequence stored in the cache has a standardized format. For example, the target time period sequence can be written to the cache in a HashMap structure. The Key value in the HashMap structure is the configuration identifier of the target time period sequence, and the Value value consists of the configuration identifier of the target time period sequence, the second encrypted value, and the JSON string of the target time period sequence. For example, the Key stores the configuration ID, and the Value structure is "Configuration ID_Configuration MD5_Loop Result JSON String." Similarly, this embodiment does not limit the structure and format of the write cache.

[0105] See also Figure 10 As shown, the embodiment of the present application also discloses a time period generation device, which is applied to the server, including:

[0106] an acquisition and provision module, configured to acquire a call request from a user terminal and provide a target service for generating a time period to the user terminal according to the call request, so that the user terminal can call the target service;

[0107] a receiving and generating module, configured to receive the target time period configuration information sent by the user terminal through the target service, and generate a corresponding target time period sequence according to the target time period configuration information using the target service;

[0108] A sending module is used to send the target time period sequence to the user terminal.

[0109] It can be seen that the embodiment of the present application first obtains the call request of the user end, and provides the target service for generating the time period to the user end according to the call request, so that the user end can call the target service; then, the target time period configuration information sent by the user end is received through the target service, and the target service is used to generate the corresponding target time period sequence according to the target time period configuration information; finally, the target time period sequence is sent to the user end. The embodiment of the present application abstracts the time period generation function into a service model, and through configuration, it can formulate time period sequences for various complex scenarios, and extract the function from the business, eliminating the need for repeated code writing, reducing the amount of development, and supporting calls from multiple objects and multiple business fields, thereby improving functional reusability and flexibility.

[0110] In some specific embodiments, the receiving and generating module specifically includes:

[0111] a receiving unit, configured to receive, through the target service, the target time period configuration information input by the user terminal via a preset interface on a manual interaction interface provided by the target service; wherein the target time period configuration information includes a period start date, a cycle type, a time unit, a cycle interval, and a number of cycles;

[0112] A generating unit is used to use the target service to generate corresponding target time periods in sequence according to the period start date, the cycle type, the time unit, and the cycle interval according to the number of cycles, and obtain the target time period sequence containing the target time periods of the number of cycles.

[0113] In some specific embodiments, when the target time period configuration information further includes a period end date, each time after generating the target time period, the time period generating device further includes:

[0114] The date judgment module judges whether the period end date of the newly generated target time period is greater than the period end date. If so, the generation of the next target time period is stopped, and the generated target time period is determined as a period in the target time period sequence. If not, the generation of the next target time period is continued.

[0115] In some specific embodiments, when the target time period configuration information further includes a period offset, the time period generating device further includes:

[0116] An offset module is used to use the target service to shift the period start date forward or backward along the horizontal axis of time by the period offset units to obtain a new period start date, so that the target service can generate the corresponding target time period in sequence according to the new period start date, the cycle type, the time unit, and the cycle interval according to the number of cycles.

[0117] In some specific embodiments, the time period generating device further includes:

[0118] a record determination module, configured to determine whether there is a configuration information record identical to the target time period configuration information in the cache, and if so, to send a time period sequence corresponding to the identical configuration information record in the cache to the user terminal;

[0119] A writing module is configured to, if not, execute the step of generating the corresponding target time period sequence according to the target time period configuration information using the target service, and write the target time period sequence into the cache.

[0120] In some specific embodiments, the record determination module specifically includes:

[0121] an identifier determination unit, configured to determine whether a configuration identifier identical to the configuration identifier of the target time period configuration information exists in the cache, and if so, read a first encrypted value from the cache; wherein the first encrypted value is an encrypted value obtained by encrypting the time period configuration information corresponding to the configuration identifier identical to the configuration identifier of the target time period configuration information using a preset encryption method;

[0122] An encryption judgment unit is used to encrypt the target time period configuration information using the preset encryption method to obtain a second encryption value, and to determine whether the first encryption value and the second encryption value are the same. If so, it is determined that there is a configuration information record in the cache that is the same as the target time period configuration information.

[0123] In some specific embodiments, the writing module is specifically used to write the target time period sequence into the cache in a HashMap structure; wherein the Key value in the HashMap structure is the configuration identifier of the target time period sequence, and the Value value is composed of the configuration identifier of the target time period sequence, the second encrypted value, and the JSON string of the target time period sequence.

[0124] Furthermore, an embodiment of the present application also provides an electronic device. Figure 11 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram should not be considered as any limitation to the scope of application of the present application.

[0125] Figure 11 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps of the time period generation method disclosed in any of the aforementioned embodiments.

[0126] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device. The communication protocol it follows is any communication protocol that can be applied to the technical solution of this application and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world. Its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0127] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or CD, etc. The resources stored thereon may include an operating system 221, a computer program 222 and data 223, etc. The storage method can be temporary storage or permanent storage.

[0128] The operating system 221 is used to manage and control the hardware devices and computer program 222 on the electronic device 20, enabling the processor 21 to operate and process the massive amount of data 223 in the memory 22. The operating system 221 can be Windows Server, NetWare, Unix, Linux, etc. In addition to including computer programs capable of implementing the time period generation method disclosed in any of the aforementioned embodiments and executed by the electronic device 20, the computer program 222 can further include computer programs capable of performing other specific tasks. The data 223 can include data such as call requests collected by the electronic device 20.

[0129] Furthermore, an embodiment of the present application also discloses a storage medium, in which a computer program is stored. When the computer program is loaded and executed by a processor, the time period generation method steps disclosed in any of the aforementioned embodiments are implemented.

[0130] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. Reference can be made to the descriptions of the identical or similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and the relevant parts can be referred to the descriptions of the methods.

[0131] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.

[0132] The above is a detailed introduction to the time period generation method, device, equipment and storage medium provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core ideas. At the same time, for those skilled in the art, according to the ideas of the present invention, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A time period generation method, characterized in that: The server side used in the field of employee management includes: Obtaining a call request from a user terminal, and providing a target service for generating a time period to the user terminal according to the call request, so that the user terminal calls the target service; receiving, through the target service, target time period configuration information input by the user terminal through a preset interface on a manual interaction interface provided by the target service, and generating, using the target service, a corresponding target time period sequence according to the target time period configuration information, wherein the target time period configuration information is a configuration rule for the user terminal to generate a result of the time period of the business object, and the target time period configuration information includes a period start date, a cycle type, a time unit, a cycle interval, and a number of cycles; The step of receiving, through the target service, the period start date input by the user terminal through a preset interface on the manual interaction interface provided by the target service comprises: receiving, through the target service, a personnel identifier of the business object input by the user terminal through the preset interface on the manual interaction interface provided by the target service, and obtaining the corresponding period start date according to the personnel identifier; The target time period sequence is sent to the user terminal.

2. The time period generation method according to claim 1, characterized in that: The generating a corresponding target time period sequence according to the target time period configuration information by using the target service includes: The target service is used to generate corresponding target time periods in sequence according to the period start date, the cycle type, the time unit, and the cycle interval according to the number of cycles, to obtain the target time period sequence containing the target time periods for the number of cycles.

3. The time period generation method according to claim 2, characterized in that: The target time period configuration information also includes a period end date; After each generation of the target time period, the method further includes: Determine whether the period end date of the newly generated target time period is greater than the period end date. If so, stop generating the next target time period and determine the generated target time period as a period in the target time period sequence. If not, continue generating the next target time period.

4. The time period generation method according to claim 2, characterized in that: The target time period configuration information also includes a period offset; Before generating a corresponding target time period sequence according to the target time period configuration information using the target service, the method further includes: The target service is used to shift the period start date forward or backward along the horizontal axis of time by the period offset units to obtain a new period start date, so that the target service generates the corresponding target time period in sequence according to the new period start date, the cycle type, the time unit, and the cycle interval according to the number of cycles.

5. The time period generation method according to any one of claims 1 to 4, characterized in that: After receiving the target time period configuration information sent by the user terminal through the target service, the method includes: Determine whether there is a configuration information record identical to the target time period configuration information in the cache, and if so, send the time period sequence corresponding to the identical configuration information record in the cache to the user terminal; If not, the step of using the target service to generate the corresponding target time period sequence according to the target time period configuration information is executed, and the target time period sequence is written into the cache.

6. The time period generation method according to claim 5, characterized in that: The determining whether there is a configuration information record identical to the target time period configuration information in the cache includes: determining whether there exists a configuration identifier identical to the configuration identifier of the target time period configuration information in the cache, and if so, reading a first encrypted value from the cache; wherein the first encrypted value is an encrypted value obtained by encrypting the time period configuration information corresponding to the configuration identifier identical to the configuration identifier of the target time period configuration information using a preset encryption method; The target time period configuration information is encrypted using the preset encryption method to obtain a second encrypted value, and it is determined whether the first encrypted value and the second encrypted value are the same. If so, it is determined that there is a configuration information record in the cache that is the same as the target time period configuration information.

7. The time period generation method according to claim 6, characterized in that: Writing the target time period sequence into the cache comprises: The target time period sequence is written into the cache in a HashMap structure; wherein the Key value in the HashMap structure is the configuration identifier of the target time period sequence, and the Value value consists of the configuration identifier of the target time period sequence, the second encrypted value, and the JSON string of the target time period sequence.

8. A time period generation method, characterized in that: User terminals used in employee management include: Sending a call request to a server and calling a target service provided by the server for generating a time period; Sending target time period configuration information to the server through a preset interface on the manual interaction interface provided by the target service, so that the server receives the target time period configuration information through the target service, and uses the target service to generate a corresponding target time period sequence according to the target time period configuration information. The target time period configuration information is a configuration rule for the user end to generate a result of the time period of the business object, and the target time period configuration information includes a period start date, a cycle type, a time unit, a cycle interval, and a number of cycles; The step of sending the period start date to the server through a preset interface on the manual interaction interface provided by the target service comprises: receiving, through the target service, a personnel identifier of a business object input by the user terminal through the preset interface on the manual interaction interface provided by the target service, and obtaining the corresponding period start date according to the personnel identifier; Receive the target time period sequence sent by the server.

9. A time period generating device, characterized in that: The server side used in the field of employee management includes: an acquisition and provision module, configured to acquire a call request from a user terminal and provide a target service for generating a time period to the user terminal according to the call request, so that the user terminal can call the target service; a receiving and generating module, configured to receive, through the target service, target time period configuration information input by the user terminal via a preset interface on a manual interaction interface provided by the target service, and generate, using the target service, a corresponding target time period sequence based on the target time period configuration information, wherein the target time period configuration information is a configuration rule for the user terminal to generate a result of the time period of the business object, and the target time period configuration information includes a period start date, a cycle type, a time unit, a cycle interval, and a number of cycles; The step of receiving, through the target service, the period start date input by the user terminal through a preset interface on the manual interaction interface provided by the target service comprises: receiving, through the target service, a personnel identifier of the business object input by the user terminal through the preset interface on the manual interaction interface provided by the target service, and obtaining the corresponding period start date according to the personnel identifier; A sending module is used to send the target time period sequence to the user terminal.

10. An electronic device, characterized in that: The electronic device includes a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement the time period generation method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that Used to store computer executable instructions, which, when loaded and executed by a processor, implement the time period generation method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Equipment operation schedule setting method and device, storage medium and terminal

    CN112950142A