Response method and device for high-concurrency travel budget request and electronic equipment
By constructing a dynamic fare calculation engine and optimizing room sharing using a graph model, and combining it with the Kahan accumulation algorithm, the system addresses the issues of insufficient multi-dimensional calculation and manual intervention in corporate travel expense systems, achieving efficient and accurate automated processing of travel expenses.
Patent Information
- Application Number
- CN202511119219.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-11
- Publication Date
- 2025-11-14
AI Technical Summary
Existing corporate travel expense systems lack multi-dimensional calculation capabilities and cannot take into account gender grouping, job level differences, and room sharing rules, resulting in calculation results that are out of touch with actual needs. Manual intervention processes are cumbersome and inefficient, and the lack of flexibility in rule adaptation can easily lead to errors and budget waste.
A dynamic expense calculation engine was built, which adopted a graph model to optimize room sharing matching and modular rule design. Through the graph model of same-sex employees, the maximum weight matching algorithm and the Kahan accumulation algorithm, the calculation of travel expenses was automated and accurate.
It has achieved automation, accuracy, and compliance in travel expense calculation, reducing the error rate to zero and shortening the calculation time from more than 30 minutes in the traditional manual method to seconds, eliminating over-reimbursement and budget waste, and supporting flexible rule adaptation and policy adjustment.
Smart Images

