瀏覽代碼

Merge branch 'develop' of http://132.232.92.186:3000/XinXiBu/OA2023 into develop

amigotrip 9 月之前
父節點
當前提交
c84d134584

+ 78 - 32
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -4592,7 +4592,7 @@ Group by PriceType ", dto.diId);
             //主管职位
             //string[] Manager = { "149", "283" };
 
-            ArrayList resultArr = new ArrayList();
+            List<ComputeRoyaltiesView> resultArr = new List<ComputeRoyaltiesView>();
 
             var teamLv = _sqlSugar.Queryable<Sys_SetData>().Where(x => x.STid == 56 && x.IsDel == 0).ToList();
 
@@ -4719,14 +4719,14 @@ Group by PriceType ", dto.diId);
                     }
                     var groupinfo = listAir.First(x => x.Id == airArr.Key);
                     string temp = "本团人数" + Convert.ToInt32(groupinfo.VisitPNumber) + ",该人员" + user.CnName + "共订航段数" + groupAirCount.ToString() + ",每程航班提成为10元," + user.CnName + "提成共" + (groupAirCount * 10).ToString("#0.00");
-                    resultArr.Add(new
+                    resultArr.Add(new ComputeRoyaltiesView
                     {
-                        groupinfo.TeamName,
-                        groupinfo.Id,
+                        TeamName = groupinfo.TeamName,
+                        Id = groupinfo.Id,
                         chiArr = infos,
                         teamLvStr = teamLv.Find(x=>x.Id == groupinfo.TeamLevSId)?.Name,
-                        groupinfo.VisitDate,
-                        temp,
+                        VisitDate = groupinfo.VisitDate,
+                        temp = temp,
                         price = (groupAirCount * 10),
                     }) ;
                 }
@@ -4791,14 +4791,14 @@ Group by PriceType ", dto.diId);
 
                     var groupinfo = listHotel.First(x => x.Id == group.Key);
                     var temp = "本团人数" + groupinfo.VisitPNumber + ",该人员" + user.CnName + "共操作酒店晚数" + totalPrice / 10 + ",每间每晚提成10元," + user.CnName + "提成共" + totalPrice.ToString("#0.00") + "元";
-                    resultArr.Add(new
+                    resultArr.Add(new ComputeRoyaltiesView
                     {
-                        groupinfo.TeamName,
-                        groupinfo.Id,
+                        TeamName = groupinfo.TeamName,
+                        Id =  groupinfo.Id,
                         chiArr = infos,
                         teamLvStr = teamLv.Find(x => x.Id == groupinfo.TeamLevSId)?.Name,
-                        groupinfo.VisitDate,
-                        temp,
+                        VisitDate =  groupinfo.VisitDate,
+                        temp = temp,
                         price = totalPrice,
                     });
                 }
@@ -4816,15 +4816,15 @@ Group by PriceType ", dto.diId);
                 {
                     var price = LvArr.Find(x => x.Id == groupinfo.OpRoyaltyLv)?.Name.ObjToInt() ?? 0;
                     string temp = $"本团等级为{teamLv.Find(x => x.Id == groupinfo.TeamLevSId)?.Name} 提成金额为{price} {(string.IsNullOrWhiteSpace(groupinfo.OpRoyaltyRemark) ? "" : "提成说明:" + groupinfo.OpRoyaltyRemark )}";
-                    resultArr.Add(new
+                    resultArr.Add(new ComputeRoyaltiesView
                     {
-                        groupinfo.TeamName,
-                        groupinfo.Id,
-                        chiArr = new string[] { temp },
+                        TeamName = groupinfo.TeamName,
+                        Id = groupinfo.Id,
+                        chiArr = new ArrayList (){ temp },
                         teamLvStr = teamLv.Find(x => x.Id == groupinfo.TeamLevSId)?.Name,
-                        groupinfo.VisitDate,
-                        temp,
-                        price
+                        VisitDate = groupinfo.VisitDate,
+                        temp = temp,
+                        price = price
                     });
                 }
 
@@ -4876,7 +4876,7 @@ Group by PriceType ", dto.diId);
                     bool isBasics = operUserMax == userId;
                     var money = 0;
 
-                    var infos = new List<string>();
+                    var infos = new ArrayList();
                     foreach (var item in group)
                     {
                         if (item.CreateUserId != user.Id)
@@ -4912,14 +4912,14 @@ Group by PriceType ", dto.diId);
                         infos.Add($"{groupinfo.TeamName} 操作场数不是最多人员,所以无基本提成");
                     }
 
-                    resultArr.Add(new
+                    resultArr.Add(new ComputeRoyaltiesView
                     {
-                        groupinfo.TeamName,
-                        groupinfo.Id,
+                        TeamName = groupinfo.TeamName,
+                        Id =  groupinfo.Id,
                         chiArr = infos,
                         teamLvStr = teamLv.Find(x => x.Id == groupinfo.TeamLevSId)?.Name,
-                        groupinfo.VisitDate,
-                        temp,
+                        VisitDate = groupinfo.VisitDate,
+                        temp =  temp,
                         price = money,
                     });
                 }
@@ -4980,18 +4980,18 @@ Group by PriceType ", dto.diId);
                    
                     string temp  = "本团人数" + groupinfo.VisitPNumber + ",该人员" + user.CnName + "共办理英国、加拿大、美国签证" + (singlePrice == 50 ? count : 0).ToString() + "本护照(包含免签人员),申根国家及其他所有国家" + (singlePrice == 30 ? count : 0).ToString() + "本。" + user.CnName + "提成共" + money.ToString("#0.00") + "元";
 
-                    resultArr.Add(new
+                    resultArr.Add(new ComputeRoyaltiesView
                     {
-                        groupinfo.TeamName,
-                        groupinfo.Id,
+                        TeamName =  groupinfo.TeamName,
+                        Id = groupinfo.Id,
                         chiArr = arr,
                         teamLvStr = teamLv.Find(x => x.Id == groupinfo.TeamLevSId)?.Name,
-                        groupinfo.VisitDate,
-                        temp,
+                        VisitDate =  groupinfo.VisitDate,
+                        temp =  temp,
                         price = money,
                     });
                 }
-
+                    
             }
 
             if (resultArr.Count > 0)
