Attendance processing methods, systems and computer-readable storage media

CN117172737BActive Publication Date: 2026-08-14CHINA MERCHANTS BANK
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-31
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

同类Saas产品大多使用同一套计算逻辑应用于所有的客户,如果某些客户需要重新定制计算规则,如修改规则和计算方式,则需要重新修改代码,通常会存在较大的定制化成本,而且个性化扩展能力低,不具备较好的维护性

Benefits of technology

[0051]本发明实施例提出的考勤处理方法、系统及计算机可读存储介质,通过获取考勤业务逻辑规则;将所述考勤业务逻辑规则输入考勤计算模型,通过所述考勤计算模型对考勤计算规则进行结构化,得到结构化的计算图;将所述结构化的计算图输入至规则引擎中执行,得到考勤计算执行结果。本发明方案提出一种基于规则引擎的考勤计算模型,能够将考勤计算规则进行结构化,并支持“运行时”扩展,能够方便快速的调整考勤计算逻辑。本发明相比于现有技术,具有较大的灵活性和扩展性,能够针对不同的考勤规则进行快速扩展和调整,从而在提供高效准确的考勤计算功能的同时,提高了考勤规则计算方式的扩展性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117172737B_ABST
    Figure CN117172737B_ABST
Patent Text Reader

Abstract

This invention discloses an attendance processing method, system, and computer-readable storage medium. The method includes: acquiring attendance business logic rules; inputting the attendance business logic rules into an attendance calculation model, structuring the attendance calculation rules through the attendance calculation model to obtain a structured calculation graph; and inputting the structured calculation graph into a rule engine for execution to obtain the attendance calculation execution result. This invention proposes an attendance calculation model based on a rule engine, which can structure attendance calculation rules and support "runtime" extensions, enabling convenient and rapid adjustment of the attendance calculation logic. Compared to existing technologies, it has greater flexibility and scalability, allowing for rapid expansion and adjustment for different attendance rules. While providing efficient and accurate attendance calculation functions, it also improves the scalability of the attendance rule calculation method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of attendance processing technology, and in particular to an attendance processing method, system, and computer-readable storage medium. Background Technology

[0002] Most current employee attendance software calculates employee attendance status and duration based on pre-set program settings. Similar SaaS products often use the same calculation logic for all customers. If some customers need to customize the calculation rules, such as modifying the rules and calculation methods, the code must be rewritten, typically resulting in significant customization costs. Furthermore, they lack personalization and scalability, and are not very maintainable. Summary of the Invention

[0003] The main objective of this invention is to provide an attendance processing method, system, and computer-readable storage medium, which aims to improve the flexibility and scalability of attendance calculation functions and reduce costs.

[0004] To achieve the above objectives, the present invention provides an attendance processing method, the method comprising the following steps:

[0005] Obtain the attendance business logic rules;

[0006] The attendance business logic rules are input into the attendance calculation model, and the attendance calculation rules are structured through the attendance calculation model to obtain a structured calculation graph;

[0007] The structured computation graph is input into the rule engine for execution, and the attendance calculation results are obtained.

[0008] Optionally, the step of inputting the attendance business logic rules into the attendance calculation model, and structuring the attendance calculation rules through the attendance calculation model to obtain a structured calculation graph includes:

[0009] The attendance business logic rules are input into the attendance calculation model and processed as follows:

[0010] Construct computing nodes based on the aforementioned attendance business logic rules;

[0011] A structured computation graph is constructed based on the computation nodes.

[0012] Optionally, the step of constructing computing nodes based on the attendance business logic rules includes:

[0013] The various business logic rules in attendance calculation are combined into calculation units that can be executed by a computer rule engine, and calculation nodes are constructed based on these calculation units.

[0014] Optionally, the step of constructing a structured computation graph based on the computing nodes includes:

[0015] Based on the computing nodes, a hierarchical and depth-structured tree-like computation graph is constructed, which is used by the program to perform rule calculations according to the execution order and execution method defined in the tree-like computation graph during the execution phase.

[0016] Based on the dependencies between computing nodes, a chain-like computing graph with computing order attributes is constructed.

[0017] Optionally, after the step of constructing a chained computation graph with computation order attributes based on the dependencies between various computing nodes, the method further includes:

[0018] Perform circular dependency checks on the computation nodes in the chained computation graph;

[0019] If there are no circular dependencies in the chained computation graph, then the following steps are executed: input the structured computation graph into the rule engine for execution, and obtain the attendance calculation execution result.

[0020] Optionally, the step of constructing a hierarchical and depth-structured tree computation graph based on the computation nodes includes:

[0021] Define the rule attributes of the tree-like computation graph, and obtain a rule definition set based on the rule attributes. The rule attributes include: rule ID, rule level, rule sequence number, sub-rule set, whether it is an execution node, and rule type.

[0022] Define the computation node data structure attributes of the tree-like computation graph, and obtain a set of computation nodes based on the computation node data structure attributes. The computation node data structure attributes include: node ID, formula content, and dependency list.

[0023] Based on the rule definition set and the set of computation nodes of the tree-like computation graph, a tree-like computation graph with hierarchical and depth structures is constructed.

