Parcourir la source

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

yuanrf il y a 7 mois
Parent
commit
2f9a2d9579

+ 49 - 7
OASystem/OASystem.Api/Controllers/ResourceController.cs

@@ -1754,6 +1754,7 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
             return Ok(JsonView(true, groupData.Msg, groupData.Data));
 
         }
+        
         /// <summary>
         /// 上传文件(邮件截图)
         /// </summary>
@@ -1804,7 +1805,7 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
             }
 
             var oaInfo = await _sqlSugar.Queryable<Res_OfficialActivities>().Where(x => x.Id == dto.id).FirstAsync();
-
+            List<string> files = new List<string>();
             var status = false;
             var _oaInfo = new Res_OfficialActivities()
             {
@@ -1826,27 +1827,40 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
             }
             else
             {
-                var upd = await _sqlSugar.Updateable<Res_OfficialActivities>()
-                                          .SetColumns(x =>  x.ScreenshotOfMailUrl == JsonConvert.SerializeObject(fileUrls))
+
+                var oldFiles = JsonConvert.DeserializeObject<List<string>>(oaInfo.ScreenshotOfMailUrl);
+
+                if (oldFiles.Count > 0)
+                {
+                    fileUrls.AddRange(oldFiles);
+                }
+
+                fileUrls = fileUrls.Distinct().ToList();
+
+                if (oldFiles.Count()>0)
+                {
+                    var upd = await _sqlSugar.Updateable<Res_OfficialActivities>()
+                                          .SetColumns(x => x.ScreenshotOfMailUrl == JsonConvert.SerializeObject(oldFiles))
                                           .Where(x => x.Id == dto.id)
                                           .ExecuteCommandAsync();
 
-                if (upd > 0) status = true;
+                    if (upd > 0) status = true;
+                }
             }
 
+            List<string> returnFileUrls = new List<string>();
             fileUrls.ForEach(x => {
 
-                x = $"{networkPath}{x}";
+                returnFileUrls.Add( $"{networkPath}{x}");
             });
 
             if (status)
             {
-                return Ok(JsonView(true, "操作成功!", new { id = dto.id, fileUrls = fileUrls } ));
+                return Ok(JsonView(true, "操作成功!", new { id = dto.id, fileUrls = returnFileUrls } ));
             }
             return Ok(JsonView(false, "操作失败!"));
         }
 
-
         /// <summary>
         /// 删除文件(邮件截图)
         /// </summary>
@@ -1882,6 +1896,15 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
                     var updFile = urls.Remove(filePath);
                     if (updFile)
                     {
+                        //删除文件
+                        string fileUrl = AppSettingsHelper.Get("GrpFileBasePath").Replace(@"/Office/GrpFile", "") + filePath;
+
+                        if (System.IO.File.Exists(fileUrl))
+                        {
+                            System.IO.File.Delete(fileUrl);
+                        }
+
+
                         string urlJsonstr = JsonConvert.SerializeObject(urls);
                         var upd = await _sqlSugar.Updateable<Res_OfficialActivities>()
                                                  .SetColumns(x => x.ScreenshotOfMailUrl == urlJsonstr)
@@ -1895,7 +1918,26 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
             return Ok(JsonView(false, "操作失败!"));
         }
 
+        /// <summary>
+        /// 公务出访 确认、取消邀请
+        /// </summary>
+        /// <param name="file"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> OfficialActivitiesInviteOperation(OfficialActivitiesInviteOperationDto dto)
+        {
+            if (dto.Id < 1 ) return Ok(JsonView(false, "Id参数有误!"));
+            if (dto.Type < 0 || dto.Type > 1) return Ok(JsonView(false, "Type参数有误!"));
 
+            var upd = await _sqlSugar.Updateable<Res_OfficialActivities>()
+                                     .SetColumns(x => x.ConfirmTheInvitation == dto.Type)
+                                     .Where(x => x.Id == dto.Id)
+                                     .ExecuteCommandAsync();
+            if (upd > 0) return Ok(JsonView(true, "操作成功!"));
+
+            return Ok(JsonView(false, "操作失败!"));
+        }
 
         /// <summary>
         /// 上传文件

+ 10 - 0
OASystem/OASystem.Domain/Dtos/Resource/OfficialActivitiesDto.cs

@@ -151,6 +151,16 @@ namespace OASystem.Domain.Dtos.Resource
         public string FileName { get; set; }
     }
 
+    public class OfficialActivitiesInviteOperationDto
+    {
+        public int Id { get; set; }
+        /// <summary>
+        /// 邀请确认
+        /// 0 未确认 1 已确认
+        /// </summary>
+        public int Type { get; set; }
+    }
+
     /// <summary>
     /// 导出请示参数
     /// </summary>

+ 1 - 1
OASystem/OASystem.Infrastructure/Repositories/Resource/OfficialActivitiesRepository.cs

@@ -151,7 +151,7 @@ FROM
 {0}", sqlWhere);
                 var OfficialActivities = await _sqlSugar.SqlQueryable<OfficialActivitiesView>(sql)
                     .FirstAsync();
-                OfficialActivities.ScreenshotOfMailUrls.ForEach(url => { url = AppSettingsHelper.Get("GrpFileBaseUrl") + url; });
+                //OfficialActivities.ScreenshotOfMailUrls.ForEach(url => { url = AppSettingsHelper.Get("GrpFileBaseUrl") + url; });
                 result = new Result() { Code = 0, Msg = "查询成功!", Data = OfficialActivities };
 
             }