Vacation data processing method and device, storage medium and terminal

By performing fine-grained segmentation and index binding of vacation data, the problem of low efficiency in existing vacation data statistics has been solved, achieving efficient and accurate vacation data statistics.

CN122390699APending Publication Date: 2026-07-14CSC FINANCIAL CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CSC FINANCIAL CO LTD
Filing Date
2026-05-25
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

The existing leave and attendance data statistics are inefficient, mainly because the leave data is not finely broken down, resulting in data redundancy in one or several information tables, which makes it impossible to process efficiently.

Method used

By obtaining raw leave data from the leave information table, performing fine-grained segmentation, and binding a unique index identifier to each leave segment before storing it in the segmentation details table, when responding to leave data statistics instructions, the leave segments within the data processing period are retrieved based on the unique index identifier to perform statistical processing of leave type and attendance object.

Benefits of technology

It significantly improves the efficiency of vacation statistics, reduces the consumption of computing resources and response delays, ensures the accuracy of statistical results, and avoids statistical ambiguity or double counting caused by vacations across cycles and types.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122390699A_ABST
    Figure CN122390699A_ABST
Patent Text Reader

Abstract

The application discloses a kind of holiday data processing method and device, storage medium, terminal, it is related to data processing technical field, it can be applied to human resource management field, main purpose is to solve the problem of low efficiency of holiday data processing.The main include obtaining original holiday data from holiday information table, wherein the original holiday data includes holiday type, time information and attendance object information;According to time information, the original holiday data is finely granular and is split, and after the unique index mark is respectively bound to each holiday segment after splitting, the holiday segment is stored in the split detail table;In response to holiday data statistical instruction, according to unique index mark, the holiday segment covered by data processing period is retrieved from split detail table as to-be-processed holiday segment;According to the holiday type and attendance object of to-be-processed holiday segment, holiday statistics processing is carried out, and the holiday data statistical result in data processing period is obtained.It is mainly used for processing holiday data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology and can be applied to the field of human resource management. In particular, it relates to a method and apparatus for processing vacation data, a storage medium, and a terminal. Background Technology

[0002] With the rapid development of the global information technology industry and the field of digital human resource management, more and more enterprises and organizations are using information systems to complete tasks such as employee payroll calculation. Among them, employee leave and attendance data are the foundation for various benefits calculations, including salary and leave allowances. Therefore, the recording and statistics of leave and attendance data play an important role in the field of digital human resource management.

[0003] Existing leave and attendance data statistics mainly rely on digital systems to set up leave information tables in databases, supplemented by manual or third-party system input of leave and attendance information to automate leave applications and attendance statistics. This approach generally only presets fixed dependency rules and does not perform fine-grained breakdown of leave data. Leave, return-to-work, and attendance information are redundantly stored in one or several information tables, resulting in low efficiency in leave data statistics and calculation. Summary of the Invention

[0004] In view of this, the present invention provides a vacation data processing method and apparatus, storage medium and terminal, the main purpose of which is to solve the problem of low efficiency in existing vacation data processing.

[0005] According to one aspect of the present invention, a method for processing vacation data is provided, comprising: Obtain raw leave data from the leave information table, wherein the raw leave data includes leave type, time information and attendance object information; The original vacation data is split into fine-grained segments based on the time information, and after binding a unique index identifier to each of the split vacation segments, the vacation segments are stored in the split details table. In response to the vacation data statistics instruction, based on the unique index identifier, the vacation segments covered by the data processing cycle are retrieved from the split details table as vacation segments to be processed. Leave statistics are performed according to the leave type and attendance object of the leave segment to be processed, and the leave data statistics results within the data processing period are obtained.

[0006] Furthermore, based on the time information of the original vacation data, the original vacation data is segmented into multiple vacation segments, including: Retrieve the work calendar of the attendance object corresponding to the original leave data; By removing non-working days from the original leave data based on the work calendar, at least one leave period is obtained; The vacation period is divided into multiple vacation segments based on the time information, wherein the time information includes a start date, an end date, a start time type, and an end time type.

[0007] Furthermore, the vacation period is divided based on the time information to obtain multiple vacation segments, including: For vacation periods with overlapping start and end dates, the vacation period is treated as a vacation segment, and the duration of the vacation segment is assigned according to the start and end time types of the vacation period. For vacation periods where the start and end dates do not overlap, the vacation period is divided into a first-day vacation segment, a last-day vacation segment, and a middle vacation period. The first-day vacation segment is assigned a duration based on its start time type, and the last-day vacation segment is assigned a duration based on its end time type. The middle vacation period is then split into multiple middle-day vacation segments according to the vacation type.

[0008] Further, according to the leave type and attendance object of the leave segment to be processed, leave statistics processing is performed to obtain the leave data statistics results within the data processing period, including: The leave segments to be processed are divided into objects according to the attendance objects to obtain a set of leave segments for at least one attendance object. For each set of vacation segments, the vacation segments to be processed within the group are divided into vacation types according to vacation type, resulting in at least one subset of vacation segments of each vacation type; For each subset of vacation segments, the vacation segments to be processed with the same date and opposite positive and negative vacation processing items are deducted in duration. The remaining vacation segments to be processed after the duration deduction are merged in duration to obtain the vacation statistics data of the vacation type. Based on the vacation statistics data corresponding to different vacation types for all attendance subjects, the vacation data statistics results for the data processing period are generated.

[0009] Furthermore, the segment to be processed also includes a processing state; After processing the segment to be processed, the method further includes: updating the processing status of the segment to be processed from unprocessed to processed; Before processing the segment to be processed, the method further includes: identifying the processing status of the segment to be processed; if the processing status is unprocessed, then performing a duration deduction or duration merging operation. After the time deduction process, the newly generated vacation segments to be processed will be in an unprocessed state.