[0024] Optionally, the data structure of the tree-like computation graph includes: a root rule node and several layers of sub-rule nodes. Each layer of sub-rule nodes represents a set of rules formed by the corresponding logical branch in the attendance calculation. A subset of each rule set includes the smallest execution unit for sequential execution.

[0025] Optionally, the step of constructing a hierarchical and depth-structured tree computation graph based on the rule definition set and computation node set of the tree computation graph includes:

[0026] Initialize each rule type into multiple execution lists;

[0027] Process the rule nodes for each rule type in the rule set according to the following steps:

[0028] Extract all rule nodes with a level of 0, and process these rule nodes one by one;

[0029] For each rule node, a judgment is made according to the rule node definition. If the rule node's sub-rule set is not empty and the rule node is a non-executable node, then all sub-rule nodes in the sub-rule set attribute of the rule node are extracted and sorted in ascending order according to the rule number in the sub-rule set attribute, with smaller numbers having higher priority. The above steps are repeated to process all sub-rule nodes until a node with an executable attribute is obtained, and each node in the sub-rule set of the executable node attribute is placed into the execution list in order.

[0030] Following the steps described above, multiple execution lists are merged to obtain a final tree-like computation graph with hierarchical and depth structures. Optionally, the step of constructing a chain-like computation graph with computation order attributes based on the dependencies between computation nodes includes:

[0031] Define the computation node data structure attributes of the chain computation graph, and obtain a set of computation nodes based on the computation node data structure attributes. The computation node data structure attributes include: node ID, formula content, and dependency list.

[0032] Initialize the dependencies of all computing nodes in the set of computing nodes;

[0033] For each node item in the set of computing nodes, the formula content in the node item is parsed to obtain all the reference items in the formula content, forming a set of reference items;

[0034] Assign the collection of referenced items to the dependency list in the node item;

[0035] Topological sorting is used to sort the nodes according to their dependency list, forming an ordered set of nodes, where the dependent items have higher execution priority than their dependent items.

[0036] The sorted set of nodes is output to obtain the chain computation graph.

[0037] Optionally, the step of inputting the structured computation graph into the rule engine for execution to obtain the attendance calculation result includes:

[0038] The structured computation graph is input into the rule engine, and the calculation is performed according to the formula content in the computation node to obtain the attendance calculation result.

[0039] Optionally, the step of performing circular dependency checks on the computation nodes in the chained computation graph includes:

[0040] Obtain the set F of all nodes in the chained computation graph. The attributes of each node in the set F include: id, content, and depends.

[0041] For each node item in the set F of all nodes in the chain computation graph, with id as the current node and the lines connecting each node in depends to the current node as directed edges, a directed graph is constructed.

[0042] Initialize the node access matrix, where each node is in an unvisited state.

[0043] Use a depth-first traversal algorithm to traverse each node in the directed graph;

[0044] If the corresponding node state in the node access matrix is ​​unvisited, then the corresponding node state in the node access matrix is ​​assigned to the visited state.

[0045] If the corresponding node in the node access matrix is ​​already in an accessed state, then output that there is a circular dependency and exit.

[0046] If, through traversal, all nodes in the node set are visited only once, then there is no circular dependency.

[0047] Optionally, the method further includes:

[0048] When there are new additions or changes to the attendance business logic rules, the attendance calculation rules of the attendance calculation model are expanded or adjusted according to the new attendance business logic rules.

[0049] This embodiment also proposes an attendance processing system, which includes: a memory, a processor, and an attendance processing program stored in the memory and executable on the processor. When the attendance processing program is executed by the processor, it implements the steps of the attendance processing method described above.

[0050] This embodiment also proposes a computer-readable storage medium storing an attendance processing program, which, when executed by a processor, implements the steps of the attendance processing method described above.

[0051] The attendance processing method, system, and computer-readable storage medium proposed in this invention involve: acquiring attendance business logic rules; inputting these rules into an attendance calculation model; structuring the attendance calculation rules using the model to obtain a structured calculation graph; and inputting the structured calculation graph into a rule engine for execution to obtain the attendance calculation result. This invention proposes a rule engine-based attendance calculation model that can structure attendance calculation rules and supports "runtime" extensions, enabling convenient and rapid adjustments to the attendance calculation logic. Compared to existing technologies, this invention offers greater flexibility and scalability, allowing for rapid expansion and adjustment for different attendance rules, thereby providing efficient and accurate attendance calculation functions while improving the scalability of the attendance rule calculation method. Attached Figure Description

[0052] Figure 1 This is a schematic diagram of the functional modules of the terminal equipment to which the attendance processing device of the present invention belongs;

[0053] Figure 2 This is a flowchart illustrating the first embodiment of the attendance processing method of the present invention;

[0054] Figure 3 This is a schematic diagram of a tree-like computational graph with hierarchical and depth structures in an embodiment of the attendance processing method of the present invention;

[0055] Figure 4 This is a schematic diagram of a chain-like computation graph structure with a calculation order attribute in an embodiment of the attendance processing method of the present invention;

[0056] Figure 5 This is a flowchart illustrating the second embodiment of the attendance processing method of the present invention;

[0057] Figure 6 This is a flowchart illustrating the third embodiment of the attendance processing method of the present invention.

