Преглед изворни кода

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

amigotrip пре 7 месеци
родитељ
комит
b0a5f6f53d

+ 70 - 11
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -4551,6 +4551,8 @@ Group by PriceType ", dto.diId);
             var jw = JsonView(false);
             var userId = dto.UserId;
             var user =  _sqlSugar.Queryable<Sys_Users>().First(x=>x.Id == userId);
+            jw.Data = System.Array.Empty<string>();
+
             if (user == null)
             {
                 jw.Msg = "暂无该用户!";
@@ -4602,7 +4604,7 @@ Group by PriceType ", dto.diId);
                     JoinType.Left, a.Id == x.DIId ,
                     JoinType.Left, b.CTable == 85 && b.CId == x.Id )
                 ).Where((x, a, b) => x.IsDel == 0 && x.CreateUserId == userId  && (b.IsAuditGM == 1 || b.IsAuditGM == 3)
-                    && a.IsDel == 0 && a.VisitDate > StartDateTime && a.VisitDate < EndDateTime && b.IsDel == 0)
+                    && a.IsDel == 0 && a.VisitDate >= StartDateTime && a.VisitDate <= EndDateTime && b.IsDel == 0)
                     .Select((x, a, b) => new
                     {
                         x.FlightsDescription,
@@ -4735,8 +4737,8 @@ Group by PriceType ", dto.diId);
                 var listHotel = _sqlSugar.Queryable<Grp_HotelReservations, Grp_DelegationInfo, Grp_CreditCardPayment>((x, a, b) => new JoinQueryInfos(
                      JoinType.Left,x.DiId == a.Id,
                      JoinType.Left,b.CTable == 76 && b.CId == x.Id  ))
-                    .Where((x, a, b) => x.IsDel == 0 && x.CreateUserId == userId && a.VisitDate > StartDateTime 
-                    && a.VisitDate < EndDateTime && a.IsDel == 0 && b.IsDel == 0 && x.CardPrice > 0).Select((x,a,b)=> new
+                    .Where((x, a, b) => x.IsDel == 0 && x.CreateUserId == userId && a.VisitDate >= StartDateTime 
+                    && a.VisitDate <= EndDateTime && a.IsDel == 0 && b.IsDel == 0 && x.CardPrice > 0).Select((x,a,b)=> new
                     {
                         a.Id,
                         a.TeamName,
@@ -4804,19 +4806,39 @@ Group by PriceType ", dto.diId);
             }
             else if (OP.Contains(userId))
             {
+                var OPList = _sqlSugar.Queryable<Grp_DelegationInfo>().Where((a) => a.IsDel == 0
+                     && a.VisitDate >= StartDateTime && a.VisitDate <= EndDateTime
+                 ).ToList();
 
+                var LvArr = _sqlSugar.Queryable<Sys_SetData>().Where(x => x.STid == 70 && x.IsDel == 0).ToList();
+
+                foreach (var groupinfo in OPList)
+                {
+                    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
+                    {
+                        groupinfo.TeamName,
+                        groupinfo.Id,
+                        chiArr = new string[] { temp },
+                        teamLvStr = teamLv.Find(x => x.Id == groupinfo.TeamLevSId)?.Name,
+                        groupinfo.VisitDate,
+                        temp,
+                        price
+                    });
+                }
 
             }
             else if (Invitation.Contains(userId))
             {
-                // 2)付费公务活动部分:¥50 / 团;
+                //2)付费公务活动部分:¥50 / 团;
                 //4)不付费公务活动部分(自己联络)额外奖励:¥200 / 团(若公务活动方与邀请方为同一机构,奖励金额为¥100 / 团);
                 //5)只发邀请的团组不付费邀请额外奖励:¥100 / 团;
                 //邀请方已授权我司签发的邀请仍按照:¥100 / 团,无额外奖励。 
                 var officialList = _sqlSugar.Queryable<Res_OfficialActivities, Grp_DelegationInfo>((x,a)=> 
                     new JoinQueryInfos(JoinType.Left,a.Id == x.DiId)
                 ).Where((x,a) => x.IsSubmitApproval == 0 && x.IsDel == 0 && a.IsDel == 0
-                    && a.VisitDate > StartDateTime && a.VisitDate < EndDateTime
+                    && a.VisitDate >= StartDateTime && a.VisitDate <= EndDateTime
                 )
                 .Select((x, a) => new
                 {
@@ -4824,7 +4846,12 @@ Group by PriceType ", dto.diId);
                     a.TeamName,
                     a.VisitDate,
                     x.CreateUserId,
-                    x.Type
+                    x.Type,
+                    a.TeamLevSId,
+                    x.Country,
+                    x.Area,
+                    x.Date,
+                    x.Client
                 })
                 .ToList();
 
@@ -4832,6 +4859,7 @@ Group by PriceType ", dto.diId);
 
                 foreach (var group in groups)
                 {
+                    var groupinfo = officialList.First(x => x.Id == group.Key);
                     var officialGroupList = group.GroupBy(d => d.CreateUserId);
                     int operUserMax = 0, operMaxCount = 0;
 
@@ -4846,23 +4874,54 @@ Group by PriceType ", dto.diId);
 
                     string temp = string.Empty;
                     bool isBasics = operUserMax == userId;
-                    var comMoney = 0;
+                    var money = 0;
 
+                    var infos = new List<string>();
                     foreach (var item in group)
                     {
+                        if (item.CreateUserId != user.Id)
+                        {
+                            continue;
+                        }
+
+                        string info = string.Empty;
                         if (item.Type == 0)
                         {
-                            comMoney += (100 + 300);
+                            money += (100 + 300);
+                            info = $"{item.Country} - {item.Area} - {item.Client} - {item.Date} 提成金额为 400";
                         }
                         else if (item.Type == 1)
                         {
-                            comMoney += 300;
+                            money += 300;
+                            info = $"{item.Country} - {item.Area} - {item.Client} - {item.Date} 提成金额为 300";
                         }
                         else if (item.Type == 2)
                         {
-                            comMoney += 200;
+                            money += 200;
+                            info = $"{item.Country} - {item.Area} - {item.Client} - {item.Date} 提成金额为 200";
                         }
+                        infos.Add(info);
                     }
+
+                    if (isBasics)
+                    {
+                        infos.Add($"{groupinfo.TeamName} 该人员{user.CnName}操作场数最多,基本提成为{150}");
+                    }
+                    else
+                    {
+                        infos.Add($"{groupinfo.TeamName} 操作场数不是最多人员,所以无基本提成");
+                    }
+
+                    resultArr.Add(new
+                    {
+                        groupinfo.TeamName,
+                        groupinfo.Id,
+                        chiArr = infos,
+                        teamLvStr = teamLv.Find(x => x.Id == groupinfo.TeamLevSId)?.Name,
+                        groupinfo.VisitDate,
+                        temp,
+                        price = money,
+                    });
                 }
             }
             else if (Visa.Contains(userId)) //签证
@@ -4873,7 +4932,7 @@ Group by PriceType ", dto.diId);
                 var whereExpression = Expressionable.Create<Grp_VisaInfo, Grp_DelegationInfo, Grp_CreditCardPayment>()
                     .And(
                         (x, a, b) => x.IsDel == 0 && x.CreateUserId == userId && (b.IsAuditGM == 1 || b.IsAuditGM == 3)
-                        && a.IsDel == 0 && a.VisitDate > StartDateTime && a.VisitDate < EndDateTime && b.IsDel == 0 && x.IsThird == 0 && x.PassengerType == 974
+                        && a.IsDel == 0 && a.VisitDate >= StartDateTime && a.VisitDate <= EndDateTime && b.IsDel == 0 && x.IsThird == 0 && x.PassengerType == 974
                     );
                 var listVisa = _sqlSugar.Queryable<Grp_VisaInfo, Grp_DelegationInfo, Grp_CreditCardPayment>((x, a, b) => new
                     JoinQueryInfos(

+ 2 - 0
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -3702,6 +3702,8 @@ namespace OASystem.API.Controllers
                 .Where(expression.ToExpression())
                 .ToList();
 
+            //.ToPageList(pagenumber, pageSize, ref totalCount, ref totalPage)
+
             return Ok(JsonView(true, "success", dbQuery.Select(x => new
             {
                 x.FileName,

+ 1 - 0
OASystem/OASystem.Domain/Entities/Resource/Res_OfficialActivities.cs

@@ -18,6 +18,7 @@ namespace OASystem.Domain.Entities.Resource
         public int DiId { get; set; }
 
         /// <summary>
+        /// 0带公务 1不带公务 2纯公务
         /// 邀请方 1  公务方 0 
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "int")]