[0010] Furthermore, the process of constructing a unique index identifier for any vacation segment includes: A unique index identifier for the leave segment is constructed based on the attendance object information, time attribute, leave type, and leave processing item of the leave segment, and the unique index identifier is used as the idempotent write key for the leave segment.

[0011] Furthermore, before retrieving the original vacation data from the vacation information table, the method further includes: A distributed lock is requested using the combination of attendance object information and time information corresponding to the original leave data as the lock key; If the distributed lock acquisition is successful, the process continues with retrieving the original vacation data from the vacation information table; if the distributed lock acquisition fails, the process waits for a retry.

[0012] According to another aspect of the present invention, a vacation data processing apparatus is provided, comprising: The acquisition module is used to acquire raw leave data from the leave information table, wherein the raw leave data includes leave type, time information and attendance object information; The splitting module is used to perform fine-grained splitting of the original vacation data based on the time information, and after binding a unique index identifier to each split vacation segment, store the vacation segment in the splitting details table; The retrieval module is used to respond to the vacation data statistics instruction and retrieve the vacation segments covered by the data processing cycle from the split details table based on the unique index identifier, as the vacation segments to be processed. The statistical processing module is used to perform vacation statistical processing according to the vacation type and attendance object of the vacation segment to be processed, and to obtain the vacation data statistical results within the data processing period.

[0013] Furthermore, the splitting module includes: The retrieval unit is used to retrieve the work calendar of the attendance object corresponding to the original leave data; The elimination processing unit is used to eliminate non-working days from the original vacation data based on the work calendar to obtain at least one vacation interval; The splitting unit is used to split the vacation period according to the time information to obtain multiple vacation segments, wherein the time information includes start date, end date, start time type and end time type.

[0014] Furthermore, in specific application scenarios, the splitting unit is specifically used to treat a vacation interval with overlapping start and end dates as a vacation segment, and to assign a duration to the vacation segment based on the start and end time types of the vacation interval; For vacation periods where the start and end dates do not overlap, the vacation period is divided into a first-day vacation segment, a last-day vacation segment, and a middle vacation period. The duration of the first-day vacation segment is assigned according to the start time type, and the duration of the last-day vacation segment is assigned according to the end time type. The middle vacation period is then split into multiple middle-day vacation segments according to the vacation type.

[0015] Furthermore, the statistical processing module includes: The first partitioning unit is used to partition the leave fragments to be processed according to the attendance objects, so as to obtain a set of leave fragments for at least one attendance object. The second partitioning unit is used to partition the vacation fragments to be processed in each vacation fragment set according to the vacation type, so as to obtain at least one subset of vacation fragments of at least one vacation type. The processing unit is used to perform time deduction processing on the pairs of unprocessed vacation segments with the same date and opposite positive and negative vacation processing items for each subset of vacation segments, and to perform time merging processing on the remaining unprocessed vacation segments after time deduction processing to obtain vacation statistics data of the vacation type. The generation unit is used to generate the vacation data statistics results for the data processing period based on the vacation statistics data of different vacation types corresponding to all attendance objects.

[0016] The leave segment to be processed carries a field for the period to which the attendance belongs, a field for whether it is confirmed, a field for the attendance calculation time, and a field for the time to cancel the leave. The device further includes: The leave cancellation identification module is used to identify the pending leave segments for early leave cancellation, make-up leave cancellation, and make-up leave based on the comparison relationship between the attendance period field, the confirmation field, the attendance calculation time field, and the leave cancellation time field. Specifically, it includes: If the confirmation field of the leave segment to be processed is no and the leave cancellation time field has a value, then the leave segment to be processed will not be subject to attendance statistics processing. If the confirmation field of the leave segment to be processed is yes, the leave cancellation time field has a value, and the leave cancellation time is greater than the attendance calculation time of the previous attendance cycle, then the leave segment to be processed will be used as a time deduction item for attendance statistics processing. If the leave date in the leave segment to be processed is less than the start date of the current attendance period, and the confirmation field is negative, then the leave segment to be processed will be subject to attendance statistics processing.

[0017] Furthermore, the splitting module also includes: The index generation unit is used to construct a unique index identifier for the leave segment based on the attendance object information, time attribute, leave type and leave processing item of the leave segment, and use the unique index identifier as the idempotent write key of the leave segment.

[0018] Furthermore, the device also includes: A distributed lock is requested using the combination of attendance object information and time information corresponding to the original leave data as the lock key; If the distributed lock acquisition is successful, the process continues with retrieving the original vacation data from the vacation information table; if the distributed lock acquisition fails, the process waits for a retry.

[0019] According to another aspect of the present invention, a storage medium is provided, wherein at least one executable instruction is stored therein, the executable instruction causing a processor to perform an operation corresponding to the vacation data processing method described above.

[0020] According to another aspect of the present invention, a terminal is provided, comprising: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other through the communication bus; The memory is used to store at least one executable instruction, which causes the processor to perform the operation corresponding to the above-described vacation data processing method.

[0021] By employing the above-described technical solutions, the technical solutions provided by the embodiments of the present invention have at least the following advantages: This invention provides a method, apparatus, storage medium, and terminal for processing leave data. In this embodiment, raw leave data is obtained from a leave information table, including leave type, time information, and attendance object information. The raw leave data is then finely segmented based on the time information, and each segment is bound with a unique index identifier before being stored in a segmentation detail table. In response to a leave data statistics command, leave segments covered by the data processing cycle are retrieved from the segmentation detail table based on the unique index identifier, serving as leave segments to be processed. Leave statistics are then performed according to the leave type and attendance object of the leave segments to be processed, yielding the leave data statistics results within the data processing cycle. This significantly reduces the computational resource consumption during large-scale data queries and statistics, lowers the response latency and system input / output overhead caused by directly manipulating the original coarse-grained leave table, and ensures that the statistical results are accurate to a single leave segment, avoiding statistical ambiguity or duplicate calculations caused by cross-cycle or cross-type leave, thereby greatly improving the efficiency of leave statistics under complex attendance rules.