[0058] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0059] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0060] The main solution of this invention is as follows: First, obtain the attendance business logic rules. Second, input the attendance business logic rules into the attendance calculation model. Third, structure the attendance calculation rules using the attendance calculation model to obtain a structured calculation graph. Fourth, input the structured calculation graph into the rule engine for execution to obtain the attendance calculation execution result. This invention proposes an attendance calculation model based on a rule engine, which can structure attendance calculation rules and support "runtime" extensions, enabling convenient and rapid adjustment of the attendance calculation logic. Compared to existing technologies, this invention offers greater flexibility and scalability, allowing for rapid expansion and adjustment for different attendance rules. This provides efficient and accurate attendance calculation functionality while improving the scalability of the attendance rule calculation method.

[0061] This invention takes into account that most current employee attendance software calculates employee attendance status and duration based on pre-set program settings. Similar SaaS products mostly use the same calculation logic for all customers. If some customers need to customize the calculation rules, such as modifying the rules and calculation methods, the code needs to be modified again, which usually results in significant customization costs, low personalization and scalability, and poor maintainability.

[0062] Based on this, embodiments of the present invention provide an attendance calculation model based on a rule engine, which can structure attendance calculation rules and support "runtime" extensions, enabling convenient and rapid adjustment of attendance calculation logic, improving the flexibility and scalability of attendance calculation functions, and reducing costs.

[0063] Specifically, refer to Figure 1 , Figure 1 This is a schematic diagram of the functional modules of the terminal device to which the attendance processing device of the present invention belongs. The attendance processing device can be a device independent of the terminal device, and it can be implemented on the terminal device or system in the form of hardware or software. The terminal device can be a smart mobile terminal such as a mobile phone or tablet computer, or it can be a network device such as a server.

[0064] In this embodiment, the terminal device to which the attendance processing device belongs includes at least an output module 110, a processor 120, a memory 130, and a communication module 140.

[0065] The memory 130 stores the operating system and attendance processing program; the output module 110 can be a display screen, speaker, etc. The communication module 140 can include a WIFI module, a mobile communication module, and a Bluetooth module, etc., and communicates with external devices or servers through the communication module 140.

[0066] In one embodiment, when the attendance processing program in memory 130 is executed by the processor, it performs the following steps:

[0067] Obtain the attendance business logic rules;

[0068] The attendance business logic rules are input into the attendance calculation model, and the attendance calculation rules are structured through the attendance calculation model to obtain a structured calculation graph;

[0069] The structured computation graph is input into the rule engine for execution, and the attendance calculation results are obtained.

[0070] Furthermore, when the attendance processing program in memory 130 is executed by the processor, it also performs the following steps:

[0071] The attendance business logic rules are input into the attendance calculation model and processed as follows:

[0072] Construct computing nodes based on the aforementioned attendance business logic rules;

[0073] A structured computation graph is constructed based on the computation nodes.

[0074] Furthermore, when the attendance processing program in memory 130 is executed by the processor, it also performs the following steps:

[0075] The various business logic rules in attendance calculation are combined into calculation units that can be executed by a computer rule engine, and calculation nodes are constructed based on these calculation units.

[0076] Furthermore, when the attendance processing program in memory 130 is executed by the processor, it also performs the following steps:

[0077] Based on the computing nodes, a hierarchical and depth-structured tree-like computation graph is constructed, which is used by the program to perform rule calculations according to the execution order and execution method defined in the tree-like computation graph during the execution phase.

[0078] Based on the dependencies between computing nodes, a chain-like computing graph with computing order attributes is constructed.

[0079] Furthermore, when the attendance processing program in memory 130 is executed by the processor, it also performs the following steps:

[0080] Perform circular dependency checks on the computation nodes in the chained computation graph;

[0081] If there are no circular dependencies in the chained computation graph, then the following steps are executed: input the structured computation graph into the rule engine for execution, and obtain the attendance calculation execution result.

[0082] Furthermore, when the attendance processing program in memory 130 is executed by the processor, it also performs the following steps:

[0083] Define the rule attributes of the tree-like computation graph, and obtain a rule definition set based on the rule attributes. The rule attributes include: rule ID, rule level, rule sequence number, sub-rule set, whether it is an execution node, and rule type.

[0084] Define the computation node data structure attributes of the tree-like computation graph, and obtain a set of computation nodes based on the computation node data structure attributes. The computation node data structure attributes include: node ID, formula content, and dependency list.

[0085] Based on the rule definition set and the set of computation nodes of the tree-like computation graph, a tree-like computation graph with hierarchical and depth structures is constructed.

[0086] Furthermore, when the attendance processing program in memory 130 is executed by the processor, it also performs the following steps:

[0087] Initialize each rule type into multiple execution lists;

[0088] Process the rule nodes for each rule type in the rule set according to the following steps:

[0089] Extract all rule nodes with a level of 0, and process these rule nodes one by one;

[0090] For each rule node, a judgment is made according to the rule node definition. If the rule node's sub-rule set is not empty and the rule node is a non-executable node, then all sub-rule nodes in the sub-rule set attribute of the rule node are extracted and sorted in ascending order according to the rule number in the sub-rule set attribute, with smaller numbers having higher priority. The above steps are repeated to process all sub-rule nodes until a node with an executable attribute is obtained, and each node in the sub-rule set of the executable node attribute is placed into the execution list in order.

