Lyyyi преди 1 месец
родител
ревизия
4259867ec8
променени са 1 файла, в които са добавени 33 реда и са изтрити 30 реда
  1. 33 30
      OASystem/OASystem.Api/Controllers/GroupsController.cs

+ 33 - 30
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -130,23 +130,13 @@ namespace OASystem.API.Controllers
         private readonly IDeepSeekService _deepSeekService;
 
         /// <summary>
-        ///初始化岗位对应负责的数据类型
+        /// 初始化岗位对应负责的数据类型
         /// 
         ///  岗位ID
-        ///  24 机票
-        ///  25 酒店
-        ///  26 签证
-        ///  27 商邀
-        ///  28 OP
+        ///  24 机票、25 酒店、26 签证、27 商邀、28 OP
         ///  
         ///  费用类型ID
-        ///  76 酒店预订	
-        ///  79 车/导游地接	
-        ///  80 签证
-        ///  81 邀请/公务活动
-        ///  82 团组客户保险
-        ///  85 机票预订
-        ///  98 其他款项
+        ///  76 酒店预订、79 车/导游地接、80 签证、81 邀请/公务活动、82 团组客户保险、85 机票预订、98 其他款项
         /// </summary>
         private readonly Dictionary<int, List<int>> _dataInit = new() {
                 { 24, new List<int> { 85 } },      // 机票 -> 机票预订
@@ -28497,6 +28487,11 @@ ORDER BY
         {
             try
             {
+                var conferenceTypeIds = new List<int>() {
+                    302,  // 成都-会务活动
+                    691   // 四川-会务活动
+                };
+
                 Grp_DelegationInfo targetGroup = null;
 
                 targetGroup = await _sqlSugar.Queryable<Grp_DelegationInfo>()
@@ -28507,7 +28502,8 @@ ORDER BY
                 {
                     targetGroup = await _sqlSugar.Queryable<Grp_DelegationInfo>()
                         .Where(x => x.IsDel == 0)
-                        .OrderByDescending(x => x.CreateTime)
+                        .Where(x => conferenceTypeIds.Contains(x.TeamDid))
+                        .OrderByDescending(x => x.VisitDate)
                         .FirstAsync();
                 }
 
@@ -28517,10 +28513,17 @@ ORDER BY
                 }
 
                 var groupList = await _sqlSugar.Queryable<Grp_DelegationInfo>()
-                    .Where(x => x.IsDel == 0)
-                    .OrderByDescending(x => x.CreateTime)
-                    .Select(x => new { x.Id, x.TeamName })
-                    .ToListAsync();
+                   .Where(x => x.IsDel == 0)
+                   .Where(x => conferenceTypeIds.Contains(x.TeamDid))
+                   .OrderByDescending(x => x.VisitDate)
+                   .Select(x => new {
+                       x.Id,
+                       x.TeamName,
+                       HasChildData = SqlFunc.Subqueryable<Grp_ConferenceProcedures>()
+                           .Where(child => child.DiId == x.Id) 
+                           .Any() // 判断子表是否存在数据
+                   })
+                   .ToListAsync();
 
                 var conferenceProceduresList = await _sqlSugar.Queryable<Grp_ConferenceProcedures>()
                     .Where(x => x.DiId == targetGroup.Id && x.IsDel == 0)
@@ -28536,19 +28539,19 @@ ORDER BY
                 }
 
                 var conferenceProceduresGroupByTitle = conferenceProceduresList
-                .GroupBy(x => x.Title)
-                .Select(x => new
-                {
-                    title = x.Key,
-                    itmes = x.Select(y => new
+                    .GroupBy(x => x.Title)
+                    .Select(x => new
                     {
-                        y.Id,
-                        y.DataDetails,
-                        y.Details,
-                        y.Remark
-                    }).ToList()
-                })
-                .ToList();
+                        title = x.Key,
+                        itmes = x.Select(y => new
+                        {
+                            y.Id,
+                            y.DataDetails,
+                            y.Details,
+                            y.Remark
+                        }).ToList()
+                    })
+                    .ToList();
 
                 var response = new
                 {