CN-121998599-A - Salary processing method and device, electronic equipment and storage medium
Abstract
The application provides a salary processing method, a device, electronic equipment and a storage medium, which comprise the steps of obtaining salary data sources of staff in a target salary period; the method comprises the steps of obtaining a current latest version of salary calculation snapshot from a configuration unit, compiling and checking DSL salary calculation formulas in the salary calculation snapshot, calculating salary data of each employee in parallel by using a code operation unit based on DSL salary calculation formulas, tax tables, social security and public accumulation base parameters and salary data sources if the compiling and checking are successful, and carrying out unified rounding processing on the salary data of each employee based on accuracy strategies of each currency to generate final salary amount. The application improves the efficiency and accuracy of salary processing.
Inventors
- JI WEIGUO
- You chaoyang
- SUN JIANG
Assignees
- 北森云计算有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20260409
Claims (10)
- 1. The salary processing method is characterized by being applied to a salary calculation engine, wherein the salary calculation engine comprises a configuration unit and a code running unit, the configuration unit is used for configuring salary calculation rule parameters, generating salary calculation snapshots based on the configured salary calculation rule parameters and carrying out versioning management on the salary calculation snapshots, and the code running unit is used for loading the salary calculation snapshots and executing salary calculation, and the method comprises the following steps: Obtaining salary data sources of staff in a target salary period; Obtaining a current latest version compensation calculation snapshot supporting version tracing from the configuration unit, wherein at least a plurality of DSL payroll calculation formulas, tax tables, social security and public accumulation gold number parameters and precision strategies of each currency are packaged in the compensation calculation snapshot; Compiling and checking a DSL payroll formula in the payroll calculation snapshot; if the compiling and the checking fail, terminating the calculation flow, and returning feedback information containing error details to the configuration unit; if compiling and checking are successful, parallelly calculating payroll data of each employee by using the code running unit based on the DSL payroll calculation formula, the tax table, the social security and public accumulation fund base parameter and the payroll data source; And carrying out unified rounding processing on payroll data of each employee based on the precision strategies of each currency, and generating final payroll amount.
- 2. The method of claim 1, wherein compiling and verifying DSL payroll formulas in the payroll snapshot comprises: Analyzing each DSL payroll formula to generate a corresponding abstract syntax tree; deducing the types of all nodes of the abstract syntax tree to obtain the types of all nodes, and carrying out type verification based on a preset type rule; Responding to the success of the type verification, extracting the variable names of other formulas referenced in the DSL payroll formulas, and constructing a dependency relationship directed graph taking each DSL payroll formula as a node; performing depth-first search on the dependency graph, and detecting whether a cyclic dependency ring exists; In response to a type verification failure or detection of the loop, marking a DSL payroll formula currently being compiled as a compilation failure, and generating positioning information comprising a formula name, a rank number, a context code segment, and an error type.
- 3. The method of claim 1, wherein said calculating payroll data for each employee in parallel using said code running unit based on said DSL payroll formula, tax table, social security and public accumulation fund base parameters and said payroll data source comprises: distributing salary data sources of all staff to a plurality of parallel computing threads according to staff identification; In each parallel computing thread, generating a unique idempotent key for each employee computing task, wherein the idempotent key consists of a payoff batch identifier, an employee identifier and a payoff computing snapshot; Before performing the calculation, determining whether the idempotent key already exists; Marking task states of corresponding staff members in processing in response to the absence of the idempotent key, and performing payroll calculation based on the DSL payroll formula, tax table, social security and public accumulation fund base parameters and the payroll data source; responding to the fact that the idempotent key exists and the state is successful, and directly returning to a stored calculation result; And re-executing the calculation in response to the idempotent key already existing but in the processing state and exceeding a preset timeout threshold.
- 4. The method of claim 1, wherein the uniformly rounding payroll data for each employee based on the accuracy policy for each currency, the generating a final payroll amount comprising: After all staff calculates, performing one-time rounding processing on payroll data of each staff according to a precision strategy and a rounding mode corresponding to a target currency, wherein the payroll data comprises an issue, a deduction and an actual issue amount; performing global tail difference verification on salary data of each rounded employee, wherein the global tail difference verification is to verify deviation between the rounded total sum and the total sum before rounding; If the deviation of the global tail error verification exceeds a preset deviation value, blocking the payroll process and generating a financial review alarm.
- 5. The method according to claim 1, wherein the method further comprises: aggregating the salary data rounded by each employee by taking the employee mark as a key to generate a summary vector containing the total amount, the individual tax, the social security deduction, the public accumulation fund deduction and the real net amount; assembling the summarized vectors of all staff members into a wage bill object in a unified format; Performing deterministic serialization on the payroll objects to generate JSON character strings, wherein the deterministic serialization comprises the steps of sequencing all field names according to dictionary sequences, removing irrelevant blank characters, and uniformly representing numerical values as decimal character strings without thousandth symbols; Invoking a key management service to acquire a key bound with the current payroll period; Calculating a digital signature based on the JSON string and the acquired key; The digital signature, the key used, and the payroll object are packaged as a digitally signed payroll.
- 6. The method of claim 5, wherein the method further comprises: Constructing a money making request based on wage bills of each employee; sending the money-making request to an API interface of a target bank by calling a release adapter corresponding to the target bank; Receiving a payment receipt returned by an API (application program interface) of the target bank; And executing account checking operation based on the total actual sending amount in the payroll bill and the account checking total amount in the check-out return license.
- 7. The method of claim 6, wherein the method further comprises: Serializing salary data sources of staff in the target salary period into read-only input files, and calculating hash values of the input files; after the wage issuing and the checking are completed, packaging the hash value, the salary calculation snapshot, the abstract of the wage bill, the check receipt and the checking result of the input file into an audit record; And writing the audit record into an audit bin, and generating a hash chain based on the hash value of the preamble audit record to form an audit snapshot for subsequent playback verification.
- 8. The utility model provides a salary processing apparatus, characterized in that is applied to salary calculation engine, the salary calculation engine includes configuration unit and code running unit, the configuration unit is used for configuring salary calculation rule parameter, and based on the configured salary calculation rule parameter generates salary calculation snapshot, and carries out versioning management to the salary calculation snapshot, the code running unit is used for loading the salary calculation snapshot, and carries out salary calculation, the apparatus includes: The first acquisition unit is used for acquiring salary data sources of staff in the target salary period; The second obtaining unit is used for obtaining a current latest version compensation calculation snapshot supporting version tracing from the configuration unit, wherein the compensation calculation snapshot is at least packaged with a plurality of DSL payroll calculation formulas, tax tables, social security and public accumulation fund base parameters and precision strategies of each currency; the compiling unit is used for compiling and checking the DSL payroll formula in the payroll calculation snapshot, terminating the calculation flow if the compiling and checking fail, and returning feedback information containing error details to the configuration unit; The computing unit is used for parallelly computing payroll data of each employee by utilizing the code running unit based on the DSL payroll calculation formula, the tax table, the social security and public accumulation fund base parameter and the payroll data source if compiling and checking are successful; and the rounding processing unit is used for carrying out unified rounding processing on payroll data of each employee based on the precision strategies of each currency, and generating final payroll amount.
- 9. An electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are in communication with each other through the communication bus; The memory is used for storing a computer program; the processor is configured to implement the method of any one of claims 1-7 when executing a program stored on the memory.
- 10. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein a computer program which, when executed by a processor, implements the method of any of claims 1-7.
Description
Salary processing method and device, electronic equipment and storage medium Technical Field The present invention relates to the field of data processing technologies, and in particular, to a salary processing method, apparatus, electronic device, and storage medium. Background In large enterprises, salary calculation usually involves highly complex business rules, and tax policies of different areas, social security accumulation payment standards, currency systems and diversified incentive structures (such as ladder tax rate, regional subsidy, performance prizes, equity redemption and the like) need to be adapted at the same time. Conventional salary systems often employ hard-coded logic or simple expression engine-based accounting mechanisms that are difficult to support effectively such dynamic and heterogeneous salary scenarios. On the one hand, every time tax rate adjustment, social security base update or new payroll project are carried out, developers are required to intervene in modifying source codes, executing full regression test and arranging system shutdown release, so that the response period is long, the operation and maintenance cost is high, and the risk of inconsistent configuration is easily caused by version management omission. On the other hand, the batch calculation task of tens of thousands or hundreds of thousands of staff is faced, the salary calculation efficiency is low, the calculation process is easy to be interfered by intermediate states, the result deviation occurs, and the accuracy is low. Disclosure of Invention Accordingly, the present invention is directed to a method, an apparatus, an electronic device and a storage medium for processing payroll, so as to improve the efficiency and accuracy of payroll processing. In a first aspect, a salary processing method is provided, applied to a salary calculation engine, the salary calculation engine including a configuration unit and a code running unit, the configuration unit being configured to configure salary calculation rule parameters independently of codes and generate salary calculation snapshots based on the configured salary calculation rule parameters to implement decoupling of the salary calculation rule parameters and the salary calculation codes, the code running unit being configured to load the salary calculation snapshots and perform salary calculation, the method comprising: Obtaining salary data sources of staff in a target salary period; obtaining a current latest version of pay calculation snapshot from the configuration unit, wherein the pay calculation snapshot is at least packaged with a plurality of DSL payroll formulas, tax tables, social security and accumulation fund base parameters and precision strategies of each currency; compiling and checking a DSL payroll formula in the payroll calculation snapshot; if the compiling and the checking are successful, calculating payroll data of each employee in parallel by utilizing a code operation unit based on a DSL payroll calculation formula, a tax table, social security and public accumulation fund base parameters and payroll data sources; and carrying out unified rounding processing on payroll data of each employee based on the precision policy of each currency, and generating final payroll amount. Optionally, compiling and verifying the DSL payroll formula in the payroll snapshot comprises: analyzing each DSL payroll formula to generate a corresponding abstract syntax tree; deducing the types of all nodes of the abstract syntax tree to obtain the types of all nodes, and carrying out type verification based on a preset type rule; Responding to the success of the type verification, extracting the variable names of other formulas referenced in the DSL payroll formulas, and constructing a dependency relationship directed graph taking each DSL payroll formula as a node; Performing depth-first search on the dependency graph, and detecting whether a circular dependency loop exists or not; in response to a type verification failure or detection of a loop of cyclic dependencies, marking a DSL payroll formula currently being compiled as a compilation failure, and generating positioning information comprising a formula name, a rank number, a context code segment, and an error type. Optionally, based on the DSL payroll formula, the tax table, the social security and public accumulation fund base parameter, and the payroll data source, the calculating payroll data of each employee in parallel by using the code running unit includes: distributing salary data sources of all staff to a plurality of parallel computing threads according to staff identification; In each parallel computing thread, generating a unique idempotent key for each employee computing task, wherein the idempotent key consists of a payoff batch identifier, an employee identifier and a payoff computing snapshot; before performing the calculation, judging whether an idempotent key exists or not; Marking