[0022] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention, it can be implemented according to the contents of the specification. Furthermore, in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description

[0023] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings: Figure 1 A flowchart of a vacation data processing method provided by an embodiment of the present invention is shown; Figure 2 A flowchart of another vacation data processing method provided by an embodiment of the present invention is shown; Figure 3 This diagram illustrates a block diagram of a vacation data processing device provided in an embodiment of the present invention. Figure 4 A schematic diagram of the structure of a terminal provided in an embodiment of the present invention is shown. Detailed Implementation

[0024] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0025] To address the problem of low efficiency in existing leave data processing, this invention provides a leave data processing method. The method is executed by a server corresponding to the leave data processing system. This server can share a server with its associated attendance system, and can be a local server or a cloud server; this invention does not impose specific limitations. Figure 1 As shown, the method includes steps 101-104: 101. Obtain the original leave data from the leave information table.

[0026] In this embodiment of the invention, the leave information table is a data table used to store various parameter fields in the original leave application. After the leave application is submitted, the system obtains the leave parameters input by the user (including leave type, start and end times, reason, etc.), generates original leave data based on the leave parameters, and stores it in the leave information table. The original leave data includes leave type, time information, and attendance object information. Leave type includes annual leave, sick leave, personal leave, work injury leave, etc. Time information includes attendance object information, which is the identification information of the personnel being attended, such as employee number, department, etc. Time information includes start time (YYYY-MM-DD), end time (YYYY-MM-DD), start time type, and end time type. The time type is used to distinguish between morning and afternoon of the day; for example, 0 represents morning and 1 represents afternoon. It should be noted that the original leave data includes both leave application data and leave cancellation data, which are distinguished by the positive and negative leave processing items; for example, a positive leave processing item indicates a leave application, and a negative leave processing item indicates a leave cancellation.

[0027] The purpose of acquiring raw leave data is to preprocess the data before performing leave data statistics. This acquisition can be triggered based on a preset time node, such as midnight on the last day of each month, or it can be actively triggered by the user, such as when the user opens the leave management system. It can also be time-driven, such as when the human resources system pushes leave data change messages.

[0028] In one embodiment of the present invention, for further explanation and limitation, before obtaining the original vacation data from the vacation information table, the method further includes: A distributed lock is requested using the combination of attendance object information and time information corresponding to the original leave data as the lock key; If the distributed lock acquisition is successful, the process continues with retrieving the original vacation data from the vacation information table; if the distributed lock acquisition fails, the process waits for a retry.

[0029] In this embodiment of the invention, a distributed lock controls the concurrent processing of raw leave data. Before reading raw leave data from the leave information table, the system requests a distributed lock using the attendance object + time as the unique lock key. A successful request indicates that no other thread or service is currently processing leave data for the same object within the same time period, allowing continued reading and subsequent data splitting and statistical processing. A failed request indicates that another request is processing the same data, and the current request must wait for a retry, thus avoiding duplicate data reading or write conflicts. For example, if a leave application submitted by an employee is being written to the leave information table, while the system is retrieving raw leave data, read-write concurrency conflicts can easily occur, leading to incomplete data reads. With a distributed lock, if another thread is writing leave application data for the same employee within the same time period, the writing thread already holds the lock for that key. The thread retrieving the data will fail to acquire the lock and will enter a waiting retry phase until the write is committed and the lock is released.

[0030] 102. Based on the time information, the original vacation data is split into fine-grained segments, and after binding a unique index identifier to each of the split vacation segments, the vacation segments are stored in the split details table.

[0031] In this embodiment of the invention, the original leave records are broken down into finer-grained leave segments based on time information, such as by day, half-day, or hour. A unique index identifier is generated for each segment based on the leave type and the attendance subject, and these are ultimately stored in a detailed breakdown table. This process solves the coarse-grained problems of original continuous leave records, such as difficulty in accurately matching attendance dates, inability to handle half-days, cross-type leave, and cross-statistical periods. It supports accurate attendance statistics by day / hour, quick retrieval of whether a day has been taken, and facilitates alignment with clock-in / out and work hour data, as well as leave cancellation processing. Ultimately, it achieves efficient conflict detection, compliance traceability, and detailed management of complex leave scenarios.

[0032] In one embodiment of the present invention, for further illustration and limitation, such as Figure 2 As shown, the original vacation data is segmented based on the time information to obtain multiple vacation segments, including: 1021. Retrieve the work calendar of the attendance object corresponding to the original leave data.

[0033] 1022. Based on the work calendar, remove non-working days from the original vacation data to obtain at least one vacation period.

[0034] 1023. The vacation period is divided into multiple vacation segments based on the time information.

[0035] In this embodiment of the invention, since the original leave data may contain leave applications from non-working days or spanning multiple days, after obtaining the original leave data, non-working days are removed and the data is finely segmented based on the work calendar and time information. The work calendar is precisely adapted to the attendance recipient. Specifically, a basic work calendar is obtained by acquiring the latest unified holiday information, and then fine-tuned based on the leave method corresponding to the attendance recipient's department and job position to obtain a work calendar matching the current attendance recipient. Unified holiday information can be manually entered into the system or entered through a third-party system, such as obtaining the latest holiday data for the current year after government agencies release holiday arrangements. The leave method corresponding to the department and job position determines the specific leave method. That is, for departments or jobs with a comprehensive working hour system or shift system, leave duration cannot be directly calculated by natural days. Therefore, the leave calendar needs to be adjusted for shift systems to obtain a leave calendar precisely adapted to the attendance recipient, ensuring the accuracy of non-working day filtering.

