Method, device and product for updating custom field of human resource outsourcing system

By setting a timestamp field in the employee information table and a database change capture mechanism to monitor changes in the employee information table, using an asynchronous message queue to send change information, dynamically calculating the values ​​of custom fields and storing the results, the problem of low efficiency in custom field calculation and updating is solved, and the system response speed and user experience are improved.

CN120743372APending Publication Date: 2025-10-03SHANGHAI JINLI INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510843151.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-23
Publication Date
2025-10-03

AI Technical Summary

Technical Problem

In the existing technology, the human resource management system has problems with the data processing efficiency of the system in updating custom fields. The existing technology has problems such as low efficiency in custom field calculation and update, failure to take effect in a timely manner, slow system response speed, and poor user experience.

Method used

By setting a timestamp field in the employee information table and using the database change capture mechanism to monitor data, the database change capture mechanism is used to monitor changes in the employee information table, write change records into the change table, and send change information through the asynchronous message queue, dynamically calculate the value of the custom field, and store the result in the database.

Benefits of technology

It enables timely updates of custom fields, improves system response speed and user experience, reduces system resource consumption, supports differentiated configurations for multiple customers, and shortens the time it takes to bring new formulas online.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120743372A_ABST
    Figure CN120743372A_ABST
Patent Text Reader

Abstract

The invention discloses a method, a device and a product for updating a custom field of a human resource outsourcing system. The method comprises the following steps: setting a timestamp field in an employee information table; monitoring the change of the employee information table through a database change capturing mechanism, and writing a change record into a change table; scanning the change table at a preset time interval through a first process, and asynchronously sending change information in the change table through a message queue; monitoring the message of the message queue through a second process, and executing the following processing according to the employee ID in the message: loading a custom field configured by a customer to which the employee belongs and a formula expression thereof from a database; traversing each formula expression, and analyzing the hierarchical dependency relationship of all the custom fields; and dynamically calculating the value of each self-defined field according to the hierarchical dependency relationship and the updated value of the associated field, and updating and storing a calculation result to a database. The user-defined field configuration requirements of different clients can be met, and the efficiency of updating the user-defined field is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of human resource management, and in particular to a method, device, electronic device, computer-readable storage medium, and computer program product for updating custom fields in a human resource outsourcing system. Background Art

[0002] In the field of human resource management, the Human Resources Outsourcing System (HRO) plays a vital role. It is responsible for the comprehensive maintenance of employee information, social security information, salary information, etc., and generates corresponding reports at preset intervals, while providing pages for users to query information.

[0003] Typically, HRO systems configure some basic fields by default. Furthermore, to meet the needs of diverse clients, they also support custom fields. However, HRO systems have the following characteristics: the same system must simultaneously serve multiple client companies, each of which may have completely different field definitions, calculation rules, and data permissions. Furthermore, the same field may require different calculation rules in different time periods (for example, the year-end bonus calculation formula differs in December from other months). Therefore, HRO systems present significant challenges in maintaining and updating custom fields.

[0004] Currently, the industry mainly uses the following two solutions for calculating and updating custom fields in HRO systems, but both have obvious pain points.

[0005] The first type of solution is to hard-code in the business code (source code). For example, the system has two basic fields, [Cost Center] and [Salary], by default. The customer wants to add a custom field [Cost] in the HRO system. Accordingly, the hard coding is as follows: if (cost center == "A place") {return cost = salary * 1.5}; else if (cost center == "B place") {return cost = salary * 1.7}. This type of solution has at least the following defects: 1) Every time a new business rule is added, the source code needs to be modified and redeployed, which is a large workload and has poor scalability. 2) Different customers require different custom fields. The different needs of many customers lead to a surge in code branches and high maintenance costs. 3) The development cycle generally takes several days, which is long. Updates to custom fields cannot take effect in a timely manner, and there is a problem of delayed response.

[0006] The second type of solution is to perform real-time calculations on custom fields when the customer opens a page or report. In other words, the HRO system does not actually save the value of the custom field, but instead calculates it based on a preset formula when the customer reads it. This type of solution has at least the following flaws: 1) When faced with multi-layer formulas to calculate the value of a custom field, the query and calculation time of the multi-layer nested formulas will increase exponentially. The nested calculation process will consume a large amount of system resources and time, resulting in a slower system response speed and a poor user experience. 2) When a calculation fails or an error occurs, it is difficult to trace the problem.

[0007] In summary, the current HRO system has obvious deficiencies in processing the calculation and update of customer-defined fields. A new technical solution is urgently needed to solve these problems in order to improve the system's performance, scalability, and flexibility and better meet the diverse needs of customers. Summary of the Invention

[0008] In view of this, embodiments of the present application provide a method, device, electronic device, computer-readable storage medium, and computer program product for updating custom fields in a human resources outsourcing system, to solve at least one of the above technical problems.

[0009] In a first aspect, an embodiment of the present application provides a method for updating custom fields in a human resources outsourcing system, comprising: setting a timestamp field in an employee information table, and synchronously updating the timestamp field when any field in the employee information table is updated; monitoring changes in the employee information table through a database change capture mechanism, and writing change records into a change table, wherein the change table contains at least an employee ID and a timestamp field; scanning the change table at predetermined time intervals through a first process, and when a change is detected in the information in the change table, asynchronously sending the change information in the change table through a message queue; monitoring messages in the message queue through a second process, and performing the following processing according to the employee ID in the message: loading the custom fields and formula expressions configured by the customer to which the employee belongs from the database, each formula expression representing the operational relationship between at least one custom field and its associated fields, wherein the associated fields include basic fields configured by system default and / or other custom fields configured by the customer; traversing each formula expression and analyzing the hierarchical dependencies of all custom fields; obtaining the updated values ​​of the associated fields, and dynamically calculating the values ​​of each custom field according to the hierarchical dependencies and the updated values ​​of the associated fields, and updating and storing the calculation results in the corresponding fields of the database.

[0010] According to some embodiments of the present application, optionally, each formula expression is traversed and the hierarchical dependencies of all custom fields are analyzed, including: traversing each formula expression and converting all custom fields and their dependencies into a directed acyclic graph, wherein the directed acyclic graph includes nodes and edges, each custom field serves as a node of the directed acyclic graph, and each edge points from the dependent field to the target field based on the dependency relationship; checking whether there is a loop in the directed acyclic graph, and if so, throwing an exception and reporting an error; counting the number of incoming edges of each node in the directed acyclic graph; generating a hierarchical calculation order for the custom fields based on the hierarchical traversal algorithm and the number of incoming edges of each node; dynamically calculating the value of each custom field according to the hierarchical dependencies and the updated values ​​of the associated fields, including: step by step calculating the value of each custom field according to the hierarchical calculation order, the dependencies of the custom fields and the updated values ​​of the associated fields.

