|
1 | 1 | using System; |
2 | | -using System.Collections.Generic; |
3 | | -using System.ComponentModel.DataAnnotations; |
4 | 2 | using System.Linq; |
5 | 3 | using System.Threading.Tasks; |
| 4 | +using System.Collections.Generic; |
| 5 | +using System.ComponentModel.DataAnnotations; |
6 | 6 | using Microsoft.AspNetCore.Mvc; |
7 | 7 | using PayrollEngine.Api.Core; |
8 | | -using PayrollEngine.Domain.Application.Service; |
9 | 8 | using PayrollEngine.Domain.Model; |
10 | 9 | using ApiObject = PayrollEngine.Api.Model; |
| 10 | +using PayrollEngine.Domain.Application.Service; |
11 | 11 |
|
12 | 12 | namespace PayrollEngine.Backend.Controller; |
13 | 13 |
|
@@ -739,6 +739,42 @@ public override async Task<ActionResult> QueryPayrollCaseChangeValuesAsync(int t |
739 | 739 | lookupName, lookupKey, rangeValue, culture); |
740 | 740 | } |
741 | 741 |
|
| 742 | + /// <summary> |
| 743 | + /// Get payroll lookup range brackets |
| 744 | + /// </summary> |
| 745 | + /// <param name="tenantId">The tenant id</param> |
| 746 | + /// <param name="payrollId">The payroll id</param> |
| 747 | + /// <param name="lookupNames">The lookup names (case-insensitive)</param> |
| 748 | + /// <param name="rangeValue">Optional value to find matching brackets (supported by threshold and progressive lookups)</param> |
| 749 | + /// <param name="regulationDate">The regulation date (default: UTC now)</param> |
| 750 | + /// <param name="evaluationDate">The evaluation date (default: UTC now)</param> |
| 751 | + /// <param name="culture">The content culture</param> |
| 752 | + /// <returns>The lookup range results</returns> |
| 753 | + [HttpGet("{payrollId}/lookups/ranges")] |
| 754 | + [OkResponse] |
| 755 | + [NotFoundResponse] |
| 756 | + [ApiOperationId("GetPayrollLookupRanges")] |
| 757 | + public async Task<ActionResult<ApiObject.LookupRangeResult[]>> GetPayrollLookupRangesAsync(int tenantId, int payrollId, |
| 758 | + [FromQuery][Required] string[] lookupNames, [FromQuery] decimal? rangeValue, |
| 759 | + [FromQuery] DateTime? regulationDate, [FromQuery] DateTime? evaluationDate, [FromQuery] string culture) |
| 760 | + { |
| 761 | + // authorization |
| 762 | + var authResult = await TenantRequestAsync(tenantId); |
| 763 | + if (authResult != null) |
| 764 | + { |
| 765 | + return authResult; |
| 766 | + } |
| 767 | + return await base.GetPayrollLookupRangesAsync( |
| 768 | + new() |
| 769 | + { |
| 770 | + TenantId = tenantId, |
| 771 | + PayrollId = payrollId, |
| 772 | + RegulationDate = regulationDate, |
| 773 | + EvaluationDate = evaluationDate |
| 774 | + }, |
| 775 | + lookupNames, rangeValue, culture); |
| 776 | + } |
| 777 | + |
742 | 778 | /// <summary> |
743 | 779 | /// Get payroll report sets |
744 | 780 | /// </summary> |
|
0 commit comments