Browse Source

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

LEIYI 3 days ago
parent
commit
b9de7fe9eb

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

@@ -5338,29 +5338,59 @@ FROM
         /// </summary>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult SharedFileInit()
+        public IActionResult SharedFileInit(int userid ,int portType)
         {
+
+            var marketingDepartmentIds = new List<int> { 6, 26 , 27 , 28 };
+
+            var isMarketingDepartment  = _sqlSugar.Queryable<Sys_Users>()
+                .Where(x => x.IsDel == 0 && marketingDepartmentIds.Contains(x.DepId))
+                .Select(x => x.Id)
+                .ToList()
+                .Contains(userid);
+
             var dropDownType = _sqlSugar.Queryable<Sys_SetData>()
-                .Where(x => x.STid == 111 && x.IsDel == 0)
-                .Select(x => new
-                {
-                    x.Name,
-                    x.Id,
-                }).ToList();
+                                .Where(x => x.STid == 111 && x.IsDel == 0)
+                                .Select(x => new
+                                {
+                                    x.Name,
+                                    x.Id,
+                                }).ToList();
 
-            var dropDownGroupList = _sqlSugar.Queryable<Grp_DelegationInfo>()
-                .Where(x => x.IsDel == 0)
-                .Select(x => new
-                {
-                    x.TeamName,
-                    x.Id,
-                }).ToList();
+            if (isMarketingDepartment)
+            {
+                dropDownType = dropDownType.Where(x => x.Id == 1412).ToList();
+            }
 
-            return Ok(JsonView(true, "SUCCESS!", new
+            if (portType == 1)
             {
-                dropDownType,
-                dropDownGroupList
-            }));
+                var dropDownGroupList = _sqlSugar.Queryable<Grp_DelegationInfo>()
+                    .Where(x => x.IsDel == 0)
+                    .Select(x => new
+                    {
+                        x.TeamName,
+                        x.Id,
+                    }).ToList();
+
+                return Ok(JsonView(true, "SUCCESS!", new
+                {
+                    dropDownType,
+                    dropDownGroupList,
+                    isMarketingDepartment
+                }));
+            }
+            else if (portType == 2 || portType == 3)
+            {
+                return Ok(JsonView(true, "SUCCESS!", new
+                {
+                    dropDownType,
+                    isMarketingDepartment
+                }));
+            }
+            else
+            {
+                return Ok(JsonView(false, "portType有误!"));
+            }
         }
 
         /// <summary>
@@ -5447,7 +5477,7 @@ FROM
 
             List<Grp_GroupShareFile> insertList = new List<Grp_GroupShareFile>();
 
-            string winPath = AppSettingsHelper.Get("ShareFileBasePath") + $"/{setdata.Name}/";
+            string winPath = AppSettingsHelper.Get("ShareFileBasePath") + $"{setdata.Name}/";
 
             if (!Directory.Exists(winPath))
             {
@@ -5506,20 +5536,24 @@ FROM
             var queryExpression = Expressionable.Create<Grp_GroupShareFile>()
                 .And(x => x.Diid == dto.Diid)
                 .And(x => x.FileType == dto.FileType)
-                .And(x => x.IsDel == 0);
+                .And(x => x.IsDel == 0)
+                .AndIF(!dto.FileName.IsNullOrWhiteSpace(), x => x.FileName.Contains(dto.FileName))
+                .AndIF(DateTime.TryParse(dto.StartTime, out DateTime Start), x => x.CreateTime >= Start)
+                .AndIF(DateTime.TryParse(dto.EndTime, out DateTime End), x => x.CreateTime <= End);
 
             int totalCount = 0;
             var dbQuery = _sqlSugar.Queryable<Grp_GroupShareFile>()
-                        .Where(queryExpression.ToExpression())
-                        .Select(x => new
-                        {
-                            x.Id,
-                            FilePath = AppSettingsHelper.Get("ShareFileBaseUrl") + x.FilePath.Replace(AppSettingsHelper.Get("ShareFileBasePath"), AppSettingsHelper.Get("ShareFileFtpPath")),
-                            x.FileName,
-                            x.FileType,
-                            x.CreateTime,
-                        })
-                        .ToPageList(dto.PageIndex, dto.PageSize, ref totalCount);
+                            .Where(queryExpression.ToExpression())
+                            .OrderBy(x => x.UploadJob)
+                            .Select(x => new
+                            {
+                                x.Id,
+                                FilePath = AppSettingsHelper.Get("ShareFileBaseUrl") + x.FilePath.Replace(AppSettingsHelper.Get("ShareFileBasePath"), AppSettingsHelper.Get("ShareFileFtpPath")),
+                                x.FileName,
+                                x.FileType,
+                                x.CreateTime,
+                            })
+                            .ToPageList(dto.PageIndex, dto.PageSize, ref totalCount);
 
             return Ok(JsonView(true, "SUCCESS!", new
             {
@@ -5546,6 +5580,12 @@ FROM
                 return Ok(jw);
             }
 
+            if (sing.CreateUserId != dto.UserId)
+            {
+                jw.Msg = "只能删除自己上传的文件!";
+                return Ok(jw);
+            }
+
             if (System.IO.File.Exists(sing.FilePath))
             {
                 try

+ 11 - 0
OASystem/OASystem.Domain/Dtos/FileDto/FileDto.cs

@@ -51,6 +51,12 @@ namespace OASystem.Domain.Dtos.FileDto
         public int PageIndex { get; set; }
 
         public int PageSize { get; set; }
+
+        public string FileName { get; set; }
+        
+        public string StartTime { get; set; }
+
+        public string EndTime { get; set; }
     }
 
     public class QueryGroupModelFileDto
@@ -81,4 +87,9 @@ namespace OASystem.Domain.Dtos.FileDto
         public int Id { get; set; }
         public int UserId { get; set; }
     }
+
+    public class DownSharedFileDto
+    {
+        public int Id { get; set; }
+    }
 }