[0011] According to some embodiments of the present application, optionally, the database includes a SQL Server database, and the database change capture mechanism includes a change data capture tool built into the SQL Server database; or, the database includes a MY SQL database, and the database change capture mechanism includes a trigger.

[0012] According to some embodiments of the present application, optionally, the method for updating a custom field in a human resources outsourcing system further includes:

[0013] The same version number is added to the updated value of the associated field and the value of the custom field that depends on the associated field for calculation. During the calculation process, the updated value of the associated field in the database is locked to prevent the value of the associated field from being updated again during the calculation process.

[0014] According to some embodiments of the present application, optionally, the method for updating custom fields in a human resources outsourcing system also includes: receiving formula configuration information input by the customer through the front-end configuration page of the human resources outsourcing system, wherein the front-end configuration page is bound to the customer ID to ensure that the formula configurations of different customers are completely isolated; in response to the formula configuration information, configuring the custom field and its formula expression; when saving the formula expression, checking the circular dependencies and syntax errors in the formula expression, and saving it to the database if there are no errors, and prompting an error if there are errors.

[0015] According to some embodiments of the present application, optionally, the method for updating custom fields in a human resources outsourcing system also includes: when the calculation of the value of a custom field fails, determining at which level the custom field is; if it is at the starting level, performing a validity check on the associated fields of the custom field, recalculating when the check is correct, and saving the original values ​​of the associated fields of the custom field when the check is incorrect; if it is at the intermediate level, pausing all downstream calculations, and performing status verification on the preceding custom field, recalculating when the verification is successful, and saving the original values ​​and intermediate calculation results of the preceding custom field and its associated fields when the verification fails; if it is at the final level, performing a consistency check on the entire link, recalculating when the verification is successful, and saving the complete calculation context and intermediate calculation results when the verification fails.

[0016] According to some embodiments of the present application, optionally, the predetermined time interval is a fixed time interval, or the predetermined time interval is a non-fixed time interval that changes with the update frequency of the target field in the employee information table.

[0017] In a second aspect, an embodiment of the present application provides a device for updating a custom field in a human resources outsourcing system, comprising:

[0018] The setting module is used to set the timestamp field in the employee information table. When any field in the employee information table is updated, the timestamp field is updated synchronously.

[0019] A monitoring module, configured to monitor changes in the employee information table through a database change capture mechanism and write change records into a change table, wherein the change table includes at least employee ID and timestamp fields;

[0020] an asynchronous sending module, configured to scan the change table at predetermined time intervals through a first process, and when a change is detected in the information in the change table, asynchronously send the change information in the change table through a message queue;

[0021] An update module is used to listen to the messages of the message queue through a second process, and perform the following processing according to the employee ID in the message: loading the custom fields and formula expressions configured by the customer to which the employee belongs from the database, each formula expression representing the operation relationship between at least one custom field and its associated fields, wherein the associated fields include the basic fields configured by the system by default and / or other custom fields configured by the customer; traversing each formula expression and analyzing the hierarchical dependency of all custom fields; obtaining the updated value of the associated field, and dynamically calculating the value of each custom field according to the hierarchical dependency and the updated value of the associated field, and updating and storing the calculation results in the corresponding fields of the database.

[0022] In a third aspect, an embodiment of the present application provides an electronic device comprising a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the steps of the method for updating custom fields in the human resources outsourcing system as described above are implemented.

[0023] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, implement the steps of the method for updating custom fields in a human resources outsourcing system as described above.

[0024] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes computer program instructions. When the computer program instructions are executed by a processor, the steps of the method for updating custom fields in the human resources outsourcing system as described above are implemented.

[0025] The method, apparatus, electronic device, computer-readable storage medium, and computer program product for updating custom fields in a human resources outsourcing system provided by the embodiments of the present application, on the one hand, separate business rules from the code and store custom fields and their formula expressions in a database, eliminating the need to intrude into the business code. Business developers do not need to worry about field update logic, eliminating the maintenance difficulties caused by "hard coding" and implementing custom field updates through configuration rather than code modification to meet the personalized needs of different customers. On the other hand, a pre-calculation mode is used to persist custom field results. When displaying a page, report, or list, they only need to be read directly, eliminating the need for on-the-spot calculations each time they are displayed. This allows the update of custom fields to be completed in a relatively short time, improving the responsiveness of the HRO system and the user experience.

[0026] In terms of details, by setting a timestamp field in the employee information table, any field update leaves a traceable time stamp, solving the technical problem of traditional solutions that make it difficult to accurately identify the timing of changes. Using a database change capture mechanism to monitor changes can reduce detection latency from minutes to seconds compared to scheduled full table scans, while also effectively reducing ineffective IO consumption. By decoupling change detection and calculation processes through asynchronous message queues, computing services can be scaled independently, while bursty traffic can be buffered by message queues. By storing custom fields and their formula expressions as structured metadata, a single HRO system can simultaneously manage the differentiated formula configurations of multiple customers, reducing the time it takes to bring new formulas online to minutes. By dynamically analyzing field dependencies and topologically sorting them at runtime, the calculation level of custom fields can be automatically identified, maintaining linear time complexity when processing multi-layer nested formulas. In other words, no matter how deep the formula nesting level is (such as 3 or more levels), the calculation time is only proportional to the number of fields actually changed, rather than the exponential growth of traditional solutions. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following briefly introduces the drawings in the embodiments of the present application.

[0028] Figure 1 A flowchart of a method for updating custom fields in a human resources outsourcing system provided in an embodiment of the present application.

[0029] Figure 2 This is a flowchart of S1042 in the method for updating custom fields in the human resources outsourcing system provided in an embodiment of the present application.

[0030] Figure 3 A directed acyclic graph is schematically shown.

[0031] Figure 4 The front-end configuration page of the human resources outsourcing system is schematically shown.

[0032] Figure 5 A schematic diagram of the architecture of a method for updating custom fields in a human resources outsourcing system provided in an embodiment of the present application.

[0033] Figure 6 A structural block diagram of a device for updating custom fields in a human resources outsourcing system provided in an embodiment of the present application.

[0034] Figure 7 A schematic diagram of the hardware structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0035] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is merely to provide a better understanding of the present application by illustrating the examples of the present application.

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

[0037] It should be understood that the term "and / or" as used herein is merely a description of the relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A exists alone, A and B exist simultaneously, or B exists alone. Furthermore, the character " / " in this document generally indicates that the associated objects are in an "or" relationship.