@@ -5001,8 +5001,9 @@ Group by PriceType ", dto.diId);
                 decimal total = 0;
                 foreach (var item in resultArr)
                 {
-                    var number = item.GetType().GetProperty("price")?.GetValue(item)?.ToString();
-                    total += decimal.TryParse(number,out decimal numberInt) ? numberInt : 0.00M;
+                    //var number = item.GetType().GetProperty("price")?.GetValue(item)?.ToString();
+                    //total += decimal.TryParse(number,out decimal numberInt) ? numberInt : 0.00M;
+                    total += item.price;
                 }
 
                 jw.Data = new
@@ -5019,6 +5020,51 @@ Group by PriceType ", dto.diId);
             return Ok(jw);
         
         }
+
+        /// <summary>
+        /// 导出提成表格
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult ExportRoyaltyExcel(ExportRoyaltyExcelDto dto)
+        {
+            var jw = JsonView(false);
+
+            var apiResult = ComputeRoyalties(new
+                 ComputeRoyaltiesDto
+            {
+                EndDate = dto.EndDate,
+                StartDate = dto.StartDate,
+                UserId = dto.UserId,
+            });
+
+            var parseApiResult =  ((apiResult as OkObjectResult)?.Value) as OASystem.Domain.ViewModels.JsonView;
+
+            if (parseApiResult != null && parseApiResult.Code == 200)
+            {
+                var apiArr = (parseApiResult.Data?.GetType().GetProperty("resultArr")?.GetValue(parseApiResult.Data)) as List<ComputeRoyaltiesView>;
+
+                if (apiArr != null && apiArr.Count > 0)
+                {
+                    //打开excel模板
+                    foreach (var item in apiArr)
+                    {
+                        //载入数据
+                    }
+
+                    jw = JsonView(true, "success!", new
+                    {
+                        Url = "",
+                    });
+                }
+            }
+            else
+            {
+                jw.Msg = "获取提成信息error";
+            }
+
+            return Ok(jw);
+        }
         #endregion
     }
 }

+ 17 - 0
OASystem/OASystem.Domain/Dtos/Financial/ComputeRoyaltiesDto.cs

@@ -1,4 +1,5 @@
 using System;
+using System.Collections;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -14,4 +15,20 @@ namespace OASystem.Domain.Dtos.Financial
         public string EndDate { get; set; }
 
     }
+
+    public class ExportRoyaltyExcelDto : ComputeRoyaltiesDto
+    {
+
+    }
+
+    public class ComputeRoyaltiesView
+    {
+        public decimal price { get; set; }
+        public string TeamName { get; set; }
+        public int Id { get; set; }
+        public ArrayList chiArr { get; set; }
+        public string? teamLvStr { get; set; }
+        public DateTime VisitDate { get; set; }
+        public string temp { get; set; }
+    }
 }