yuanrf месяцев назад: 8
Родитель
Сommit
8fe44a5ee1

+ 14 - 5
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -6734,7 +6734,7 @@ namespace OASystem.API.Controllers
         /// <param name="dto"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult ExportTravel(InitOpTravelDto dto)
+        public IActionResult ExportTravel(ExportTravelDto dto)
         {
             var jw = JsonView(false);
             int diid = 0;
@@ -6911,12 +6911,21 @@ namespace OASystem.API.Controllers
                 }
             }
             string path = savePath + Find.TeamName + "出访日程.docx";
-            string ftpPath = AppSettingsHelper.Get("WordBaseUrl") + AppSettingsHelper.Get("WordFtpPath") + "Travel/export/" + Find.TeamName + "出访日程.docx";
+            string ftpPath = AppSettingsHelper.Get("WordBaseUrl") + AppSettingsHelper.Get("WordFtpPath") + "Travel/export/" + Find.TeamName + "出访日程";
 
             try
             {
-                doc.Save(path, Aspose.Words.SaveFormat.Doc);
-                jw = JsonView(true, "导出成功", ftpPath);
+
+                Aspose.Words.SaveFormat saveFormat = Aspose.Words.SaveFormat.Doc;
+                string postfix = ".docx";
+                if (dto.IsPDF)
+                {
+                    saveFormat = Aspose.Words.SaveFormat.Pdf;
+                    postfix = ".pdf";
+                }
+
+                doc.Save(path, saveFormat);
+                jw = JsonView(true, "导出成功", ftpPath + postfix);
             }
             catch (Exception)
             {
@@ -11788,7 +11797,7 @@ ORDER by  gctggrc.id DESC
             #endregion
             if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3) // web/Android
             {
-                var res = ExportTravel(new InitOpTravelDto() { Diid = dto.diId });
+                var res = ExportTravel(new ExportTravelDto() { Diid = dto.diId });
                 return Ok(res.GetType().GetProperty("Value").GetValue(res, null));
             }
             else

+ 7 - 0
OASystem/OASystem.Domain/Dtos/Groups/CarTouristGuideGroundDto.cs

@@ -210,6 +210,13 @@ namespace OASystem.Domain.Dtos.Groups
         public int Diid { get; set;}
     }
 
+    public class ExportTravelDto
+    {
+        public int Diid { get; set; }
+
+        public bool IsPDF { get; set; } = false;
+    }
+
     public class DelOpTravelDto
     {
         public int Diid { get; set; }