[0038] It will be apparent to those skilled in the art that various modifications and variations can be made in this application without departing from the spirit or scope of this application. Therefore, this application is intended to cover modifications and variations of this application that fall within the scope of the corresponding claims (technical solutions claimed for protection) and their equivalents. It should be noted that the embodiments provided in the examples of this application can be combined with each other without contradiction.

[0039] Before describing the technical solutions provided by the embodiments of the present application, in order to facilitate understanding of the embodiments of the present application, the present application first specifically describes the problems existing in the related art:

[0040] In the field of human resource management, the Human Resources Outsourcing System (HRO) plays a vital role. It is responsible for the comprehensive maintenance of employee information, social security information, salary information, etc., and generates corresponding reports at preset intervals, while providing pages for users to query information.

[0041] Usually, the HRO system will configure some basic fields by default. In addition, in order to meet the needs of different customers, it will also support customers to configure custom fields. Taking a common scenario as an example, the system maintains the basic fields of employees' [Cost Center] and [Salary]. Some customers expect to add a custom field of [Cost] in the reports and lists generated by the system. The calculation rules of the [Cost] field will vary depending on the [Cost Center]. For example, when the [Cost Center] is "A", [Cost] is equal to [Salary] multiplied by 1.5; when the [Cost Center] is "B", [Cost] is equal to [Salary] multiplied by 1.7. This custom field function can well meet the diverse customized field display needs of customers.

[0042] However, HRO systems present several unique challenges: The same system must simultaneously serve multiple client companies, each of which may have completely different field definitions, calculation rules, and data permissions. Furthermore, the same field may require different calculation rules in different time periods (e.g., the year-end bonus calculation formula may differ in December compared to other months). Consequently, maintaining and updating custom fields in HRO systems presents significant challenges.

[0043] Currently, the industry mainly uses the following two solutions for calculating and updating custom fields in HRO systems, but both have obvious pain points.

[0044] The first type of solution is to hard-code in the business code (source code). For example, the system has two basic fields, [Cost Center] and [Salary], by default. The customer wants to add a custom field [Cost] in the HRO system. Accordingly, the hard coding is as follows: if (cost center == "A place") {return cost = salary * 1.5}; else if (cost center == "B place") {return cost = salary * 1.7}. This type of solution has at least the following defects: 1) Every time a new business rule is added, the source code needs to be modified and redeployed, which is a large workload and has poor scalability. 2) Different customers require different custom fields. The different needs of many customers lead to a surge in code branches and high maintenance costs. 3) The development cycle generally takes several days, which is long. Updates to custom fields cannot take effect in a timely manner, and there is a problem of delayed response.

[0045] The second approach involves performing on-the-fly calculations on custom fields when a client opens a page or report. This means the HRO system doesn't actually save the custom field values; instead, it calculates them based on pre-set formulas when the client accesses them. This approach has at least the following drawbacks: When calculating custom field values ​​using multiple formulas, query and calculation time for these nested formulas increases exponentially. This nested calculation process consumes significant system resources and time, resulting in slow system response and a poor user experience. For example, a client might also require a custom field called "Budget," calculated as "Budget" equal to "Cost" multiplied by "Profit Margin." Both "Cost" and "Profit Margin" are also formula fields derived from formulas. This means that each time a page is opened, the system must first calculate "Cost" and "Profit Margin" using the existing basic fields, and then calculate "Budget" based on the values ​​of these two fields. This nested calculation process consumes significant system resources and time, slowing system response and creating a poor user experience. Furthermore, when calculations fail or errors occur, it becomes difficult to trace the problem.

[0046] In view of the above research findings of the inventors, the embodiments of the present application provide a method, apparatus, electronic device, computer-readable storage medium, and computer program product for updating custom fields in a human resources outsourcing system, aiming to address the obvious deficiencies in the current HRO system in processing the calculation and update of customer-defined fields, thereby improving the performance, scalability, and flexibility of the system and better meeting the diverse needs of customers.

[0047] The following first introduces the method for updating custom fields in the human resources outsourcing system provided in the embodiment of the present application.

[0048] Figure 1 A flow chart of a method for updating custom fields in a human resources outsourcing system provided in an embodiment of the present application. Figure 1 As shown, the method includes the following steps S101 to S104.

[0049] S101: Set a timestamp field in the employee information table, and update the timestamp field synchronously when any field in the employee information table is updated.

[0050] The employee information table is the core data table of the HRO system, storing key data such as basic employee information, position information, and salary information. For example, in some examples, the employee information table may include multiple basic fields such as employee ID, employee name, ID number, mobile phone number, cost center, department ID, basic salary, salary type, social security contribution base, and provident fund contribution base. It may also include some custom fields configured by the customer, such as cost and budget fields, which are not limited in this application. The employee information table can be designed using a relational database (such as a SQL Server database or a MYSQL database).

[0051] The core of S101 is to set a timestamp field (UpdateDate field) in the employee information table, and use the database mechanism to ensure that when any field in the employee information table is modified, the timestamp field is automatically updated to the current time, thereby providing a reliable change judgment basis for the subsequent change capture mechanism.

[0052] S102: Monitor changes in the employee information table through a database change capture mechanism, and write change records into a change table. The change table at least includes employee ID and timestamp fields.

[0053] The database change capture mechanism is a technology for identifying and tracking data changes in a database. It can capture data operations such as inserts, updates, and deletes. In S102, the database change capture mechanism can be used to monitor changes in fields in the employee information table and write change records into the change table. For example, in some examples, the database change capture mechanism can be used to monitor changes in any field in the employee information table. When any field changes, the changed field and its value are written into the change table. In other examples, the database change capture mechanism can also be used to monitor changes in the timestamp field (UpdateDate field) in the employee information table. When the timestamp field changes, the employee ID and timestamp field are written into the change table. In this way, by setting and monitoring the UpdateDate field, full table scans can be avoided, I / O operations and CPU processing can be reduced, and long full table scans that block write operations can be avoided, achieving change capture with delays of minutes or even seconds.

[0054] In some specific embodiments, the database may include a SQL Server database, and the database change capture mechanism may include a built-in Change Data Capture (CDC) tool in the SQL Server database. The CDC tool monitors changes in a timestamp field (UpdateDate field) in an employee information table, and when the timestamp field changes, writes the employee ID and the timestamp field to a change table (e.g., CDC.Employee table).

[0055] Compared with traditional polling or trigger methods, using the database's built-in change data capture (CDC) tool to monitor timestamp field changes can reduce data change latency in HRO system custom field update scenarios. The delay from data change to event triggering can be controlled to seconds, making it suitable for HR business scenarios that require processing high-frequency changes and have strict data consistency requirements.

