An attendance data generation method, system, computer device and readable medium
By generating a data extraction thread in the attendance system to extract and cache personnel information from the object management system, the problem of excessive time in generating attendance results is solved, and attendance record generation with instant saving and optimization is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHONGQING UNISINSIGHT TECH CO LTD
- Filing Date
- 2022-06-22
- Publication Date
- 2026-07-07
AI Technical Summary
Existing technologies take too long to extract personnel information from the object management system when generating attendance results, resulting in a poor user experience, especially when there are too many people in a department, which may cause the page to time out and fail to save.
By generating a data extraction thread, personnel information associated with the work group to be attended is extracted from the object management system and transmitted to the attendance system cache. After matching, attendance data is generated. If there is no complete match, a new data extraction thread is started to continue extraction until attendance data is generated.
When there are many employees in a work group waiting to be checked in, users can save the work group's attendance record immediately, avoiding webpage request timeouts, optimizing the attendance record generation process, and ensuring that attendance results are generated instantly.
Smart Images

Figure CN115187195B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of attendance data generation technology, and in particular to an attendance data generation method, system, computer equipment, and readable medium. Background Technology
[0002] In a security system, the object management system and the attendance system are two relatively independent subsystems. The object management system manages the basic information of attendance personnel (such as name, employee ID, department, and identity), while the attendance system manages the card-swiping information (such as swipe time, employee ID, and attendance device number). The attendance system relies on the personnel information in the object management system to function. When an employee swipes their card, the attendance device sends the swipe information to the attendance system. The attendance system then integrates its own existing swipe information with the personnel information extracted from the object management system and stored in its database to process the data according to attendance logic and generate the attendance result.
[0003] To expedite the generation of attendance results by the attendance system, personnel information for each work group is typically extracted from the object management database and transferred to the attendance system database, usually by creating work groups. However, when a department has a large number of employees, extracting personnel information from the object management system to the attendance system can take a considerable amount of time. This results in some work group information being stored for too long or even timeouts, leading to a poor user experience. Summary of the Invention
[0004] In view of the shortcomings of the prior art described above, the purpose of this invention is to provide an attendance data generation method, system, computer equipment, and readable medium to solve the problem that the prior art takes too long to extract personnel information when generating attendance results.
[0005] To achieve the above and other related objectives, the present invention provides a method for generating attendance data, the method comprising the following steps:
[0006] Obtain the pre-determined or real-time determined work groups to be checked in, as well as the card-swiping information generated on the attendance system;
[0007] Receive attendance instruction signals and generate data extraction threads based on the attendance instruction signals. The attendance instruction signals are generated after the work group to be attended is determined or saved.
[0008] Based on the data extraction thread, personnel information associated with the work group to be checked and recorded is extracted from the object management system, and the extracted personnel information is transmitted to the attendance system cache.
[0009] The attendance system matches the personnel information cached in the attendance system with the generated card-swiping information. If there is a complete match, the attendance data of the work group to be attended is generated based on the cached personnel information and the card-swiping information. Alternatively, if there is an incomplete match, a new data extraction thread is activated based on the matching result, and personnel information is extracted again based on the new data extraction thread and then matched again until the attendance data of the work group to be attended is generated.
[0010] Optionally, the process of matching the personnel information cached in the attendance system with the generated card-swiping information includes:
[0011] Obtain the card-swiping personnel corresponding to the card-swiping information, and determine whether the card-swiping personnel are in the personnel information cached in the attendance system;
[0012] When the card-swiping personnel is in the personnel information cached in the attendance system, it is determined that the personnel information cached in the attendance system completely matches the card-swiping information;
[0013] When the card-swiping personnel is not in the personnel information cached in the attendance system, it is determined that the personnel information cached in the attendance system does not completely match the card-swiping information.
[0014] Optionally, when the person swiping the card is not in the personnel information cached in the attendance system, the method further includes:
[0015] Obtain the department of the person swiping the card from the object management system, and determine whether the department of the person swiping the card belongs to the work group to be checked in;
[0016] If the department of the person swiping the card belongs to the work group to be checked in, a new data extraction thread is activated, and personnel information is extracted from the object management system according to the new data extraction thread.
[0017] If the department of the person swiping the card cannot be obtained from the object management system, or if the department of the person swiping the card does not belong to the work group to be checked in, then the card swiping information will not be processed.
[0018] Optionally, when the personnel information cached in the attendance system does not completely match the card-swiping information, the method further includes:
[0019] Obtain the row identifier of the card-swiper in the temporary table of the object management system, and denote it as the target row identifier; the temporary table of the object management system is generated after receiving the attendance instruction signal;
[0020] Determine whether the target row identifier is located within the existing thread pagination row identifier range in the attendance system; wherein, the thread pagination row identifier range consists of the pagination start data row identifier and the pagination end data row identifier;
[0021] If the location is specified, the personnel information corresponding to the card-swiping personnel will be extracted from the object management system and cached in the attendance system.
[0022] If not located, the target row identifier is used as the starting data row identifier for thread paging and broadcast to other data extraction threads in the same thread pool; and a new data extraction thread is enabled, with the target row identifier used as the first starting data row identifier for paging in the new data extraction thread.
[0023] According to the identifier of the first page starting data row in the new data extraction thread, personnel information is extracted from the object management system page by page until the personnel information extraction is completed or the thread terminates.
[0024] Optionally, the process of extracting personnel information from the object management system page by page according to the page start data row identifier of the first page task in the new data extraction thread includes:
[0025] Calculate the first page ending data row identifier in the new data extraction thread based on the first page start data row identifier and the preset number of pages;
[0026] The first page row identifier range of the new data extraction thread is generated based on the first page start data row identifier and the first page end data row identifier in the new data extraction thread;
[0027] Get the starting data row identifiers of all threads broadcast to the same thread pool, and determine whether the obtained starting data row identifiers of the threads are within the range of the first thread page row identifier;
[0028] If it exists, a new thread pagination row identifier range is generated and written into the key-value database of the attendance system. The new thread pagination identifier range is used as the starting range of the current page. Personnel information is extracted from the object management system page by page until the extraction of personnel information for the current page is completed or the extraction of all pages for the current thread is completed.
[0029] If it does not exist, the first thread pagination row identifier range is written into the key-value database of the attendance system, and the first thread pagination row identifier range is used as the starting range of the current page. Personnel information is extracted from the object management system page by page until the extraction of personnel information for the current page is completed or the extraction of all pages for the current thread is completed.
[0030] Optionally, the method further includes extracting personnel information from the object management system paginated by pagination, using the first thread pagination row identifier range as the starting range of the current pagination, until the personnel information extraction for the current pagination is completed:
[0031] Determine whether all row identifiers within the first thread pagination row identifier range contain personnel information;
[0032] If no personnel information exists in some row identifiers within the first thread's pagination row identifier range, then it is determined that all pagination extraction for the current thread has ended;
[0033] If all row identifiers within the first thread pagination row identifier interval contain personnel information, the current pagination extraction is determined to be complete. Then, based on the pagination termination data row identifier within the first thread pagination row identifier interval, the next thread pagination row identifier interval is generated, and the next thread pagination identifier interval is used as the starting range of the current pagination. Personnel information is extracted from the object management system paginated until the extraction of personnel information for the current pagination is completed or the extraction of all paginations for the current thread is completed.
[0034] Optionally, the method further includes:
[0035] Obtain the personnel information extracted by each data extraction thread, and generate a data source file in the attendance system based on the personnel information extracted by each data extraction thread, so that each data source file corresponds to a data extraction thread.
[0036] All data source files within the attendance system are combined to generate a database table.
[0037] The present invention also provides an attendance data generation system, the system comprising:
[0038] The data acquisition module is used to acquire the work groups to be checked in a pre-determined or real-time manner, as well as the pre-generated or real-time generated card-swiping information;
[0039] The first thread module is used to receive attendance instruction signals and generate a data extraction thread based on the attendance instruction signals. The attendance instruction signals are generated after the work group to be attended is determined or saved.
[0040] The first information extraction module is used to extract personnel information associated with the work group to be checked and recorded from the object management system according to the data extraction thread, and transmit it to the cache module.
[0041] The caching module is used to cache the extracted personnel information;
[0042] The matching module is used to match the cached personnel information with the generated card-swiping information;
[0043] The second thread module is used to start a new data extraction thread based on the matching result when the cached personnel information and the generated card swipe information do not completely match.
[0044] The second information extraction module is used to extract personnel information associated with the work group to be checked and recorded from the object management system according to the new data extraction thread, and transmit it to the cache module.
[0045] The attendance data generation module is used to generate attendance data for the work group to be attended based on the cached personnel information and the generated card-swiping information when the personnel information cached in the attendance system completely matches the generated card-swiping information.
[0046] The present invention also provides a computer device, comprising:
[0047] processor; and
[0048] A computer-readable medium storing instructions that, when executed by the processor, cause the device to perform any of the methods described above.
[0049] The present invention also provides a computer-readable medium having instructions stored thereon, the instructions being loaded by a processor and executed as described in any of the above methods.
[0050] As described above, the present invention provides a method, system, computer device, and readable medium for generating attendance data, which has the following beneficial effects:
[0051] This invention first acquires a pre-determined or real-time determined work group to be checked in, as well as the card-swiping information generated on the attendance system; then it receives an attendance instruction signal and generates a data extraction thread based on the attendance instruction signal, wherein the attendance instruction signal is generated after the work group to be checked in is determined or saved; then, based on the data extraction thread, it extracts personnel information associated with the work group to be checked in from the object management system and transmits the extracted personnel information to the attendance system cache; finally, it matches the personnel information cached in the attendance system with the generated card-swiping information, and if there is a complete match, it generates the attendance data of the work group to be checked in based on the cached personnel information and card-swiping information; or if there is an incomplete match, it activates a new data extraction thread based on the matching result, and continues to extract personnel information based on the new data extraction thread and then performs matching again until the attendance data of the work group to be checked in is generated. Therefore, when there are too many people in a work group awaiting attendance, the user or attendance manager responsible for attendance can directly save the work group on the attendance configuration page, thus avoiding long waiting times on the page and preventing webpage request timeouts. Simultaneously, this invention optimizes the attendance record generation process. Even if personnel information data extraction is incomplete, personnel information can be directly queried through the object management system and returned to the attendance system to generate attendance results. Essentially, when there are too many people in the selected departments of a work group awaiting attendance, this invention not only saves the front-end interaction and back-end logic of the work group, allowing for immediate saving of the work group, but also flexibly controls the extraction of personnel information from the object management system to the attendance system. Attached Figure Description
[0052] Figure 1 This is a flowchart illustrating an attendance data generation method provided in one embodiment;
[0053] Figure 2 A flowchart illustrating an attendance data generation method is provided for another embodiment;
[0054] Figure 3 This is a flowchart illustrating the process of extracting personnel information in one embodiment.
[0055] Figure 4 A schematic diagram of a paginated personnel information extraction process provided in one embodiment;
[0056] Figure 5 A schematic diagram of a data extraction thread pool provided in one embodiment;
[0057] Figure 6 A schematic diagram illustrating the principle of an attendance data generation method provided in one embodiment;
[0058] Figure 7 A schematic diagram of the hardware structure of an attendance data generation system provided in one embodiment;
[0059] Figure 8 This is a schematic diagram of the hardware structure of a computer device provided in one embodiment. Detailed Implementation
[0060] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, unless otherwise specified, the following embodiments and features described therein can be combined with each other.
[0061] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Therefore, the drawings only show the components related to the present invention and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.
[0062] Work group: refers to an organization that brings together workers of the same, similar, or different jobs to engage in production activities based on the division of labor.
[0063] A department is an organization established to perform prescribed tasks and authorized to govern one or more specific areas. There is a relationship between departments and work groups. For example, a department may include one or more work groups; or, a work group may include one or more departments. In the embodiments of this application, a work group includes one or more departments.
[0064] CTID: Row Identifier: In PGSQL (Postgreat Structured Query Language, Object-Relational Database Management System), it is used to represent the physical location of data, that is, which data block and offset a data record is located at.
[0065] S_CTID: The CTID of the first data entry in the current page when the thread reads the page, which is recorded as the identifier of the first data row of the page.
[0066] E_CTID: When a thread reads pages, the CTID of the last data in the current page is used as the page termination data row identifier.
[0067] B_CTID: The CTID of the first data extracted by the thread, which is equal to the S_CTID of the first page extraction task of the thread, and is denoted as the thread's page start data row identifier.
[0068] (S_CTID, E_CTID): The data range of the current page when the thread reads pages, denoted as the thread page row identifier range.
[0069] Redis (Remote Dictionary Server) is a memory-based key-value non-relational database, often simply called a key-value database.
[0070] Please see Figure 1 As shown, the present invention provides a method for generating attendance data, the method comprising the following steps:
[0071] S100: Obtain the pre-determined or real-time determined work groups to be checked and the card-swiping information generated on the attendance system;
[0072] S200, receive attendance instruction signal, and generate data extraction thread according to the attendance instruction signal, the attendance instruction signal is generated after the work group to be attended is determined or saved;
[0073] S300, based on the data extraction thread, extract personnel information associated with the work group to be attended from the object management system, and transmit the extracted personnel information to the attendance system cache;
[0074] S400, the personnel information cached in the attendance system is matched with the generated card swipe information. If there is a complete match, the attendance data of the work group to be attended is generated based on the cached personnel information and the card swipe information. Alternatively, if there is an incomplete match, a new data extraction thread is activated based on the matching result, and personnel information is extracted again based on the new data extraction thread and then matched again until the attendance data of the work group to be attended is generated.
[0075] Therefore, when the number of personnel in a work group awaiting attendance is too large, the user or attendance manager responsible for attendance can directly save the work group on the attendance configuration page, thus avoiding long waiting times on the page and preventing webpage request timeouts. Simultaneously, this embodiment optimizes the attendance record generation process. Even if personnel information data extraction is incomplete, personnel information can be directly queried through the object management system and returned to the attendance system to generate attendance results. Essentially, when the selected department for a work group awaiting attendance has too many personnel, this embodiment not only saves the front-end interaction and back-end logic of the attendance group, allowing for immediate saving of the work group, but also flexibly controls the extraction of personnel information from the object management system to the attendance system.
[0076] According to the above description, in an exemplary embodiment, the process of matching the personnel information cached in the attendance system with the generated card-swiping information includes: obtaining the card-swiping personnel corresponding to the card-swiping information, and determining whether the card-swiping personnel is in the personnel information cached in the attendance system. When the card-swiping personnel is in the personnel information cached in the attendance system, it is determined that the personnel information cached in the attendance system completely matches the card-swiping information. When the card-swiping personnel is not in the personnel information cached in the attendance system, it is determined that the personnel information cached in the attendance system does not completely match the card-swiping information. Specifically, when the card-swiping personnel is not in the personnel information cached in the attendance system, this embodiment may further include: obtaining the department of the card-swiping personnel from the object management system, and determining whether the department of the card-swiping personnel belongs to the work group to be attended. If the department of the card-swiping personnel belongs to the work group to be attended, a new data extraction thread is activated, and personnel information is continued to be extracted from the object management system according to the new data extraction thread. If the department of the person swiping the card cannot be obtained from the object management system, or if the department of the person swiping the card does not belong to the work group to be checked in, then the card swiping information will not be processed.
[0077] In an exemplary embodiment, when the personnel information cached by the attendance system does not completely match the card-swiping information, the method further includes:
[0078] The row identifier of the card-swiping personnel in the temporary table of the object management system is obtained and denoted as the target row identifier. The temporary table of the object management system is generated after receiving the attendance instruction signal. As an example, when the attendance manager responsible for generating attendance results saves the work group, the object management system generates a temporary personnel information table that conforms to the work group configuration based on the attendance system request parameters. The purpose of creating the temporary table is twofold: first, to ensure that the row identifier CTID of the personnel records that meet the extraction conditions is a fixed value; and second, to ensure that it is specifically created for the attendance system extraction task, containing only query operations without indexes or constraints, thereby improving query efficiency.
[0079] Determine whether the target row identifier is within the existing thread pagination row identifier range in the attendance system; wherein, the thread pagination row identifier range consists of a pagination start data row identifier and a pagination end data row identifier. As an example, the thread pagination row identifier range could be: (pagination start data row identifier, pagination end data row identifier), or (S_CTID, E_CTID).
[0080] If the target row identifier is within the existing thread pagination row identifier range in the attendance system, then the personnel information corresponding to the card-swiping personnel will be extracted from the object management system and cached in the attendance system. As an example, in this embodiment, the attendance system can utilize the key-value database Redis to cache the extracted personnel information and row identifier CTID range information to speed up the matching of personnel attributes and improve the speed of attendance record generation.
[0081] If the target row identifier is not located within the existing thread paging row identifier range in the attendance system, then the target row identifier is used as the thread paging start data row identifier and broadcast to other data extraction threads in the same thread pool; and a new data extraction thread is enabled, and the target row identifier is used as the first paging start data row identifier in the new data extraction thread.
[0082] Then, according to the identifier of the first page starting data row in the new data extraction thread, personnel information is extracted page by page from the object management system until the personnel information extraction is completed or the thread terminates.
[0083] Specifically, such as Figure 3As shown, the attendance system generates a data extraction thread pool for retrieving personnel information and enables the data extraction thread to extract personnel information from a temporary table in the object management system. At this time, the starting data row identifier S_CTID for the first pagination extraction task of this data extraction thread is 1, and the range of row identifier CTID data in the key-value database Redis is empty. Each pagination extraction includes query conditions and updates the temporary table. During the execution of the data extraction thread, if personnel card swipe information is generated but has not yet been extracted, the attendance system obtains the row identifier CTID of that personnel in the temporary table of the object management system, records it as the target row identifier, and simultaneously queries the existing thread pagination row identifier range (S_CTID, E_CTID) in the key-value database Redis to determine whether the target row identifier CTID is within the existing range (S_CTID, E_CTID). If the personnel information is found in the object management system, the personnel information retrieved from the attendance system will be directly returned to the attendance system. If not, the CTID of that row will be used as the starting data row identifier B_CTID for thread pagination and broadcast to all threads in the current data extraction thread pool. Simultaneously, a new data extraction thread will be started, and the CTID will be used as the starting data row identifier S_CTID for the first pagination in the new thread. This thread will simultaneously extract personnel information from the object management system along with the existing data extraction thread, and the extracted personnel information will be cached in the key-value database Redis. This process continues until the personnel information extraction is complete, or until all threads in the current data extraction thread pool terminate, or until the current data extraction thread terminates. In this embodiment, the initial generation of the personnel extraction thread pool and data extraction thread is triggered by the attendance manager saving the work groups to be attended. Subsequent generation of data extraction threads is triggered by the attendance system swiping the cards of personnel not yet extracted.
[0084] According to the above description, in an exemplary embodiment, the process of extracting personnel information from the object management system page by page according to the page start data row identifier of the first page task in the new data extraction thread includes:
[0085] The first page ending data row identifier in the new data extraction thread is calculated based on the first page starting data row identifier and the preset page number. As an example, the page number in this embodiment can be determined by the attendance management personnel responsible for generating attendance results. For instance, if 10,000 personnel information entries need to be extracted from the object management system, the preset page number can be 100 pages, meaning that 100 personnel information entries are extracted each time a page is used.
[0086] The first page row identifier range of the new data extraction thread is generated based on the first page start data row identifier and the first page end data row identifier in the new data extraction thread;
[0087] Get the starting data row identifiers of all threads broadcast to the same thread pool, and determine whether the obtained starting data row identifiers of the threads are within the range of the first thread page row identifier;
[0088] If it exists, a new thread pagination row identifier range is generated and written into the key-value database of the attendance system. The new thread pagination identifier range is used as the starting range of the current page. Personnel information is extracted from the object management system page by page until the extraction of personnel information for the current page is completed or the extraction of all pages for the current thread is completed.
[0089] If it does not exist, the first thread pagination row identifier range is written into the key-value database of the attendance system, and the first thread pagination row identifier range is used as the starting range of the current page. Personnel information is extracted from the object management system page by page until the extraction of personnel information for the current page is completed or the extraction of all pages for the current thread is completed.
[0090] Specifically, such as Figure 4As shown, when the Redis key-value database in the attendance system has the first pagination start data row identifier in the new data extraction thread cached, i.e., after the pagination start data row identifier S_CTID already exists, the pagination end data row identifier E_CTID is generated based on the pagination start data row identifier S_CTID and the preset number of pages. The range of a single pagination extraction is (S_CTID, E_CTID). Typically, E_CTID = S_CTID + number of pages - 1, and the number of pages can be predefined. Then, all existing thread pagination start data row identifiers B_CTID in the thread pool are read, and it is determined whether the thread pagination start data row identifier B_CTID is within the current thread pagination row identifier range (S_CTID, E_CTID). If not, the current thread pagination row identifier range (S_CTID, E_CTID) is directly written to the Redis key-value database of the attendance system, and the personnel information is extracted paginated with (S_CTID, E_CTID) as the starting range. After extraction is completed, the current pagination extraction task ends. If it exists, then take the minimum value B_CTID-1 within the current thread's pagination row identifier range (S_CTID, E_CTID) and assign it to the pagination termination data row identifier E_CTID, generating a new thread pagination row identifier range (S_CTID, E_CTID). Then, write the new thread pagination row identifier range (S_CTID, E_CTID) into the attendance system's key-value database Redis. Finally, use the new thread pagination row identifier range (S_CTID, E_CTID) as the starting range to extract personnel information page by page until all information is extracted. Then, end the current pagination extraction task, which also indicates that all pagination extraction tasks within the data extraction thread have ended. In this embodiment, before writing the row identifier CTID range to the key-value database Redis, to avoid data conflicts caused by high concurrency, it is necessary to first obtain the qualification to store the thread paging row identifier range (S_CTID, E_CTID) through a global variable Lock in the key-value database Redis. This ensures that only one thread can write the thread paging row identifier range (S_CTID, E_CTID) to the key-value database Redis at a time, thereby avoiding multiple threads writing simultaneously and extracting duplicate data. Furthermore, when extracting data in pages, the thread paging row identifier range (S_CTID, E_CTID) written to the key-value database Redis will be deleted after the current paging task is completed.
[0091] In an exemplary embodiment, the process of extracting personnel information from the object management system paginated by pagination, using the first thread pagination row identifier range as the starting range of the current pagination, until the extraction of personnel information for the current pagination is completed, may further include:
[0092] Determine whether all row identifiers within the first thread pagination row identifier range contain personnel information;
[0093] If no personnel information exists in some row identifiers within the first thread's pagination row identifier range, then it is determined that all pagination extraction for the current thread has ended;
[0094] If all row identifiers within the first thread pagination row identifier interval contain personnel information, the current pagination extraction is determined to be complete. Then, based on the pagination termination data row identifier within the first thread pagination row identifier interval, the next thread pagination row identifier interval is generated, and the next thread pagination identifier interval is used as the starting range of the current pagination. Personnel information is extracted from the object management system paginated until the extraction of personnel information for the current pagination is completed or the extraction of all paginations for the current thread is completed.
[0095] This embodiment can determine whether the current pagination has completed the extraction of personnel information and whether the current thread has completed the extraction of personnel information by judging whether all row identifiers within the row identifier range of the thread pagination have personnel information.
[0096] Specifically, taking the first thread paging row identifier range as the starting range of the current page, personnel information is extracted from the object management system page by page until the personnel information extraction of the current page is completed. This embodiment also includes: determining whether all data has been extracted within the range of the first thread paging row identifier range (S_CTID, E_CTID), that is, determining whether all row identifiers within the first thread paging row identifier range contain personnel information; if some addresses do not contain data, it indicates that all paging extraction tasks within the thread have ended; if all data has been extracted, it indicates that paging extraction needs to continue, that is, the paging termination data row identifier E_CTID in the first thread paging row identifier range is incremented by 1 and used as the paging start data row identifier S_CTID for the next paging extraction task.
[0097] In an exemplary embodiment, the method may further include: acquiring personnel information extracted by each data extraction thread, and generating a data source file within the attendance system based on the personnel information extracted by each data extraction thread, so that each data source file corresponds to one data extraction thread; and combining all data source files within the attendance system to generate a database table. Specifically, in this embodiment, each thread generates a data source file in the attendance system database, and all source files constitute the personnel information table within the attendance system, which is presented externally as a complete database table. Therefore, the total number of threads can be determined by the physical machine resources currently running the attendance system service, that is, by using thread pool technology to strictly control the number of threads within the range of the number of CPU cores on the physical machine.
[0098] In another exemplary embodiment, such as Figure 2 As shown, this embodiment provides a method for generating attendance data, including the following steps:
[0099] Generate attendance instruction signals. Specifically, the process of generating attendance instruction signals includes: after the attendance manager adds work groups to be attended, configures the departments included in the work groups, and saves the relationship between the work groups, work groups, and departments, the attendance instruction signal is generated.
[0100] After saving the work group to be checked or the attendance instruction signal, the object management system generates a temporary personnel information table that conforms to the work group configuration based on the attendance system's request parameters. The attendance system generates a data extraction thread pool and data extraction threads, and simultaneously starts the data extraction threads to extract personnel information from the temporary table. After all threads have extracted data from the temporary table, the object management system deletes the temporary table to release resources. The data extraction thread pool and data extraction threads generated by the attendance system are as follows: Figure 5 As shown in the diagram. Specifically, in this embodiment, saving one attendance group configuration generates one personnel extraction thread pool. One thread pool contains one or more parallel threads, and each thread contains one or more serial pagination extraction tasks. B_CTID is broadcast in the thread pool. One thread pool shares one (S_CTID, E_CTID) table. A schematic diagram illustrating the relationship between thread pools, threads, and pagination extraction tasks is shown below. Figure 5 .
[0101] When attendance information is received, the attendance system first checks its internal key-value database table to see if the information is present. If not, it may be because the information has not been fully extracted. In this case, the system queries the department to which the card-swipe person belongs in the object management system. If the department is in the list of departments corresponding to the work group to be attended, the system retrieves the person's information from the object management system, integrates the person's information with the card-swipe information, and then calculates the attendance result according to the internal attendance algorithm. This way, even if the personnel information extraction is incomplete, it does not affect the generation of the attendance result.
[0102] During the data extraction thread's operation, if a person's card-swiping information is generated but has not yet been extracted, the attendance system retrieves the person's row identifier CTID from the temporary table in the object management system and records it as the target row identifier. At the same time, it queries the existing thread pagination row identifier range (S_CTID, E_CTID) in the key-value database Redis to determine whether the row identifier CTID is within the existing range (S_CTID, E_CTID). If the information is found in the object management system, the personnel information retrieved will be directly returned to the attendance system. If not, the row identifier CTID will be used as the starting data row identifier B_CTID for thread pagination and broadcast to all threads in the current data extraction thread pool. Simultaneously, a new data extraction thread will be started, and this row identifier CTID will be used as the starting data row identifier S_CTID for the first pagination in the new data extraction thread. This thread will simultaneously extract personnel information from the object management system along with the existing data extraction thread, and cache the extracted personnel information in the key-value database Redis. This process continues until personnel information extraction is complete, or until all threads in the current data extraction thread pool terminate, or until the current data extraction thread terminates. The business process for running the data extraction thread and extracting personnel information is as follows: Figure 3 As shown in the diagram. The initial generation of the data extraction thread pool and data extraction thread is triggered by the action of saving attendance group data. Subsequent generation of data extraction threads is triggered by the swiping of cards by personnel not yet selected by the attendance system. Each data extraction thread generates a data source file in the attendance system database. All source files constitute the personnel information table within the attendance system, which is presented externally as a complete database table. Essentially, the total number of threads is determined by the physical machine resources currently running the attendance system service; that is, thread pool technology is used to strictly control the number of threads within the range of the physical machine's CPU cores. During the execution of the data extraction thread, this embodiment can disable the database's built-in row identifier CTID cleanup program to ensure that the row identifier CTID of existing data remains unchanged, while the row identifier CTID of newly added data is sequentially superimposed.
[0103] When extracting personnel information in pages, if the Redis key-value database in the attendance system has a cached first page start data row identifier for the new data extraction thread (i.e., a page start data row identifier S_CTID already exists), a page end data row identifier E_CTID is generated based on the page start data row identifier S_CTID and the preset page number. The range of a single page extraction is (S_CTID, E_CTID). Typically, E_CTID = S_CTID + page number - 1, and the page number can be predefined. Then, all existing thread page start data row identifiers B_CTID in the thread pool are read, and it is determined whether the thread page start data row identifier B_CTID is within the current thread page row identifier range (S_CTID, E_CTID). If not, the current thread's pagination row identifier range (S_CTID, E_CTID) is directly written to the attendance system's key-value database Redis. Personnel information is then extracted paginated from this range, starting at (S_CTID, E_CTID). Once extraction is complete, the current pagination extraction task ends. If it is present, the minimum value B_CTID-1 within the current thread's pagination row identifier range (S_CTID, E_CTID) is assigned to the pagination termination data row identifier E_CTID, generating a new thread pagination row identifier range (S_CTID, E_CTID). This new range is then written to the attendance system's key-value database Redis. Personnel information is then extracted paginated from this new range, starting at (S_CTID, E_CTID), until extraction is complete. This ends the current pagination extraction task and also signifies the completion of all pagination extraction tasks within the data extraction thread. In this embodiment, before writing the row identifier CTID range to the key-value database Redis, to avoid data conflicts caused by high concurrency, it is necessary to first obtain the qualification to store the thread paging row identifier range (S_CTID, E_CTID) through a global variable Lock in the key-value database Redis. This ensures that only one thread can write the thread paging row identifier range (S_CTID, E_CTID) to the key-value database Redis at a time, thereby avoiding multiple threads writing simultaneously and extracting duplicate data. Furthermore, during paging data extraction, the thread paging row identifier range (S_CTID, E_CTID) written to the key-value database Redis is deleted after the current paging task is completed. The flowchart for paging personnel information extraction is shown below. Figure 4 As shown.
[0104] Therefore, in this embodiment, when there are too many people in a department, the user or attendance manager responsible for attendance can directly save the attendance group on the attendance configuration page, thus avoiding long waiting times on the page and preventing webpage request timeouts. Simultaneously, this embodiment optimizes the attendance record generation process. Even if personnel information data extraction is incomplete, personnel information can be directly queried through the object management system and returned to the attendance system to generate attendance results. Furthermore, this embodiment can improve the speed of personnel information data extraction in certain scenarios and can flexibly adapt to different scenarios. The more times unextracted personnel have swiped their cards, the higher the frequency of use of this data. Using the attendance data generation method provided in this embodiment, the resource-for-efficiency approach of multi-threading can be used to accelerate the extraction of personnel data. Conversely, fewer unextracted personnel indicate lower usage frequency, and the attendance data generation method provided in this embodiment can complete personnel data extraction with minimal resource overhead.
[0105] In one specific embodiment, taking the example of "after saving the work group, there are 10,000 personnel information records in the department that need to be extracted from the object management system, and the attendance system extracts 100 records per page," the business process principle for generating attendance data in this embodiment is as follows: Figure 6 As shown.
[0106] First, the object management system generates a temporary data table of 10,000 personnel information entries based on the filtering conditions provided by the attendance system. In addition, after the attendance system enables the personnel extraction thread pool, there is only one thread 1 in the thread pool. The first pagination extraction task has a pagination start data row identifier S_CTID of 1, and the attendance system generates database source file 1.
[0107] When thread 1 is performing the third pagination extraction task, the extraction range in the key-value database Redis is (201, 300). At this time, attendance card swipe 2 and attendance card swipe 3 are generated. There is no corresponding personnel information in the database table of the attendance system. The row identifiers CTIDs of the corresponding personnel information found in the object management system are 1014 and 5000, respectively. Since neither of these two row identifiers CTID is within the thread paging row identifier range (201, 300), 1014 and 5000 are directly broadcast as the thread paging starting data row identifier B_CTID to all data extraction threads in the same data extraction thread pool. At the same time, data extraction thread 2 and data extraction thread 3 are generated respectively. At this time, 1014 and 5000 serve as the paging starting data row identifier S_CTID for the first paging extraction task in the two new threads (i.e., data extraction thread 2 and data extraction thread 3). Then, the paging extraction of personnel information data begins, and the paging extraction ranges are (1014, 1113) and (5000, 5099) respectively. The thread paging row identifier range (1014, 1113) and (5000, 5099) are written to the key-value database Redis as the existing thread paging row identifier range of the attendance system. At the same time, data source file 2 and data source file 3 are generated in the attendance system.
[0108] When thread 1 is performing the third pagination extraction task, the extraction range in the key-value database Redis is (201, 300). At this time, attendance card swipe 4 is generated, and the row identifier CTID of the corresponding person is 202. Since 202 is within the thread's pagination row identifier range (201, 300), no new data extraction thread is started at this time. Instead, the personnel attributes corresponding to 202 are directly extracted to the attendance system cache.
[0109] When thread 1 extracts 1001, it has completed 10 pagination extraction tasks. The default range of the thread pagination row identifier for thread 1's 11th pagination extraction task is (1001, 1100). Before the 11th pagination extraction task begins, the thread pagination start data row identifier B_CTID of other data extraction threads in the same data extraction thread pool is read. It is found that the thread pagination start data row identifier B_CTID 1014 of data extraction thread 2 is within this range (1001, 1100). Therefore, the range of the thread pagination row identifier for the 11th pagination extraction task is changed to (1001, 1013) and written to Redis. Then, personnel information extraction begins according to the thread pagination row identifier range (1001, 1013). Simultaneously, after the 11th pagination extraction task is completed, thread 1's pagination extraction task also ends.
[0110] In summary, this invention provides a method for generating attendance data. First, it acquires pre-determined or real-time determined work groups to be attended, along with card-swiping information generated on the attendance system. Then, it receives an attendance instruction signal and generates a data extraction thread based on the signal, wherein the attendance instruction signal is generated after determining or saving the work groups to be attended. Next, based on the data extraction thread, it extracts personnel information associated with the work groups to be attended from the object management system and transmits the extracted personnel information to the attendance system cache. Finally, it matches the personnel information cached in the attendance system with the generated card-swiping information. If a complete match is achieved, attendance data for the work groups to be attended is generated based on the cached personnel information and card-swiping information. Alternatively, if a partial match is achieved, a new data extraction thread is activated based on the matching result, and personnel information is extracted again based on the new thread, followed by another matching process, until the attendance data for the work groups to be attended is generated. Therefore, when the number of personnel in a work group awaiting attendance is too large, the user or administrator responsible for attendance can directly save the work group on the attendance configuration page, thus avoiding long waiting times on that page and preventing webpage request timeouts. Simultaneously, this method optimizes the attendance record generation process. Even if personnel information data extraction is incomplete, personnel information can be directly queried through the object management system and returned to the attendance system to generate attendance results. Essentially, when the selected department for a work group awaiting attendance has too many personnel, this method not only saves the front-end interaction and back-end logic of the attendance group, allowing for immediate saving of the work group, but also flexibly controls the extraction of personnel information from the object management system to the attendance system.
[0111] like Figure 7 As shown, the present invention also provides an attendance data generation system, the system comprising:
[0112] The data acquisition module M10 is used to acquire the work groups to be checked in a pre-determined or real-time determined manner, as well as the pre-generated or real-time generated card swipe information;
[0113] The first thread module M20 is used to receive attendance instruction signals and generate a data extraction thread based on the attendance instruction signals. The attendance instruction signals are generated after the work group to be attended is determined or saved.
[0114] The first information extraction module M30 is used to extract personnel information associated with the work group to be checked and recorded from the object management system according to the data extraction thread, and transmit it to the cache module.
[0115] The M40 cache module is used to cache the extracted personnel information;
[0116] The matching module M50 is used to match the cached personnel information with the generated card swipe information;
[0117] The second thread module M60 is used to start a new data extraction thread based on the matching result when the cached personnel information and the generated card swipe information do not completely match.
[0118] The second information extraction module M70 is used to extract personnel information associated with the work group to be checked from the object management system according to the new data extraction thread, and transmit it to the cache module.
[0119] The attendance data generation module M80 is used to generate attendance data for the work group to be attended based on the cached personnel information and the generated card swipe information when the personnel information cached in the attendance system completely matches the generated card swipe information.
[0120] Therefore, when the number of personnel in a work group awaiting attendance is too large, the user or attendance manager responsible for attendance can directly save the work group on the attendance configuration page, thus avoiding long waiting times on the page and preventing webpage request timeouts. Simultaneously, this embodiment optimizes the attendance record generation process. Even if personnel information data extraction is incomplete, personnel information can be directly queried through the object management system and returned to the attendance system to generate attendance results. Essentially, when the selected department for a work group awaiting attendance has too many personnel, this embodiment not only saves the front-end interaction and back-end logic of the attendance group, allowing for immediate saving of the work group, but also flexibly controls the extraction of personnel information from the object management system to the attendance system.
[0121] According to the above description, in an exemplary embodiment, the process by which the matching module M50 matches the cached personnel information with the generated card-swiping information includes: obtaining the card-swiping personnel corresponding to the card-swiping information, and determining whether the card-swiping personnel is in the personnel information cached in the attendance system. When the card-swiping personnel is in the personnel information cached in the attendance system, it is determined that the personnel information cached in the attendance system completely matches the card-swiping information. When the card-swiping personnel is not in the personnel information cached in the attendance system, it is determined that the personnel information cached in the attendance system does not completely match the card-swiping information. Specifically, when the card-swiping personnel is not in the personnel information cached in the attendance system, this embodiment may further include: obtaining the department of the card-swiping personnel from the object management system, and determining whether the department of the card-swiping personnel belongs to the work group to be checked in. If the department of the card-swiping personnel belongs to the work group to be checked in, a new data extraction thread is activated, and personnel information is continued to be extracted from the object management system according to the new data extraction thread. If the department of the person swiping the card cannot be obtained from the object management system, or if the department of the person swiping the card does not belong to the work group to be checked in, then the card swiping information will not be processed.
[0122] In an exemplary embodiment, when the personnel information cached by the attendance system does not completely match the card-swiping information, the method further includes:
[0123] The row identifier of the card-swiping personnel in the temporary table of the object management system is obtained and denoted as the target row identifier. The temporary table of the object management system is generated after receiving the attendance instruction signal. As an example, when the attendance manager responsible for generating attendance results saves the work group, the object management system generates a temporary personnel information table that conforms to the work group configuration based on the attendance system request parameters. The purpose of creating the temporary table is twofold: first, to ensure that the row identifier CTID of the personnel records that meet the extraction conditions is a fixed value; and second, to ensure that it is specifically created for the attendance system extraction task, containing only query operations without indexes or constraints, thereby improving query efficiency.
[0124] Determine whether the target row identifier is within the existing thread pagination row identifier range in the attendance system; wherein, the thread pagination row identifier range consists of a pagination start data row identifier and a pagination end data row identifier. As an example, the thread pagination row identifier range could be: (pagination start data row identifier, pagination end data row identifier), or (S_CTID, E_CTID).
[0125] If the target row identifier is within the existing thread pagination row identifier range in the attendance system, then the personnel information corresponding to the card-swiping personnel will be extracted from the object management system and cached in the attendance system. As an example, in this embodiment, the attendance system can utilize the key-value database Redis to cache the extracted personnel information and row identifier CTID range information to speed up the matching of personnel attributes and improve the speed of attendance record generation.
[0126] If the target row identifier is not located within the existing thread paging row identifier range in the attendance system, then the target row identifier is used as the thread paging start data row identifier and broadcast to other data extraction threads in the same thread pool; and a new data extraction thread is enabled, and the target row identifier is used as the first paging start data row identifier in the new data extraction thread.
[0127] Then, according to the identifier of the first page starting data row in the new data extraction thread, personnel information is extracted page by page from the object management system until the personnel information extraction is completed or the thread terminates.
[0128] Specifically, such as Figure 3As shown, the attendance system generates a data extraction thread pool for retrieving personnel information and enables the data extraction thread to extract personnel information from a temporary table in the object management system. At this time, the starting data row identifier S_CTID for the first pagination extraction task of this data extraction thread is 1, and the range of row identifier CTID data in the key-value database Redis is empty. Each pagination extraction includes query conditions and updates the temporary table. During the execution of the data extraction thread, if personnel card swipe information is generated but has not yet been extracted, the attendance system obtains the row identifier CTID of that personnel in the temporary table of the object management system, records it as the target row identifier, and simultaneously queries the existing thread pagination row identifier range (S_CTID, E_CTID) in the key-value database Redis to determine whether the target row identifier CTID is within the existing range (S_CTID, E_CTID). If the personnel information is found in the object management system, the personnel information retrieved from the attendance system will be directly returned to the attendance system. If not, the CTID of that row will be used as the starting data row identifier B_CTID for thread pagination and broadcast to all threads in the current data extraction thread pool. Simultaneously, a new data extraction thread will be started, and the CTID will be used as the starting data row identifier S_CTID for the first pagination in the new thread. This thread will simultaneously extract personnel information from the object management system along with the existing data extraction thread, and the extracted personnel information will be cached in the key-value database Redis. This process continues until the personnel information extraction is complete, or until all threads in the current data extraction thread pool terminate, or until the current data extraction thread terminates. In this embodiment, the initial generation of the personnel extraction thread pool and data extraction thread is triggered by the attendance manager saving the work groups to be attended. Subsequent generation of data extraction threads is triggered by the attendance system swiping the cards of personnel not yet extracted.
[0129] According to the above description, in an exemplary embodiment, the process of extracting personnel information from the object management system page by page according to the page start data row identifier of the first page task in the new data extraction thread includes:
[0130] The first page ending data row identifier in the new data extraction thread is calculated based on the first page starting data row identifier and the preset page number. As an example, the page number in this embodiment can be determined by the attendance management personnel responsible for generating attendance results. For instance, if 10,000 personnel information entries need to be extracted from the object management system, the preset page number can be 100 pages, meaning that 100 personnel information entries are extracted each time a page is used.
[0131] The first page row identifier range of the new data extraction thread is generated based on the first page start data row identifier and the first page end data row identifier in the new data extraction thread;
[0132] Get the starting data row identifiers of all threads broadcast to the same thread pool, and determine whether the obtained starting data row identifiers of the threads are within the range of the first thread page row identifier;
[0133] If it exists, a new thread pagination row identifier range is generated and written into the key-value database of the attendance system. The new thread pagination identifier range is used as the starting range of the current page. Personnel information is extracted from the object management system page by page until the extraction of personnel information for the current page is completed or the extraction of all pages for the current thread is completed.
[0134] If it does not exist, the first thread pagination row identifier range is written into the key-value database of the attendance system, and the first thread pagination row identifier range is used as the starting range of the current page. Personnel information is extracted from the object management system page by page until the extraction of personnel information for the current page is completed or the extraction of all pages for the current thread is completed.
[0135] Specifically, such as Figure 4As shown, when the Redis key-value database in the attendance system has the first pagination start data row identifier in the new data extraction thread cached, i.e., after the pagination start data row identifier S_CTID already exists, the pagination end data row identifier E_CTID is generated based on the pagination start data row identifier S_CTID and the preset number of pages. The range of a single pagination extraction is (S_CTID, E_CTID). Typically, E_CTID = S_CTID + number of pages - 1, and the number of pages can be predefined. Then, all existing thread pagination start data row identifiers B_CTID in the thread pool are read, and it is determined whether the thread pagination start data row identifier B_CTID is within the current thread pagination row identifier range (S_CTID, E_CTID). If not, the current thread pagination row identifier range (S_CTID, E_CTID) is directly written to the Redis key-value database of the attendance system, and the personnel information is extracted paginated with (S_CTID, E_CTID) as the starting range. After extraction is completed, the current pagination extraction task ends. If it exists, then take the minimum value B_CTID-1 within the current thread's pagination row identifier range (S_CTID, E_CTID) and assign it to the pagination termination data row identifier E_CTID, generating a new thread pagination row identifier range (S_CTID, E_CTID). Then, write the new thread pagination row identifier range (S_CTID, E_CTID) into the attendance system's key-value database Redis. Finally, use the new thread pagination row identifier range (S_CTID, E_CTID) as the starting range to extract personnel information page by page until all information is extracted. Then, end the current pagination extraction task, which also indicates that all pagination extraction tasks within the data extraction thread have ended. In this embodiment, before writing the row identifier CTID range to the key-value database Redis, to avoid data conflicts caused by high concurrency, it is necessary to first obtain the qualification to store the thread paging row identifier range (S_CTID, E_CTID) through a global variable Lock in the key-value database Redis. This ensures that only one thread can write the thread paging row identifier range (S_CTID, E_CTID) to the key-value database Redis at a time, thereby avoiding multiple threads writing simultaneously and extracting duplicate data. Furthermore, when extracting data in pages, the thread paging row identifier range (S_CTID, E_CTID) written to the key-value database Redis will be deleted after the current paging task is completed.
[0136] In an exemplary embodiment, the process of extracting personnel information from the object management system paginated by pagination, using the first thread pagination row identifier range as the starting range of the current pagination, until the extraction of personnel information for the current pagination is completed, may further include:
[0137] Determine whether all row identifiers within the first thread pagination row identifier range contain personnel information;
[0138] If no personnel information exists in some row identifiers within the first thread's pagination row identifier range, then it is determined that all pagination extraction for the current thread has ended;
[0139] If all row identifiers within the first thread pagination row identifier interval contain personnel information, the current pagination extraction is determined to be complete. Then, based on the pagination termination data row identifier within the first thread pagination row identifier interval, the next thread pagination row identifier interval is generated, and the next thread pagination identifier interval is used as the starting range of the current pagination. Personnel information is extracted from the object management system paginated until the extraction of personnel information for the current pagination is completed or the extraction of all paginations for the current thread is completed.
[0140] This embodiment can determine whether the current pagination has completed the extraction of personnel information and whether the current thread has completed the extraction of personnel information by judging whether all row identifiers within the row identifier range of the thread pagination have personnel information.
[0141] Specifically, taking the first thread paging row identifier range as the starting range of the current page, personnel information is extracted from the object management system page by page until the personnel information extraction of the current page is completed. This embodiment also includes: determining whether all data has been extracted within the range of the first thread paging row identifier range (S_CTID, E_CTID), that is, determining whether all row identifiers within the first thread paging row identifier range contain personnel information; if some addresses do not contain data, it indicates that all paging extraction tasks within the thread have ended; if all data has been extracted, it indicates that paging extraction needs to continue, that is, the paging termination data row identifier E_CTID in the first thread paging row identifier range is incremented by 1 and used as the paging start data row identifier S_CTID for the next paging extraction task.
[0142] In an exemplary embodiment, the system may further include: acquiring personnel information extracted by each data extraction thread, and generating a data source file within the attendance system based on the personnel information extracted by each data extraction thread, so that each data source file corresponds to one data extraction thread; and combining all data source files within the attendance system to generate a database table. Specifically, in this embodiment, each thread generates a data source file in the attendance system database, and all source files constitute the personnel information table within the attendance system, which is presented externally as a complete database table. Therefore, the total number of threads can be determined by the physical machine resources currently running the attendance system service, that is, by using thread pool technology to strictly control the number of threads within the range of the number of CPU cores on the physical machine.
[0143] In another exemplary embodiment, this embodiment provides an attendance data generation system for performing the following steps:
[0144] Generate attendance instruction signals. Specifically, the process of generating attendance instruction signals includes: after the attendance manager adds work groups to be attended, configures the departments included in the work groups, and saves the relationship between the work groups, work groups, and departments, the attendance instruction signal is generated.
[0145] After saving the work group to be checked or the attendance instruction signal, the object management system generates a temporary personnel information table that conforms to the work group configuration based on the attendance system's request parameters. The attendance system generates a data extraction thread pool and data extraction threads, and simultaneously starts the data extraction threads to extract personnel information from the temporary table. After all threads have extracted data from the temporary table, the object management system deletes the temporary table to release resources. The data extraction thread pool and data extraction threads generated by the attendance system are as follows: Figure 5 As shown in the diagram. Specifically, in this embodiment, saving one attendance group configuration generates one personnel extraction thread pool. One thread pool contains one or more parallel threads, and each thread contains one or more serial pagination extraction tasks. B_CTID is broadcast in the thread pool. One thread pool shares one (S_CTID, E_CTID) table. A schematic diagram illustrating the relationship between thread pools, threads, and pagination extraction tasks is shown below. Figure 5 .
[0146] When attendance information is received, the attendance system first checks its internal key-value database table to see if the information is present. If not, it may be because the information has not been fully extracted. In this case, the system queries the department to which the card-swipe person belongs in the object management system. If the department is in the list of departments corresponding to the work group to be attended, the system retrieves the person's information from the object management system, integrates the person's information with the card-swipe information, and then calculates the attendance result according to the internal attendance algorithm. This way, even if the personnel information extraction is incomplete, it does not affect the generation of the attendance result.
[0147] During the data extraction thread's operation, if a person's card-swiping information is generated but has not yet been extracted, the attendance system retrieves the person's row identifier CTID from the temporary table in the object management system and records it as the target row identifier. At the same time, it queries the existing thread pagination row identifier range (S_CTID, E_CTID) in the key-value database Redis to determine whether the row identifier CTID is within the existing range (S_CTID, E_CTID). If the information is found in the object management system, the personnel information retrieved will be directly returned to the attendance system. If not, the row identifier CTID will be used as the starting data row identifier B_CTID for thread pagination and broadcast to all threads in the current data extraction thread pool. Simultaneously, a new data extraction thread will be started, and this row identifier CTID will be used as the starting data row identifier S_CTID for the first pagination in the new data extraction thread. This thread will simultaneously extract personnel information from the object management system along with the existing data extraction thread, and cache the extracted personnel information in the key-value database Redis. This process continues until personnel information extraction is complete, or until all threads in the current data extraction thread pool terminate, or until the current data extraction thread terminates. The business process for running the data extraction thread and extracting personnel information is as follows: Figure 3 As shown in the diagram. The initial generation of the data extraction thread pool and data extraction thread is triggered by the action of saving attendance group data. Subsequent generation of data extraction threads is triggered by the swiping of cards by personnel not yet selected by the attendance system. Each data extraction thread generates a data source file in the attendance system database. All source files constitute the personnel information table within the attendance system, which is presented externally as a complete database table. Essentially, the total number of threads is determined by the physical machine resources currently running the attendance system service; that is, thread pool technology is used to strictly control the number of threads within the range of the physical machine's CPU cores. During the execution of the data extraction thread, this embodiment can disable the database's built-in row identifier CTID cleanup program to ensure that the row identifier CTID of existing data remains unchanged, while the row identifier CTID of newly added data is sequentially superimposed.
[0148] When extracting personnel information in pages, if the Redis key-value database in the attendance system has a cached first page start data row identifier for the new data extraction thread (i.e., a page start data row identifier S_CTID already exists), a page end data row identifier E_CTID is generated based on the page start data row identifier S_CTID and the preset page number. The range of a single page extraction is (S_CTID, E_CTID). Typically, E_CTID = S_CTID + page number - 1, and the page number can be predefined. Then, all existing thread page start data row identifiers B_CTID in the thread pool are read, and it is determined whether the thread page start data row identifier B_CTID is within the current thread page row identifier range (S_CTID, E_CTID). If not, the current thread's pagination row identifier range (S_CTID, E_CTID) is directly written to the attendance system's key-value database Redis. Personnel information is then extracted paginated from this range, starting at (S_CTID, E_CTID). Once extraction is complete, the current pagination extraction task ends. If it is present, the minimum value B_CTID-1 within the current thread's pagination row identifier range (S_CTID, E_CTID) is assigned to the pagination termination data row identifier E_CTID, generating a new thread pagination row identifier range (S_CTID, E_CTID). This new range is then written to the attendance system's key-value database Redis. Personnel information is then extracted paginated from this new range, starting at (S_CTID, E_CTID), until extraction is complete. This ends the current pagination extraction task and also signifies the completion of all pagination extraction tasks within the data extraction thread. In this embodiment, before writing the row identifier CTID range to the key-value database Redis, to avoid data conflicts caused by high concurrency, it is necessary to first obtain the qualification to store the thread paging row identifier range (S_CTID, E_CTID) through a global variable Lock in the key-value database Redis. This ensures that only one thread can write the thread paging row identifier range (S_CTID, E_CTID) to the key-value database Redis at a time, thereby avoiding multiple threads writing simultaneously and extracting duplicate data. Furthermore, during paging data extraction, the thread paging row identifier range (S_CTID, E_CTID) written to the key-value database Redis is deleted after the current paging task is completed. The flowchart for paging personnel information extraction is shown below. Figure 4 As shown.
[0149] Therefore, in this embodiment, when there are too many people in a department, the user or attendance manager responsible for attendance can directly save the attendance group on the attendance configuration page, thus avoiding long waiting times on the page and preventing webpage request timeouts. Simultaneously, this embodiment optimizes the attendance record generation process. Even if personnel information data extraction is incomplete, personnel information can be directly queried through the object management system and returned to the attendance system to generate attendance results. Furthermore, this embodiment can improve the speed of personnel information data extraction in certain scenarios and can flexibly adapt to different scenarios. The more times unextracted personnel swipe their cards, the higher the frequency of use of this data. Using the attendance data generation system provided in this embodiment, resources can be traded for efficiency through multi-threading to speed up the extraction of personnel data. Conversely, fewer unextracted personnel indicate lower usage frequency, and the attendance data generation system provided in this embodiment can complete personnel data extraction with minimal resource overhead.
[0150] In one specific embodiment, taking the example of "after saving the work group, there are 10,000 personnel information records in the department that need to be extracted from the object management system, and the attendance system extracts 100 records per page," the business process principle for generating attendance data in this embodiment is as follows: Figure 6 As shown.
[0151] First, the object management system generates a temporary data table of 10,000 personnel information entries based on the filtering conditions provided by the attendance system. In addition, after the attendance system enables the personnel extraction thread pool, there is only one thread 1 in the thread pool. The first pagination extraction task has a pagination start data row identifier S_CTID of 1, and the attendance system generates database source file 1.
[0152] When thread 1 is performing the third pagination extraction task, the extraction range in the key-value database Redis is (201, 300). At this time, attendance card swipe 2 and attendance card swipe 3 are generated. There is no corresponding personnel information in the database table of the attendance system. The row identifiers CTIDs of the corresponding personnel information found in the object management system are 1014 and 5000, respectively. Since neither of these two row identifiers CTID is within the thread paging row identifier range (201, 300), 1014 and 5000 are directly broadcast as the thread paging starting data row identifier B_CTID to all data extraction threads in the same data extraction thread pool. At the same time, data extraction thread 2 and data extraction thread 3 are generated respectively. At this time, 1014 and 5000 serve as the paging starting data row identifier S_CTID for the first paging extraction task in the two new threads (i.e., data extraction thread 2 and data extraction thread 3). Then, the paging extraction of personnel information data begins, and the paging extraction ranges are (1014, 1113) and (5000, 5099) respectively. The thread paging row identifier range (1014, 1113) and (5000, 5099) are written to the key-value database Redis as the existing thread paging row identifier range of the attendance system. At the same time, data source file 2 and data source file 3 are generated in the attendance system.
[0153] When thread 1 is performing the third pagination extraction task, the extraction range in the key-value database Redis is (201, 300). At this time, attendance card swipe 4 is generated, and the row identifier CTID of the corresponding person is 202. Since 202 is within the thread's pagination row identifier range (201, 300), no new data extraction thread is started at this time. Instead, the personnel attributes corresponding to 202 are directly extracted to the attendance system cache.
[0154] When thread 1 extracts 1001, it has completed 10 pagination extraction tasks. The default range of the thread pagination row identifier for thread 1's 11th pagination extraction task is (1001, 1100). Before the 11th pagination extraction task begins, the thread pagination start data row identifier B_CTID of other data extraction threads in the same data extraction thread pool is read. It is found that the thread pagination start data row identifier B_CTID 1014 of data extraction thread 2 is within this range (1001, 1100). Therefore, the range of the thread pagination row identifier for the 11th pagination extraction task is changed to (1001, 1013) and written to Redis. Then, personnel information extraction begins according to the thread pagination row identifier range (1001, 1013). Simultaneously, after the 11th pagination extraction task is completed, thread 1's pagination extraction task also ends.
[0155] In summary, this invention provides an attendance data generation system. First, it acquires pre-determined or real-time determined work groups to be attended, along with card-swiping information generated on the attendance system. Then, it receives attendance command signals and generates a data extraction thread based on these signals, wherein the attendance command signals are generated after the work groups to be attended are determined or saved. Next, based on the data extraction thread, it extracts personnel information associated with the work groups to be attended from the object management system and transmits the extracted personnel information to the attendance system cache. Finally, it matches the personnel information cached in the attendance system with the generated card-swiping information. If a complete match is achieved, it generates attendance data for the work groups to be attended based on the cached personnel information and card-swiping information. Alternatively, if a partial match is achieved, it activates a new data extraction thread based on the matching result, and continues to extract personnel information based on the new data extraction thread before matching again, until the attendance data for the work groups to be attended is generated. Therefore, when there are too many people in a work group awaiting attendance, the user or attendance manager responsible for attendance can directly save the work group on the attendance configuration page, thus avoiding long waiting times on that page and preventing webpage request timeouts. Simultaneously, the system optimizes the attendance record generation process. Even if personnel information data extraction is incomplete, personnel information can be directly queried through the object management system and returned to the attendance system to generate attendance results. Essentially, when there are too many people in the selected departments of a work group awaiting attendance, this system not only saves the front-end interaction and back-end logic of the work group, allowing for immediate saving of the work group, but also flexibly controls the extraction of personnel information from the object management system to the attendance system.
[0156] This application also provides a computer device, which may include: one or more processors; and one or more machine-readable media storing instructions thereon, which, when executed by the one or more processors, cause the device to perform... Figure 1 The method described. Figure 8 A schematic diagram of the structure of a computer device 1000 is shown. (See attached diagram.) Figure 8 As shown, the computer device 1000 includes: a processor 1010, a memory 1020, a power supply 1030, a display unit 1040, and an input unit 1060.
[0157] The processor 1010 is the control center of the computer device 1000. It connects various components via interfaces and lines, and executes various functions of the computer device 1000 by running or executing software programs and / or data stored in the memory 1020, thereby providing overall monitoring of the computer device 1000. In this embodiment, when the processor 1010 calls the computer program stored in the memory 1020, it executes... Figure 1The method described herein. Optionally, the processor 1010 may include one or more processing units; preferably, the processor 1010 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. In some embodiments, the processor and memory may be implemented on a single chip; in some embodiments, they may also be implemented on separate chips.
[0158] The memory 1020 may primarily include a program storage area and a data storage area. The program storage area may store the operating system, various applications, etc.; the data storage area may store data created based on the use of the computer device 1000, etc. In addition, the memory 1020 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device, etc.
[0159] The computer device 1000 also includes a power supply 1030 (such as a battery) that supplies power to various components. The power supply can be logically connected to the processor 1010 through a power management system, thereby enabling the management of charging, discharging, and power consumption.
[0160] The display unit 1040 can be used to display information input by the user or information provided to the user, as well as various menus of the computer device 1000. In this embodiment of the invention, it is mainly used to display the display interfaces of various applications in the computer device 1000, as well as text, images, and other objects displayed on the display interfaces. The display unit 1040 may include a display panel 1050. The display panel 1050 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
[0161] The input unit 1060 can be used to receive information such as numbers or characters input by the user. The input unit 1060 may include a touch panel 1070 and other input devices 1080. The touch panel 1070, also known as a touch screen, can collect touch operations on or near the touch panel 1070 by the user (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel 1070).
[0162] Specifically, the touch panel 1070 can detect user touch operations and the signals generated by these operations, convert them into touch point coordinates, send them to the processor 1010, and receive and execute commands from the processor 1010. Furthermore, the touch panel 1070 can be implemented using various types of touch technologies, including resistive, capacitive, infrared, and surface acoustic wave. Other input devices 1080 can include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.
[0163] Of course, the touch panel 1070 can cover the display panel 1050. When the touch panel 1070 detects a touch operation on or near it, it transmits the information to the processor 1010 to determine the type of touch event. Subsequently, the processor 1010 provides corresponding visual output on the display panel 1050 based on the type of touch event. Although in Figure 8 In this embodiment, the touch panel 1070 and the display panel 1050 are two separate components to realize the input and output functions of the computer device 1000. However, in some embodiments, the touch panel 1070 and the display panel 1050 can be integrated to realize the input and output functions of the computer device 1000.
[0164] The computer device 1000 may also include one or more sensors, such as pressure sensors, gravity acceleration sensors, proximity sensors, etc. Of course, depending on the specific application requirements, the computer device 1000 may also include other components such as cameras.
[0165] This application also provides a computer-readable storage medium storing instructions that, when executed by one or more processors, enable the device to perform the functions described in this application. Figure 1 The method described.
[0166] It will be understood by those skilled in the art that Figure 8 This is merely an example of a computer device and does not constitute a limitation on the device. The device may include more or fewer components than illustrated, or a combination of certain components, or different components. For ease of description, the above sections are divided into modules (or units) according to their functions and described separately. Of course, in implementing this application, the functions of each module (or unit) can be implemented in one or more software or hardware components.
[0167] Those skilled in the art will understand that this application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application, and should be understood to be implementable by computer program instructions for each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams. These computer program instructions may be applied to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable time and attendance data generation device to create a machine, such that the instructions, which execute via the processor of the computer or other programmable time and attendance data generation device, produce instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 The computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable time and attendance data generation device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in the process. Figure 1 One or more processes and / or boxes Figure 1 The functions specified in one or more boxes. These computer program instructions may also be loaded onto a computer or other programmable time and attendance data generating device to cause a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable device for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0168] It should be understood that although terms such as first, second, third, etc., may be used in the embodiments of the present invention to describe the preset scope, these preset scopes should not be limited to these terms. These terms are only used to distinguish the preset scopes from each other. For example, without departing from the scope of the embodiments of the present invention, a first thread module may also be referred to as a second thread module, and similarly, a second thread module may also be referred to as a first thread module.
[0169] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.
Claims
1. A method for generating attendance data, characterized in that, The method includes the following steps: Obtain the pre-determined or real-time determined work groups to be checked in, as well as the card-swiping information generated on the attendance system; Receive attendance instruction signals and generate data extraction threads based on the attendance instruction signals. The attendance instruction signals are generated after the work group to be attended is determined or saved. Based on the data extraction thread, personnel information associated with the work group to be checked and recorded is extracted from the object management system, and the extracted personnel information is transmitted to the attendance system cache. The attendance system matches the personnel information cached in the attendance system with the generated card-swiping information. If there is a complete match, the attendance data of the work group to be attended is generated based on the cached personnel information and the card-swiping information. Alternatively, if there is an incomplete match, a new data extraction thread is activated based on the matching result, and personnel information is extracted again based on the new data extraction thread and then matched again until the attendance data of the work group to be attended is generated.
2. The attendance data generation method according to claim 1, characterized in that, The process of matching the personnel information cached in the attendance system with the generated card-swiping information includes: Obtain the card-swiping personnel corresponding to the card-swiping information, and determine whether the card-swiping personnel are in the personnel information cached in the attendance system; When the card-swiping personnel is in the personnel information cached in the attendance system, it is determined that the personnel information cached in the attendance system completely matches the card-swiping information; When the card-swiping personnel is not in the personnel information cached in the attendance system, it is determined that the personnel information cached in the attendance system does not completely match the card-swiping information.
3. The attendance data generation method according to claim 2, characterized in that, When the person swiping the card is not in the personnel information cached in the attendance system, the method further includes: Obtain the department of the person swiping the card from the object management system, and determine whether the department of the person swiping the card belongs to the work group to be checked in; If the department of the person swiping the card belongs to the work group to be checked in, a new data extraction thread is activated, and personnel information is extracted from the object management system according to the new data extraction thread. If the department of the person swiping the card cannot be obtained from the object management system, or if the department of the person swiping the card does not belong to the work group to be checked in, then the card swiping information will not be processed.
4. The attendance data generation method according to claim 2 or 3, characterized in that, When the personnel information cached in the attendance system does not completely match the card-swiping information, the method further includes: Obtain the row identifier of the card-swiper in the temporary table of the object management system, and denote it as the target row identifier; the temporary table of the object management system is generated after receiving the attendance instruction signal; Determine whether the target row identifier is located within the existing thread pagination row identifier range in the attendance system; wherein, the thread pagination row identifier range consists of the pagination start data row identifier and the pagination end data row identifier; If the location is specified, the personnel information corresponding to the card-swiping personnel will be extracted from the object management system and cached in the attendance system. If not located, the target row identifier is used as the starting data row identifier for thread paging and broadcast to other data extraction threads in the same thread pool; and a new data extraction thread is enabled, with the target row identifier used as the first starting data row identifier for paging in the new data extraction thread. According to the identifier of the first page starting data row in the new data extraction thread, personnel information is extracted from the object management system page by page until the personnel information extraction is completed or the thread terminates.
5. The attendance data generation method according to claim 4, characterized in that, The process of extracting personnel information from the object management system page by page according to the page start data row identifier of the first page task in the new data extraction thread includes: Calculate the first page ending data row identifier in the new data extraction thread based on the first page start data row identifier and the preset number of pages; The first page row identifier range of the new data extraction thread is generated based on the first page start data row identifier and the first page end data row identifier in the new data extraction thread; Get the starting data row identifiers of all threads broadcast to the same thread pool, and determine whether the obtained starting data row identifiers of the threads are within the range of the first thread page row identifier; If it exists, a new thread pagination row identifier range is generated and written into the key-value database of the attendance system. The new thread pagination identifier range is used as the starting range of the current page. Personnel information is extracted from the object management system page by page until the extraction of personnel information for the current page is completed or the extraction of all pages for the current thread is completed. If it does not exist, the first thread pagination row identifier range is written into the key-value database of the attendance system, and the first thread pagination row identifier range is used as the starting range of the current page. Personnel information is extracted from the object management system page by page until the extraction of personnel information for the current page is completed or the extraction of all pages for the current thread is completed.
6. The attendance data generation method according to claim 5, characterized in that, Using the first thread pagination row identifier range as the starting range of the current pagination, personnel information is extracted from the object management system paginated until the extraction of personnel information for the current pagination is completed. The method further includes: Determine whether all row identifiers within the first thread pagination row identifier range contain personnel information; If no personnel information exists in some row identifiers within the first thread's pagination row identifier range, then it is determined that all pagination extraction for the current thread has ended; If all row identifiers within the first thread pagination row identifier interval contain personnel information, the current pagination extraction is determined to be complete. Then, based on the pagination termination data row identifier within the first thread pagination row identifier interval, the next thread pagination row identifier interval is generated, and the next thread pagination identifier interval is used as the starting range of the current pagination. Personnel information is extracted from the object management system paginated until the extraction of personnel information for the current pagination is completed or the extraction of all paginations for the current thread is completed.
7. The attendance data generation method according to claim 1, 2, 3, 5 or 6, characterized in that, The method further includes: Obtain the personnel information extracted by each data extraction thread, and generate a data source file in the attendance system based on the personnel information extracted by each data extraction thread, so that each data source file corresponds to a data extraction thread. All data source files within the attendance system are combined to generate a database table.
8. An attendance data generation system, characterized in that, The system includes: The data acquisition module is used to acquire the work groups to be checked in a pre-determined or real-time manner, as well as the pre-generated or real-time generated card-swiping information; The first thread module is used to receive attendance instruction signals and generate a data extraction thread based on the attendance instruction signals. The attendance instruction signals are generated after the work group to be attended is determined or saved. The first information extraction module is used to extract personnel information associated with the work group to be checked and recorded from the object management system according to the data extraction thread, and transmit it to the cache module. The caching module is used to cache the extracted personnel information; The matching module is used to match the cached personnel information with the generated card-swiping information; The second thread module is used to start a new data extraction thread based on the matching result when the cached personnel information and the generated card swipe information do not completely match. The second information extraction module is used to extract personnel information associated with the work group to be checked and recorded from the object management system according to the new data extraction thread, and transmit it to the cache module. The attendance data generation module is used to generate attendance data for the work group to be attended based on the cached personnel information and the generated card-swiping information when the personnel information cached in the cache module completely matches the generated card-swiping information.
9. A computer device, characterized in that, include: processor; and, A computer-readable medium storing instructions that, when executed by the processor, cause the device to perform the method as described in any one of claims 1 to 7.
10. A computer-readable medium, characterized in that, It stores instructions that are loaded by a processor and executed as described in any one of claims 1 to 7.