Browse Source

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

yuanrf 8 months ago
parent
commit
7ee6c8d782

+ 18 - 13
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -88,6 +88,7 @@ using Microsoft.AspNetCore.WebUtilities;
 using K4os.Compression.LZ4.Internal;
 using static Pipelines.Sockets.Unofficial.SocketConnection;
 using System.Diagnostics.PerformanceData;
+using System.Drawing.Printing;
 
 namespace OASystem.API.Controllers
 {
@@ -11376,7 +11377,6 @@ ORDER by  gctggrc.id DESC
 
         #endregion
 
-
         #region 下载匹配op行程单
         /// <summary>
         /// 匹配op行程单
@@ -11623,20 +11623,23 @@ ORDER by  gctggrc.id DESC
 
                 if (!string.IsNullOrEmpty(dto.Country))
                 {
-                    _view = _view.Where(x => x.VisitCountry != null && x.VisitCountry.Contains(dto.Country)).ToList();
+                    _view = _view.Where(x => !string.IsNullOrEmpty(x.VisitCountry) && x.VisitCountry.Contains(dto.Country)).ToList();
                 }
 
                 if (!string.IsNullOrEmpty(dto.Area))
                 {
-                    _view = _view.Where(x => x.RouteCity != null && x.RouteCity.Contains(dto.Area)).ToList();
+                    _view = _view.Where(x => !string.IsNullOrEmpty(x.RouteCity) && x.RouteCity.Contains(dto.Area)).ToList();
                 }
 
                 if (!string.IsNullOrEmpty(dto.TeamName))
                 {
-                    _view = _view.Where(x => x.TeamName != null && x.TeamName.Contains(dto.TeamName)).ToList();
+                    _view = _view.Where(x => !string.IsNullOrEmpty(x.TeamName) && x.TeamName.Contains(dto.TeamName)).ToList();
                 }
+                int startIndex = (dto.PageIndex - 1) * dto.PageSize; // 计算开始的索引
+                int endIndex = startIndex + dto.PageSize - 1; // 计算结束的索引
+                var _view1 = _view.Skip(startIndex).Take(endIndex).ToList();
                 swatch.Stop();
-                return Ok(JsonView(true, $"查询成功!耗时 {swatch.ElapsedMilliseconds} ms", _view.Skip(dto.PageIndex).Take(dto.PageSize).ToList(), _view.Count));
+                return Ok(JsonView(true, $"查询成功!耗时 {swatch.ElapsedMilliseconds} ms", _view1, _view.Count));
             }
             else
             {
@@ -12130,11 +12133,13 @@ And (UnitName != '' Or UnitName != null) {sqlWhere}");
             var watch = new Stopwatch();
             watch.Start();
             RefAsync<int> total = 0;
-            var countyDatas = await _sqlSugar.Queryable<Grp_DelegationInfo>()
-                                             .Where(it => it.IsDel == 0)
-                                             .WhereIF(!string.IsNullOrEmpty(dto.Search), it => it.TeamName.Contains(dto.Search))
-                                             .OrderBy(it => new { JietuanTime = SqlFunc.Desc(it.JietuanTime) })
-                                             .Select(it => new { id = it.Id, name = it.TeamName })
+            var countyDatas = await _sqlSugar.Queryable<Res_OfficialActivities>()
+                                             .InnerJoin<Grp_DelegationInfo>((oa,di) => oa.DiId == di.Id)
+                                             .Where((oa, di) => oa.IsDel == 0)
+                                             .WhereIF(!string.IsNullOrEmpty(dto.Search), (oa, di) => di.TeamName.Contains(dto.Search))
+                                             .OrderBy((oa, di) => new { id = SqlFunc.Desc(di.Id) })
+                                             .Select((oa, di) => new { id = di.Id, name = di.TeamName })
+                                             .Distinct()
                                              .ToPageListAsync(dto.PageIndex, dto.PageSize, total);
             watch.Stop();
 
@@ -12157,10 +12162,9 @@ And (UnitName != '' Or UnitName != null) {sqlWhere}");
             var infos = await _sqlSugar.Queryable<GroupLinkInvitingPageListView>()
                                              .AS("Grp_DelegationInfo")
                                              .Includes(x => x.InvitingInfos)
-                                             .Where(x => x.IsDel == 0)
-                                             .Where(x => x.InvitingInfos.Any(z => z.IsDel == 0))
+                                             .Where(x => x.IsDel == 0 && x.InvitingInfos.Any(z => z.IsDel == 0))
                                              .WhereIF(!string.IsNullOrEmpty(dto.Counrty), x => x.VisitCountry.Contains(dto.Counrty))
-                                             .WhereIF(!string.IsNullOrEmpty(dto.Area), x => x.InvitingInfos.Any(z => z.Area.Contains(dto.Area))) //TeamName
+                                             .WhereIF(!string.IsNullOrEmpty(dto.Area), x => x.InvitingInfos.Any(z => z.Area.Contains(dto.Area))) //
                                              .WhereIF(!string.IsNullOrEmpty(dto.TeamName), x => x.TeamName.Contains(dto.TeamName)) //
                                              .WhereIF(!string.IsNullOrEmpty(dto.UnitName), x => x.InvitingInfos.Any(z => z.Client.Contains(dto.UnitName)))
                                              .OrderBy(x => new { JietuanTime = SqlFunc.Desc(x.VisitStartDate) })
@@ -12171,6 +12175,7 @@ And (UnitName != '' Or UnitName != null) {sqlWhere}");
                 x.TeamDid = setDatas.Find(y => int.Parse(x.TeamDid) == y.Id)?.Name ?? "-";
                 x.JietuanOperator = userDatas.Find(y => int.Parse(x.JietuanOperator) == y.Id)?.CnName ?? "-";
                 x.TeamLevSId = setDatas.Find(y => int.Parse(x.TeamLevSId) == y.Id)?.Name ?? "-";
+                x.InvitingInfos = x.InvitingInfos.Where(it => it.IsDel == 0).ToList();
             });
 
             watch.Stop();

+ 1 - 0
OASystem/OASystem.Domain/ViewModels/Groups/GroupLinkInvitingView.cs

@@ -66,6 +66,7 @@ namespace OASystem.Domain.ViewModels.Groups
         [Navigate(NavigateType.OneToMany, nameof(Res_OfficialActivities.DiId), nameof(Id))]
         public List<InvitingInfo> InvitingInfos { get; set; }
 
+
     }
 
     [SugarTable("Res_OfficialActivities")]