[0056] In other specific embodiments, the database may include a MySQL database, and the database change capture mechanism may include a trigger. By adding a trigger to the employee information table, the trigger monitors changes in fields (such as a timestamp field) in the employee information table and writes a change record to a change table when a field changes. The change table may include at least the employee ID and timestamp fields.

[0057] S103: Scan the change table at predetermined time intervals through the first process, and when it is detected that the information in the change table has changed, send the change information in the change table asynchronously through the message queue.

[0058] The first process and the second process described below can be separate processes. The first process detects changes in the change table, while the second process calculates and updates custom fields. This allows the first process to focus on change identification and event distribution, requiring only scanning the change table and sending messages. The second process focuses on formula calculations and data updates. This allows detection to continue collecting change events even if the calculation process fails. Furthermore, bursty traffic can be buffered by the message queue, acting as a buffer pool to absorb traffic spikes.

[0059] In some embodiments, the predetermined time interval can be a fixed time interval. The length of the fixed time interval can be flexibly adjusted according to actual circumstances and is not limited in this application. For example, the fixed time interval can be 1 second, that is, the first process scans the change table every 1 second. When a change is detected in the change table, the change information in the change table is asynchronously sent via a message queue. The change information may include at least an employee ID and a timestamp field.

[0060] In other embodiments, the predetermined time interval may also be a non-fixed time interval that changes with the update frequency of the target field in the employee information table, i.e., a dynamic time interval. The target field may be any preset field, such as a timestamp field or a salary field, and this application is not limited thereto. The predetermined time interval may be negatively correlated with the update frequency of the target field. That is, the higher the target field update frequency within a period of time, the shorter the predetermined time interval. Conversely, the lower the target field update frequency within a period of time, the longer the predetermined time interval.

[0061] This way, when the HRO system is experiencing peak business hours (such as the month-end settlement period) and the frequency of employee information table updates increases, the dynamic interval automatically shortens the scanning cycle to ensure that changes are captured promptly; during business downturns, the interval is automatically extended to avoid unnecessary resource consumption. This adaptive feature ensures that HRO system resource utilization remains at a reasonable level. Furthermore, traditional fixed-interval solutions still perform regular scans even when no changes have occurred, resulting in wasted computing resources. Dynamic intervals, however, sense the actual frequency of changes and automatically reduce the number of scans during quiet periods, significantly reducing database I / O pressure and CPU usage.

[0062] S104: Monitor the message queue through the second process, and perform the following processing according to the employee ID in the message, that is, execute S1041 to S1043.

[0063] S1041: Load the custom fields and formula expressions configured for the customer to which the employee belongs from the database.

[0064] Each formula expression represents an operational relationship between at least one custom field and its associated fields, wherein the associated fields include basic fields configured by default in the system and / or other custom fields configured by the customer.

[0065] Specifically, the custom fields and their formula expressions configured by the customer to which the employee belongs can be queried and loaded from the database based on the employee ID. The number of custom fields and their formula expressions can be one or more, and can be flexibly configured according to customer needs. This application does not limit this. Each formula expression defines how a custom field is calculated through associated fields, where associated fields can include at least one of the following categories: basic fields configured by system default (such as salary, cost center, and other fields predefined by the system), and other custom fields (derivative fields configured by the same customer to form a dependency chain).

[0066] For example, a customer might configure [Cost] = [Salary] × [Cost Coefficient] and [Budget] = [Cost] × [Profit Margin]. Both [Cost] and [Budget] are custom fields. [Cost] depends on the base field [Salary] and the custom field [Cost Coefficient], while [Budget] depends on [Cost].

[0067] S1042: Traverse each formula expression and analyze the hierarchical dependency of all custom fields.

[0068] By parsing each formula expression, you can build a dependency graph of custom fields, clarify the calculation order between fields, and which related fields each custom field depends on for calculation.

[0069] For example, L1 (starting level): [Salary], [Cost Center]; L2 (middle level): [Cost Coefficient] (dependent on [Cost Center]), [Profit Margin]; L3 (middle level): [Cost] (dependent on [Salary] and [Cost Coefficient]); L4 (final level): [Budget] (dependent on [Cost] and [Profit Margin]). This step avoids circular dependencies (for example, A depends on B, and B depends on A), ensuring that the calculation logic is feasible.

[0070] S1043: Obtain the updated value of the associated field, and dynamically calculate the value of each custom field according to the hierarchical dependency and the updated value of the associated field, and update the calculation result and store it in the corresponding field of the database.

[0071] In some embodiments, the associated fields may all be located in the employee information table, i.e., the associated fields may be basic fields in the employee information table and / or other custom fields configured by the customer. In other embodiments, cross-table calculations may also be involved, where some associated fields may be located in the employee information table, while others may be located in an associated data table. The number of associated data tables may be one or more, and this application does not limit this. That is, the associated fields may be basic fields in the employee information table and / or associated data table and / or other custom fields configured by the customer.

[0072] In S1043, the updated values ​​of associated fields can be retrieved from one or more data tables, including the employee information table. Based on the hierarchical dependencies and the updated values ​​of the associated fields, the values ​​of each custom field can be dynamically calculated and stored in the corresponding fields in the database. When a client opens a page, report, or list, the updated custom field values ​​can be directly read and displayed.

[0073] The embodiment of the present application provides a method for updating custom fields in a human resources outsourcing system. On the one hand, it separates business rules from the code and stores custom fields and their formula expressions in the database. This eliminates the need to intrude into the business code, and business developers do not need to worry about field update logic. This eliminates the maintenance difficulties caused by "hard coding" and implements custom field updates through configuration rather than code modification, meeting the personalized needs of different customers. On the other hand, a pre-calculation mode is used to persist custom field results. When displaying a page, report, or list, it only needs to be read directly, without the need for on-the-spot calculation each time it is displayed. This allows the update of custom fields to be completed in a relatively short time, improving the responsiveness of the HRO system and the user experience.

[0074] In terms of details, by setting a timestamp field in the employee information table, any field update leaves a traceable time stamp, solving the technical problem of traditional solutions that make it difficult to accurately identify the timing of changes. Using a database change capture mechanism to monitor changes can reduce detection latency from minutes to seconds compared to scheduled full table scans, while also effectively reducing ineffective IO consumption. By decoupling change detection and calculation processes through asynchronous message queues, computing services can be scaled independently, while bursty traffic can be buffered by message queues. By storing custom fields and their formula expressions as structured metadata, a single HRO system can simultaneously manage the differentiated formula configurations of multiple customers, reducing the time it takes to bring new formulas online to minutes. By dynamically analyzing field dependencies and topologically sorting them at runtime, the calculation level of custom fields can be automatically identified, maintaining linear time complexity when processing multi-layer nested formulas. In other words, no matter how deep the formula nesting level is (such as 3 or more levels), the calculation time is only proportional to the number of fields actually changed, rather than the exponential growth of traditional solutions.