[0091] Following the steps above, multiple execution lists are merged to obtain the final tree-like computation graph with hierarchical and depth structures.

[0092] Furthermore, when the attendance processing program in memory 130 is executed by the processor, it also performs the following steps:

[0093] Define the computation node data structure attributes of the chain computation graph, and obtain a set of computation nodes based on the computation node data structure attributes. The computation node data structure attributes include: node ID, formula content, and dependency list.

[0094] Initialize the dependencies of all computing nodes in the set of computing nodes;

[0095] For each node item in the set of computing nodes, the formula content in the node item is parsed to obtain all the reference items in the formula content, forming a set of reference items;

[0096] Assign the collection of referenced items to the dependency list in the node item;

[0097] Topological sorting is used to sort the nodes according to their dependency list, forming an ordered set of nodes, where the dependent items have higher execution priority than their dependent items.

[0098] The sorted set of nodes is output to obtain the chain computation graph.

[0099] Furthermore, when the attendance processing program in memory 130 is executed by the processor, it also performs the following steps:

[0100] The structured computation graph is input into the rule engine, and the calculation is performed according to the formula content in the computation node to obtain the attendance calculation result.

[0101] Furthermore, when the attendance processing program in memory 130 is executed by the processor, it also performs the following steps:

[0102] Obtain the set F of all nodes in the chained computation graph. The attributes of each node in the set F include: id, content, and depends.

[0103] For each node item in the set F of all nodes in the chain computation graph, with id as the current node and the lines connecting each node in depends to the current node as directed edges, a directed graph is constructed.

[0104] Initialize the node access matrix, where each node is in an unvisited state.

[0105] Use a depth-first traversal algorithm to traverse each node in the directed graph;

[0106] If the corresponding node state in the node access matrix is ​​unvisited, then the corresponding node state in the node access matrix is ​​assigned to the visited state.

[0107] If the corresponding node in the node access matrix is ​​already in an accessed state, then output that there is a circular dependency and exit.

[0108] If, through traversal, all nodes in the node set are visited only once, then there is no circular dependency.

[0109] Furthermore, when the attendance processing program in memory 130 is executed by the processor, it also performs the following steps:

[0110] When there are new additions or changes to the attendance business logic rules, the attendance calculation rules of the attendance calculation model are expanded or adjusted according to the new attendance business logic rules.

[0111] This embodiment, through the above-described scheme, specifically involves obtaining attendance business logic rules; inputting these rules into an attendance calculation model; structuring these rules using the attendance calculation model to obtain a structured calculation graph; and then inputting the structured calculation graph into a rule engine for execution to obtain the attendance calculation result. This invention proposes an attendance calculation model based on a rule engine, which can structure attendance calculation rules and support "runtime" extensions, enabling convenient and rapid adjustments to the attendance calculation logic. Compared to existing technologies, this invention offers greater flexibility and scalability, allowing for rapid expansion and adjustment for different attendance rules, thereby providing efficient and accurate attendance calculation functionality while improving the scalability of the attendance rule calculation method.

[0112] Based on, but not limited to, the terminal device architecture described above, embodiments of the method of the present invention are proposed.

[0113] The technical solution of this invention mainly addresses the scalability of attendance calculation models or rules. It defines a set of attendance rule calculation models and, based on a rule engine, supports runtime expansion.

[0114] Reference Figure 2 , Figure 2 This is a flowchart illustrating the first embodiment of the attendance processing method of the present invention.

[0115] like Figure 2 As shown, the first embodiment of the present invention proposes an attendance processing method, the method comprising the following steps:

[0116] Step S101: Obtain the attendance business logic rules;

[0117] This embodiment is mainly applied to various attendance processing scenarios, such as scenarios where companies or enterprises need to determine employee attendance status and calculate attendance duration.

[0118] Different scenarios may have different attendance business logic rules. This embodiment proposes an attendance calculation model based on a rule engine, which can structure the attendance calculation rules and support "runtime" extensions. It can easily and quickly adjust the attendance calculation logic, providing efficient and accurate attendance calculation functions while improving the scalability of the attendance rule calculation method.

[0119] Specifically, the first step is to obtain the attendance business logic rules that need to be calculated. Different companies or enterprises may have corresponding attendance business logic rules, such as rules on working hours, rules on being late or leaving early, rules on clocking in and out, rules on business trips, etc. Through the attendance business logic rules, the employee's attendance status and attendance duration can be calculated.

[0120] Step S102: Input the attendance business logic rules into the attendance calculation model, and structure the attendance calculation rules through the attendance calculation model to obtain a structured calculation graph;

[0121] In this embodiment, an attendance calculation model is configured to calculate attendance rules. The attendance calculation rules are structured and can be quickly expanded and adjusted for different attendance business logic rules to provide efficient and accurate attendance calculation functions. At the same time, the attendance calculation logic can be easily and quickly adjusted to improve the scalability of the attendance rule calculation method.

[0122] In order to combine all the logic in attendance calculation into a calculation unit that can be executed by the computer rule engine, and to support dynamic expansion at runtime, this embodiment of the invention constructs calculation nodes based on attendance business logic rules. According to the needs of attendance business logic calculation, each calculation node is constructed into two types of calculation graphs for the final attendance calculation.

