Ver código fonte

成本添加团组搜索, 共享文件团组列表按照出访时间降序

yuanrf 2 meses atrás
pai
commit
15a69629a9

+ 155 - 99
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -42,6 +42,7 @@ using OASystem.Infrastructure.Repositories.CRM;
 using OASystem.Infrastructure.Repositories.Financial;
 using OASystem.Infrastructure.Repositories.Groups;
 using OASystem.Infrastructure.Tools;
+using OASystem.RedisRepository;
 using Org.BouncyCastle.Crypto;
 using Org.BouncyCastle.Utilities;
 using Quartz.Util;
@@ -5366,6 +5367,7 @@ FROM
             {
                 var dropDownGroupList = _sqlSugar.Queryable<Grp_DelegationInfo>()
                     .Where(x => x.IsDel == 0)
+                    .OrderByDescending(x=> x.VisitDate )
                     .Select(x => new
                     {
                         x.TeamName,
@@ -17203,6 +17205,60 @@ ORDER by  gctggrc.id DESC
             return Ok(jw);
         }
 
+
+        [HttpPost]
+        public async Task<IActionResult> SearchGroupByKeyword(SearchGroupByKeywordDto dto)
+        {
+            var jw = JsonView(true);
+
+            List<DelegationInfoAndIsTrueView> matches = new List<DelegationInfoAndIsTrueView>();
+
+            if (string.IsNullOrWhiteSpace(dto.Keyword))
+            {
+                matches = _sqlSugar.SqlQueryable<DelegationInfoAndIsTrueView>($@"
+                     Select  a.Id,TeamName GroupName,b.isTrue From  Grp_DelegationInfo  a left join  (select top 100 percent Diid, CASE 
+                      WHEN COUNT(*) >= 0 THEN 'True' 
+                      ELSE 'False' END as isTrue  from Grp_GroupCost where Isdel = 0 and date != '' group by Diid) b on a.Id = b.Diid
+                       Where TeamName != '' And IsDel = 0 Order By a.VisitStartDate Desc
+                   ")
+               .ToList();
+            }
+            else
+            {
+                string likeKey = string.Empty;
+
+                foreach (var item in dto.Keyword)
+                {
+                    likeKey += "%" + item;
+                }
+
+                likeKey += "%";
+
+                matches = _sqlSugar.SqlQueryable<DelegationInfoAndIsTrueView>($@"
+                     Select  a.Id,TeamName GroupName,b.isTrue From  Grp_DelegationInfo  a left join  (select top 100 percent Diid, CASE 
+                      WHEN COUNT(*) >= 0 THEN 'True' 
+                      ELSE 'False' END as isTrue  from Grp_GroupCost where Isdel = 0 and date != '' group by Diid) b on a.Id = b.Diid
+                       Where TeamName != '' And IsDel = 0 And TeamName LIKE '{likeKey}'   Order By a.VisitStartDate Desc
+                   ")
+               .ToList();
+            }
+
+            if (matches.Any())
+            {
+                jw.Data = matches;
+            }
+            else
+            {
+                jw.Code = 201;
+                jw.Msg = "empty list";
+                jw.Data = new List<string>(1);
+            }
+
+
+
+            return Ok(jw);
+        }
+
         #endregion
 
         #region 酒店预订 新 雷怡 2023-12-28 17:45
@@ -22955,118 +23011,118 @@ And (UnitName != '' Or UnitName != null) {sqlWhere}");
             }
         }
 
-        [HttpPost]
-        public async Task<IActionResult> ServerHttp(string paramStr)
-        {
-            paramStr = paramStr.TrimEnd('\'');
-            paramStr = paramStr.TrimStart('\'');
-            JsonView jw = JsonView(false);
-            JObject param = JObject.Parse(paramStr);
-            if (!param.ContainsKey("url"))
-            {
-                jw.Msg = "url null";
-                return Ok(jw);
-            }
+        //[HttpPost]
+        //public async Task<IActionResult> ServerHttp(string paramStr)
+        //{
+        //    paramStr = paramStr.TrimEnd('\'');
+        //    paramStr = paramStr.TrimStart('\'');
+        //    JsonView jw = JsonView(false);
+        //    JObject param = JObject.Parse(paramStr);
+        //    if (!param.ContainsKey("url"))
+        //    {
+        //        jw.Msg = "url null";
+        //        return Ok(jw);
+        //    }
 
-            string url = param["url"]!.ToString();
-            var methon = "get";
+        //    string url = param["url"]!.ToString();
+        //    var methon = "get";
 
-            Dictionary<string, string> headValues = null;
-            string bodyStr = string.Empty;
+        //    Dictionary<string, string> headValues = null;
+        //    string bodyStr = string.Empty;
 
-            if (param.ContainsKey("methon"))
-            {
-                methon = param["methon"]!.ToString().ToLower();
-            }
+        //    if (param.ContainsKey("methon"))
+        //    {
+        //        methon = param["methon"]!.ToString().ToLower();
+        //    }
 
-            if (param.ContainsKey("header"))
-            {
-                var header = param["header"]!.ToString();
-                JObject headerJobject = JObject.Parse(header);
-                headValues = new Dictionary<string, string>();
-                foreach (JProperty item in headerJobject.Properties())
-                {
-                    var value = item.Value.ToString();
-                    var head = item.Path;
-                    headValues.Add(head, value);
-                }
-            }
+        //    if (param.ContainsKey("header"))
+        //    {
+        //        var header = param["header"]!.ToString();
+        //        JObject headerJobject = JObject.Parse(header);
+        //        headValues = new Dictionary<string, string>();
+        //        foreach (JProperty item in headerJobject.Properties())
+        //        {
+        //            var value = item.Value.ToString();
+        //            var head = item.Path;
+        //            headValues.Add(head, value);
+        //        }
+        //    }
 
-            HttpClient client = new HttpClient();
-            string responseString = string.Empty;
-            StringContent content = null;
+        //    HttpClient client = new HttpClient();
+        //    string responseString = string.Empty;
+        //    StringContent content = null;
 
-            if (headValues != null)
-            {
-                foreach (var item in headValues.Keys)
-                {
-                    if (item.ToLower().Contains("content") && item.ToLower().Contains("type"))
-                    {
-                        if (param.ContainsKey("body"))
-                        {
-                            bodyStr = param["body"]!.ToString();
-                        }
-                        content = new StringContent(bodyStr, Encoding.UTF8, headValues[item]);
-                    }
-                    else
-                    {
-                        client.DefaultRequestHeaders.Add(item, headValues[item]);
-                    }
-                }
-            }
+        //    if (headValues != null)
+        //    {
+        //        foreach (var item in headValues.Keys)
+        //        {
+        //            if (item.ToLower().Contains("content") && item.ToLower().Contains("type"))
+        //            {
+        //                if (param.ContainsKey("body"))
+        //                {
+        //                    bodyStr = param["body"]!.ToString();
+        //                }
+        //                content = new StringContent(bodyStr, Encoding.UTF8, headValues[item]);
+        //            }
+        //            else
+        //            {
+        //                client.DefaultRequestHeaders.Add(item, headValues[item]);
+        //            }
+        //        }
+        //    }
 
-            try
-            {
-                if (methon == "get")
-                {
-                    responseString = await client.GetStringAsync(url);
+        //    try
+        //    {
+        //        if (methon == "get")
+        //        {
+        //            responseString = await client.GetStringAsync(url);
 
-                }
-                else if (methon == "post")
-                {
-                    var request = new HttpRequestMessage(HttpMethod.Post, url)
-                    {
-                        Content = content
-                    };
-                    var response = await client.SendAsync(request);
+        //        }
+        //        else if (methon == "post")
+        //        {
+        //            var request = new HttpRequestMessage(HttpMethod.Post, url)
+        //            {
+        //                Content = content
+        //            };
+        //            var response = await client.SendAsync(request);
 
-                    try
-                    {
-                        Stream responseStream = await response.Content.ReadAsStreamAsync();
+        //            try
+        //            {
+        //                Stream responseStream = await response.Content.ReadAsStreamAsync();
 
-                        using (GZipStream gzipStream = new GZipStream(responseStream, CompressionMode.Decompress))
-                        {
-                            using (StreamReader reader = new StreamReader(gzipStream))
-                            {
-                                responseString = await reader.ReadToEndAsync();
-                            }
-                        }
-                    }
-                    catch (Exception)
-                    {
-                        responseString = await response.Content.ReadAsStringAsync();
-                    }
+        //                using (GZipStream gzipStream = new GZipStream(responseStream, CompressionMode.Decompress))
+        //                {
+        //                    using (StreamReader reader = new StreamReader(gzipStream))
+        //                    {
+        //                        responseString = await reader.ReadToEndAsync();
+        //                    }
+        //                }
+        //            }
+        //            catch (Exception)
+        //            {
+        //                responseString = await response.Content.ReadAsStringAsync();
+        //            }
 
-                }
-                else
-                {
-                    responseString = "methon error";
-                }
+        //        }
+        //        else
+        //        {
+        //            responseString = "methon error";
+        //        }
 
-                jw = JsonView(true, "success", responseString);
-            }
-            catch (Exception ex)
-            {
-                jw.Msg = "error " + ex.Message;
-                jw.Data = ex.StackTrace;
-            }
-            finally
-            {
-                client.Dispose();
-            }
+        //        jw = JsonView(true, "success", responseString);
+        //    }
+        //    catch (Exception ex)
+        //    {
+        //        jw.Msg = "error " + ex.Message;
+        //        jw.Data = ex.StackTrace;
+        //    }
+        //    finally
+        //    {
+        //        client.Dispose();
+        //    }
 
-            return Ok(jw);
-        }
+        //    return Ok(jw);
+        //}
 
         #endregion
 

+ 5 - 0
OASystem/OASystem.Domain/Dtos/Groups/GroupCostSavaDto.cs

@@ -1374,6 +1374,11 @@ namespace OASystem.Domain.Dtos.Groups
         public string Param { get; set; }
     }
 
+    public class SearchGroupByKeywordDto
+    {
+        public string Keyword { get; set; }
+    }
+
     public class HistoryCarDataView
     {
         public int id { get; set; }