[0075] Figure 2 This is a flow chart of S1042 in the method for updating custom fields in the human resources outsourcing system provided in the embodiment of the present application. Figure 2 As shown, according to some embodiments of the present application, optionally, S1042: traversing each formula expression and analyzing the hierarchical dependencies of all custom fields may include the following steps S201 to S204.

[0076] S201: traverse each formula expression and convert all custom fields and their dependencies into a directed acyclic graph.

[0077] Figure 3 A directed acyclic graph is schematically shown. Figure 3 As shown, taking the example of updating the custom fields "Cost" and "Budget," a directed acyclic graph (DAG) can include nodes D1 and edges B1. Each custom field (such as cost coefficient, cost, and budget) can be represented as a node D1 in the DAG. Each edge B1 points from the dependent field to the target field based on the dependency relationship, indicating the calculation order. It should be noted that associated fields (such as salary and cost center) are leaf nodes and do not participate in the sorting process.

[0078] S202: Check whether there is a loop in the directed acyclic graph, and if so, throw an exception and report an error.

[0079] Checks whether there are loops in the directed acyclic graph, i.e., circular dependencies (e.g., A→B→C→A). If there are loops, an exception is thrown and an error is reported. Once all loops are correct, save the directed acyclic graph.

[0080] Then, the directed acyclic graph is converted into a hierarchical execution order through topological sorting, ensuring that low-level fields are calculated first and high-level fields are calculated later.

[0081] S203: Count the number of incoming edges of each node in the directed acyclic graph.

[0082] Count the number of incoming edges of each node in the directed acyclic graph, that is, the number of input edges (also known as the dependency number). Figure 3 For example, the number of input edges of [Cost Coefficient] is 1, the number of input edges of [Cost] is 2, and the number of input edges of [Budget] is 1.

[0083] S204: Based on the hierarchical traversal algorithm and the number of incoming edges of each node, a hierarchical calculation order of the custom field is generated.

[0084] Hierarchical traversal algorithms, such as the Kahn algorithm, are primarily used for topological sorting of directed acyclic graphs (DAGs). Their core goal is to determine the execution order of nodes, ensuring that all dependent items are processed before the target item. In the HRO system, this algorithm is used to resolve the dependencies of custom fields and ensure the correctness of formula calculations.

[0085] The hierarchical traversal algorithm works as follows: First, all nodes with zero incoming edges (no dependent fields) are queued as the first layer. Then, iterative processing is performed: nodes are removed from the queue and output as the current layer. All outgoing edges of the node are removed (i.e., the dependent fields have been calculated). The incoming edge count of the node with the removed edges is reduced by 1. If the incoming edge count returns to zero, the node is queued for the next layer. Termination condition: When the queue is empty, if all nodes have been processed, a valid topological sort is obtained; otherwise, a loop (circular dependency) exists.

[0086] by Figure 3 For example, based on the hierarchical traversal algorithm and the number of incoming edges of each node, the hierarchical calculation order and dependency relationship of generating custom fields are as follows:

[0087] L1 (starting level): [Salary], [Cost Center];

[0088] L2 (middle level): Cost coefficient (depends on cost center), Profit margin;

[0089] L3 (middle level): [Cost] (depends on [Wage] and [Cost Coefficient]);

[0090] L4 (final level): [Budget] (depends on [Cost] and [Profit Margin]).

[0091] Accordingly, S1043: dynamically calculating the value of each custom field according to the hierarchical dependency and the updated value of the associated field may include the following steps:

[0092] The value of each custom field is calculated step by step according to the hierarchical calculation order, the dependencies of the custom fields, and the updated values ​​of the related fields.

[0093] In a human resource outsourcing (HRO) system, cascading updates of custom fields may face the following challenges: dependent fields may be modified by other transactions during the calculation, and the final result may mix new and old data, resulting in logical contradictions.

[0094] In view of this, according to some embodiments of the present application, optionally, the method for updating a custom field in a human resources outsourcing system may further include the following steps:

[0095] The same version number is added to the updated value of the associated field and the value of the custom field that depends on the associated field for calculation. During the calculation process, the updated value of the associated field in the database is locked to prevent the value of the associated field from being updated again during the calculation process.

[0096] For example, when a base field (such as salary) is updated, the system assigns it an incremental version number (such as v11). All custom fields that depend on it (such as cost and budget) inherit this version number during calculation. Before calculating a custom field, the system checks that the version numbers of all associated fields match the latest value. If the versions do not match (for example, if salary is updated to v12 during calculation), the current calculation is aborted and a recalculation is triggered.

[0097] This ensures that calculations are based on field data from the same point in time, ensuring that the data displayed in the report fully matches the version at the same point in time, and avoiding confusion caused by concurrent updates (such as using old salary values ​​to calculate new costs). In addition, invalid calculations are immediately terminated when the version does not match, saving resources and reducing redundant calculations.