[0123] Specifically, the attendance business logic rules are input into the attendance calculation model, and the attendance calculation rules are structured through the attendance calculation model to obtain a structured calculation graph.

[0124] The attendance business logic rules are input into the attendance calculation model and processed as follows:

[0125] Computational nodes are constructed based on the attendance business logic rules, and a structured computational graph is constructed based on the computational nodes.

[0126] The step of constructing computing nodes based on the attendance business logic rules includes:

[0127] The various business logic rules in attendance calculation are combined into calculation units that can be executed by a computer rule engine, and calculation nodes are constructed based on these calculation units.

[0128] Step S103: Input the structured computation graph into the rule engine for execution to obtain the attendance calculation execution result.

[0129] In this embodiment, the attendance calculation model relies on a rule engine for execution. The structured calculation graph output by the attendance calculation model is input into the rule engine for execution, resulting in the attendance calculation execution result. Therefore, by structuring the attendance calculation rules through the attendance calculation model, efficient and accurate attendance calculation functions can be provided. Furthermore, execution through the rule engine supports runtime expansion, allowing for rapid expansion and adjustment of different attendance business logic rules. This facilitates quick adjustments to the attendance calculation logic and improves the scalability of the attendance rule calculation method.

[0130] More specifically, in order to combine all the logic in attendance calculation into a calculation unit that can be executed by the computer rule engine and to support dynamic expansion at runtime, this invention constructs two types of calculation graphs for each calculation node according to the business logic calculation needs and through the attendance calculation model for the final attendance calculation.

[0131] Among them, the two types of computation graphs include: tree-like computation graphs with hierarchical and depth structures, and chain-like computation graphs with computation order attributes.

[0132] In the attendance calculation model, the step of constructing a structured computation graph based on the computation nodes may include:

[0133] A tree-like computation graph with hierarchical and depth structures is constructed based on the aforementioned computation nodes;

[0134] Based on the dependencies between computing nodes, a chain-like computing graph with computing order attributes is constructed.

[0135] The hierarchical and depth-structured tree-like computation graph is used by the program to perform rule calculations according to the execution order and execution method defined in the tree-like computation graph during the execution phase.

[0136] The data structure of the tree-like computation graph includes: a root rule node and several layers of sub-rule nodes. Each layer of sub-rule nodes represents a set of rules formed by the corresponding logical branch in attendance calculation. A subset of each rule set includes the smallest execution unit for sequential execution.

[0137] Among them, the tree-like computational graph structure with hierarchical and depth structures is as follows: Figure 3 As shown, the Root node is the root node, which is only a logical node and does not have a specific computational meaning. Level 0 represents the rule set formed by the large logical branches in attendance calculation, such as the set of free time rules and the set of non-free time rules. Levels 1 and above represent subsets of each rule set, and there are also the smallest execution units that are executed sequentially in the subsets, such as n11, n12, etc. in the figure.

[0138] Among them, chain-like computation graph structures with computation order attributes are as follows: Figure 4 As shown.

[0139] There are two different construction methods for the two types of computation graphs. The construction process of the two types of computation graphs is described in detail below:

[0140] Specifically, as one implementation method, a hierarchical and depth-structured tree computation graph is constructed based on the computing nodes, which is used by the program to perform rule calculations according to the execution order and execution method defined in the tree computation graph during the execution phase.

[0141] One implementation method for constructing a hierarchical and depth-structured tree computation graph may include:

[0142] First, the data structure for this type of computation graph is defined:

[0143] Define the rule attributes of the tree-like computation graph, and obtain a rule definition set based on the rule attributes. The rule attributes include: rule ID, rule level, rule sequence number, sub-rule set, whether it is an execution node, and rule type.

[0144] Define the computation node data structure attributes of the tree-like computation graph, and obtain a set of computation nodes based on the computation node data structure attributes. The computation node data structure attributes include: node ID, formula content, and dependency list.

[0145] Then, based on the rule definition set and the set of computation nodes of the tree-like computation graph, a tree-like computation graph with hierarchical and depth structures is constructed.

[0146] In other words, the steps for constructing a hierarchical and depth-structured tree computation graph can be as follows:

[0147] Input: rule definition set D (each rule has the following attributes: id, level, seq, subrules, isExecute, type), compute node set F (each node has the following attributes: id, content, depends);

[0148] Output: An executable computation graph.

[0149] Specifically, as one implementation, the step of constructing a hierarchical and depth-structured tree computation graph based on the rule definition set and computation node set of the tree computation graph includes:

[0150] First, the rules are divided into multiple subsets D{D1,D2,...Dn} according to their type, and the execution list set L{L1,L2,...,Ln} is initialized.

[0151] Then, the following processing is performed on each subset Di in set D:

[0152] Extract all rule nodes in Di with a level attribute of 0, and process these rule nodes one by one;