[0036] After the removal process, the vacation data that originally spanned non-statutory holidays was divided into multiple vacation intervals, but these intervals were not the smallest possible vacation intervals. At this point, based on time information including start date, end date, start time type, and end time type, the vacation intervals were further refined. The coarse-grained range from one day to another was broken down into independent vacation segments arranged in smaller time units, such as half a day, hour, half hour, or even minute. The start time type and end time type are attribute fields used to precisely pinpoint the start and end times of a vacation. Together with the start and end dates, they form a complete time boundary, solving the problem that dates alone cannot express finer granularity. The start time type specifically indicates the exact location of the vacation's start time within the start date. Common values ​​include "AM," "PM," "09:00," "14:30," and "All Day." For example, a start date of "2026-05-11" and a start time type of "PM" means the employee began their vacation on the afternoon of May 11th. Correspondingly, the end time type specifies the exact location of the leave's end point within the end date. For example, if the end date is "2026-05-15" and the end time type is "AM", it means that the leave ends on the morning of May 15th, and the employee will return to work as usual in the afternoon.

[0037] By adopting this splitting method based on start / end dates and time types, the system can automatically break down previously coarse, continuous leave periods into independent leave segments aligned to half-days, hours, or even minutes. This enables precise deduction of leave based on actual duration, avoiding over- or under-deduction. For example, in cross-cycle scenarios, when an employee's leave application spans attendance cycles, such as monthly, quarterly, or annual settlement points, the system, after splitting by time segments, can automatically allocate leave days to different cycles. For instance, if an employee applies for leave from "May 30th afternoon to June 2nd morning," it is split into four segments: "May 30th afternoon, May 31st full day, June 1st full day, and June 2nd morning." Thus, when settling May attendance, only the allowance corresponding to the first two segments is deducted, avoiding premature deduction of the next cycle's allowance, complying with the phased compliance requirements of finance and human resources. Furthermore, in leave cancellation scenarios, when an employee withdraws or reduces an approved leave application, the refined splitting mechanism can accurately locate the segments that need to be restored. For example, an employee originally applied for leave from "the morning of May 11th to the afternoon of May 13th," which has been split into six half-day segments. If the employee returns to work early and cancels leave on "the morning of May 12th," the system only needs to cancel the "morning of May 12th" segment, while the remaining five segments remain as leave. This granular control avoids the entire leave application being rolled back or manually split, ensuring the accuracy of the credit limit restoration and preventing other normal leave from being mistakenly modified due to leave cancellation operations, significantly reducing the workload of manual verification.

[0038] In one embodiment of the present invention, for further explanation and limitation, the vacation period is divided according to the time information to obtain multiple vacation segments, including: For vacation intervals where the start and end dates overlap, the vacation interval is treated as a vacation segment, and the duration of the vacation segment is assigned according to the start and end time types of the vacation interval. For vacation periods where the start and end dates do not overlap, the vacation period is divided into a first-day vacation segment, a last-day vacation segment, and a middle vacation period. The duration of the first-day vacation segment is assigned according to the start time type, and the duration of the last-day vacation segment is assigned according to the end time type. The middle vacation period is then split into multiple middle-day vacation segments according to the vacation type.

[0039] In this embodiment of the invention, for vacation periods with overlapping start and end dates (i.e., vacations on the same day), they can be directly treated as independent vacation segments, and their duration is calculated based on the start and end time types of the segment itself. For example, a vacation from "morning" to "afternoon" is counted as 1 day, and a vacation from "2 pm" to "4 pm" is counted as 2 hours, without further splitting. For vacation periods with non-overlapping start and end dates (i.e., spanning multiple days), the system divides them into three types of segments: the first-day vacation segment (from the start time type to the end of the day), the last-day vacation segment (from the start of the day to the end time type), and at least one complete intermediate day vacation segment, with all days considered workdays. The first-day segment is assigned a value based on the start time type; for example, "afternoon" only counts as half a day. The last-day segment is assigned a value based on the end time type; for example, "morning" only counts as half a day.

[0040] Leave types include the first type, which only allows leave based on calendar days, such as marriage leave, maternity leave, bereavement leave, and work-related injury leave; and the second type, where the leave duration can be defined by the user, such as personal leave, compensatory leave, and sick leave. The splitting of intermediate leave intervals can be done in two ways. One is to directly assign the intermediate day leave segment to the company's preset full day duration, such as 1 day or 8 hours. This segmentation method accurately reflects the incomplete attendance of the first and last two days and efficiently handles full-day leave over multiple days in between, avoiding the performance waste and segment redundancy caused by brute-force hourly splitting. The other method is to divide the intermediate leave interval between the first and last days into multiple segments at equal intervals according to the smallest leave unit corresponding to the current leave type, such as half a day or one hour. That is, intermediate day leave segments covering full calendar days can be further divided into the smallest leave units, thus ensuring that each segment corresponds to a clear, independently measurable, and deductible smallest leave unit, achieving a refined and fair breakdown of leave applications that span multiple days, time periods, and include incomplete half-days.