[0098] Additionally, before a calculation begins, you can lock the rows or columns containing related fields. For example, you can lock only the rows or columns involved in the calculation (e.g., employee A's record), rather than the entire table, to minimize blocking. Furthermore, during the lock, other transactions cannot modify the dependent fields, ensuring that values ​​used in the calculation are not overwritten, avoiding exceptions such as "field values ​​changing mid-calculation."

[0099] Figure 4 The front-end configuration page of the human resources outsourcing system is schematically shown. Figure 4 As shown, the customer can configure the custom fields and their formula expressions through the front-end configuration page of the HRO system. Specifically, in some embodiments, optionally, the method for updating the custom fields of the human resources outsourcing system can also include the following steps:

[0100] S41: Receive formula configuration information input by the customer through the front-end configuration page of the human resources outsourcing system.

[0101] The front-end configuration page is bound to the customer ID to ensure complete isolation of formula configurations for different customers. Specifically, after a user logs in, the front-end configuration page automatically associates their customer ID, displaying only the fields and formula expressions configured for the current customer. This prevents cross-configuration between customers and maintains a streamlined interface, ensuring, for example, that customer A cannot see customer B's salary formula.

[0102] S42: In response to the formula configuration information, configure the custom field and its formula expression.

[0103] Custom fields and their formula expressions can be configured based on the formula configuration information entered by the customer.

[0104] S43: When saving a formula expression, check for circular dependencies and syntax errors in the formula expression. If there are no errors, save the expression to the database. If there are errors, prompt an error message.

[0105] When saving a formula expression, check whether there is a circular dependency (such as A→B→C→A) in the formula expression, and check whether there is a syntax error in the formula expression. If there is no circular dependency and no syntax error, save it to the database. If there is a circular dependency and / or syntax error, an error prompt will be given, such as preventing the formula expression from being saved and highlighting the error path.

[0106] According to some embodiments of the present application, optionally, the method for updating a custom field in a human resources outsourcing system may further include the following steps S51 to S54.

[0107] S51: When calculating the value of the custom field fails, determining at which level the custom field is located.

[0108] Locate the computational level where the failed field is located based on the dependency graph (e.g., L1 starting level, L2 to Ln-1 intermediate levels, Ln final level). n represents the number of levels, which is a positive integer.

[0109] S52: If it is at the starting level, then the validity check is performed on the associated fields of the custom field, and recalculated when the check is correct. When the check is incorrect, the original value of the associated fields of the custom field is saved.

[0110] If the custom field is at the starting level, the associated base field is verified to be valid, such as whether the cost center value is the preset "Location A / Location B." If the verification is correct, the custom field value is recalculated. If an error is detected, the original value of the associated field (base field) is saved for easy backtracking.

[0111] S53: If it is at the intermediate level, all downstream calculations are suspended, and the status of the front custom field is verified. If the verification succeeds, the calculation is recalculated. If the verification fails, the original value and intermediate calculation results of the front custom field and its associated fields are saved.

[0112] If the custom field is at an intermediate level, all downstream fields that depend on it are marked as paused, while non-related fields continue to calculate normally. At the same time, the preceding custom field is checked for success and its value and version number are consistent. If verification succeeds (e.g., the preceding custom field is successfully calculated and the version number is consistent), the custom field's value is recalculated. If verification fails, an intermediate result snapshot is saved, namely, the original value and intermediate calculation results of the preceding custom field and its related fields. This prevents the spread of errors and ensures that only the affected fields are paused.

[0113] S54: If it is at the final level, the entire link is checked for consistency. If the check succeeds, the calculation is recalculated. If the check fails, the complete calculation context and intermediate calculation results are saved.

[0114] If the custom field is at the final level, all dependency paths are traced backwards from the final field, checking the success of each field calculation and the version consistency of each field level to accurately identify conflict points. If verification succeeds, the custom field value is recalculated. If verification fails, the complete calculation context and intermediate calculation results are saved. This ensures that the final result complies with business rules and supports root cause analysis of complex issues.

[0115] This application uses a hierarchical fault-tolerant processing mechanism to achieve accurate problem location and intelligent recovery when custom field calculation fails.

[0116] The following describes a method for updating custom fields in a human resources outsourcing system provided in an embodiment of the present application in conjunction with a specific application embodiment.

[0117] Figure 5 A schematic diagram of the architecture of the method for updating custom fields in the human resources outsourcing system provided in the embodiment of the present application. Figure 5 As shown, in this application, we mainly rely on database technology to monitor changes in the specified table, and then use a scheduled job to read the table change data, recalculate the custom fields, and update the values.

[0118] The employee information table (Employee table) is the core data table of the HRO system, which stores key data such as employee basic information, position information, salary information, etc. In some examples, the employee information table may include some common basic fields, and may also include some custom fields configured by the customer, which is not limited in this application. UpdateDate field update: The UpdateDate field is the timestamp field on the Emploee table. When any field in the employee information table is updated, the timestamp field is updated synchronously. In some examples, the CDC tool built into the database is used to monitor changes in the timestamp field (UpdateDate field) in the employee information table. When the timestamp field changes, the employee ID and timestamp field are written to the CDC.Employee table. The CDC.Employee table may only have simple employee ID fields and timestamp fields.

[0119] In some embodiments, in the HRO system architecture, two core background services, emp-service and hro.web, are set up. The two services respectively assume different responsibilities and jointly support the dynamic formula field calculation function of the system.

[0120] The first backend service (emp-service) is primarily responsible for capturing and distributing change data, as well as calculating and updating custom fields. Specifically, the first backend service (emp-service) can be configured with a first process and a second process. The first process (XXL-JOb) scans the CDC.Employee table at predetermined intervals. Upon detecting a change in information in the CDC.Employee table, it generates a RabbitMQ asynchronous message and asynchronously sends the change information in the CDC.Employee table via the message queue.

[0121] The second process monitors the RabbitMQ asynchronous messages in the message queue and performs calculation and update of custom fields. The specific process has been described in detail above and will not be repeated here.

[0122] The second backend service (hro.web) can be linked to the frontend configuration page, primarily providing a frontend configuration page for customers to define custom fields and their formula expressions, such as [Cost] = [Salary] × [Cost Factor]. Furthermore, the second backend service (hro.web) can be used to store formula expressions, dependencies, and hierarchy information in a database.

[0123] Based on the same technical concept as that provided by the above method embodiment, the present application also provides a device for updating custom fields in a human resources outsourcing system. Figure 6 A structural diagram of a device for updating custom fields in a human resources outsourcing system provided in an embodiment of the present application. Figure 6 As shown, the apparatus 60 for updating custom fields in a human resources outsourcing system provided in an embodiment of the present application may include the following modules:

[0124] Setting module 601, used to set a timestamp field in the employee information table, and to synchronously update the timestamp field when any field in the employee information table is updated;

[0125] A monitoring module 602 is configured to monitor changes in the employee information table through a database change capture mechanism and write change records into a change table, which contains at least employee ID and timestamp fields;

[0126] The asynchronous sending module 603 is configured to scan the change table at predetermined time intervals through the first process, and when a change is detected in the change table, asynchronously send the change information in the change table through the message queue;

[0127] The update module 604 is configured to monitor the message queue through the second process and perform the following processing according to the employee ID in the message:

[0128] Loading from the database the custom fields and formula expressions configured for the customer to which the employee belongs, where each formula expression represents an operational relationship between at least one custom field and its associated fields, where the associated fields include system default basic fields and / or other custom fields configured by the customer;

[0129] Traverse each formula expression and analyze the hierarchical dependencies of all custom fields;

[0130] Get the updated value of the associated field, dynamically calculate the value of each custom field according to the hierarchical dependency and the updated value of the associated field, and update the calculation results and store them in the corresponding fields of the database.

[0131] The embodiments of the present application provide a device for updating custom fields in a human resources outsourcing system. On the one hand, this device separates business rules from the code and stores custom fields and their formula expressions in a database. This eliminates the need to intrude into the business code, and business developers do not need to worry about field update logic. This eliminates the maintenance difficulties caused by "hard coding" and implements custom field updates through configuration rather than code modification, meeting the personalized needs of different customers. On the other hand, a pre-calculation mode is used to persistently store custom field results. When displaying a page, report, or list, it only needs to be read directly, eliminating the need for on-the-spot calculations each time it is displayed. This allows the update of custom fields to be completed in a relatively short time, improving the responsiveness of the HRO system and the user experience.

[0132] In terms of details, by setting a timestamp field in the employee information table, any field update leaves a traceable time stamp, solving the technical problem of traditional solutions that make it difficult to accurately identify the timing of changes. Using a database change capture mechanism to monitor changes can reduce detection latency from minutes to seconds compared to scheduled full table scans, while also effectively reducing ineffective IO consumption. By decoupling change detection and calculation processes through asynchronous message queues, computing services can be scaled independently, while bursty traffic can be buffered by message queues. By storing custom fields and their formula expressions as structured metadata, a single HRO system can simultaneously manage the differentiated formula configurations of multiple customers, reducing the time it takes to bring new formulas online to minutes. By dynamically analyzing field dependencies and topologically sorting them at runtime, the calculation level of custom fields can be automatically identified, maintaining linear time complexity when processing multi-layer nested formulas. In other words, no matter how deep the formula nesting level is (such as 3 or more levels), the calculation time is only proportional to the number of fields actually changed, rather than the exponential growth of traditional solutions.

[0133] According to some embodiments of the present application, optionally, the update module 604 can be specifically used to: traverse each formula expression, convert all custom fields and their dependencies into a directed acyclic graph, wherein the directed acyclic graph includes nodes and edges, each custom field serves as a node of the directed acyclic graph, and each edge points from the dependent field to the target field based on the dependency relationship; check whether there is a loop in the directed acyclic graph, and if so, throw an exception and report an error; count the number of incoming edges of each node in the directed acyclic graph; based on the hierarchical traversal algorithm and the number of incoming edges of each node, generate a hierarchical calculation order for the custom fields; dynamically calculate the value of each custom field according to the hierarchical dependencies and the updated values ​​of the associated fields, including: gradually calculating the value of each custom field according to the hierarchical calculation order, the dependencies of the custom fields and the updated values ​​of the associated fields.

[0134] According to some embodiments of the present application, optionally, the database includes a SQL Server database, and the database change capture mechanism includes a change data capture tool built into the SQL Server database; or, the database includes a MY SQL database, and the database change capture mechanism includes a trigger.

[0135] According to some embodiments of the present application, optionally, the device 60 for updating custom fields in the human resources outsourcing system may also include a locking module for adding the same version number to the updated value of the associated field and the value of the custom field calculated based on the associated field, and locking the updated value of the associated field in the database during the calculation process to avoid the value of the associated field being updated again during the calculation process.

[0136] According to some embodiments of the present application, optionally, the device 60 for updating custom fields in the human resources outsourcing system may also include a formula configuration module for receiving formula configuration information input by the customer through the front-end configuration page of the human resources outsourcing system, wherein the front-end configuration page is bound to the customer ID to ensure that the formula configurations of different customers are completely isolated; in response to the formula configuration information, the custom fields and their formula expressions are configured; when saving the formula expressions, the circular dependencies and syntax errors in the formula expressions are checked, and if there are no errors, they are saved to the database, and if there are errors, an error prompt is given.

[0137] According to some embodiments of the present application, optionally, the device 60 for updating custom fields in the human resources outsourcing system may also include a failure check module, which is used to determine at which level the custom field is when the calculation of the value of the custom field fails; if it is at the starting level, the validity of the associated fields of the custom field is checked, and the calculation is recalculated when the check is correct, and the original value of the associated field of the custom field is saved when the check is wrong; if it is at the intermediate level, all downstream calculations are paused, and the status of the preceding custom field is verified, and the calculation is recalculated when the verification is successful, and the original value and intermediate calculation result of the preceding custom field and its associated fields are saved when the verification fails; if it is at the final level, the consistency check is performed on the entire link, and the calculation is recalculated when the verification is successful, and the complete calculation context and intermediate calculation results are saved when the verification fails.

[0138] According to some embodiments of the present application, optionally, the predetermined time interval is a fixed time interval, or the predetermined time interval is a non-fixed time interval that changes with the update frequency of the target field in the employee information table.

[0139] Figure 6 Each module / unit in the device shown has the function of implementing each step in the method for updating custom fields in the human resources outsourcing system provided by the above method embodiment and can achieve its corresponding technical effects. For the sake of brevity, they will not be repeated here.

[0140] The electronic device in the embodiment of the present application can be a user terminal device, a server, other computing devices, or a cloud server. Figure 7 This is a hardware structure diagram of an electronic device according to an embodiment of the present application. The electronic device may include a processor 701 and a memory 702 storing computer program instructions. When the processor 701 executes the computer program instructions, it implements the process or function of the method for updating custom fields in the human resources outsourcing system according to any of the above embodiments.

[0141] Specifically, the processor 701 may include a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application. The memory 702 may include a large-capacity memory for data or instructions. For example, the memory 702 may be at least one of the following: a hard disk drive (HDD), a read-only memory (ROM), a random access memory (RAM), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, a universal serial bus (USB) drive, or other physical / tangible memory storage device. For another example, the memory 702 may include a removable or non-removable (or fixed) medium. For another example, the memory 702 may be inside or outside the integrated gateway disaster recovery device. The memory 702 may be a non-volatile solid-state memory. In other words, the memory 702 typically includes a tangible (non-transitory) computer-readable storage medium (such as a memory device) encoded with computer-executable instructions, and when the software is executed (such as by one or more processors), the operations described in the method of the embodiments of the present application may be performed. The processor 701 implements the process or function of any of the methods for updating custom fields in the human resources outsourcing system in the above embodiments by reading and executing the computer program instructions stored in the memory 702 .

[0142] In one example, Figure 7 The electronic device shown may also include a communication interface 703 and a bus 710. The processor 701, memory 702, and communication interface 703 are connected via the bus 710 and communicate with each other. The communication interface 703 is primarily used to implement communication between the various modules, devices, units, and / or equipment in the embodiments of the present application. The bus 710 includes hardware, software, or both, and can couple the components of the online data traffic metering device to each other. For example, the bus may include at least one of the following: an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industrial Standard Architecture (EISA) bus, a Front Side Bus (FSB), a HyperTransport (HT) interconnect, an Industrial Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Area Bus (VLB) bus, or other suitable buses. The bus 710 may include one or more buses. Although the embodiments of the present application describe or illustrate a specific bus, the embodiments of the present application may consider any suitable bus or interconnection method.

[0143] In combination with the method in the above embodiments, an embodiment of the present application also provides a computer-readable storage medium, which stores computer program instructions. When the computer program instructions are executed by a processor, they implement the process or function of the method for updating custom fields in a human resources outsourcing system in any of the above embodiments.

[0144] In addition, an embodiment of the present application further provides a computer program product having computer program instructions stored thereon. When the computer program instructions are executed by a processor, the process or function of the method for updating custom fields in a human resources outsourcing system in any of the above embodiments is implemented.

[0145] The flowcharts and / or block diagrams of the methods, devices, systems and computer program products of the embodiments of the present application are described above by way of example, and various aspects thereof are described. It should be understood that each box in the flowchart and / or block diagram or a combination thereof may be implemented by computer program instructions, or may be implemented by dedicated hardware that performs a specified function or action, or may be implemented by a combination of dedicated hardware and computer instructions. For example, these computer program instructions may be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to form a machine that enables these instructions executed by such a processor to enable the implementation of the functions / actions specified in each box in the flowchart and / or block diagram or a combination thereof. Such a processor may be a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit.

[0146] The functional blocks shown in the block diagram of the embodiment of the present application can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application-specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc.; when implemented in software, it is a program or code segment used to perform the required task. The program or code segment can be stored in a memory or transmitted on a transmission medium or a communication link via a data signal carried in a carrier. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.

[0147] It should be noted that the present application is not limited to the specific configurations and processes described above or shown in the figures. The above is only a specific implementation method of the present application. Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working process of the described system, device, module or unit can refer to the corresponding process in the method embodiment without further description. It should be understood that the scope of protection of the present application is not limited to this. Any technician familiar with the technical field can think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the scope of protection of the present application.

Claims

1. A method for updating custom fields in a human resources outsourcing system, characterized in that: include: Set a timestamp field in the employee information table, and update the timestamp field synchronously when any field in the employee information table is updated; Monitor changes in the employee information table through a database change capture mechanism and write change records into a change table, wherein the change table contains at least employee ID and timestamp fields; Scanning the change table at predetermined time intervals by a first process, and when detecting that information in the change table has changed, asynchronously sending the change information in the change table through a message queue; The second process monitors the message queue and performs the following processing according to the employee ID in the message: Loading from the database the custom fields and formula expressions configured for the customer to which the employee belongs, where each formula expression represents an operational relationship between at least one custom field and its associated fields, where the associated fields include system default basic fields and / or other custom fields configured by the customer; Traverse each formula expression and analyze the hierarchical dependencies of all custom fields; Get the updated value of the associated field, dynamically calculate the value of each custom field according to the hierarchical dependency and the updated value of the associated field, and update the calculation results and store them in the corresponding fields of the database.

2. The method according to claim 1, characterized in that Traverse each formula expression and analyze the hierarchical dependencies of all custom fields, including: Traverse each formula expression and convert all custom fields and their dependencies into a directed acyclic graph. A directed acyclic graph consists of nodes and edges. Each custom field is a node in the directed acyclic graph, and each edge points from the dependent field to the target field based on the dependency relationship. Check whether there is a loop in the directed acyclic graph. If so, throw an exception and report an error. Count the number of incoming edges of each node in the directed acyclic graph; Generate the hierarchical calculation order of custom fields based on the hierarchical traversal algorithm and the number of incoming edges of each node; Dynamically calculate the values ​​of each custom field based on hierarchical dependencies and updated values ​​of associated fields, including: The value of each custom field is calculated step by step according to the hierarchical calculation order, the dependencies of the custom fields, and the updated values ​​of the related fields.

3. The method according to claim 1, characterized in that The database includes a SQL Server database, and the database change capture mechanism includes a change data capture tool built into the SQL Server database; Alternatively, the database includes a MY SQL database, and the database change capture mechanism includes a trigger.

4. The method according to claim 1, wherein The method further comprises: The same version number is added to the updated value of the associated field and the value of the custom field that depends on the associated field for calculation. During the calculation process, the updated value of the associated field in the database is locked to prevent the value of the associated field from being updated again during the calculation process.

5. The method according to claim 1, wherein The method further comprises: Receive formula configuration information entered by customers through the front-end configuration page of the human resources outsourcing system. The front-end configuration page is bound to the customer ID to ensure that formula configurations of different customers are completely isolated; In response to the formula configuration information, configure the custom field and its formula expression; When saving a formula expression, check for circular dependencies and syntax errors in the formula expression. If there are no errors, save it to the database. If there are errors, an error message will be displayed.

6. The method according to claim 1, characterized in that The method further comprises: When calculating the value of a custom field fails, determine which level the custom field is at; If it is at the starting level, the validity of the associated fields of the custom field will be checked. If the check is correct, the calculation will be recalculated. If the check is incorrect, the original value of the associated fields of the custom field will be saved. If it is at the intermediate level, all downstream calculations are suspended and the status of the front-end custom fields is verified. If the verification succeeds, the calculation is recalculated. If the verification fails, the original values ​​and intermediate calculation results of the front-end custom fields and their associated fields are saved. If it is at the final level, the entire link is checked for consistency. If the check succeeds, the calculation is recalculated. If the check fails, the complete calculation context and intermediate calculation results are saved.

7. The method according to claim 1, characterized in that The predetermined time interval is a fixed time interval, or the predetermined time interval is a non-fixed time interval that changes with the update frequency of the target field in the employee information table.

8. A device for updating custom fields in a human resources outsourcing system, characterized in that: include: The setting module is used to set the timestamp field in the employee information table. When any field in the employee information table is updated, the timestamp field is updated synchronously. A monitoring module, configured to monitor changes in the employee information table through a database change capture mechanism and write change records into a change table, wherein the change table includes at least employee ID and timestamp fields; an asynchronous sending module, configured to scan the change table at predetermined time intervals through a first process, and when a change is detected in the information in the change table, asynchronously send the change information in the change table through a message queue; The update module is configured to monitor the messages in the message queue through a second process and perform the following processing according to the employee ID in the message: Loading from the database the custom fields and formula expressions configured for the customer to which the employee belongs, where each formula expression represents an operational relationship between at least one custom field and its associated fields, where the associated fields include system default basic fields and / or other custom fields configured by the customer; Traverse each formula expression and analyze the hierarchical dependencies of all custom fields; Get the updated value of the associated field, dynamically calculate the value of each custom field according to the hierarchical dependency and the updated value of the associated field, and update the calculation results and store them in the corresponding fields of the database.

9. An electronic device, characterized in that: The electronic device comprises: a processor and a memory storing computer program instructions; and when the electronic device executes the computer program instructions, the method according to any one of claims 1 to 7 is implemented.

10. A computer program product, characterized in that The method comprises computer program instructions, which implement the method according to any one of claims 1 to 7 when executed by a processor.