[0153] For each rule node in Di, a judgment is made according to the rule node definition. If the subrule set (all subrule nodes (subrules attribute)) of the rule node (node ​​A) is not empty, and the rule node is a non-executable node (isExecute attribute), then all subrule nodes (a1, a2, ... an) in the subrule set attribute of the rule node (node ​​A) are extracted and sorted in ascending order according to the rule sequence number (seq attribute) in their attributes, where the smaller the sequence number, the higher the priority. The above steps are repeated to process all its subrule nodes (a1, a2, ... an) until a node with the node attribute of executable (isExecute attribute) is obtained, and each node in the subrule set of the executable node attribute is placed into the execution list Li in order.

[0154] Then, following the steps above, the multiple execution lists are directly merged, and the resulting set of execution lists L is the final tree-like computation graph with hierarchical and depth structures.

[0155] One implementation method involves constructing a chain-like computation graph with computation order attributes based on the dependencies between computing nodes. The specific construction process may include:

[0156] First, define the computation node data structure attributes of the chain computation graph, and obtain the computation node set based on the computation node data structure attributes. The computation node data structure attributes include: node id, formula content, and dependency list.

[0157] Then, based on the dependencies between computing nodes in the computing node set, a chain-like computing graph with computing order attributes is constructed.

[0158] In other words, the steps for constructing a chained computation graph include:

[0159] Input: A set of compute nodes F (each node contains the following attributes: id, content, depends);

[0160] Output: Chained computation graph.

[0161] Specifically, as one implementation method, the steps of constructing a chained computation graph with computation order attributes based on the dependencies between computation nodes in the computation node set may include:

[0162] First, initialize the dependencies of all computing nodes in the computing node set F;

[0163] Then, for each node item in the set of computing nodes, the formula content in the node item is parsed to obtain all the reference items in the formula content, forming a set of reference items, and the set of reference items is assigned to the depends (dependency list) in the node item.

[0164] Then, using topological sorting, the nodes are sorted according to the dependency list of each node item to form an ordered set of nodes F', where the dependent items have higher execution priority than the dependent items.

[0165] Finally, the sorted set of nodes F' is output to obtain the chained computation graph.

[0166] After constructing a tree-like computation graph with hierarchical and depth structures and a chain-like computation graph with computation order attributes, the structured computation graph is input into the rule engine, and the calculation is performed according to the formula content in the computation nodes to obtain the attendance calculation execution result.

[0167] This embodiment, through the above-described scheme, specifically involves obtaining attendance business logic rules; inputting these rules into an attendance calculation model; structuring these rules using the attendance calculation model to obtain a structured calculation graph; and then inputting the structured calculation graph into a rule engine for execution to obtain the attendance calculation result. This invention proposes an attendance calculation model based on a rule engine, which can structure attendance calculation rules and support "runtime" extensions, enabling convenient and rapid adjustments to the attendance calculation logic. Compared to existing technologies, this invention offers greater flexibility and scalability, allowing for rapid expansion and adjustment for different attendance rules, thereby providing efficient and accurate attendance calculation functionality while improving the scalability of the attendance rule calculation method.

[0168] Reference Figure 5 , Figure 5 This is a flowchart illustrating the second embodiment of the attendance processing method of the present invention.

[0169] like Figure 5 As shown, the second embodiment of the present invention proposes an attendance processing method based on the above. Figure 2 The illustrated embodiment further includes, after the step of constructing a structured computation graph based on the computing nodes:

[0170] Step S1023: Perform a circular dependency check on the computation nodes in the chained computation graph;

[0171] If there are no circular dependencies in the chained computation graph, then the following steps are executed: input the structured computation graph into the rule engine for execution, and obtain the attendance calculation execution result.

[0172] Compared to the above embodiments, this embodiment also includes a technical solution for performing circular dependency checks on the computation nodes in the chained computation graph.

[0173] This embodiment takes into account that after all computing nodes are constructed into a computing graph using the method of the above embodiment, the execution order of all computing nodes is determined. However, for a chained computing graph, there may still be a situation where nodes have circular dependencies due to errors in the business logic of the formula. Circular dependencies will cause the computing to fail. Therefore, in this embodiment, it is necessary to check the nodes in the chained computing graph for circular dependencies during the computing process to avoid the situation where the computing cannot be executed normally due to the existence of circular dependencies.

[0174] In one implementation, the step of performing cyclic dependency checks on the computation nodes in the chained computation graph may include:

[0175] First, obtain the set F of all nodes in the chained computation graph. The attributes of each node in the set F include: id, content, and depends.

[0176] Then, for each node item in the set F of all nodes in the chain computation graph (each node in the set F contains attributes: id, content, depends), with id as the current node and the lines connecting each node in depends to the current node as directed edges, a directed graph V is constructed.

[0177] Then, initialize the node access matrix, where each node in the node access matrix is ​​in an unvisited state;

[0178] Then, for each node Vi in the directed graph V, perform the following operation:

[0179] Using a depth-first traversal algorithm, traverse each node in the directed graph V. If the corresponding node state in the node access matrix is ​​unvisited, then assign the corresponding node state in the node access matrix as visited. If the corresponding node state in the node access matrix is ​​already visited, output that a circular dependency exists and exit. If all nodes in the node set are visited only once through traversal, it indicates that there is no circular dependency.