Figure CN120952705A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of corporate travel expense management, and more specifically, to a method, apparatus, and electronic device for responding to high-concurrency travel budget requests. Background Technology
[0002] In corporate business trips involving multiple employees, travel expenses are often reimbursed through a unified invoicing and centralized reimbursement system. Existing reimbursement systems require dynamic calculation of the total accommodation cost based on factors such as employee rank, role, and city type, but this approach faces numerous technical bottlenecks in practical applications.
[0003] The main problems with existing technologies are as follows: First, insufficient multi-dimensional calculation capabilities. The system only supports calculating the total amount based on a single standard (such as the highest or lowest standard), and cannot simultaneously take into account multiple factors such as gender grouping, job level differences, and room sharing rules, resulting in a disconnect between the calculated results and actual travel needs. Second, cumbersome and inefficient manual intervention processes. When processing expenses for multiple business trips, manual operations such as gender grouping, standard sorting, and room number counting are required, which not only consumes a lot of time but is also prone to errors due to human operation. Third, a lack of flexibility in rule adaptation. The system cannot automatically process complex business rules such as same-sex room sharing and separate reimbursement for special job levels, leading to over-reimbursement or budget waste. Summary of the Invention
[0004] The purpose of this application is to provide a response method, device, and electronic device for high-concurrency travel budget requests, which solves the above-mentioned problems existing in the prior art. By constructing a dynamic fare calculation engine, optimizing room sharing matching with graph models, and modular design of rules, the calculation of travel expenses is automated, accurate, and compliant.
[0005] Firstly, a response method for high-concurrency travel budget requests is provided, which may include: A travel processing request that retrieves attribute information of multiple business travelers; the attribute information includes employee ID, job level information, gender information, historical business travel records, and department information; Based on the employee identifier, the historical business trip record, the job level information, the gender information, and the department information, construct a graph model of employees of the same gender; The total number of rooms is determined by the weight values of each edge in the same-sex employee graph model; the weight values are determined by a dynamic compatibility function. The differential values of each business trip employee extracted from the expense standard library are sorted in descending order to obtain the target sequence; Using the total number of rooms as the cutoff point, determine the corresponding number of differential values in the target sequence; The Kahan accumulation algorithm is used to calculate the total travel expenses by calculating the corresponding number of differential values.
[0006] In one possible implementation, a graph model of employees of the same gender is constructed based on the employee identifier, the historical business trip record, the job level information, the gender information, and the department information, including: Based on the gender information, the employee identifier, the historical business trip record, the job level information, and the department information are classified to obtain a male list and a female list; Use the employee identifiers in any list as nodes, and establish edges between the nodes; For job level information, historical room sharing records in historical business trip records, business trip frequency and department information, determine the weight value of each side; Based on the nodes, edges, and weight values corresponding to any type of list, construct a graph model of same-sex employees with an adjacency list structure and store it in system memory.
[0007] In one possible implementation, the dynamic compatibility function is:
[0008] Where W is the weight value, The score for the job grade difference factor. Score the historical room-sharing record factor. The score for the frequency of business trips matching factor. For the departmental relevance factor score, , , and These represent the percentages of the corresponding factors.
[0009] In one possible implementation, the expression for the job grade difference factor score is:
[0010] in, and These are the job level values for employee 1 and employee 2, respectively.
[0011] In one possible implementation, the total number of rooms is determined by the weight values of each edge in the same-sex employee graph model, including: For any graph model of employees of the same gender, extract the total number of nodes in the graph model of employees of the same gender. Based on the total number of nodes, the basic number of rooms is determined by rounding up. According to the maximum weight matching algorithm, the weight values of each edge in the same-gender employee graph model are processed to obtain the edge combination with the highest total weight; wherein, each node participates in the connection of at most one edge. Based on the aforementioned edge combinations, the number of room-sharing pairs is determined; If the sum of the number of room-sharing pairs and the number of nodes not participating in room-sharing is the same as the number of basic rooms, then the number of basic rooms is determined as the number of rooms corresponding to the same-gender employee graph model; The total number of rooms is determined by summing the number of rooms corresponding to each employee's gender in the diagram model.
[0012] In one possible implementation, determining the number of room-sharing pairs based on the edge combinations includes: Traverse the edge combinations selected by the maximum weight matching algorithm and identify the employee identifiers of the two nodes corresponding to each edge; The employee identifiers involved in edge connection are marked using a Boolean array; The edges that do not trigger the repeat mark are counted to obtain the edge count result, and the edge count result is determined as the number of room pairs.
[0013] In one possible implementation, the Kahan accumulation algorithm is used to calculate the total travel expenses by calculating the corresponding number of differential values, including: Configure and initialize the accumulated variable and the error compensation variable; Traverse the corresponding number of difference scale values in the target sequence, and determine the first temporary variable for the corresponding difference scale value and the error compensation variable; Based on the initial accumulated variable and the first temporary variable, the second temporary variable is determined; Based on the second temporary variable, the initial accumulated variable, and the first temporary variable, a new error compensation variable is determined; The second temporary variable is designated as the new initialization accumulation variable; After traversing through all the difference values in the target sequence, the target cumulative variable is obtained; Based on the target cumulative variable and the number of business trip days, the total travel expenses are determined.
[0014] Secondly, a response apparatus for high-concurrency travel budget requests is provided, the apparatus including: The acquisition unit is used to acquire travel processing requests that include attribute information of multiple business travelers; the attribute information includes employee identifier, job level information, gender information, historical business travel records, and department information; The construction unit constructs a graph model of employees of the same gender based on the employee identifier, the historical business trip record, the job level information, the gender information, and the department information. A determining unit is used to determine the total number of rooms by using the weight values of each edge in the same-gender employee graph model; the weight values are determined by a dynamic compatibility function. The sorting unit is used to sort the difference values of each business trip employee extracted from the expense standard library in descending order to obtain the target sequence; The determining unit is further configured to determine a corresponding number of differential values in the target sequence, using the total number of rooms as the cutoff point; The calculation unit is used to calculate the total travel expenses by employing the Kahan accumulation algorithm on the corresponding number of differential values.
[0015] Thirdly, an electronic device is provided, which includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; When a processor executes a program stored in memory, it implements any of the steps described in the first aspect above.
[0016] Fourthly, a computer-readable storage medium is provided, wherein a computer program is stored therein, and when executed by a processor, the computer program implements the steps of any of the methods described in the first aspect above.
[0017] This application provides a response method for high-concurrency travel budget requests. This method constructs a travel expense calculation scheme based on gender grouping, intelligent matching, and a dynamic rule engine. It eliminates human error through automated gender grouping, graph model maximum weight matching for room sharing, and the Kahan accumulation algorithm, reducing the error rate to zero. In terms of processing efficiency, synchronous data acquisition, fast sorting, and optimization algorithms shorten the time for calculating expenses for multiple people from over 30 minutes traditionally done manually to seconds (≤800ms). The formula engine automatically adapts to rules such as separate calculations for A / B categories and same-gender room sharing, preventing over-reimbursement and budget waste. The modular design allows for adding new rules without refactoring the core logic, flexibly adapting to policy adjustments. Simultaneously, full-process automation reduces user operations, and the configurable formula engine optimizes the experience, comprehensively improving the accuracy, efficiency, and compliance of corporate travel expense reimbursements. Attached Figure Description
[0018] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 A system architecture diagram for a response method to high-concurrency travel budget requests, provided in an embodiment of this application; Figure 2 A flowchart illustrating a response method for high-concurrency travel budget requests provided in an embodiment of this application; Figure 3 A schematic diagram of the system accommodation interface provided in an embodiment of this application; Figure 4 A schematic diagram of a response device for high-concurrency travel budget requests provided in an embodiment of this application; Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0020] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0021] The response method for high-concurrency travel budget requests provided in this application embodiment can be applied to... Figure 1 In the system architecture shown, such as Figure 1 As shown, the system may include: a server in the enterprise's backend and terminals for enterprise employees. The server can be a physical server, a server cluster composed of multiple physical servers, or a distributed system. It can also be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. The terminal may be a user equipment (UE) such as a mobile phone, smartphone, laptop, digital radio receiver, personal digital assistant (PDA), tablet computer (PAD), handheld device, in-vehicle device, wearable device, computing device, or other processing device connected to a wireless modem, mobile station (Mobile Station, MS), or mobile terminal. The terminal and server can be directly or indirectly connected via wired or wireless communication methods; this application does not limit the connection.
[0022] The terminal is used to obtain travel processing requests that include attribute information of multiple business travelers and send the travel processing requests to the server. A server is used to receive travel processing requests and execute a response method for high-concurrency travel budget requests provided in this application.
[0023] In corporate business trips involving multiple employees, travel expenses are often reimbursed through a unified invoicing and centralized reimbursement system. Existing reimbursement systems require dynamic calculation of the total accommodation cost based on factors such as employee rank, role, and city type, but this approach faces numerous technical bottlenecks in practical applications.
[0024] The main problems with existing technologies are as follows: First, insufficient multi-dimensional calculation capabilities. The system only supports calculating the total amount based on a single standard (such as the highest or lowest standard), and cannot simultaneously take into account multiple factors such as gender grouping, job level differences, and room sharing rules, resulting in a disconnect between the calculated results and actual travel needs. Second, cumbersome and inefficient manual intervention processes. When processing expenses for multiple business trips, manual operations such as gender grouping, standard sorting, and room number counting are required, which not only consumes a lot of time but is also prone to errors due to human operation. Third, a lack of flexibility in rule adaptation. The system cannot automatically process complex business rules such as same-sex room sharing and separate reimbursement for special job levels, leading to over-reimbursement or budget waste.
[0025] Therefore, this application provides a response method for high-concurrency travel budget requests to solve the above-mentioned problems in the prior art. By constructing a dynamic cost calculation engine, optimizing room sharing matching with graph models, and modularizing rule design, the method achieves automation, accuracy, and compliance in travel expense calculation.
[0026] The preferred embodiments of this application are described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit this application. Furthermore, the embodiments and features in the embodiments of this application can be combined with each other without conflict.
[0027] Figure 2 This is a flowchart illustrating a response method for high-concurrency travel budget requests, provided as an embodiment of this application. Figure 2 As shown, the method may include: Step S210: Obtain a travel processing request that includes attribute information of multiple business travelers; The attribute information includes employee ID, job level, gender, travel history, and department information. Specifically, after a travel processing request is triggered, the system automatically calls the personnel data interface to synchronously obtain the complete attribute information of the batch of business travelers from the personnel file module of the enterprise's internal database, ensuring the integrity and timeliness of the data.
[0028] Furthermore, to ensure data accuracy, the system employs a synchronous blocking data acquisition mechanism: after the user completes the personnel selection, the front-end interface temporarily freezes interactive operations, and the main thread is suspended until the database returns a complete dataset of personnel attributes, avoiding subsequent grouping or calculation errors due to missing data. After data acquisition is complete, the system stores the aforementioned attribute information in a memory buffer, providing structured data support for the entire subsequent process.
[0029] Step S220: Construct a graph model of same-sex employees based on employee identification, historical business trip records, job level information, gender information, and department information.
[0030] Specifically, step 1: According to gender information, classify employee identification, historical business trip records, job level information and department information to obtain a list of males and a list of females.
[0031] The system iterates through the acquired personnel dataset and divides the personnel into two categories based on gender information: Male List: Stores data for all male employees. Each record contains the following fields: {Employee ID, Job Rank, Department, Historical Roommate Sharing Records, Number of Business Trips per Year}. Female List: Stores data for all individuals whose gender is female; the fields are the same as those in the Male List.
[0032] After classification, the system automatically verifies whether the total number of personnel in the two lists matches the original total number of business travelers, ensuring that no personnel are omitted or classified repeatedly, thus providing an accurate data source for subsequent graph model construction.
[0033] Step 2: Take the employee identifiers from any list as nodes and establish edges between the nodes.
[0034] The employee ID (employee number) from either the male or female list is used as the unique node ID in the graph model, with each node corresponding to one employee on a business trip. Each node is associated with a complete set of attributes, including: job level information (value converted to numerical form, e.g., P5 corresponds to 5), department information, number of business trips per year, and historical room-sharing records (number of times room-sharing with other employees). These attribute information are directly used to calculate the weight values of subsequent edges.
[0035] Edges are established only between nodes within the same gender list; that is, nodes in the male list are only connected to male nodes, and nodes in the female list are only connected to female nodes. Edges between nodes of different genders are strictly excluded to ensure compliance with the business rules for same-gender room sharing. The edges are established to cover all node pairs within the same gender list (i.e., there is a potential connection between any two employees of the same gender), reserving a complete relation space for subsequent weight calculation and optimal matching.
[0036] Step 3: Determine the weight values for each side of the job level information, historical room sharing records in the historical business trip records, business trip frequency, and department information; the weight values are determined through a dynamic compatibility function.
[0037] The expression for the dynamic compatibility function is:
[0038] Where W is the weight value, The score for the job grade difference factor. Score the historical room-sharing record factor. The score for the frequency of business trips matching factor. For the departmental relevance factor score, , , and These represent the percentages of the corresponding factors.
[0039] Furthermore, the job level information is first quantified (company job levels P1 to P7 correspond to 1 to 7 respectively). Calculate the absolute value of the job grade difference for each node pair and convert it into a positive score; that is, the expression for the job grade difference factor score is:
[0040] and These are the job level values for employee 1 and employee 2, respectively.
[0041] In this method, the closer the job levels are, the higher the score (e.g., if the job level difference between P5 and P6 is 0, the score is 1.0; if the job level difference between P5 and P6 is 1, the score is 0.5).
[0042] In some embodiments, the number of times node pairs share a room is queried from historical business trip records, and the factor score of the historical room sharing record is determined according to rules: Three or more instances of room sharing: Historical room sharing record factor score = 1.0; 1-2 shared room records: Historical shared room record factor score = 0.7; No shared room record but belonging to the same department: Historical room-sharing record factor score = 0.5; No shared room records and no departmental affiliation: Historical room-sharing record factor score = 0.3.
[0043] In some embodiments, the process of determining the business trip frequency matching factor score may include: Based on the number of business trips per year for each node, determine the business trip frequency matching factor score. ;
[0044] in, The number of business trips per employee 1 per year. The number of business trips per year for employee 2 is denoted by the business trip frequency matching factor score, which ranges from 0 to 1. A higher value indicates a higher degree of matching between the two employees' business trip frequencies.
[0045] In some embodiments, the departmental relevance factor score is based on the hierarchical relationship of the department to which the node belongs: Employees in the same department: Departmental relevance factor score = 1.0; Cross-departmental but belonging to the same business unit: Departmental relevance factor score = 0.5; No direct connection between departments: Departmental connection factor score = 0.3.
[0046] In summary, the scores of the four factors are summed according to their weight ratios to obtain the final weight value of the edge (range 0-1). The higher the weight, the stronger the compatibility between the two employees sharing a room.
[0047] In one example , , and The values are 0.4, 0.3, 0.2 and 0.1 respectively.
[0048] Step 4: Based on the nodes, edges, and weight values corresponding to any type of list, construct a graph model of employees of the same gender with an adjacency list structure and store it in the system memory.
[0049] To support the efficient execution of the subsequent maximum weight matching algorithm, the graph model uses an adjacency list structure for storage and is deployed in system memory, as implemented below: Construct two adjacency lists (male adjacency list and female adjacency list) based on the gender list. In each adjacency list, the key is the node ID (employee identifier), and the value is the list of connecting edges for that node. Each edge contains the target node ID and the corresponding weight value (e.g., in the male adjacency list, the edge list for node EMP001 is [(EMP003,0.85),(EMP005,0.62)]).
[0050] The adjacency list data is directly stored in the hash table in the system memory, supporting node access and edge query with O(1) time complexity, which meets the performance requirement of "computation time ≤ 800ms" in the file; Node attributes are stored in association with the adjacency list. Attributes such as job title and department can be quickly indexed by node ID, avoiding duplicate data storage that consumes memory.
[0051] Step S230: Determine the total number of rooms by using the weight values of each edge in the same-gender employee graph model.
[0052] Specifically, step 1: For any graph model of employees of the same gender, extract the total number of nodes in the graph model of employees of the same gender; For the constructed graph models of male and female employees (corresponding to the graph structures of the male and female lists respectively), the first step is to extract the total number of nodes from each employee graph model of the same gender. The total number of nodes represents the number of business travelers in that gender group. For example, a male employee graph model with 3 nodes represents 3 male business travelers, and a female employee graph model with 5 nodes represents 5 female business travelers. The extraction of the total number of nodes is achieved by traversing the adjacency list structure of the graph model and directly reading the number of node IDs stored in the hash table. This ensures that the data source is consistent with the previous gender grouping results, providing basic data support for subsequent room count calculations.
[0053] Step 2: Based on the total number of nodes, determine the basic number of rooms using the rounding-up rule; After obtaining the total number of nodes in the same-gender employee graph model, the basic number of rooms is calculated using the ceil function implemented by the computer program. Specifically, for the same-gender group with a total of N nodes, the formula for calculating the basic number of rooms can be expressed as: basic number of rooms = ceil(N / 2), where N is the number of nodes, and the ceil function is used to perform a rounding operation on the division result (e.g., when the total number of nodes is 5, 5 / 2 = 2.5, and the basic number of rooms after rounding up is 3; when the total number of nodes is 3, 3 / 2 = 1.5, and the basic number of rooms after rounding up is 2).
[0054] This step replaces traditional manual estimation with automated calculations, ensuring that the initial number of rooms meets the basic constraint that each room can accommodate a maximum of 2 people, while also providing a benchmark value for subsequent room-sharing optimization.
[0055] Step 3: According to the maximum weight matching algorithm, process the weight values of each edge in the graph model of employees of the same gender to obtain the edge combination with the highest total weight, and determine the number of room sharing pairs based on the edge combination; Each node (employee identifier) can participate in the connection of at most one edge, meaning that an employee can only form a room-sharing relationship with one other employee to avoid duplicate matching.
[0056] By iteratively calculating using the maximum weight matching algorithm, node pairs with high edge weights (i.e., employee combinations with strong compatibility) are selected first to ensure that the total weight of the selected edge combinations is the highest.
[0057] Next, traverse each edge in the edge combination and identify the two node identifiers (employee identifiers) corresponding to each edge. A boolean array is used to uniquely mark the nodes involved in the edge connection, ensuring that the same node is not counted repeatedly. The number of edges in a combination that do not trigger a duplicate flag is the actual number of room-sharing pairs formed. For example, if the combination of the above 5 female employees contains 2 valid edges, then the number of room-sharing pairs is 2, meaning that 2 room-sharing relationships are formed.
[0058] Step 4: Verify the number of room pairs and obtain the verification results.
[0059] If the sum of the number of room sharing pairs and the number of nodes not participating in room sharing is the same as the number of basic rooms, then the number of basic rooms is determined as the number of rooms corresponding to the same gender employee graph model; The number of nodes that did not participate in room sharing = the total number of nodes in the same gender graph model - 2 × the number of room sharing pairs (because each edge corresponds to 2 employees); For example: The total number of nodes for 5 female employees is 5, the number of room sharing pairs is 2, and the number of nodes not participating in room sharing is 1 (5-2×2=1). Then 2+1=3, which is consistent with the basic number of rooms of 3. Therefore, it is confirmed that the number of rooms for this female group is 3.
[0060] If the sum of the number of room sharing pairs and the number of nodes not participating in room sharing is different from the basic number of rooms, then re-traverse the adjacency list of the same gender employee graph model, check whether the total number of nodes is consistent with the original number of gender groups, remove duplicate nodes or add missing nodes, and ensure that the data source for calculating the basic number of rooms is accurate. Afterwards, the maximum weight matching algorithm is forced to run again, strictly verifying the participation of nodes on each edge, marking matched nodes with a boolean array to ensure that the constraint of each node only participates in one edge is effective, and re-selecting the edge combination with the highest total weight that meets the room number constraint. If a second execution still fails to match, the system automatically verifies the multi-dimensional factor calculation of the edge weights (such as job level numerical conversion and departmental correlation determination), corrects the factor score deviation, and then executes the matching again to ensure the rationality of the edge combination screening.
[0061] In this method, the number of room-sharing pairs and the number of independent nodes are counted again until the sum of the two matches the basic number of rooms. At this point, the basic number of rooms is confirmed as the final number of rooms for that gender group. This mechanism avoids manual intervention through automated verification and retries, ensuring zero error in the calculation of gender grouping and room count in the document, and providing an accurate basis for the subsequent calculation of the total difference. The maximum weight matching algorithm improves room-sharing satisfaction from 68% to 92%, reduces travel costs by 18%, and keeps the calculation time within 800ms.
[0062] Step 5: The total number of rooms is determined by summing the number of rooms corresponding to each employee of the same gender in the diagram model.
[0063] After performing the above steps on both the male and female employee graphical models, sum the number of rooms corresponding to the two gender groups to obtain the final total number of rooms. For example, if the male group has 2 rooms and the female group has 3 rooms, then the total number of rooms is 2 + 3 = 5.
[0064] Step S240: Sort the differential values of each business trip employee extracted from the expense standard library in descending order to obtain the target sequence, and determine the corresponding number of differential values in the target sequence with the total number of rooms as the cutoff point.
[0065] Specifically, based on the attribute information (employee identifier, job level information) of the nodes in the same-gender employee graph model, the corresponding job level differential standard rule of the employee in the expense standard library is matched; at the same time, combined with the travel city and travel date information in the travel processing request, the specific differential standard value in the current travel scenario is determined (e.g., the accommodation fee standard for a P7 job level employee in a special city is 700 yuan / night).
[0066] Each employee's differential value is uniquely associated with its entity node, ensuring that the extracted differential value strictly matches the employee's attributes (job level, city) and avoiding calculation errors caused by standard mismatch. For example, the differential value for a P5 employee in the male list is 500 yuan / night, while the differential value for a P7 employee in the female list is 700 yuan / night.
[0067] Next, the difference values corresponding to the graphical models of male and female employees are sorted independently. For example, the difference value of the male group is [500, 400, 500], and the target sequence after sorting is [500, 500, 400]; the difference value of the female group is [700, 600, 500, 400, 400], and the target sequence after sorting is [700, 600, 500, 400, 400].
[0068] This method uses the numerical value of the difference as the sole sorting criterion, with larger values appearing first, ensuring that the business logic of prioritizing high difference values is implemented. The sorting process is implemented using a fast sorting algorithm in a computer program, guaranteeing sorting efficiency in scenarios with multiple users.
[0069] Then, the cutoff point for the male group is the number of rooms it corresponds to (e.g., 2 rooms for men), and the cutoff point for the female group is the number of rooms it corresponds to (e.g., 3 rooms for women).
[0070] Extract the first N values from the male target sequence (N = number of male rooms), and extract the first M values from the female target sequence (M = number of female rooms). For example: the male target sequence [500, 500, 400] is extracted by extracting the first 2 values to get [500, 500]; the female target sequence [700, 600, 500, 400, 400] is extracted by extracting the first 3 values to get [700, 600, 500].
[0071] The number of values extracted must be strictly consistent with the number of rooms in the corresponding gender group. If there is a discrepancy (such as the number of extracted values being less than the number of rooms), the system will automatically trigger data verification and re-check the difference value extraction and sorting process to ensure the accuracy of the extracted results.
[0072] In summary, the sequence of differential values extracted through the above steps directly corresponds to the business rule of calculating the differential for each room based on the highest job level. For example, the extracted values for the three rooms in the female group are [700, 600, 500], corresponding to the cost standards for the three rooms (the first room is calculated at 700 yuan, the second at 600 yuan, and the third at 500 yuan). This not only conforms to the cost control logic of prioritizing the capture of the highest differential but also ensures the matching with the number of rooms, providing core data support for the accurate calculation of the total travel expenses.
[0073] Step S250: Using the Kahan accumulation algorithm, calculate the corresponding number of differential values to obtain the total travel expenses.
[0074] Specifically, step 1: Configure and initialize the accumulated variable and the error compensation variable; The initialization variable `sum` is set to 0 to accumulate the total difference values. Its data type is high-precision floating-point (such as 64-bit double-precision floating-point number) to avoid integer overflow or precision loss. The error compensation variable `c` is set to 0 to store the truncation error generated during each accumulation process. By dynamically tracking the error, it is ensured that subsequent calculations can compensate for the error.
[0075] Step 2: Traverse the corresponding number of difference values in the target sequence, and determine the first temporary variable for the corresponding difference values and error compensation variables; For the current scale value x, the first temporary variable y is calculated using the formula y=xc. This step pre-deducts the error compensation variable c accumulated during the previous accumulation process from the current scale value to prevent errors from being carried over into the new round of calculation. For example, if the previous error compensation variable c was 0.0001 and the current scale value x is 700, then y=700-0.0001=699.9999.
[0076] Step 3: Based on the initialization of the accumulated variable and the first temporary variable, determine the second temporary variable; Based on the initial accumulated variable `sum` and the first temporary variable `y`, the second temporary variable `t` is calculated using the formula `t = sum + y`, which is the sum of the current accumulated value and the compensated difference value. For example, if the current value of `sum` is 0 and `y` is 699.9999, then `t = 0 + 699.9999 = 699.9999`.
[0077] Step 4: Based on the second temporary variable, the initialized cumulative variable, and the first temporary variable, determine the new error compensation variable; The new error compensation variable c is calculated using the formula c=(t-sum)-y. This value is essentially the truncation error caused by the precision limitations of floating-point operations during this accumulation process. For example, if t=699.9999, sum=0, and y=699.9999, then c=(699.9999-0)-699.9999=0, and no new error is generated.
[0078] Step 5: Determine the second temporary variable as the new initialization accumulation variable; Assign the second temporary variable t to the accumulator variable sum, i.e., sum = t, to complete the accumulation of the current difference value. For example, sum is updated to 699.9999.
[0079] Step 6: After traversing through all the difference values in the target sequence, the target accumulated variable is obtained; After traversing all the extracted difference values in the target sequence, the value stored in the cumulative variable `sum` is the sum of the difference values for that gender group, which is used as the target cumulative variable.
[0080] For example, if the difference between the female group and the target variable is [700, 600, 500], after being accumulated by the Kahan algorithm, the target accumulated variable is 700 + 600 + 500 = 1800 (when there is no error); if there is a floating-point operation error, the algorithm will ensure that the result is still the precise value of 1800 through a compensation mechanism.
[0081] Step 7: Determine the total travel expenses based on the target cumulative variable and the number of business trip days.
[0082] After summing the cumulative target variables for each gender group, multiply by the number of business trip days to obtain the final total travel cost. The specific formula is: Total travel cost = (Cumulative target variable for men + Cumulative target variable for women) × Number of business trip days; For example: If the cumulative variable of the male target is 1000 (500+500) and the cumulative variable of the female target is 1800 (700+600+500), and the number of business trips is 3 days, then the total cost = (1000+1800)×3 = 2800×3 = 8400 yuan.
[0083] In some embodiments, the final total travel expenses are calculated separately based on the number of business trips for male employees and female employees.
[0084] Compared to ordinary accumulation algorithms, the Kahan accumulation algorithm dynamically tracks and corrects floating-point operation errors through error compensation variables, ensuring that the accuracy of total cost calculation remains at a very high level even in scenarios with a large number of differential values or significant numerical differences. Furthermore, the algorithm's calculation logic is concise, and the traversal process is executed efficiently through loop statements, meeting the response efficiency requirements of high-concurrency scenarios (single-gender group accumulation time ≤ 50ms), providing technical support for accurate accounting and compliance control of travel expenses.
[0085] In some embodiments, the scenario design for business trips involving a mix of special-level and ordinary-level personnel divides business travelers into four categories: Category A, Category B, male ordinary-level personnel, and female ordinary-level personnel. Fees are calculated separately for each category and then aggregated to ensure that personnel costs under different rules are accurately split and integrated.
[0086] Category A and Category B refer to employees in the company who enjoy special travel rules (such as senior executives and special positions). They usually follow independent rules such as actual reimbursement and one person per room, which are different from the room-sharing rules for ordinary employees. Total difference in performance for Category A employees = (Category A difference in performance, number of Category A employees) × number of days.
[0087] According to the independent expense allowance rules for Category A personnel, first calculate the daily expense per person, then multiply by the number of people and the number of business trip days to get the total expense for Category A personnel (for example: 2 Category A personnel, daily expense allowance of 800 yuan, business trip of 3 days, then this item is 800×2×3=4800 yuan).
[0088] The total difference in allowance for Category B employees is calculated in the same way as that for Category A employees.
[0089] In another example, a formula engine is added to the cost type configuration interface: Total Amount = Total A-level Standards (A-level Standards, Number of A-level Personnel) × Number of Days + Total B-level Standards (B-level Standards, Number of B-level Personnel) × Number of Days + Total Male Standards (Male_standards, Number of Male Rooms) × Number of Days + Total Female Standards (Female_standards, Number of Female Rooms) × Number of Days
[0090] Combination Figure 3 In the diagram, if the option to summarize the difference amount for multiple people by gender is selected, the number of rooms will be calculated based on the gender of the person on the business trip, and then the corresponding difference amount will be calculated based on the individual's difference amount.
[0091] For example: Currently, there are 10 people on business trips. Among them, 2 are in Category A and Category B respectively, 3 are males in other job levels, and 5 are females in other job levels living in special cities.
[0092] Male employees at job level P4 (1 person): 400 yuan / night; P5 (2 people): 500 yuan / night; Female employees at job level P4 (2 people) are charged 400 yuan / night; P5 (3 people) are charged 500 yuan / night. Category A and Category B employees: P6 (1 person) 600 yuan / night; P7 (1 person) 700 yuan / night; Room occupancy logic: Except for Class A and Class B employees, Class A employees are reimbursed based on actual expenses, while Class B employees stay in one room each; for other classes, employees of the same gender must stay in a standard room. Following the example above, the number of rooms available is: Rooms = 2 (one room each for Class A and Class B) + Number of male rooms (3 / 2) (rounding up if decimal) + Number of female rooms (5 / 2) (rounding up if decimal) = 2 + 2 + 3 = 7 rooms; that is, one room for Class A, one room for Class B, 2 rooms for males, and 3 rooms for females. The room number is automatically calculated according to the above logic, and the reimbursable amount is equal to: Number of rooms × the data for the previous higher-level classes. Reimbursable amount = Number of rooms for Class A employees × Maximum limit × Number of days + Number of rooms for Class B employees × Maximum limit × Number of days = 500 × 2 × Number of days + 700 × 1 × Number of days + 600 × 1 × Number of days + 500 × 3 × Number of days.
[0093] This application provides a response method for high-concurrency travel budget requests. This method constructs a travel expense calculation scheme based on gender grouping, intelligent matching, and a dynamic rule engine. It eliminates human error through automated gender grouping, graph model maximum weight matching for room sharing, and the Kahan accumulation algorithm, reducing the error rate to zero. In terms of processing efficiency, synchronous data acquisition, fast sorting, and optimization algorithms shorten the time for calculating expenses for multiple people from over 30 minutes traditionally done manually to seconds (≤800ms). The formula engine automatically adapts to rules such as separate calculations for A / B categories and same-gender room sharing, preventing over-reimbursement and budget waste. The modular design allows for adding new rules without refactoring the core logic, flexibly adapting to policy adjustments. Simultaneously, full-process automation reduces user operations, and the configurable formula engine optimizes the experience, comprehensively improving the accuracy, efficiency, and compliance of corporate travel expense reimbursements.
[0094] Corresponding to the above method, embodiments of this application also provide a response device for high-concurrency travel budget requests, such as... Figure 4 As shown, the device includes: The acquisition unit 410 is used to acquire a travel processing request that includes attribute information of multiple business travelers; the attribute information includes employee identifier, job level information, gender information, historical business travel records, and department information; Construction unit 420 constructs a graph model of employees of the same gender based on the employee identifier, the historical business trip record, the job level information, the gender information and the department information; The determining unit 430 is used to determine the total number of rooms by using the weight values of each edge in the same-gender employee graph model; the weight values are determined by a dynamic compatibility function. Arrangement unit 440 is used to sort the difference values of each business trip employee extracted from the expense standard library in descending order to obtain the target sequence; The determining unit 430 is further configured to determine a corresponding number of differential values in the target sequence, using the total number of rooms as the cutoff point; The calculation unit 450 is used to calculate the total travel expenses by employing the Kahan accumulation algorithm on the corresponding number of differential values.
[0095] The functions of each unit in the response device for high-concurrency travel budget requests provided in the above embodiments of this application can be implemented through the above-described method steps. Therefore, the specific working process and beneficial effects of each unit in the response device for high-concurrency travel budget requests provided in the embodiments of this application will not be repeated here.
[0096] This application also provides an electronic device, such as... Figure 5 As shown, it includes a processor 510, a communication interface 520, a memory 530, and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other through the communication bus 540.
[0097] Memory 530 is used to store computer programs; When the processor 510 executes the program stored in the memory 530, it performs the following steps: A travel processing request that retrieves attribute information of multiple business travelers; the attribute information includes employee ID, job level information, gender information, historical business travel records, and department information; Based on the employee identifier, the historical business trip record, the job level information, the gender information, and the department information, construct a graph model of employees of the same gender; The total number of rooms is determined by the weight values of each edge in the same-sex employee graph model; the weight values are determined by a dynamic compatibility function. The differential values of each business trip employee extracted from the expense standard library are sorted in descending order to obtain the target sequence; Using the total number of rooms as the cutoff point, determine the corresponding number of differential values in the target sequence; The Kahan accumulation algorithm is used to calculate the total travel expenses by calculating the corresponding number of differential values.
[0098] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0099] The communication interface is used for communication between the aforementioned electronic devices and other devices.
[0100] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0101] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0102] The implementation methods and beneficial effects of the various components of the electronic device in the above embodiments for solving the problem can be found in [reference needed]. Figure 2 The steps in the illustrated embodiments are used to implement the electronic device. Therefore, the specific working process and beneficial effects of the electronic device provided in this application will not be repeated here.
[0103] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores instructions that, when executed on a computer, cause the computer to perform a response method for high-concurrency travel budget requests as described in any of the above embodiments.
[0104] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute a response method for high-concurrency travel budget requests as described in any of the above embodiments.
[0105] Those skilled in the art will understand that the embodiments in this application can be provided as methods, systems, or computer program products. Therefore, the embodiments in this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the embodiments in this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0106] This application describes embodiments of methods, apparatus (systems), and computer program products according to embodiments of this application with reference to flowchart illustrations and / or block diagrams. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0107] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0108] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0109] Unless otherwise defined, the technical or scientific terms used in this application shall have the ordinary meaning understood by one of ordinary skill in the art to which this invention pertains. The terms "first," "second," and similar terms used in this application do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed following the word and their equivalents, without excluding other elements or objects. Terms such as "connected," "coupled," or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are used only to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0110] Although preferred embodiments have been described in this application, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the embodiments in this application are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments in this application.
[0111] Obviously, those skilled in the art can make various modifications and variations to the embodiments of this application without departing from the spirit and scope of the embodiments of this application. Therefore, if these modifications and variations to the embodiments of this application fall within the scope of the embodiments of this application and their equivalents, then these modifications and variations are also intended to be included in the embodiments of this application.
Claims
1. A response method for high-concurrency travel budget requests, characterized in that, The method includes: A travel processing request that retrieves attribute information of multiple business travelers; the attribute information includes employee ID, job level information, gender information, historical business travel records, and department information; Based on the employee identifier, the historical business trip record, the job level information, the gender information, and the department information, construct a graph model of employees of the same gender; The total number of rooms is determined by the weight values of each edge in the same-sex employee graph model; the weight values are determined by a dynamic compatibility function. The differential values of each business trip employee extracted from the expense standard library are sorted in descending order to obtain the target sequence; Using the total number of rooms as the cutoff point, determine the corresponding number of differential values in the target sequence; The Kahan accumulation algorithm is used to calculate the total travel expenses by calculating the corresponding number of differential values.
2. The method as described in claim 1, characterized in that, Based on the employee identifier, the historical business trip record, the job level information, the gender information, and the department information, a graph model of same-gender employees is constructed, including: Based on the gender information, the employee identifier, the historical business trip record, the job level information, and the department information are classified to obtain a male list and a female list; Use the employee identifiers in any list as nodes, and establish edges between the nodes; Determine the weight values for each side of job level information, historical room sharing records in historical business trip records, business trip frequency, and department information; Based on the nodes, edges, and weight values corresponding to any type of list, construct a graph model of same-sex employees with an adjacency list structure and store it in system memory.
3. The method as described in claim 1, characterized in that, The dynamic compatibility function is: Where W is the weight value, The score for the job grade difference factor. Score the historical room-sharing record factor. The score for the frequency of business trips matching factor. For the departmental relevance factor score, , , and These represent the percentages of the corresponding factors.
4. The method as described in claim 3, characterized in that, The expression for the job grade difference factor score is: in, and These are the job level values for employee 1 and employee 2, respectively.
5. The method as described in claim 2, characterized in that, The total number of rooms is determined by the weight values of each edge in the same-sex employee graph model, including: For any graph model of employees of the same gender, extract the total number of nodes in the graph model of employees of the same gender. Based on the total number of nodes, the basic number of rooms is determined by rounding up. According to the maximum weight matching algorithm, the weight values of each edge in the same-gender employee graph model are processed to obtain the edge combination with the highest total weight; wherein, each node participates in the connection of at most one edge. Based on the aforementioned edge combinations, the number of room-sharing pairs is determined; If the sum of the number of room-sharing pairs and the number of nodes not participating in room-sharing is the same as the number of basic rooms, then the number of basic rooms is determined as the number of rooms corresponding to the same-gender employee graph model; The total number of rooms is determined by summing the number of rooms corresponding to each employee's gender in the diagram model.
6. The method as described in claim 5, characterized in that, Based on the edge combination, the number of room-sharing pairs is determined, including: Traverse the edge combinations selected by the maximum weight matching algorithm and identify the employee identifiers of the two nodes corresponding to each edge; The employee identifiers involved in edge connection are marked using a Boolean array; The edges that do not trigger the repeat mark are counted to obtain the edge count result, and the edge count result is determined as the number of room pairs.
7. The method as described in claim 1, characterized in that, The Kahan accumulation algorithm is used to calculate the total travel expenses by calculating the corresponding number of differential values, including: Configure and initialize the accumulated variable and the error compensation variable; Traverse the corresponding number of difference scale values in the target sequence, and determine the first temporary variable for the corresponding difference scale value and the error compensation variable; Based on the initial accumulated variable and the first temporary variable, the second temporary variable is determined; Based on the second temporary variable, the initial accumulated variable, and the first temporary variable, a new error compensation variable is determined; The second temporary variable is designated as the new initialization accumulation variable; After traversing through all the difference values in the target sequence, the target cumulative variable is obtained; Based on the target cumulative variable and the number of business trip days, the total travel expenses are determined.
8. A response device for high-concurrency travel budget requests, characterized in that, The device includes: The acquisition unit is used to acquire travel processing requests that include attribute information of multiple business travelers; the attribute information includes employee identifier, job level information, gender information, historical business travel records, and department information; The construction unit constructs a graph model of employees of the same gender based on the employee identifier, the historical business trip record, the job level information, the gender information, and the department information. A determining unit is used to determine the total number of rooms by using the weight values of each edge in the same-gender employee graph model; the weight values are determined by a dynamic compatibility function. The sorting unit is used to sort the difference values of each business trip employee extracted from the expense standard library in descending order to obtain the target sequence; The determining unit is further configured to determine a corresponding number of differential values in the target sequence, using the total number of rooms as the cutoff point; The calculation unit is used to calculate the total travel expenses by employing the Kahan accumulation algorithm on the corresponding number of differential values.
9. An electronic device, characterized in that, The electronic device includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the steps of the method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method described in any one of claims 1-7.