[0041] The first method, which directly assigns the duration of a full day to the corresponding Chinese / Japanese leave segment, is suitable for leave types where the minimum leave application or cancellation unit is "day," such as maternity leave and bereavement leave. The second method, which divides the leave interval into equal parts at the minimum unit, is suitable for leave types where the minimum leave unit is "half a day" or "hour," and where subsequent cancellation, accounting adjustments, or cross-cycle allocation may be required based on segments, such as personal leave, annual leave, and compensatory leave. This ensures that if an employee cancels leave early on a particular half-day, the status of that half-day can be accurately restored or adjusted.

[0042] 103. In response to the vacation data statistics instruction, based on the unique index identifier, retrieve the vacation segments covered by the data processing cycle from the split details table as vacation segments to be processed.

[0043] In this embodiment of the invention, after receiving a request for vacation data statistics, the data processing cycle and attendance objects carried in the vacation data statistics instruction are used as time constraints. The unique index identifiers of each vacation segment are traversed and matched, and only vacation segments whose attendance object information matches and falls within the data processing cycle are extracted as vacation segments to be processed for subsequent statistical analysis. The vacation data statistics instruction can be triggered by a user's click, a system scheduled task, or a request to a human resources system API call; this embodiment of the invention does not impose specific limitations. The scenarios in which the vacation data statistics instruction is generated can include attendance calculation, salary calculation, or compliance checks—scenarios requiring the output of vacation data statistics results.

[0044] Since the split details table stores not the original leave application forms, but rather split leave segments, and each segment is bound to a corresponding unique index identifier, the retrieval process only uses the unique index identifier as the query basis to directly locate and load all leave segments to be processed within the corresponding period. The unique index identifier needs to include time information, attendance object information, and leave processing item; other information can be customized according to the leave statistics dimensions. For example, if leave statistics are needed for a specific leave type, a leave type field can be configured in the unique index identifier; if leave statistics are needed for a specific leave information table, the primary key of the leave information table can be configured in the unique index identifier.

[0045] In one embodiment of the present invention, for further explanation and limitation, the process of constructing a unique index identifier for any vacation segment includes: A unique index identifier for the leave segment is constructed based on the attendance object information, time attribute, leave type, and leave processing item of the leave segment, and the unique index identifier is used as the idempotent write key for the leave segment.

[0046] In this embodiment of the invention, attendance object information, such as employee ID, department code, time attributes such as segment start date, start time type, end date, end time type, leave type such as annual leave, sick leave, and compensatory leave, and leave processing items, such as positive numbers representing the amount deducted for applied leave and negative numbers representing the amount restored upon return from leave, are combined to generate a unique identifier. The index is specifically obtained through hashing or string concatenation and serves as the idempotent key when writing the segment to the database. Idempotent writing means that repeated write requests will not generate duplicate data, thereby avoiding duplicate processing. In the leave return scenario, the system distinguishes between leave deduction and leave return restoration by positive and negative items. Even if the original data of leave and leave return records for the same period are similar, different unique indexes will be generated due to the different positive and negative items, ensuring that both can be written correctly and do not interfere with each other, achieving highly reliable idempotent control at the leave segment level.

[0047] 104. Perform leave statistics processing according to the leave type and attendance object of the leave segment to be processed to obtain the leave data statistics results within the data processing period.

[0048] In this embodiment of the invention, leave segments to be processed are grouped and aggregated according to two dimensions: leave type and attendance subject. Specifically, firstly, all leave segments belonging to the same combination are grouped into the same group, using the attendance subject (e.g., employee Zhang San) and leave type (e.g., annual leave, sick leave) as the key. Then, statistical calculations are performed on the segments within each group, such as accumulating leave duration to obtain the total number of leave days; deducting the duration of leave segments with different positive and negative leave processing options to achieve leave cancellation or calculate the longest consecutive leave; finally, a structured statistical result is output, with attendance subject and leave type as rows and various statistical indicators as columns, thus obtaining the statistical data of each employee under different leave types, i.e., the leave data statistical result.

[0049] In one embodiment of the present invention, for further explanation and limitation, leave statistical processing is performed according to the leave type and attendance object of the leave segment to be processed to obtain the leave data statistical results within the data processing period, including: The leave segments to be processed are divided into objects according to the attendance objects to obtain a set of leave segments for at least one attendance object. For each set of vacation segments, the vacation segments to be processed within the group are divided into vacation types according to vacation type, resulting in at least one subset of vacation segments of each vacation type; For each subset of vacation segments, the vacation segments to be processed with the same date and opposite positive and negative vacation processing items are deducted in duration. The remaining vacation segments to be processed after the duration deduction are merged in duration to obtain the vacation statistics data of the vacation type. Based on the vacation statistics data corresponding to different vacation types for all attendance subjects, the vacation data statistics results for the data processing period are generated.

[0050] In this embodiment of the invention, leave statistics are performed based on the finely granular leave segments. First, a global set of leave segments within a processing cycle is generated for different attendance objects, using the attendance object as the largest dimension. Then, within this set of attendance objects, further classification and statistics are performed according to leave type, forming subsets. Leave segments are deducted and merged within each leave type subset, ultimately generating leave data for each type based on the processed data for all attendance objects. The leave statistics results for the entire data processing cycle are then summarized. For example: Zhang has taken 3 days of annual leave and 0.5 days of sick leave; Li has taken 2 days of compensatory leave, etc. The leave statistics results can be further used to generate reports, synchronize with the payroll system, or update remaining leave quotas, etc.

[0051] Because the vacation statistics focus on granular vacation segments rather than continuous, cross-period vacation records that include non-working days, the system can accurately summarize vacation duration by any time dimension, such as day, week, month, or attendance cycle. When a half-day of leave is canceled, only the corresponding segment needs to be deducted, without recalculating the entire record, thus generating accurate and traceable vacation statistics results.