[0180] This embodiment, through the above-described scheme, specifically obtains attendance business logic rules; inputs these rules into an attendance calculation model, and structures them using the model to obtain a structured computation graph; performs circular dependency checks on the computation nodes in the chained computation graph; if no circular dependencies exist, the structured computation graph is input into a rule engine for execution, yielding the attendance calculation result. This invention proposes a rule engine-based attendance calculation model that can structure attendance calculation rules and supports runtime extensions, enabling convenient and rapid adjustments to the attendance calculation logic. Compared to existing technologies, this invention offers greater flexibility and scalability, allowing for rapid expansion and adjustment for different attendance rules, thereby providing efficient and accurate attendance calculation functionality while improving the scalability of the attendance rule calculation method. Furthermore, during the calculation process, circular dependency checks are performed on the nodes in the computation graph to avoid situations where circular dependencies prevent normal execution of the calculation.

[0181] Reference Figure 6 , Figure 6 This is a flowchart illustrating the third embodiment of the attendance processing method of the present invention.

[0182] like Figure 6 As shown, the attendance processing method proposed in the third embodiment of the present invention, based on any of the above embodiments, further includes:

[0183] Step S104: When there are new additions or changes to the attendance business logic rules, the attendance calculation rules of the attendance calculation model are expanded or adjusted according to the new attendance business logic rules.

[0184] Compared to the above embodiments, this embodiment also includes a scheme to expand or adjust the attendance calculation rules according to the actual situation.

[0185] Specifically, in this embodiment, attendance rules are calculated through an attendance calculation model. This structured approach allows for rapid expansion and adjustment of attendance business logic rules, adapting to scenarios where new or changed rules exist. For example, if customers require customized attendance calculation rules, such as modifications to rules and calculation methods, the attendance calculation model can be expanded or adjusted based on the new rules without rewriting the code. This reduces the customization cost of attendance calculation rules, enhances their personalized expansion capabilities, and improves maintainability. While providing efficient and accurate attendance calculation functionality, it also allows for convenient and rapid adjustment of the attendance calculation logic, improving the scalability of the attendance rule calculation method.

[0186] This embodiment, through the above-described scheme, specifically involves: acquiring attendance business logic rules; inputting these rules into an attendance calculation model; structuring these rules using the attendance calculation model to obtain a structured calculation graph; inputting the structured calculation graph into a rule engine for execution to obtain the attendance calculation execution result; and expanding or adjusting the attendance calculation rules of the attendance calculation model based on new or changed attendance business logic rules. This invention proposes a rule engine-based attendance calculation model that can structure attendance calculation rules and support "runtime" expansion, enabling convenient and rapid adjustment of the attendance calculation logic. Compared to existing technologies, this invention offers greater flexibility and scalability, allowing for rapid expansion and adjustment for different attendance rules, thereby providing efficient and accurate attendance calculation functionality while improving the scalability of the attendance rule calculation method.

[0187] Furthermore, embodiments of the present invention also propose an attendance processing device, the device comprising:

[0188] The acquisition module is used to acquire attendance business logic rules;

[0189] The processing module is used to input the attendance business logic rules into the attendance calculation model, and to structure the attendance calculation rules through the attendance calculation model to obtain a structured calculation graph.

[0190] The execution module is used to input the structured computation graph into the rule engine for execution, and obtain the attendance calculation execution result.

[0191] The implementation principle of the attendance processing device of the present invention can be referred to the above embodiments, and will not be repeated here.

[0192] Furthermore, this invention also proposes an attendance processing system, which includes: a memory, a processor, and an attendance processing program stored in the memory and executable on the processor. When the attendance processing program is executed by the processor, it implements the steps of the attendance processing method described above.

[0193] The implementation principle of the attendance processing system of the present invention can be referred to the above embodiments, and will not be repeated here.

[0194] Furthermore, embodiments of the present invention also propose a computer-readable storage medium storing an attendance processing program, which, when executed by a processor, implements the steps of the attendance processing method described above.

[0195] The principle of attendance processing in this embodiment can be referred to in the above embodiments, and will not be repeated here.

[0196] Compared to existing technologies, the attendance processing method, system, and computer-readable storage medium proposed in this invention obtain attendance business logic rules; input these rules into an attendance calculation model; structure the rules using the model to obtain a structured calculation graph; and input the structured calculation graph into a rule engine for execution to obtain the attendance calculation result. This invention proposes a rule engine-based attendance calculation model that can structure attendance calculation rules and supports runtime extensions, enabling convenient and rapid adjustments to the attendance calculation logic. Compared to existing technologies, this invention offers greater flexibility and scalability, allowing for rapid expansion and adjustment for different attendance rules, thereby providing efficient and accurate attendance calculation functionality while improving the scalability of the attendance rule calculation method.

[0197] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.

[0198] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0199] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a recommendation effect evaluation system (which may be a mobile phone, computer, server, controlled terminal, or network device, etc.) to execute the methods of each embodiment of the present invention.

[0200] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.

Claims

