Przeglądaj źródła

1、公务详情 接口修改 增加 图片相关信息
2、邀请公务 图片上传 PC 联调

LEIYI 7 miesięcy temu
rodzic
commit
a0d974b428

+ 11 - 3
OASystem/OASystem.Api/Controllers/ResourceController.cs

@@ -14,6 +14,7 @@ using Org.BouncyCastle.Utilities;
 using Quartz.Util;
 using System.Collections.Generic;
 using System.Diagnostics;
+using System.IO;
 using System.Net.Http.Headers;
 using static OpenAI.GPT3.ObjectModels.SharedModels.IOpenAiModels;
 using static QRCoder.PayloadGenerator.SwissQrCode;
@@ -1769,7 +1770,7 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
             {
                 return Ok(JsonView(false, "参数有误,上传失败!"));
             }
-            if (dto.files.Count < 1)
+            if (dto.files == null || dto.files.Count < 1)
             {
                 return Ok(JsonView(false, "文件为空,上传失败!"));
             }
@@ -1791,8 +1792,15 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
                 }
                 
                 var path = Path.Combine(filePath, projectFileName);
-                using var stream = new FileStream(path, FileMode.Create);
-                await file.CopyToAsync(stream);
+                //using var stream = new FileStream(path, FileMode.Create);
+                //await file.CopyToAsync(stream);
+
+                using (FileStream fs = System.IO.File.Create(path))
+                {
+                    file.CopyTo(fs);
+                    fs.Flush();
+                }
+
                 fileUrls.Add($"/{ptfPath}公务相关文件/{projectFileName}");
             }
 

+ 1 - 1
OASystem/OASystem.Domain/Entities/Resource/Res_OfficialActivities.cs

@@ -147,7 +147,7 @@ namespace OASystem.Domain.Entities.Resource
         /// <summary>
         /// 邮件截图
         /// </summary>
-        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(120)")]
+        [SugarColumn(IsNullable = true, ColumnDataType = "nvarchar(500)")]
         public string? ScreenshotOfMailUrl { get; set; }
     }
 }

+ 8 - 1
OASystem/OASystem.Domain/ViewModels/Resource/OfficialActivitiesView.cs

@@ -1,4 +1,5 @@
-using OASystem.Domain.Entities.Resource;
+using Newtonsoft.Json;
+using OASystem.Domain.Entities.Resource;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -9,6 +10,12 @@ namespace OASystem.Domain.ViewModels.Resource
 {
     public class OfficialActivitiesView : Res_OfficialActivities
     {
+
+        public List<string> ScreenshotOfMailUrls { get {
+
+                return !string.IsNullOrEmpty(ScreenshotOfMailUrl) ? JsonConvert.DeserializeObject<List<string>>(ScreenshotOfMailUrl):new List<string>();
+            } }
+
         public string CreateUserName { get; set; }
         public string OfficialFormName { get; set; }
     }

+ 30 - 27
OASystem/OASystem.Infrastructure/Repositories/Resource/OfficialActivitiesRepository.cs

@@ -1,6 +1,7 @@
 using AutoMapper;
 using MathNet.Numerics.Distributions;
 using MathNet.Numerics.Statistics.Mcmc;
+using Newtonsoft.Json;
 using OASystem.Domain;
 using OASystem.Domain.Dtos.Resource;
 using OASystem.Domain.Entities.Groups;
@@ -152,33 +153,35 @@ FROM
   LEFT JOIN Sys_SetData sd ON oa.OfficialForm = sd.Id
 {0}", sqlWhere);
                 var OfficialActivities = await _sqlSugar.SqlQueryable<OfficialActivitiesView>(sql)
-                    .Select(x => new {
-                        x.Id,
-                        x.Country,
-                        x.Area,
-                        x.Client,
-                        x.Date,
-                        x.Time,
-                        x.Address,
-                        x.Contact,
-                        x.Job,
-                        x.Tel,
-                        x.OfficialFormName,
-                        x.Field,
-                        x.ReqSample,
-                        x.Setting,
-                        x.Dresscode,
-                        x.Attendees,
-                        x.IsNeedTrans,
-                        x.Translators,
-                        x.Language,
-                        x.Trip,
-                        x.IsSubmitApproval,
-                        x.IsPay,
-                        x.ConfirmTheInvitation,
-                        x.ScreenshotOfMailUrl,
-                        x.CreateUserName
-                    })
+                    //.Select(x => new
+                    //{
+                    //    x.Id,
+                    //    x.Country,
+                    //    x.Area,
+                    //    x.Client,
+                    //    x.Date,
+                    //    x.Time,
+                    //    x.Address,
+                    //    x.Contact,
+                    //    x.Job,
+                    //    x.Tel,
+                    //    x.OfficialFormName,
+                    //    x.Field,
+                    //    x.ReqSample,
+                    //    x.Setting,
+                    //    x.Dresscode,
+                    //    x.Attendees,
+                    //    x.IsNeedTrans,
+                    //    x.Translators,
+                    //    x.Language,
+                    //    x.Trip,
+                    //    x.IsSubmitApproval,
+                    //    x.IsPay,
+                    //    x.ConfirmTheInvitation,
+                    //    x.ScreenshotOfMailUrl,
+                    //    x.ScreenshotOfMailUrls,
+                    //    x.CreateUserName
+                    //})
                     .FirstAsync();
                 result = new Result() { Code = 0, Msg = "查询成功!", Data = OfficialActivities };