[0052] In one embodiment of the present invention, for further explanation and limitation, the leave segment to be processed carries an attendance period field, a confirmation field, an attendance calculation time field, and a leave cancellation time field. Before performing vacation statistics processing on the vacation segments to be processed in any subset of the aforementioned vacation segments, the method further includes: Based on the comparison relationship between the attendance period field, the confirmation field, the attendance calculation time field, and the leave cancellation time field, the pending leave segments for early leave cancellation, make-up leave cancellation, and make-up leave are identified, specifically including: If the confirmation field of the leave segment to be processed is no and the leave cancellation time field has a value, then the leave segment to be processed will not be subject to attendance statistics processing. If the confirmation field of the leave segment to be processed is yes, the leave cancellation time field has a value, and the leave cancellation time is greater than the attendance calculation time of the previous attendance cycle, then the leave segment to be processed will be used as a time deduction item for attendance statistics processing. If the leave date in the leave segment to be processed is less than the start date of the current attendance period, and the confirmation field is negative, then the leave segment to be processed will be subject to attendance statistics processing.

[0053] In this embodiment of the invention, each leave segment to be processed carries four key fields: the attendance period field, the confirmation field, the attendance calculation time field, and the leave cancellation time field. The attendance period field identifies which attendance period the leave belongs to; the confirmation field indicates confirmation if it is yes, otherwise it is not confirmed; the attendance calculation time field is the system time recorded during each statistical analysis, used to distinguish after which statistical analysis the leave occurred; the leave cancellation time field indicates the actual time of the leave cancellation operation. Before performing grouped statistics by leave type and attendance object, the system will automatically identify and classify the following three special cases based on the comparison relationship of the above fields to ensure the accuracy of the statistical results: Early cancellation of leave: When the confirmation field of a certain leave segment to be processed is "no", that is, it has not been confirmed and sealed, but the leave cancellation time field has a valid value, it means that the employee has cancelled the leave in advance before the leave is included in the attendance cycle. In this case, the leave has actually been cancelled, and there is no need to count the number of leave days or deduct them.

[0054] Supplementary Leave Cancellation: When the "Confirmation Status" field for a leave period is "Yes" (meaning it has been confirmed), the "Leave Cancellation Time" field has a valid value, and the cancellation time is later than the attendance calculation time of the previous attendance period, it indicates that the leave cancellation occurred after the previous attendance statistics were completed, and thus constitutes supplementary leave cancellation. This leave was not deducted in the previous statistics and needs to be deducted in the current attendance calculation. Therefore, this leave period needs to be marked as a time deduction item and included in this statistical processing, with the corresponding deduction from the employee's total leave days.

[0055] Compensatory Leave Situation: When the leave date in a leave segment is earlier than the start date of the current attendance period (i.e., the leave occurred before the current attendance period), and the confirmation field is "No," meaning it has not yet been confirmed, it indicates that the leave is a subsequent make-up leave from a previous period. Although this compensatory leave occurred in the past, it needs to be included in the current attendance statistics because it has not yet been confirmed and counted in previous attendance periods. Therefore, this leave segment should be included in the attendance statistics of the current period to ensure that employee leave records are complete and without omissions.

[0056] It should be noted that the above data can also be separated into hot and cold data based on processing status. For example, confirmed data with a processing status flag of 0 and a processing status flag of 1 within the past 6 months can be stored in the hot shard, while other historical data can be migrated to the cold shard. This achieves automatic data routing based on status flags. When querying historical reports, the cold shard is accessed, while daily attendance calculations only scan the hot shard, thus significantly reducing the amount of data per calculation and improving the response speed and system throughput of attendance statistics.

[0057] This invention provides a method for processing leave data. In this embodiment, raw leave data is obtained from a leave information table, including leave type, time information, and attendance object information. The raw leave data is then finely segmented based on the time information, and each segment is bound with a unique index identifier before being stored in a segmentation detail table. In response to a leave data statistics command, leave segments covered by the data processing cycle are retrieved from the segmentation detail table based on the unique index identifier, serving as leave segments to be processed. Leave statistics are then performed according to the leave type and attendance object of the leave segments to be processed, yielding the leave data statistics results within the data processing cycle. This significantly reduces the computational resource consumption during large-scale data queries and statistics, lowers the response latency and system input / output overhead caused by directly manipulating the original coarse-grained leave table, and ensures that the statistical results are accurate to a single leave segment, avoiding statistical ambiguity or double counting caused by cross-cycle or cross-type leave, thereby greatly improving the efficiency of leave statistics under complex attendance rules.

[0058] Furthermore, as a response to the above Figure 1 To implement the method shown, this embodiment of the invention provides a vacation data processing device, such as... Figure 3 As shown, the device includes: The acquisition module 31 is used to acquire raw leave data from the leave information table, wherein the raw leave data includes leave type, time information and attendance object information; The splitting module 32 is used to perform fine-grained splitting of the original vacation data based on the time information, and after binding a unique index identifier to each of the split vacation segments, store the vacation segments in the splitting details table; The retrieval module 33 is used to respond to the vacation data statistics instruction and retrieve the vacation segments covered by the data processing cycle from the split details table according to the unique index identifier, as the vacation segments to be processed. The statistical processing module 34 is used to perform vacation statistical processing according to the vacation type and attendance object of the vacation segment to be processed, and to obtain the vacation data statistical results within the data processing period.

[0059] Furthermore, the splitting module 32 includes: The retrieval unit is used to retrieve the work calendar of the attendance object corresponding to the original leave data; The elimination processing unit is used to eliminate non-working days from the original vacation data based on the work calendar to obtain at least one vacation interval; The splitting unit is used to split the vacation period according to the time information to obtain multiple vacation segments, wherein the time information includes start date, end date, start time type and end time type.

