Преглед изворни кода

新增团组签证资料下载功能及优化代码结构

- 在 GroupsController.cs 中新增 VisaProcessDownload 方法:
  实现生成团组签证相关资料并打包下载的功能。
- 在 GeneralMethod.cs 中新增动态生成 Word 表格的通用方法:
  支持生成酒店和航班信息表格,包含分页和样式设置。
- 优化 SQL 查询逻辑,调整 OrderBy 和 Where 子句格式。
- 调整 JSON 返回结构,优化前端数据展示。
- 更新 Grp_VisaProcessSteps.cs 中的 URL 路径。
- 新增 TourClientInfosView 视图模型,扩展客户信息查询。
- 优化客户信息加密、解密及公司信息去重逻辑。
- 修复代码格式问题,删除未使用的命名空间引用。
Lyyyi пре 19 часа
родитељ
комит
9a68fe11a3

+ 186 - 3
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -49,6 +49,7 @@ using System.Text.RegularExpressions;
 using System.Web;
 using static OASystem.API.OAMethodLib.JWTHelper;
 using static OASystem.Infrastructure.Repositories.Groups.AirTicketResRepository;
+using static OpenAI.GPT3.ObjectModels.SharedModels.IOpenAiModels;
 using Bookmark = Aspose.Words.Bookmark;
 using Cell = Aspose.Words.Tables.Cell;
 using Table = Aspose.Words.Tables.Table;
@@ -27272,15 +27273,18 @@ ORDER BY
                 .Select((x, y) => new 
                 {
                     y.Id,
-                    GroupName = y.TeamName
+                    GroupName = y.TeamName,
+                    y.VisitDate
                 })
+                .Distinct()
                 .ToPageListAsync(pageIndex, pageSize, total);
 
             var msg = "SUCCESS";
             if (total <= 0) msg = "暂无可操作的团组,请联系经理分配团组!";
 
+            var groups1 = groups.Select(x => new { x.Id, x.GroupName }).ToList();
 
-            return Ok(JsonView(true, msg, groups, total));
+            return Ok(JsonView(true, msg, groups1, total));
         }
 
         /// <summary>
@@ -27393,7 +27397,6 @@ ORDER BY
             //验证文件是否存在
             if (dto.Files == null || dto.Files.Count < 1) return Ok(JsonView(false, "请选择文件。"));
 
-
             //验证该步骤是否可以上传文件
             var uploadSteps = new List<int>() { 
                 5, //实际出签时间
@@ -27468,6 +27471,186 @@ ORDER BY
             return Ok(JsonView(true));
         }
 
