瀏覽代碼

新增团组增减款项Excel导出及金额显示优化

- 新增 DecreasePaymentsExcelDownload 接口,支持团组增减款项Excel导出,包含权限校验与模板填充
- 优化 AirHotelPrice 金额显示,统一为目标币种金额,动态获取币种名称
- 搜索相关接口移除分页参数硬编码,采用默认值
- DynamicSearchRequest 默认 PageSize 调整为 9999
- 新增 DecreasePaymentsExcelDownloadDto 用于导出参数传递
- Grp_GamesBudgetMaster Type 字段默认值设为 2(APEC)
Lyyyi 19 小時之前
父節點
當前提交
8bf8463e78

+ 93 - 5
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -14296,6 +14296,7 @@ FROM
         /// <param name="dto"></param>
         /// <returns></returns>
         [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public IActionResult QueryAssociateSupplier(AssociateSupplierDto dto)
         {
             var dbResult = _sqlSugar.Queryable<Grp_DecreasePayments>()
@@ -14325,6 +14326,7 @@ FROM
         /// <param name="file"></param>
         /// <returns></returns>
         [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> DecreasePaymentsOTAMate(IFormFile file)
         {
             if (file.Length < 1) return Ok(JsonView(false, "请上传文件!"));
@@ -14411,6 +14413,71 @@ FROM
             return Ok(JsonView(true, "操作成功", new { url }));
         }
 
+
+        /// <summary>
+        /// 团组增减款项 Excel
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> DecreasePaymentsExcelDownload(DecreasePaymentsExcelDownloadDto dto)
+        {
+            if (dto.GroupId < 1) return Ok(JsonView(false, "请选择团组!"));
+            if (dto.GroupId < 1) return Ok(JsonView(false, "请传入用户ID!"));
+
+            var userPers = new List<int>() {
+                    400,  // 李允
+                    233   // 刘华举
+                };
+
+            if (!userPers.Contains(dto.CurrUserId)) return Ok(JsonView(false, "您没有权限进行此操作!"));
+
+            string feeSql = string.Format(@"Select dp.Id As DPId,dp.DiId As DPDiId,dp.PriceName,ccp.PayMoney,sd1.Name As PayMoneyCurrency,
+ccp.DayRate,(((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100) As CNYPrice,ccp.ConsumptionDate,
+Case When ccp.OrbitalPrivateTransfer = 0 Then '公转' Else '私转' End As CostMark,
+Case When ccp.IsPay = 0 Then '未付款' Else '已付款' End As IsPay,sd2.Name As PaymentModes,  
+ccp.Payee,ccp.AuditGMDate,u.CnName As Applicant,dp.CreateTime,dp.Remark
+From Grp_DecreasePayments dp
+Left Join Grp_CreditCardPayment ccp On ccp.isdel = 0 And ccp.CTable = 98 And dp.Id = ccp.CId
+Left Join Sys_SetData sd1 On ccp.PaymentCurrency = sd1.Id
+Left Join Sys_SetData sd2 On ccp.PayDId = sd2.Id
+Left Join Sys_Users u On ccp.CreateUserId = u.Id
+Where dp.IsDel = 0 And ccp.Ctable = 98  And dp.Diid = {0}
+Order By CreateTime",dto.GroupId);
+
+            var feeViews = _sqlSugar.SqlQueryable<GroupOtherFeeExcelView>(feeSql).ToList();
+
+            var groupName = await _sqlSugar.Queryable<Grp_DelegationInfo>().Where(x => x.Id == dto.GroupId).Select(x => x.TeamName).FirstAsync() ?? "";
+            //获取模板
+            string tempPath = (AppSettingsHelper.Get("ExcelBasePath") + "Template/团组其他费用统计模板.xls");
+            var designer = new WorkbookDesigner();
+            designer.Workbook = new Workbook(tempPath);
+            // 获取工作簿中的工作表集合
+            var worksheets = designer.Workbook.Worksheets;
+
+            //其他费用相关 
+            var otherFeeSheet = worksheets["其他费用"];
+            DataTable otherFeeDt = CommonFun.ToDataTableArray(feeViews);
+            otherFeeDt.TableName = "OtherFeeView"; // 设置表名
+            decimal otherCNYTotalCost = feeViews.Sum(x => x.CNYPrice);
+
+            var dataSet = new System.Data.DataSet();
+            dataSet.Tables.Add(otherFeeDt);
+            designer.SetDataSource(dataSet);
+
+            //designer.SetDataSource(otherFeeDt);
+            designer.SetDataSource("GroupName", groupName);
+            designer.SetDataSource("OtherCNYTotalCost", $"{otherCNYTotalCost.ToString("#0.00")} CNY");
+
+            designer.Process();
+
+            //文件名
+            string fileName = $"{groupName}_团组其他费用费用清单{DateTime.Now.ToString("yyyyMMddHHmmss")}.xls";
+            designer.Workbook.Save(AppSettingsHelper.Get("ExcelBasePath") + "GroupStatement/" + fileName);
+            string url = AppSettingsHelper.Get("ExcelBaseUrl") + "Office/Excel/GroupStatement/" + fileName;
+            return Ok(JsonView(true, "成功", url));
+        }
+
         #region
         private static DataTable ConvertExcelToDataTable(string excelFilePath)
         {
@@ -33344,6 +33411,12 @@ AirHotelPrice
                         otherRoomFeeStr = $"{item.OtherRoomPrice.ToString("#0.00")} {roomCurr}\r\n{((item.OtherRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}";
                         rateDatas.Add(new { code = roomCurr, rate = roomInfo.Rate });
                         var ccpPaymentCurrency = currDatas.Find(it => it.Id == ccpInfo?.PaymentCurrency)?.Name ?? "";
+
+
+                        var currencytempid = ccpInfo.PaymentCurrency;
+                        var currencytempName = _sqlSugar.Queryable<Sys_SetData>().Where(it => it.Id == currencytempid).ToList()[0].Name;
+
+
                         if (ccpPaymentCurrency.Equals("CNY"))
                         {
                             payMoneyStr = $"{ccpInfo.PayMoney.ToString("#0.00")} CNY";
@@ -33353,7 +33426,11 @@ AirHotelPrice
                         {
 
                             rateDatas.Add(new { code = ccpPaymentCurrency, rate = ccpInfo.DayRate });
-                            payMoneyStr = $"{ccpInfo.PayMoney.ToString("#0.00")} {ccpPaymentCurrency}\r\n{((ccpInfo.PayMoney * ccpInfo.DayRate) / _rate).ToString("#0.00")} CNY";
+                            //payMoneyStr = $"{ccpInfo.PayMoney.ToString("#0.00")} {ccpPaymentCurrency}\r\n{((ccpInfo.PayMoney * ccpInfo.DayRate) / _rate).ToString("#0.00")} CNY";
+
+                           
+
+                            payMoneyStr = $"{((ccpInfo.PayMoney * ccpInfo.DayRate) / _rate).ToString("#0.00")} {currencytempName}";
                         }
 
                         var hotelcardPriceCurrency = currDatas.Find(it => it.Id == item?.CardPriceCurrency)?.Name ?? "";
@@ -33363,7 +33440,8 @@ AirHotelPrice
                         }
                         else
                         {
-                            cardPriceStr = $"{item.CardPrice.ToString("#0.00")} {hotelcardPriceCurrency}\r\n{((item.CardPrice * roomInfo.Rate) / _rate).ToString("#0.00")} CNY";
+                            //cardPriceStr = $"{item.CardPrice.ToString("#0.00")} {hotelcardPriceCurrency}\r\n{((item.CardPrice * roomInfo.Rate) / _rate).ToString("#0.00")} CNY";
+                            cardPriceStr = $"{((item.CardPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {currencytempName}";
                         }
 
 
@@ -33597,7 +33675,7 @@ AirHotelPrice
                     var breakfastInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 2).FirstOrDefault(); //早餐
                     var governmentRentInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 3).FirstOrDefault(); //地税
                     var cityTaxInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 4).FirstOrDefault(); //城市税
-
+                    
 
                     string roomCurr = currDatas.Find(it => it.Id == roomInfo?.Currency)?.Name ?? "";
 
@@ -33622,8 +33700,18 @@ AirHotelPrice
                         doubleRoomFeeStr = $"{((item.DoubleRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.DoubleRoomPrice.ToString("#0.00")} {roomCurr}";
                         suiteRoomFeeStr = $"{((item.SuiteRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.SuiteRoomPrice.ToString("#0.00")} {roomCurr}";
                         otherRoomFeeStr = $"{((item.OtherRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.OtherRoomPrice.ToString("#0.00")} {roomCurr}";
-                        payMoneyStr = $"{((ccpInfo.PayMoney * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{ccpInfo.PayMoney.ToString("#0.00")} {roomCurr}";
-                        cardPriceStr = $"{((item.CardPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.CardPrice.ToString("#0.00")} {roomCurr}";
+
+
+                        var currencytempid = ccpInfo.PaymentCurrency;
+                        var currencytempName = _sqlSugar.Queryable<Sys_SetData>().Where(it => it.Id == currencytempid).ToList()[0].Name;
+
+
+                        //payMoneyStr = $"{((ccpInfo.PayMoney * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{ccpInfo.PayMoney.ToString("#0.00")} {roomCurr}";
+                        payMoneyStr = $"{ccpInfo.PayMoney.ToString("#0.00")} {currencytempName}";
+
+                        //cardPriceStr = $"{((item.CardPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.CardPrice.ToString("#0.00")} {roomCurr}";
+                       
+                        cardPriceStr = $"{item.CardPrice.ToString("#0.00")} {currencytempName}";
                     }
                     string breakfastPriceStr = string.Empty,
                            breakfastCurrency = currDatas.Find(it => it.Id == item.BreakfastCurrency)?.Name ?? "",

+ 0 - 6
OASystem/OASystem.Api/Controllers/SearchController.cs

@@ -662,8 +662,6 @@ namespace OASystem.API.Controllers
                     {
                         Keyword = keyword.Trim(),
                         RequireAllSingleChars = true,
-                        PageIndex = 1,
-                        PageSize = 20, // 限制返回数量,提高性能
                         FieldWeights = new Dictionary<string, int>
                             {
                                 { "TeamName", 10 },
@@ -708,8 +706,6 @@ namespace OASystem.API.Controllers
                 {
                     Keyword = keyword.Trim(),
                     RequireAllSingleChars = true,
-                    PageIndex = 1,
-                    PageSize = 20, // 限制返回数量,提高性能
                     FieldWeights = new Dictionary<string, int>
                     {
                         { "TeamName", 10 }
@@ -807,8 +803,6 @@ namespace OASystem.API.Controllers
                 {
                     Keyword = keyword,
                     RequireAllSingleChars = true,
-                    PageIndex = 1,
-                    PageSize = 30,
                     FieldWeights = new Dictionary<string, int>
                     {
                         { "TeamName", 10 },

+ 1 - 1
OASystem/OASystem.Api/OAMethodLib/GenericSearch/DynamicSearchRequest.cs

@@ -44,7 +44,7 @@
         /// <summary>
         /// 页大小
         /// </summary>
-        public int PageSize { get; set; } = 20;
+        public int PageSize { get; set; } = 9999;
 
         /// <summary>
         /// 是否要求所有单字必须完全出现(新增参数)

+ 9 - 0
OASystem/OASystem.Domain/Dtos/Groups/DecreasePaymentsDto.cs

@@ -227,4 +227,13 @@ namespace OASystem.Domain.Dtos.Groups
             return 0;
         }
     }
+
+
+    public class DecreasePaymentsExcelDownloadDto
+    {
+
+        public int GroupId { get; set; }
+
+        public int CurrUserId { get; set; }
+    }
 }

+ 1 - 1
OASystem/OASystem.Domain/Entities/Groups/Grp_GamesBudgetMaster.cs

@@ -23,7 +23,7 @@ namespace OASystem.Domain.Entities.Groups
         /// 1.世运会 2.APEC
         /// </summary>
         [SugarColumn(ColumnName = "Type", ColumnDescription = "赛事类型", IsNullable = true, ColumnDataType = "int")]
-        public int Type { get; set; }
+        public int Type { get; set; } = 2;
 
         /// <summary>
         /// 直属父级