[0060] Furthermore, in specific application scenarios, the splitting unit is specifically used to treat a vacation interval with overlapping start and end dates as a vacation segment, and to assign a duration to the vacation segment based on the start and end time types of the vacation interval; For vacation periods where the start and end dates do not overlap, the vacation period is divided into a first-day vacation segment, a last-day vacation segment, and a middle vacation period. The duration of the first-day vacation segment is assigned according to the start time type, and the duration of the last-day vacation segment is assigned according to the end time type. The middle vacation period is then split into multiple middle-day vacation segments according to the vacation type.

[0061] Furthermore, the statistical processing module 34 includes: The first partitioning unit is used to partition the leave fragments to be processed according to the attendance objects, so as to obtain a set of leave fragments for at least one attendance object. The second partitioning unit is used to partition the vacation fragments to be processed in each vacation fragment set according to the vacation type, so as to obtain at least one subset of vacation fragments of at least one vacation type. The processing unit is used to perform time deduction processing on the pairs of unprocessed vacation segments with the same date and opposite positive and negative vacation processing items for each subset of vacation segments, and to perform time merging processing on the remaining unprocessed vacation segments after time deduction processing to obtain vacation statistics data of the vacation type. The generation unit is used to generate the vacation data statistics results for the data processing period based on the vacation statistics data of different vacation types corresponding to all attendance objects.

[0062] Furthermore, the leave segment to be processed carries a field indicating the period to which the attendance belongs, a field indicating whether it has been confirmed, a field indicating the attendance calculation time, and a field indicating the time of return from leave. The device further includes: The leave cancellation identification module is used to identify the pending leave segments for early leave cancellation, make-up leave cancellation, and make-up leave based on the comparison relationship between the attendance period field, the confirmation field, the attendance calculation time field, and the leave cancellation time field. Specifically, it includes: If the confirmation field of the leave segment to be processed is no and the leave cancellation time field has a value, then the leave segment to be processed will not be subject to attendance statistics processing. If the confirmation field of the leave segment to be processed is yes, the leave cancellation time field has a value, and the leave cancellation time is greater than the attendance calculation time of the previous attendance cycle, then the leave segment to be processed will be used as a time deduction item for attendance statistics processing. If the leave date in the leave segment to be processed is less than the start date of the current attendance period, and the confirmation field is negative, then the leave segment to be processed will be subject to attendance statistics processing.

[0063] Furthermore, the splitting module 32 also includes: The index generation unit is used to construct a unique index identifier for the leave segment based on the attendance object information, time attribute, leave type and leave processing item of the leave segment, and use the unique index identifier as the idempotent write key of the leave segment.

[0064] Furthermore, the device also includes: A distributed lock is requested using the combination of attendance object information and time information corresponding to the original leave data as the lock key; If the distributed lock acquisition is successful, the process continues with retrieving the original vacation data from the vacation information table; if the distributed lock acquisition fails, the process waits for a retry.

[0065] This invention provides a leave data processing device. In this embodiment, raw leave data is obtained from a leave information table, including leave type, time information, and attendance object information. The raw leave data is then finely segmented based on the time information, and each segment is bound with a unique index identifier before being stored in a segmentation detail table. In response to a leave data statistics command, leave segments covered by the data processing cycle are retrieved from the segmentation detail table based on the unique index identifier, serving as leave segments to be processed. Leave statistics are then performed according to the leave type and attendance object of the leave segments to be processed, yielding the leave data statistics results within the data processing cycle. This significantly reduces the computational resource consumption during large-scale data queries and statistics, lowers the response latency and system input / output overhead caused by directly manipulating the original coarse-grained leave table, and ensures that the statistical results are accurate to a single leave segment, avoiding statistical ambiguity or duplicate calculations caused by cross-cycle or cross-type leave, thereby greatly improving the efficiency of leave statistics under complex attendance rules.

[0066] According to one embodiment of the present invention, a storage medium is provided, the storage medium storing at least one executable instruction, the computer-executable instruction being capable of executing the vacation data processing method in any of the above method embodiments.

[0067] Figure 4 The diagram shows a structural schematic of a terminal according to an embodiment of the present invention. The specific implementation of the present invention does not limit the specific implementation of the terminal.

[0068] like Figure 4 As shown, the terminal may include: a processor 402, a communication interface 404, a memory 406, and a communication bus 408.

[0069] The processor 402, communication interface 404, and memory 406 communicate with each other via communication bus 408.

[0070] Communication interface 404 is used for network communication with other devices such as clients or other servers.

[0071] The processor 402 is used to execute program 410, specifically to perform the relevant steps in the above-described vacation data processing method embodiment.

[0072] Specifically, program 410 may include program code that includes computer operation instructions.

[0073] Processor 402 may be a central processing unit (CPU), a specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present invention. The terminal may include one or more processors of the same type, such as one or more CPUs; or it may include processors of different types, such as one or more CPUs and one or more ASICs.

[0074] Memory 406 is used to store program 410. Memory 406 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.

[0075] Specifically, program 410 can be used to cause processor 402 to perform the following operations: Obtain raw leave data from the leave information table, wherein the raw leave data includes leave type, time information and attendance object information; The original vacation data is split into fine-grained segments based on the time information, and after binding a unique index identifier to each of the split vacation segments, the vacation segments are stored in the split details table. In response to the vacation data statistics instruction, based on the unique index identifier, the vacation segments covered by the data processing cycle are retrieved from the split details table as vacation segments to be processed. Leave statistics are performed according to the leave type and attendance object of the leave segment to be processed, and the leave data statistics results within the data processing period are obtained.