+
+        /// <summary>
+        /// 团组签证流程 - step 7 资料下载
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public async Task<IActionResult> VisaProcessDownload(int groupId)
+        {
+            //验证根目录
+            string rootRrl = AppSettingsHelper.Get("OfficeBaseUrl");
+            string rootPath = AppSettingsHelper.Get("OfficeTempBasePath");
+            if (!System.IO.Directory.Exists(rootPath))
+            {
+                System.IO.Directory.CreateDirectory(rootPath);
+            }
+
+            //验证签证流程上传文件夹 //按照团组名称存储文件夹 GrpFile/VisaProcessFiles/
+            var groupName = await _sqlSugar.Queryable<Grp_DelegationInfo>()
+                .Where(x => x.IsDel == 0 && x.Id == groupId)
+                .Select(x => $"{x.TeamName}({x.Id})")
+                .FirstAsync();
+
+            //创建团组文件夹
+            var timestamp = DateTime.Now.ToString("yyyyMMddHHmmss");
+            var randomStr = Guid.NewGuid().ToString("N").Substring(0, 8);
+            var dirName = $"{groupName}_相关资料_{timestamp}";
+            var sourceDirectoryPath = $"{rootPath}/GrpFile/VisaProcessFiles/{groupName}";
+            var path = $"{rootPath}/GrpFile/VisaProcessFiles/{groupName}/{dirName}";
+
+            if (!System.IO.Directory.Exists(path))
+
+            {
+                System.IO.Directory.CreateDirectory(path);
+            }
+
+            //验证接团客户名单
+            string sql = string.Format(@"
+SELECT
+  tcl.Id,
+  tcl.DiId,
+  tcl.IsAccompany,
+  temp.*,
+  u.CnName AS Operator,
+  tcl.CreateTime AS OperatingTime,
+  ssd.name AS ShippingSpaceType
+FROM
+  Grp_TourClientList tcl
+  LEFT JOIN (
+    SELECT
+      dc.Id AS DcId,
+      dc.LastName,
+      dc.FirstName,
+      ccom.CompanyFullName,
+      dc.Job,
+      cc.CertNo AS IDCardNo,
+      dc.Sex,
+      dc.BirthDay
+    FROM
+      Crm_DeleClient dc
+      LEFT JOIN Crm_CustomerCompany ccom ON dc.CrmCompanyId = ccom.Id
+      AND ccom.IsDel = 0
+      LEFT JOIN Crm_CustomerCert cc ON dc.Id = cc.DcId
+      AND cc.SdId = 773
+      AND cc.IsDel = 0
+    WHERE
+      dc.IsDel = 0
+  ) temp ON temp.DcId = tcl.ClientId
+  LEFT JOIN Sys_Users u ON tcl.CreateUserId = u.Id
+  LEFT JOIN sys_setdata ssd ON ssd.isdel = 0 AND ssd.id = tcl.ShippingSpaceTypeid
+WHERE
+  tcl.IsDel = 0
+  AND tcl.DiId = {0}", groupId);
+            var groupClientList = await _sqlSugar.SqlQueryable<TourClientInfosView>(sql).ToListAsync();
+
+            //解密
+            foreach (var item in groupClientList)
+            {
+                EncryptionProcessor.DecryptProperties(item);
+            }
+
+            if (groupClientList == null || groupClientList.Count < 1)
+            {
+                return Ok(JsonView(false, $"团组客户名单未录入客户信息,不可生成相关资料。"));
+            }
+
+
+            #region 生成文件
+
+            //酒店信息
+            var hotelInfos = await _sqlSugar.Queryable<Grp_HotelReservations>()
+                    .Where(x => x.IsDel == 0 && x.DiId == groupId)
+                    .OrderBy(x => x.CheckInDate)
+                    .ToListAsync();
+
+            //航班信息
+            var airInfos = await _sqlSugar.Queryable<Grp_AirTicketReservations>()
+                    .Where(x => x.IsDel == 0 && x.DIId == groupId)
+                    .OrderBy(x => x.FlightsDate)
+                    .ToListAsync();
+
+            foreach (var clientInfo in groupClientList)
+            {
+                var clientId = clientInfo.DcId;
+                var guestName = $"{clientInfo.LastName}{clientInfo.FirstName}";
+                #region 个人信息资料
+
+                #endregion
+
+                #region 机票航班信息
+                var clientAirInfos = airInfos.Where(x => x.ClientName.Contains(clientId.ToString())).ToList();
+
+                if (clientAirInfos != null && clientAirInfos.Count > 0)
+                {
+                    //创建表格
+                    Document airDoc = new Document();
+                    DocumentBuilder airBuilder = new DocumentBuilder(airDoc);
+
+                    GeneralMethod.SetupDocumentStyles(airBuilder);
+
+                    GeneralMethod.AddTitle(airBuilder, $"{guestName} - 机票信息");
+
+                    GeneralMethod.AddAirInfoSections(airBuilder, clientAirInfos, "机票航班信息");
+
+                    var airRandomStr = Guid.NewGuid().ToString("N").Substring(0, 8);
+                    var airFileName = $"{guestName}_机票信息_{airRandomStr}.docx";
+                    airDoc.Save($"{path}/{airFileName}");
+                }
+                #endregion
+
+                #region 酒店信息
+
+                var clientHotelInfos = hotelInfos.Where(x => x.GuestName.Contains(clientId.ToString())).ToList();
+
+                if (clientHotelInfos != null && clientHotelInfos.Count > 0)
+                {
+                    //创建表格
+                    Document hotelDoc = new Document();
+                    DocumentBuilder HotelBuilder = new DocumentBuilder(hotelDoc);
+
+                    GeneralMethod.SetupDocumentStyles(HotelBuilder);
+
+                    GeneralMethod.AddTitle(HotelBuilder, $"{guestName} - 酒店信息");
+
+                    GeneralMethod.AddHotelInfoSections(HotelBuilder, clientHotelInfos, "酒店信息");
+
+                    var hotelRandomStr = Guid.NewGuid().ToString("N").Substring(0, 8);
+                    var hotelFileName = $"{guestName}_酒店信息_{hotelRandomStr}.docx";
+                    hotelDoc.Save($"{path}/{hotelFileName}");
+                }
+
+                #endregion
+            }
+
+            #endregion
+
+            //打包文件夹
+            var sourceDirectory = $"{sourceDirectoryPath}/{dirName}";
+            var zipFilePath = $"{sourceDirectoryPath}/{dirName}.zip";
+            if (System.IO.File.Exists(zipFilePath))
+            {
+                System.IO.File.Delete(zipFilePath);
+            }
+
+            ZipFile.CreateFromDirectory(sourceDirectory, zipFilePath, CompressionLevel.Fastest, false);
+
+            // 等待并验证
+            await Task.Delay(300); // 给系统时间完成文件操作
+
+            if (System.IO.File.Exists(zipFilePath))
+            {
+                var fileInfo = new FileInfo(zipFilePath);
+
+                var url = $"{rootRrl}GrpFile/VisaProcessFiles/{groupName}/{dirName}.zip";
+
+                return Ok(JsonView(url));
+            }
+
+            return Ok(JsonView(false));
+        }
+
         #endregion
 
         /// <summary>

+ 303 - 1
OASystem/OASystem.Api/OAMethodLib/GeneralMethod.cs

@@ -3,9 +3,12 @@ using Aspose.Cells;
 using Aspose.Words;
 using Aspose.Words.Layout;
 using Aspose.Words.Saving;
+using Aspose.Words.Tables;
+using Dm.util;
 using Microsoft.AspNetCore.SignalR;
 using Microsoft.International.Converters.PinYinConverter;
 using NodaTime;
+using NPOI.OpenXmlFormats.Vml;
 using OASystem.API.OAMethodLib.File;
 using OASystem.API.OAMethodLib.Hub.HubClients;
 using OASystem.API.OAMethodLib.Hub.Hubs;
@@ -20,6 +23,7 @@ using OASystem.Domain.Entities.Groups;
 using OASystem.Domain.ViewModels.Financial;
 using OASystem.Domain.ViewModels.Groups;
 using OASystem.Domain.ViewModels.JuHeExchangeRate;
+using OASystem.Domain.ViewModels.Statistics;
 using OASystem.Infrastructure.Repositories.CRM;
 using OASystem.Infrastructure.Repositories.Groups;
 using System.Data;
@@ -5820,7 +5824,6 @@ namespace OASystem.API.OAMethodLib
         #endregion
         #endregion
 
-
         #region Excel导出服务
         #region 类
         public class FileExportSettings
@@ -6213,7 +6216,306 @@ namespace OASystem.API.OAMethodLib
 
         #endregion
 
+        #region 动态构架word表格
+
+        /// <summary>
+        /// 设置表格样式
+        /// </summary>
+        /// <param name="builder"></param>
+        public static void SetupDocumentStyles(DocumentBuilder builder)
+        {
+            builder.Font.Name = "微软雅黑";
+            builder.Font.Size = 10;
+            builder.ParagraphFormat.SpaceAfter = 0;
+        }
+
+        /// <summary>
+        /// 添加标题
+        /// </summary>
+        /// <param name="builder"></param>
+        /// <param name="title"></param>
+        public static void AddTitle(DocumentBuilder builder, string title)
+        {
+            // 主标题
+            builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
+            builder.Font.Size = 16;
+            builder.Font.Bold = true;
+            builder.Font.Color = System.Drawing.Color.DarkBlue;
+            builder.Writeln(title);
+
+            // 空行
+            builder.ParagraphFormat.Alignment = ParagraphAlignment.Left;
+            builder.Font.Size = 10;
+            builder.Font.Bold = false;
+            builder.Font.Color = System.Drawing.Color.Black;
+            builder.Writeln();
+        }
+
+        /// <summary>
+        /// 生成酒机票表格信息
+        /// </summary>
+        /// <param name="builder"></param>
+        /// <param name="airInfos"></param>
+        /// <param name="footerText"></param>
+        public static void AddAirInfoSections(DocumentBuilder builder, List<Grp_AirTicketReservations> airInfos, string? footerText)
+        {
+            if (airInfos == null || !airInfos.Any())
+            {
+                builder.Writeln("暂无机票航班信息。");
+                return;
+            }
+
+            int airCount = 0;
+            const int maxAirPerPage = 3; // 每页最多显示3个酒店,确保有足够空间
+
+            for (int i = 0; i < airInfos.Count; i++)
+            {
+                var info = airInfos[i];
+
+                // 检查是否需要分页
+                if (airCount > 0 && airCount > maxAirPerPage)
+                {
+                    builder.InsertBreak(BreakType.PageBreak);
+                    airCount = 0;
+                }
+
+                airCount++;
+
+                // 为每个酒店创建详细信息表格
+                CreateAirDetailTable(builder, info);
+
+                // 酒店之间添加间距,但不是最后一个
+                if (i < airInfos.Count() - 1)
+                {
+                    AddSpacingBetweenHotels(builder);
+                }
+
+                // 检查是否达到每页最大酒店数量
+                if (airCount >= maxAirPerPage && (i < airInfos.Count - 1 || i < airInfos.Count() - 1))
+                {
+                    builder.InsertBreak(BreakType.PageBreak);
+                    airCount = 0;
+                }
+            }
+
+            if (!string.IsNullOrEmpty(footerText))
+            {
+                AddFooter(builder, footerText);
+            }
+        }
+
+
+        /// <summary>
+        /// 生成酒店表格信息
+        /// </summary>
+        /// <param name="builder"></param>
+        /// <param name="hotelInfos"></param>
+        /// <param name="footerText"></param>
+        public static void AddHotelInfoSections(DocumentBuilder builder, List<Grp_HotelReservations> hotelInfos, string? footerText)
+        {
+            if (hotelInfos == null || !hotelInfos.Any())
+            {
+                builder.Writeln("暂无酒店信息");
+                return;
+            }
+
+            int hotelCount = 0;
+            const int maxHotelsPerPage = 3; // 每页最多显示3个酒店,确保有足够空间
+
+            for (int i = 0; i < hotelInfos.Count; i++)
+            {
+                var info = hotelInfos[i];
+
+                // 检查是否需要分页
+                if (hotelCount > 0 && hotelCount > maxHotelsPerPage)
+                {
+                    builder.InsertBreak(BreakType.PageBreak);
+                    hotelCount = 0;
+                }
+
+                hotelCount++;
+
+                AddCityHeader(builder, info.City);
+
+                // 为每个酒店创建详细信息表格
+                CreateHotelDetailTable(builder, info);
+
+                // 酒店之间添加间距,但不是最后一个
+                if (i < hotelInfos.Count() - 1)
+                {
+                    AddSpacingBetweenHotels(builder);
+                }
+
+                // 检查是否达到每页最大酒店数量
+                if (hotelCount >= maxHotelsPerPage && (i < hotelInfos.Count - 1 || i < hotelInfos.Count() - 1))
+                {
+                    builder.InsertBreak(BreakType.PageBreak);
+                    hotelCount = 0;
+                }
+            }
+
+            if (!string.IsNullOrEmpty(footerText))
+            {
+                AddFooter(builder, footerText);
+            }
+        }
+
+        private static void AddSpacingBetweenHotels(DocumentBuilder builder)
+        {
+            builder.Writeln();
+            builder.InsertBreak(BreakType.LineBreak);
+        }
+
+        private static void AddCityHeader(DocumentBuilder builder, string cityName)
+        {
+            builder.ParagraphFormat.Alignment = ParagraphAlignment.Left;
+            builder.Font.Size = 14;
+            builder.Font.Bold = true;
+            builder.Font.Color = System.Drawing.Color.DarkGreen;
+            builder.Writeln($"城市:{cityName}");
+
+            builder.Font.Size = 10;
+            builder.Font.Bold = false;
+            builder.Font.Color = System.Drawing.Color.Black;
+        }
+
+        private static void CreateHotelDetailTable(DocumentBuilder builder, Grp_HotelReservations hotel)
+        {
+            // 设置表格不允许跨页断行,确保整个表格在一页上
+            Table table = builder.StartTable();
+            //table.AllowBreakAcrossPages = false; // 关键设置:不允许表格跨页
+
+            // 设置表格样式
+            ApplyTableStyle(table);
+
+            // 添加酒店基本信息行
+            AddTableRow(builder, "酒店名称", hotel.HotelName ?? "-", true);
+            AddTableRow(builder, "联系电话", hotel.HotelTel ?? "-");
+            AddTableRow(builder, "酒店地址", hotel.HotelAddress ?? "-");
+            AddTableRow(builder, "确认号码", hotel.DetermineNo ?? "-");
+            AddTableRow(builder, "入住日期", hotel.CheckInDate);
+            AddTableRow(builder, "离店日期", hotel.CheckOutDate);
+            AddTableRow(builder, "房间信息", hotel.RoomExplanation ?? "-");
+
+            builder.EndTable();
+        }
+
+        private static void CreateAirDetailTable(DocumentBuilder builder, Grp_AirTicketReservations air)
+        {
+            // 设置表格不允许跨页断行,确保整个表格在一页上
+            Table table = builder.StartTable();
+            //table.AllowBreakAcrossPages = false; // 关键设置:不允许表格跨页
+
+            // 设置表格样式
+            ApplyTableStyle(table);
+
+            // 添加酒店基本信息行
+            AddTableRow(builder, "城市(A-B)", air.FlightsCity ?? "-", true);
+            AddTableRow(builder, "航班日期", air.FlightsDate + " " + air.FlightsTime ?? "-");
+            AddTableRow(builder, "机票票号", air.TicketNumber ?? "-");
+            AddTableRow(builder, "航班简述", air.FlightsCode ?? "-");
+            AddTableRow(builder, "航班描述", air.FlightsDescription);
+
+            builder.EndTable();
+        }
+
+
+        private static void AddTableRow(DocumentBuilder builder, string title, string value, bool isHeaderRow = false)
+        {
+            // 左边单元格 - 标题
+            builder.InsertCell();
+            //builder.CellFormat.BackColor = isHeaderRow ? System.Drawing.Color.LightBlue : System.Drawing.Color.LightGray;
+            builder.CellFormat.VerticalAlignment = CellVerticalAlignment.Center;
+            builder.CellFormat.Width = 60;
+            builder.Font.Bold = true;
+            builder.Font.Size = isHeaderRow ? 12 : 10;
+            builder.Font.Color = isHeaderRow ? System.Drawing.Color.DarkBlue : System.Drawing.Color.Black;
+            builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
+            builder.Write(title);
+
+            // 右边单元格 - 值
+            builder.InsertCell();
+            //builder.CellFormat.BackColor = System.Drawing.Color.White;
+            builder.CellFormat.VerticalAlignment = CellVerticalAlignment.Center;
+            builder.CellFormat.Width = 200;
+            builder.Font.Bold = isHeaderRow;
+            builder.Font.Size = isHeaderRow ? 12 : 10;
+            builder.Font.Color = System.Drawing.Color.Black;
+            builder.ParagraphFormat.Alignment = ParagraphAlignment.Left;
+            builder.Write(value);
+
+            builder.EndRow();
+
+            // 重置单元格格式(除了宽度)
+            //builder.CellFormat.BackColor = System.Drawing.Color.White;
+            builder.Font.Bold = false;
+            builder.Font.Size = 10;
+            builder.Font.Color = System.Drawing.Color.Black;
+            builder.ParagraphFormat.Alignment = ParagraphAlignment.Left;
+        }
+
+        private static void ApplyTableStyle(Table table)
+        {
+            try
+            {
+                // 设置表格边框
+                table.SetBorders(LineStyle.Single, 1.0, System.Drawing.Color.Gray);
+
+                // 设置表格属性
+                table.LeftPadding = 5;
+                table.RightPadding = 5;
+                table.TopPadding = 3;
+                table.BottomPadding = 3;
+
+                table.Alignment = TableAlignment.Left;
+                table.AllowAutoFit = false;
+                //table.AllowBreakAcrossPages = true;
+
+                // 设置表格宽度
+                table.PreferredWidth = PreferredWidth.FromPoints(400);
+
+                // 设置列宽
+                if (table.FirstRow != null && table.FirstRow.Cells.Count == 2)
+                {
+                    table.FirstRow.Cells[0].CellFormat.PreferredWidth = PreferredWidth.FromPercent(20);
+                    table.FirstRow.Cells[1].CellFormat.PreferredWidth = PreferredWidth.FromPercent(80);
+                }
+            }
+            catch (Exception ex)
+            {
+                //_logger.LogWarning(ex, "设置表格样式时发生错误");
+            }
+        }
+
+        private static void AddFooter(DocumentBuilder builder, string footerText)
+        {
+            builder.InsertBreak(BreakType.ParagraphBreak);
+            builder.Writeln();
+            builder.Writeln();
+
+            // 添加分隔线
+            builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
+            builder.Font.Size = 8;
+            builder.Font.Color = System.Drawing.Color.LightGray;
+            //builder.Writeln("────────────────────────────────────");
+
+            builder.ParagraphFormat.Alignment = ParagraphAlignment.Right;
+            builder.Font.Size = 9;
+            builder.Font.Italic = true;
+            builder.Font.Color = System.Drawing.Color.Gray;
+            builder.Writeln(footerText);
+            builder.Writeln($"文档生成时间:{DateTime.Now:yyyy-MM-dd HH:mm:ss}");
+
+            builder.ParagraphFormat.Alignment = ParagraphAlignment.Left;
+            builder.Font.Size = 10;
+            builder.Font.Italic = false;
+            builder.Font.Color = System.Drawing.Color.Black;
+        }
+
     }