1. An attendance processing method, characterized in that, The method includes the following steps: Obtain the attendance business logic rules; The attendance business logic rules are input into the attendance calculation model, calculation nodes are constructed based on the attendance business logic rules, and a structured calculation graph is constructed based on the calculation nodes. The structured computation graph is input into the rule engine for execution, and the attendance calculation results are obtained. The steps for constructing a structured computation graph based on the computing nodes include: A hierarchical and depth-structured tree-like computation graph is constructed based on the computation nodes, which is used by the program to perform rule calculations according to the execution order and execution method defined in the tree-like computation graph during the execution phase. Based on the dependencies between computing nodes, a chain-like computing graph with computing order attributes is constructed. The steps of constructing a hierarchical and depth-structured tree computation graph based on the computation nodes include: Define the rule attributes of the tree-like computation graph, and obtain a rule definition set based on the rule attributes. The rule attributes include: rule ID, rule level, rule sequence number, sub-rule set, whether it is an execution node, and rule type. Define the computation node data structure attributes of the tree-like computation graph, and obtain a set of computation nodes based on the computation node data structure attributes. The computation node data structure attributes include: node ID, formula content, and dependency list. Based on the rule definition set and the set of computation nodes of the tree-like computation graph, a tree-like computation graph with hierarchical and depth structures is constructed. The steps for constructing a chained computation graph with computation order attributes based on the dependencies between various computing nodes include: Define the computation node data structure attributes of the chain computation graph, and obtain a set of computation nodes based on the computation node data structure attributes. The computation node data structure attributes include: node ID, formula content, and dependency list. Initialize the dependencies of all computing nodes in the set of computing nodes; For each node item in the set of computing nodes, the formula content in the node item is parsed to obtain all the reference items in the formula content, forming a set of reference items; Assign the collection of referenced items to the dependency list in the node item; Topological sorting is used to sort the nodes according to their dependency list, forming an ordered set of nodes, where the dependent items have higher execution priority than their dependent items. The sorted set of nodes is output to obtain the chain computation graph.

2. The method according to claim 1, characterized in that, The step of constructing computing nodes based on the attendance business logic rules includes: The various business logic rules in attendance calculation are combined into calculation units that can be executed by a computer rule engine, and calculation nodes are constructed based on these calculation units.

3. The method according to claim 1, characterized in that, The step of constructing a chained computation graph with computation order attributes based on the dependencies between computing nodes also includes: Perform circular dependency checks on the computation nodes in the chained computation graph; If there are no circular dependencies in the chained computation graph, then the following steps are executed: input the structured computation graph into the rule engine for execution, and obtain the attendance calculation execution result.

4. The method according to claim 1, characterized in that, The data structure of the tree-like computation graph includes: a root rule node and several layers of sub-rule nodes. Each layer of sub-rule nodes represents a set of rules formed by the corresponding logical branch in attendance calculation. A subset of each rule set includes the smallest execution unit for sequential execution.

5. The method according to claim 4, characterized in that, The step of constructing a hierarchical and depth-structured tree computation graph based on the rule definition set and computation node set of the tree computation graph includes: Initialize each rule type into multiple execution lists; Process the rule nodes for each rule type in the rule set according to the following steps: Extract all rule nodes with a level of 0, and process these rule nodes one by one; For each rule node, a judgment is made according to the rule node definition. If the rule node's sub-rule set is not empty and the rule node is a non-executable node, then all sub-rule nodes in the sub-rule set attribute of the rule node are extracted and sorted in ascending order according to the rule number in the sub-rule set attribute, with smaller numbers having higher priority. The above steps are repeated to process all sub-rule nodes until a node with an executable attribute is obtained, and each node in the sub-rule set of the executable node attribute is placed into the execution list in order. Following the steps above, multiple execution lists are merged to obtain the final tree-like computation graph with hierarchical and depth structures.

6. The method according to claim 1, characterized in that, The step of inputting the structured computation graph into the rule engine for execution to obtain the attendance calculation result includes: The structured computation graph is input into the rule engine, and the calculation is performed according to the formula content in the computation node to obtain the attendance calculation result.

7. The method according to claim 3, characterized in that, The step of performing circular dependency checks on the computation nodes in the chained computation graph includes: Obtain the set F of all nodes in the chained computation graph. The attributes of each node in the set F include: id, content, and depends. For each node item in the set F of all nodes in the chain computation graph, with id as the current node and the lines connecting each node in depends to the current node as directed edges, a directed graph is constructed. Initialize the node access matrix, where each node is in an unvisited state. Use a depth-first traversal algorithm to traverse each node in the directed graph; If the corresponding node state in the node access matrix is ​​unvisited, then the corresponding node state in the node access matrix is ​​assigned to the visited state. If the corresponding node in the node access matrix is ​​already in an accessed state, then output that there is a circular dependency and exit. If, through traversal, all nodes in the node set are visited only once, then there is no circular dependency.

8. The method according to claim 1, characterized in that, The method further includes: When there are new additions or changes to the attendance business logic rules, the attendance calculation rules of the attendance calculation model are expanded or adjusted according to the new attendance business logic rules.

9. An attendance processing system, characterized in that, The attendance processing system includes: a memory, a processor, and an attendance processing program stored in the memory and executable on the processor, wherein when the attendance processing program is executed by the processor, it implements the steps of the attendance processing method as described in any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores an attendance processing program, which, when executed by a processor, implements the steps of the attendance processing method as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Map making rule construction and structured organization method and system thereof

    CN104794236A

  • A method for realizing attendance rules by dynamically expanding adaptation in attendance calculation

    CN104866950A