|
@@ -15,6 +15,7 @@ using Quartz.Util;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Diagnostics;
|
|
|
using System.Net.Http.Headers;
|
|
|
+using static OpenAI.GPT3.ObjectModels.SharedModels.IOpenAiModels;
|
|
|
using static QRCoder.PayloadGenerator.SwissQrCode;
|
|
|
|
|
|
namespace OASystem.API.Controllers
|
|
@@ -1723,6 +1724,7 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
|
|
|
throw;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 公务出访操作(Status:1.新增,2.修改)
|
|
|
/// </summary>
|
|
@@ -1751,6 +1753,88 @@ 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>
|
|
|
+ /// <param name="file"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> OfficialActivitiesUploadFiles([FromForm]OfficialActivitiesUploadFilesDto dto)
|
|
|
+ {
|
|
|
+ string networkPath = AppSettingsHelper.Get("GrpFileBaseUrl");
|
|
|
+ string localPath = AppSettingsHelper.Get("GrpFileBasePath");
|
|
|
+ string ptfPath = AppSettingsHelper.Get("GrpFileFtpPath");
|
|
|
+ if (dto.diId < 1 || dto.currUserId < 1)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "参数有误,上传失败!"));
|
|
|
+ }
|
|
|
+ if (dto.files.Count < 1)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "文件为空,上传失败!"));
|
|
|
+ }
|
|
|
+
|
|
|
+ string localFileDir = $"{localPath}{ptfPath}";
|
|
|
+ string networkUrl = $"{networkPath}{ptfPath}";
|
|
|
+ List<string> fileUrls = new List<string>();
|
|
|
+ foreach (var file in dto.files)
|
|
|
+ {
|
|
|
+ //文件名称
|
|
|
+ string[] fileNameArray = file.FileName.Split(".");
|
|
|
+
|
|
|
+ string projectFileName = $"{fileNameArray[0].ToString()}{DateTime.UtcNow.ToString("yyyyMMddHHmmss")}.{fileNameArray[1].ToString()}";
|
|
|
+ //上传的文件的路径
|
|
|
+ string filePath = $@"{localPath}公务相关文件";
|
|
|
+ if (!Directory.Exists(filePath))
|
|
|
+ {
|
|
|
+ Directory.CreateDirectory(filePath);
|
|
|
+ }
|
|
|
+
|
|
|
+ var path = Path.Combine(filePath, projectFileName);
|
|
|
+ using var stream = new FileStream(path, FileMode.Create);
|
|
|
+ await file.CopyToAsync(stream);
|
|
|
+ fileUrls.Add($"/{ptfPath}公务相关文件/{projectFileName}");
|
|
|
+ }
|
|
|
+
|
|
|
+ var oaInfo = await _sqlSugar.Queryable<Res_OfficialActivities>().Where(x => x.Id == dto.id).FirstAsync();
|
|
|
+
|
|
|
+ var status = false;
|
|
|
+ var _oaInfo = new Res_OfficialActivities()
|
|
|
+ {
|
|
|
+ DiId = dto.diId,
|
|
|
+ ScreenshotOfMailUrl = JsonConvert.SerializeObject(fileUrls),
|
|
|
+ IsDel = 0,
|
|
|
+ CreateUserId = dto.currUserId,
|
|
|
+ CreateTime = DateTime.Now
|
|
|
+ };
|
|
|
+ if (oaInfo == null)
|
|
|
+ {
|
|
|
+ var id = await _sqlSugar.Insertable<Res_OfficialActivities>(_oaInfo)
|
|
|
+ .ExecuteReturnIdentityAsync();
|
|
|
+ if (id > 0)
|
|
|
+ {
|
|
|
+ status = true;
|
|
|
+ dto.id = id;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var upd = await _sqlSugar.Updateable<Res_OfficialActivities>()
|
|
|
+ .SetColumns(x => x.ScreenshotOfMailUrl == JsonConvert.SerializeObject(fileUrls))
|
|
|
+ .Where(x => x.Id == dto.id)
|
|
|
+ .ExecuteCommandAsync();
|
|
|
+
|
|
|
+ if (upd > 0) status = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (status)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(true, "操作成功!", new { id = dto.id, fileUrls = fileUrls } ));
|
|
|
+ }
|
|
|
+ return Ok(JsonView(false, "操作失败!"));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 上传文件
|
|
|
/// </summary>
|