+    #endregion
+
 }
 
 
+

+ 1 - 1
OASystem/OASystem.Domain/Entities/Groups/Grp_VisaProcessSteps.cs

@@ -138,7 +138,7 @@ namespace OASystem.Domain.Entities.Groups
             {
                 if (!string.IsNullOrEmpty(AttachUrl))
                 {
-                    string rootRrl = "http://132.232.92.186:24/";
+                    string rootRrl = "http://132.232.92.186:24/Office/";
                     var result = JsonSerializer.Deserialize<List<string>>(AttachUrl);
 
                     for (int i = 0; i < result.Count; i++)

+ 5 - 0
OASystem/OASystem.Domain/ViewModels/Groups/TourClientListView.cs

@@ -88,6 +88,11 @@ namespace OASystem.Domain.ViewModels.Groups
 
     }
 
+    public class TourClientInfosView : TourClientListByDiIdView
+    {
+        public int DcId { get; set; }
+    }
+
     /// <summary>
     /// 接团客户名单
     /// 根据团组Id查询List

+ 31 - 43
OASystem/OASystem.Infrastructure/Repositories/Groups/TourClientListRepository.cs

@@ -1,26 +1,11 @@
 using AutoMapper;
-using MathNet.Numerics.Distributions;
-using NPOI.SS.Formula.PTG;
-using NPOI.Util;
 using OASystem.Domain;
 using OASystem.Domain.AesEncryption;
-using OASystem.Domain.Dtos.CRM;
 using OASystem.Domain.Dtos.Groups;
 using OASystem.Domain.Entities.Customer;
 using OASystem.Domain.Entities.Groups;
-using OASystem.Domain.ViewModels.Financial;
 using OASystem.Domain.ViewModels.Groups;
 using OASystem.Infrastructure.Tools;
-using Org.BouncyCastle.Utilities.Encoders;
-using StackExchange.Redis;
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Globalization;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace OASystem.Infrastructure.Repositories.Groups
 {
@@ -28,7 +13,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
     /// 接团客户名单 
     /// 仓库
     /// </summary>
-    public class TourClientListRepository :BaseRepository<Grp_TourClientList,TourClientListView>
+    public class TourClientListRepository : BaseRepository<Grp_TourClientList, TourClientListView>
     {
         private readonly Result _result;
         private readonly IMapper _mapper;
@@ -75,7 +60,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
         /// <returns></returns>
         public async Task<Result> _ItemByDiId(int portId, int diId)
         {
-            if (portId == 1 || portId == 2 || portId == 3 ) // 1 web 2 Android 3 ios
+            if (portId == 1 || portId == 2 || portId == 3) // 1 web 2 Android 3 ios
             {
                 string sql = string.Format(@"
 SELECT
@@ -140,8 +125,8 @@ WHERE
             var view = new JsonView() { Code = StatusCodes.Status400BadRequest, Msg = "操作失败!" };
             if (portId == 1 || portId == 2 || portId == 3) // 1 web 2 Android 3 ios
             {
-                
-                var setData = await _sqlSugar.Queryable<Sys_SetData>().Where(it => it.IsDel == 0) .ToListAsync();
+
+                var setData = await _sqlSugar.Queryable<Sys_SetData>().Where(it => it.IsDel == 0).ToListAsync();
 
                 var shippingSpaceTypeData = setData.Where(it => it.STid == 44).ToList(); //舱位类型
                 var shippingSpaceTypeData1 = _mapper.Map<List<SetDataInfoView>>(shippingSpaceTypeData);
@@ -160,10 +145,10 @@ WHERE
 
                 //公司信息 
                 var clientCompanySql = string.Format(@"Select Id,CompanyFullName From Crm_CustomerCompany Where IsDel = 0");
-                var clientCompanyData =  _sqlSugar.SqlQueryable<CustomerCompanyCiew>(clientCompanySql).ToList();
+                var clientCompanyData = _sqlSugar.SqlQueryable<CustomerCompanyCiew>(clientCompanySql).ToList();
                 clientCompanyData = clientCompanyData.DistinctBy(it => it.CompanyFullName).ToList();
 
-                foreach ( var item in clientData)
+                foreach (var item in clientData)
                 {
                     if (item.FirstName.Length > 5 && item.LastName.Length > 5)
                     {
@@ -180,7 +165,8 @@ WHERE
                 }
 
 
-                var _view = new {
+                var _view = new
+                {
                     ShippingSpaceTypeData = shippingSpaceTypeData1,
                     ClientData = clientData,
                     ClientCompanyData = clientCompanyData
@@ -254,7 +240,7 @@ WHERE
   tcl.IsDel = 0
   AND tcl.Id = {0}", id);
                 var data = await _sqlSugar.SqlQueryable<TourClientListDetailsView>(sql).FirstAsync();
-                if (data != null) 
+                if (data != null)
                 {
                     EncryptionProcessor.DecryptProperties(data);
                     data.BirthDay = data.BirthDay?.DateFormat("yyyy-MM-dd") ?? "";
@@ -295,7 +281,7 @@ WHERE
                 return _result;
             }
 
-            if (dto.Id >= 0) 
+            if (dto.Id >= 0)
             {
 
                 #region 参数处理
@@ -338,12 +324,12 @@ WHERE
 
                 EncryptionProcessor.EncryptProperties(dto);
 
-                var clientInfo = await _sqlSugar.Queryable<Crm_DeleClient>().Where(it => it.IsDel == 0 
-                                                                                         && it.LastName.Equals(dto.LastName) 
-                                                                                         && it.FirstName.Equals(dto.FirstName) 
-                                                                                         //&& it.Phone.Equals(dto.Phone)
+                var clientInfo = await _sqlSugar.Queryable<Crm_DeleClient>().Where(it => it.IsDel == 0
+                                                                                         && it.LastName.Equals(dto.LastName)
+                                                                                         && it.FirstName.Equals(dto.FirstName)
+                                                                                   //&& it.Phone.Equals(dto.Phone)
                                                                                    ).FirstAsync();
-                
+
                 Crm_CustomerCompany _CustomerCompany = new Crm_CustomerCompany()
                 {
                     CompanyFullName = dto.CompanyFullName,
@@ -428,8 +414,8 @@ WHERE
                             return _result;
                         }
                         crmCompanyId = companyAdd;
-                        
-                        
+
+
                     }
                 }
 
@@ -582,7 +568,7 @@ WHERE
                         return _result;
                     }
                 }
-                
+
                 _result.Code = 0;
                 _sqlSugar.CommitTran();
 
@@ -661,7 +647,7 @@ WHERE
                         }
                     }
 
-                    _DeleClientInfo = new Crm_DeleClient() 
+                    _DeleClientInfo = new Crm_DeleClient()
                     {
                         LastName = item.LastName,
                         FirstName = item.FirstName,
@@ -690,7 +676,7 @@ WHERE
                         Crm_CustomerCert _CustomerCert = _CustomerCerts.Where(it => it.DcId == clientId && it.CertNo.Equals(item.IDCardNo)).FirstOrDefault();
                         if (_CustomerCert == null)
                         {
-                            _CustomerCert = new Crm_CustomerCert() 
+                            _CustomerCert = new Crm_CustomerCert()
                             {
                                 DcId = clientId,
                                 SdId = 773,
@@ -732,7 +718,8 @@ WHERE
                         }
                     }
 
-                    Crm_DeleClient _DeleClient = new Crm_DeleClient() {
+                    Crm_DeleClient _DeleClient = new Crm_DeleClient()
+                    {
                         CrmCompanyId = companyId,
                         LastName = item.LastName,
                         FirstName = item.FirstName,
@@ -788,7 +775,7 @@ WHERE
                     QuerFirstClient.IsDel = 1;
                     QuerFirstClient.DeleteUserId = dto.UserId;
                     QuerFirstClient.DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
-                    var UpdateTrue = _sqlSugar.Updateable(QuerFirstClient).UpdateColumns(x => new { x.IsDel,x.DeleteUserId,x.DeleteTime}).ExecuteCommand() > 0;
+                    var UpdateTrue = _sqlSugar.Updateable(QuerFirstClient).UpdateColumns(x => new { x.IsDel, x.DeleteUserId, x.DeleteTime }).ExecuteCommand() > 0;
                 }
 
                 var tourClientAdd = await _sqlSugar.Insertable(_TourClientList).ExecuteReturnIdentityAsync();
@@ -811,7 +798,7 @@ WHERE
         }
 
 
-        public async Task<Result> OperMultiple(List<TourClientListProcessInfo> _TourClientListInfos , int diid,int userId)
+        public async Task<Result> OperMultiple(List<TourClientListProcessInfo> _TourClientListInfos, int diid, int userId)
         {
             if (diid < 0)
             {
@@ -827,7 +814,7 @@ WHERE
             _sqlSugar.BeginTran();
             try
             {
-                _sqlSugar.Updateable<Grp_TourClientList>().SetColumns(x=> new Grp_TourClientList { IsDel = 1 } ).Where(x=>x.DiId == diid).ExecuteCommand();
+                _sqlSugar.Updateable<Grp_TourClientList>().SetColumns(x => new Grp_TourClientList { IsDel = 1 }).Where(x => x.DiId == diid).ExecuteCommand();
 
                 foreach (var item in _TourClientListInfos)
                 {
@@ -861,7 +848,7 @@ WHERE
                         Pinyin = item.Pinyin,
                         Phone = item.Phone,
                         Sex = item.Sex,
-                        BirthDay =  string.IsNullOrEmpty(item.BirthDay) ? null : Convert.ToDateTime(item.BirthDay),
+                        BirthDay = string.IsNullOrEmpty(item.BirthDay) ? null : Convert.ToDateTime(item.BirthDay),
                         Job = item.Job,
                         CreateUserId = userId
                     };
@@ -1047,7 +1034,7 @@ WHERE
                         _sqlSugar.RollbackTran();
                         return _result;
                     }
-                    
+
                 }
 
                 _result.Code = 0;
@@ -1071,7 +1058,7 @@ WHERE
         /// <returns></returns>
         public async Task<Result> _Del(int id, int userId)
         {
-            if (id > 0) 
+            if (id > 0)
             {
                 var _tourClientList = new Grp_TourClientList()
                 {
@@ -1142,7 +1129,8 @@ WHERE
             if (infos.Count > 0)
             {
                 //解密
-                infos.ForEach(x => { 
+                infos.ForEach(x =>
+                {
                     x.FirstName = AesEncryptionHelper.Decrypt(x.FirstName);
                     x.LastName = AesEncryptionHelper.Decrypt(x.LastName);
                 });
@@ -1157,7 +1145,7 @@ WHERE
         {
             public int Id { get; set; }
 
-            public string  Name { get; set; }
+            public string Name { get; set; }
         }
     }
 }