[0076] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.

[0077] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for processing vacation data, characterized in that, include: Obtain raw leave data from the leave information table, wherein the raw leave data includes leave type, time information and attendance object information; The original vacation data is split into fine-grained segments based on the time information, and after binding a unique index identifier to each of the split vacation segments, the vacation segments are stored in the split details table. In response to the vacation data statistics instruction, based on the unique index identifier, the vacation segments covered by the data processing cycle are retrieved from the split details table as vacation segments to be processed. Leave statistics are performed according to the leave type and attendance object of the leave segment to be processed, and the leave data statistics results within the data processing period are obtained.

2. The method according to claim 1, characterized in that, Based on the time information of the original vacation data, the original vacation data is segmented into multiple vacation segments, including: Retrieve the work calendar of the attendance object corresponding to the original leave data; By removing non-working days from the original leave data based on the work calendar, at least one leave period is obtained; The vacation period is divided into multiple vacation segments based on the time information, wherein the time information includes a start date, an end date, a start time type, and an end time type.

3. The method according to claim 2, characterized in that, The vacation period is divided based on the time information to obtain multiple vacation segments, including: For vacation intervals where the start and end dates overlap, the vacation interval is treated as a vacation segment, and the duration of the vacation segment is assigned according to the start and end time types of the vacation interval. For vacation periods where the start and end dates do not overlap, the vacation period is divided into a first-day vacation segment, a last-day vacation segment, and a middle vacation period. The first-day vacation segment is assigned a duration based on its start time type, and the last-day vacation segment is assigned a duration based on its end time type. The middle vacation period is then split into multiple middle-day vacation segments according to the vacation type. Specifically, the splitting of the intermediate holiday interval includes: when the holiday type is the first holiday type, dividing the intermediate holiday interval according to natural days to obtain multiple intermediate day holiday segments; when the holiday type is the second holiday type, retrieving the minimum holiday unit corresponding to the holiday type, and dividing the intermediate holiday interval according to the minimum holiday unit to obtain multiple intermediate day holiday segments.

4. The method according to claim 1, characterized in that, Leave statistics are performed according to the leave type and attendance subject of the leave segment to be processed, to obtain the leave data statistics results within the data processing period, including: The leave segments to be processed are divided into objects according to the attendance objects to obtain a set of leave segments for at least one attendance object. For each set of vacation segments, the vacation segments to be processed within the group are divided into vacation types according to vacation type, resulting in at least one subset of vacation segments of each vacation type; For each subset of vacation segments, the vacation segments to be processed with the same date and opposite positive and negative vacation processing items are deducted in duration. The remaining vacation segments to be processed after the duration deduction are merged in duration to obtain the vacation statistics data of the vacation type. Based on the vacation statistics data corresponding to different vacation types for all attendance subjects, the vacation data statistics results for the data processing period are generated.

5. The method according to claim 4, characterized in that, The leave segment to be processed carries a field for the period to which the attendance belongs, a field for whether it is confirmed, a field for the attendance calculation time, and a field for the time to cancel the leave. Before performing vacation statistics processing on the vacation segments to be processed in any subset of the aforementioned vacation segments, the method further includes: Based on the comparison relationship between the attendance period field, the confirmation field, the attendance calculation time field, and the leave cancellation time field, the pending leave segments for early leave cancellation, make-up leave cancellation, and make-up leave are identified, specifically including: If the confirmation field of the leave segment to be processed is no and the leave cancellation time field has a value, then the leave segment to be processed will not be subject to attendance statistics processing. If the confirmation field of the leave segment to be processed is yes, the leave cancellation time field has a value, and the leave cancellation time is greater than the attendance calculation time of the previous attendance cycle, then the leave segment to be processed will be used as a time deduction item for attendance statistics processing. If the leave date in the leave segment to be processed is less than the start date of the current attendance period, and the confirmation field is negative, then the leave segment to be processed will be subject to attendance statistics processing.

6. The method according to claim 1, characterized in that, The process of constructing a unique index identifier for any vacation segment includes: A unique index identifier for the leave segment is constructed based on the attendance object information, time attribute, leave type, and leave processing item of the leave segment, and the unique index identifier is used as the idempotent write key for the leave segment.

7. The method according to claim 6, characterized in that, Before retrieving the original leave data from the leave information table, the method further includes: A distributed lock is requested using the combination of attendance object information and time information corresponding to the original leave data as the lock key; If the distributed lock acquisition is successful, the process continues with retrieving the original vacation data from the vacation information table; if the distributed lock acquisition fails, the process waits for a retry.

8. A vacation data processing device, characterized in that, include: The acquisition module is used to acquire raw leave data from the leave information table, wherein the raw leave data includes leave type, time information and attendance object information; The splitting module is used to perform fine-grained splitting of the original vacation data based on the time information, and after binding a unique index identifier to each split vacation segment, store the vacation segment in the splitting details table; The retrieval module is used to respond to the vacation data statistics instruction and retrieve the vacation segments covered by the data processing cycle from the split details table based on the unique index identifier, as the vacation segments to be processed. The statistical processing module is used to perform vacation statistical processing according to the vacation type and attendance object of the vacation segment to be processed, and to obtain the vacation data statistical results within the data processing period.

9. A storage medium, characterized in that, The storage medium stores at least one executable instruction that causes the processor to perform the operation corresponding to the vacation data processing method as described in any one of claims 1-7.

10. A terminal, characterized in that, include: The processor, memory, communication interface, and communication bus are provided, wherein the processor, memory, and communication interface communicate with each other via the communication bus. The memory is used to store at least one executable instruction that causes the processor to perform the operation corresponding to the vacation data processing method as described in any one of claims 1-7.