|
@@ -1778,6 +1778,7 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
|
|
|
|
|
|
string localFileDir = $"{localPath}{ptfPath}";
|
|
|
List<string> fileUrls = new List<string>();
|
|
|
+ string[] failFiles = new string[] { };
|
|
|
foreach (var file in dto.files)
|
|
|
{
|
|
|
//文件名称
|
|
@@ -1794,14 +1795,20 @@ 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 (FileStream fs = System.IO.File.Create(path))
|
|
|
+ try
|
|
|
{
|
|
|
- file.CopyTo(fs);
|
|
|
- fs.Flush();
|
|
|
+ using (FileStream fs = System.IO.File.Create(path))
|
|
|
+ {
|
|
|
+ file.CopyTo(fs);
|
|
|
+ fs.Flush();
|
|
|
+ }
|
|
|
+ fileUrls.Add($"/{ptfPath}公务相关文件/{projectFileName}");
|
|
|
}
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
|
|
|
- fileUrls.Add($"/{ptfPath}公务相关文件/{projectFileName}");
|
|
|
+ failFiles.Append(file.FileName);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
var oaInfo = await _sqlSugar.Queryable<Res_OfficialActivities>().Where(x => x.Id == dto.id).FirstAsync();
|
|
@@ -1858,7 +1865,17 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
|
|
|
|
|
|
if (status)
|
|
|
{
|
|
|
- return Ok(JsonView(true, "操作成功!", new { id = dto.id, fileUrls = returnFileUrls } ));
|
|
|
+ string msg = "操作成功!";
|
|
|
+ if (failFiles.Length > 1)
|
|
|
+ {
|
|
|
+ foreach (var item in failFiles)
|
|
|
+ {
|
|
|
+ msg += $"{failFiles}、";
|
|
|
+ }
|
|
|
+ msg = msg.Substring(0, msg.Length - 1);
|
|
|
+ msg += "等文件保存失败!";
|
|
|
+ }
|
|
|
+ return Ok(JsonView(true, msg, new { id = dto.id, fileUrls = returnFileUrls } ));
|
|
|
}
|
|
|
return Ok(JsonView(false, "操作失败!"));
|
|
|
}
|