瀏覽代碼

Merge branch 'develop' of http://132.232.92.186:3000/XinXiBu/OA2023 into develop

yuanrf 1 年之前
父節點
當前提交
79b1ec6e28
共有 22 個文件被更改,包括 4749 次插入300 次删除
  1. 50 43
      OASystem/OASystem.Api/Controllers/FinancialController.cs
  2. 1729 85
      OASystem/OASystem.Api/Controllers/GroupsController.cs
  3. 8 6
      OASystem/OASystem.Api/Controllers/ResourceController.cs
  4. 1227 0
      OASystem/OASystem.Api/Controllers/StatisticsController.cs
  5. 13 0
      OASystem/OASystem.Domain/AutoMappers/_baseMappingProfile.cs
  6. 300 0
      OASystem/OASystem.Domain/Dtos/Groups/EnterExitCostDraftDto.cs
  7. 5 0
      OASystem/OASystem.Domain/Dtos/Groups/EnterExitCostDto.cs
  8. 7 0
      OASystem/OASystem.Domain/Dtos/Groups/TourClientListDto.cs
  9. 1 1
      OASystem/OASystem.Domain/Dtos/Resource/OfficialActivitiesDto.cs
  10. 64 0
      OASystem/OASystem.Domain/Entities/Groups/Grp_DayAndCostDraft.cs
  11. 32 0
      OASystem/OASystem.Domain/Entities/Groups/Grp_DayOtherPriceDraft.cs
  12. 11 1
      OASystem/OASystem.Domain/Entities/Groups/Grp_EnterExitCost.cs
  13. 258 0
      OASystem/OASystem.Domain/Entities/Groups/Grp_EnterExitCostDraft.cs
  14. 4 0
      OASystem/OASystem.Domain/ViewModels/Groups/DelegationInfoView.cs
  15. 428 0
      OASystem/OASystem.Domain/ViewModels/Groups/EnterExitCostDraftView.cs
  16. 17 0
      OASystem/OASystem.Domain/ViewModels/Groups/EnterExitCostView.cs
  17. 9 2
      OASystem/OASystem.Domain/ViewModels/Resource/OfficialActivitiesView.cs
  18. 85 50
      OASystem/OASystem.Infrastructure/Repositories/Groups/DelegationInfoRepository.cs
  19. 361 0
      OASystem/OASystem.Infrastructure/Repositories/Groups/EnterExitCostDraftRepository.cs
  20. 3 3
      OASystem/OASystem.Infrastructure/Repositories/Groups/EnterExitCostRepository.cs
  21. 122 109
      OASystem/OASystem.Infrastructure/Repositories/Resource/OfficialActivitiesRepository.cs
  22. 15 0
      OASystem/OASystem.Infrastructure/Tools/CommonFun.cs

+ 50 - 43
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -2163,9 +2163,7 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostPayRequestInit()
         {
-            try
-            {
-                var conpanyDatas = _sqlSugar.Queryable<Sys_Company>()
+            var conpanyDatas = _sqlSugar.Queryable<Sys_Company>()
                                             .Where(it => it.IsDel == 0)
                                             .Select(it => new
                                             {
@@ -2175,12 +2173,7 @@ namespace OASystem.API.Controllers
                                             }).ToList();
 
 
-                return Ok(JsonView(true, "操作成功!", new { ConpanyData = conpanyDatas }));
-            }
-            catch (Exception ex)
-            {
-                return Ok(JsonView(false, ex.Message));
-            }
+            return Ok(JsonView(true, "操作成功!", new { ConpanyData = conpanyDatas }));
         }
 
 
@@ -3142,7 +3135,18 @@ namespace OASystem.API.Controllers
                 dto.PageId = 51;
                 return Ok(JsonView(false, "请传入有效的PageId参数!"));
             }
-            if (dto.ConpanyId < 1 || dto.ConpanyId > 4)
+
+            var conpanyDatas = _sqlSugar.Queryable<Sys_Company>()
+                .Where(it => it.IsDel == 0)
+                .Select(it => new
+                {
+                    Id = it.Id,
+                    ConpamyName = it.CompanyName
+                
+                }).ToList();
+
+            var conpanyIds = conpanyDatas.Select(x => x.Id).ToList();
+            if (!conpanyIds.Contains(dto.ConpanyId))
             {
                 return Ok(JsonView(false, "请传入有效的ConpanyId参数!"));
             }
@@ -3184,39 +3188,42 @@ namespace OASystem.API.Controllers
                     dailyResult.childList = new List<Fin_DailyFeePaymentContentInfolView>();
                 }
 
-                List<tree_Group_DailyFeePaymentPageListView> _GroupData = new List<tree_Group_DailyFeePaymentPageListView>();
-                List<tree_Fin_DailyFeePaymentPageListView> _DailyData = new List<tree_Fin_DailyFeePaymentPageListView>();
-
-                //1	成都泛美商务有限公司
-                if (dto.ConpanyId == 1)
-                {
-                    if (groupResult.dataList != null && groupResult.dataList.Count > 0) _GroupData = groupResult.dataList.Where(it => it.CompanyId == 1).ToList();
-                    if (dailyResult.dataList != null && dailyResult.dataList.Count > 0) _DailyData = dailyResult.dataList.Where(it => it.CompanyId == 1).ToList();
-
-                }
-                //2	四川泛美交流有限公司
-                else if (dto.ConpanyId == 2)
-                {
-                    if (groupResult.dataList != null && groupResult.dataList.Count > 0) _GroupData = groupResult.dataList.Where(it => it.CompanyId == 2).ToList();
-                    if (dailyResult.dataList != null && dailyResult.dataList.Count > 0) _DailyData = dailyResult.dataList.Where(it => it.CompanyId == 2).ToList();
-
-                }
-                //3 成都纽茵教育科技有限公司
-                else if (dto.ConpanyId == 3)
-                {
-                    if (groupResult.dataList != null && groupResult.dataList.Count > 0) _GroupData = groupResult.dataList.Where(it => it.CompanyId == 3).ToList();
-                    if (dailyResult.dataList != null && dailyResult.dataList.Count > 0) _DailyData = dailyResult.dataList.Where(it => it.CompanyId == 3).ToList();
-
-                }
-                //4 成都鸿企中元科技有限公司
-                else if (dto.ConpanyId == 4)
-                {
-                    return Ok(JsonView(false, "暂未开放该类型!"));
-                }
-                else
-                {
-                    return Ok(JsonView(false, "参数ConpanyId不可使用!"));
-                }
+                var _GroupData = new List<tree_Group_DailyFeePaymentPageListView>();
+                var _DailyData = new List<tree_Fin_DailyFeePaymentPageListView>();
+
+                if (groupResult.dataList != null && groupResult.dataList.Any()) _GroupData = groupResult.dataList.Where(it => it.CompanyId == dto.ConpanyId).ToList();
+                if (dailyResult.dataList != null && dailyResult.dataList.Any()) _DailyData = dailyResult.dataList.Where(it => it.CompanyId == dto.ConpanyId).ToList();
+
+                ////1	成都泛美商务有限公司
+                //if (dto.ConpanyId == 1)
+                //{
+                //    if (groupResult.dataList != null && groupResult.dataList.Count > 0) _GroupData = groupResult.dataList.Where(it => it.CompanyId == 1).ToList();
+                //    if (dailyResult.dataList != null && dailyResult.dataList.Count > 0) _DailyData = dailyResult.dataList.Where(it => it.CompanyId == 1).ToList();
+
+                //}
+                ////2	四川泛美交流有限公司
+                //else if (dto.ConpanyId == 2)
+                //{
+                //    if (groupResult.dataList != null && groupResult.dataList.Count > 0) _GroupData = groupResult.dataList.Where(it => it.CompanyId == 2).ToList();
+                //    if (dailyResult.dataList != null && dailyResult.dataList.Count > 0) _DailyData = dailyResult.dataList.Where(it => it.CompanyId == 2).ToList();
+
+                //}
+                ////3 成都纽茵教育科技有限公司
+                //else if (dto.ConpanyId == 3)
+                //{
+                //    if (groupResult.dataList != null && groupResult.dataList.Count > 0) _GroupData = groupResult.dataList.Where(it => it.CompanyId == 3).ToList();
+                //    if (dailyResult.dataList != null && dailyResult.dataList.Count > 0) _DailyData = dailyResult.dataList.Where(it => it.CompanyId == 3).ToList();
+
+                //}
+                ////4 成都鸿企中元科技有限公司
+                //else if (dto.ConpanyId == 4)
+                //{
+                //    return Ok(JsonView(false, "暂未开放该类型!"));
+                //}
+                //else
+                //{
+                //    return Ok(JsonView(false, "参数ConpanyId不可使用!"));
+                //}
 
                 string _requestPaymentDt = DateTime.Now.ToString("yyyy-MM-dd"),//申请付款日期
                        _appliedAmount = "", //申请付款金额

File diff suppressed because it is too large
+ 1729 - 85
OASystem/OASystem.Api/Controllers/GroupsController.cs


+ 8 - 6
OASystem/OASystem.Api/Controllers/ResourceController.cs

@@ -2022,16 +2022,18 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
             if (_groupData.Code == 0) groupInfos = _groupData.Data;
 
             var data = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.IsDel == 0).ToList();
-            var data1 = data.Where(a => a.STid == 38).ToList();
-            var data2 = data.Where(a => a.STid == 101).ToList();
-            var data3 = data.Where(a => a.STid == 66).ToList();
+            var data1 = data.Where(a => a.STid == 38).Select(x => new { x.Id,x.Name }).ToList();
+            var data2 = data.Where(a => a.STid == 101).Select(x => new { x.Id, x.Name }).ToList();
+            var data3 = data.Where(a => a.STid == 66).Select(x => new { x.Id, x.Name ,x.Remark}).ToList();
 
             var _DeleFile = _sqlSugar.Queryable<Grp_DeleFile>().Where(a => a.Diid == dto.DiId && a.IsDel == 0 && a.Category == 970).ToList();
 
-            var translatorData = _sqlSugar.Queryable<Res_TranslatorLibrary>().Where(a => a.IsDel == 0).Select(x => new TranslatorLibraryNameView() { Id = x.Id, Name = x.Name }).ToList();
-            foreach (var item in translatorData) EncryptionProcessor.DecryptProperties(item);
+            var translatorData = _sqlSugar.Queryable<Res_TranslatorLibrary>().Where(a => a.IsDel == 0).ToList();
 
-            return Ok(JsonView(true, "查询成功!", new { Delegation = groupInfos, SetData = data1,DataSource = data2, currencyData = data3, DeleFile = _DeleFile , TranslatorData = translatorData }));
+            var translatorData1 = _mapper.Map<List<TranslatorView>>(translatorData);
+            foreach (var item in translatorData1) EncryptionProcessor.DecryptProperties(item);
+
+            return Ok(JsonView(true, "查询成功!", new { Delegation = groupInfos, SetData = data1,DataSource = data2, currencyData = data3, DeleFile = _DeleFile , TranslatorData = translatorData1 }));
         }
 
         /// <summary>

+ 1227 - 0
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -12,6 +12,7 @@ using NodaTime;
 using NPOI.POIFS.Properties;
 using NPOI.SS.Formula.Functions;
 using NPOI.SS.Formula.PTG;
+using NPOI.XSSF.Streaming.Values;
 using OASystem.API.OAMethodLib;
 using OASystem.API.OAMethodLib.JuHeAPI;
 using OASystem.Domain.AesEncryption;
@@ -2294,6 +2295,1232 @@ ORDER BY
             return Ok(JsonView(true, "成功", url));
         }
 
+
+        /// <summary>
+        ///  团组报表
+        ///  利润相关数据 
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost("PostGroupStatementDetails1")]
+        //[JsonConverter(typeof(DecimalConverter), 2)]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostGroupStatementDetails1()
+        {
+            var groupInfos = _sqlSugar.Queryable<Grp_DelegationInfo>()
+                .Where(x => x.IsDel == 0 && x.VisitDate >= DateTime.Parse ("2024-01-01") && x.VisitDate <= DateTime.Parse("2024-12-31"))
+                .OrderByDescending(x => x.VisitDate)
+                .ToList();
+
+            #region 费用类型 币种,转账,客户信息
+
+            List<Sys_SetData> _setDatas =  _sqlSugar.Queryable<Sys_SetData>().Where(it => it.IsDel == 0).ToList();
+            var _clientDatas = _sqlSugar.Queryable<Crm_DeleClient>()
+                .Where(it => it.IsDel == 0)
+                .Select(x => new Crm_DeleClient { Id = x.Id, FirstName = x.FirstName, LastName = x.LastName, Sex = x.Sex })
+                .ToList();
+           // foreach (var item1 in _clientDatas) EncryptionProcessor.DecryptProperties(item1);
+
+            #endregion
+
+            var _views = new List<GroupStatisticsInfo>();
+            int index1 = 0;
+            foreach (var info in groupInfos)
+            {
+                var _dto = new { DiId = info.Id, isAudit = false };
+
+
+                /* 
+                 * 团组报表计算方式
+                 * 当前总支出 = 团组支出.Sum() + 超支费用.Sum()
+                 * 应收金额 = 应收表.Sum()
+                 * 已收金额 = 已收表.Sum()
+                 * 应收利润(应收-支出) = 应收金额 - 收款退还 - 当前总支出
+                 * 已收利润(已收-支出) = 已收金额 - 收款退还 - 当前总支出
+                 * 
+                 */
+
+                GroupStatementDetailsView _view = new GroupStatementDetailsView();
+
+                var groupInfo = info;
+                var visitDate = info.VisitDate;
+
+                #region 团组收入
+
+                GroupIncomeView _giView = new GroupIncomeView();
+
+                /*
+                    * 应收报表
+                    * 增加方式=实际报价时 费用必须审核才能进入团组报表
+                    */
+                decimal frTotalAmount = 0.00M;//应收总金额
+                string _frSql = string.Format(@"  Select fr.Id,fr.AddingWay,fr.Status,u.CnName As Auditor,fr.AuditTime,fr.Diid,fr.PriceName,fr.Price,fr.Count,fr.Unit,fr.Currency,
+										    sd.Name As CurrencyCode,sd.Remark As CurrencyName,fr.Rate,fr.ItemSumPrice,fr.CreateTime
+										    From Fin_ForeignReceivables fr
+										    Left Join Sys_SetData sd On fr.Currency = sd.Id
+											Left Join Sys_Users u On fr.Auditor = u.Id
+										    Where fr.IsDel = 0 And fr.Diid = {0} Order By CreateTime", _dto.DiId);
+                List<Gsd_ForeignReceivablesView> _frViews = await _sqlSugar.SqlQueryable<Gsd_ForeignReceivablesView>(_frSql).ToListAsync();
+
+
+                //List<Gsd_ForeignReceivablesView> _frViews = new List<Gsd_ForeignReceivablesView>();
+                //if (_frViews1.Count > 0)
+                //{
+                //    _frViews.AddRange(_frViews1.Where(x => x.AddingWay != 2).ToList());
+                //    _frViews.AddRange(_frViews1.Where(x => x.AddingWay == 2 && x.Status == 1).ToList());
+                //}
+
+                _frViews.ForEach(x =>
+                {
+                    string namePrefix = string.Empty;
+                    if (x.AddingWay == 0) namePrefix = $"账单模块-";
+                    else if (x.AddingWay == 1) namePrefix = $"成本预算模块-";
+                    else if (x.AddingWay == 2) namePrefix = $"实际报价-";
+                    x.PriceName = $"{namePrefix}{x.PriceName}";
+                });
+
+                frTotalAmount = _frViews.Sum(it => it.ItemSumPrice);
+                _giView.Receivables = _frViews;
+                _giView.ReceivableStr = string.Format(@"应收款合计:{0} CNY(人民币)", frTotalAmount.ConvertToDecimal1().ToString("#0.00"));
+
+                /*
+                    * 已收报表
+                    */
+                decimal prTotalAmount = 0.00M;//已收总金额
+                string _prSql = string.Format(@"Select pr.Id,pr.Diid,pr.SectionTime As SectionTimeDt,pr.Price,pr.Currency,
+										    sd1.Name As CurrencyCode,sd1.Remark As CurrencyName,pr.Client,
+										    pr.ReceivablesType,sd2.Name As ReceivablesTypeName,pr.Remark,pr.CreateTime
+										    From Fin_ProceedsReceived  pr
+										    Left Join Sys_SetData sd1 On pr.Currency = sd1.Id
+										    Left Join Sys_SetData sd2 On pr.ReceivablesType = sd2.Id
+										    Where pr.IsDel = 0 and pr.Diid = {0} Order By CreateTime", _dto.DiId);
+                List<Gsd_ProceedsReceivedView> _prViews = await _sqlSugar.SqlQueryable<Gsd_ProceedsReceivedView>(_prSql).ToListAsync();
+                prTotalAmount = _prViews.Sum(it => it.Price);
+                _giView.ProceedsReceivedViews = _prViews;
+                _giView.ProceedsReceivedStr = string.Format(@$"应收合计:{frTotalAmount:#0.00} CNY  已收款合计:{prTotalAmount.ConvertToDecimal1():#0.00} CNY");
+
+
+                /*
+                    * 超支费用 
+                    */
+                decimal exTotalAmount = 0.00M;
+                //    string ecSql = string.Format(@"Select gec.Id As GECId,gec.DiId As GECDiId,gec.PriceName,(gec.PriceSum * gec.Coefficient) As PayMoney,sd1.Name As PaymentCurrency,
+                //	   (gec.PriceSum * gec.Coefficient * ccp.DayRate) As CNYPrice,ccp.DayRate,ccp.Payee,ccp.OrbitalPrivateTransfer,sd2.Name As PayWay,
+                //	   sd3.Name As CardType,ccp.IsPay,u.CnName As Applicant,gec.CreateTime
+                //From OA2023DB.dbo.Fin_GroupExtraCost gec
+                //Left Join Grp_CreditCardPayment ccp On gec.Id = ccp.CId
+                //                                    Left Join Sys_SetData sd1 On ccp.PaymentCurrency = sd1.Id
+                //                                    Left Join Sys_SetData sd2 On ccp.PayDId = sd2.Id 
+                //                                    Left Join Sys_SetData sd3 On ccp.CTDId = sd3.Id
+                //                                    Left Join Sys_Users u On ccp.CreateUserId = u.Id
+                //Where ccp.IsDel = 0 And ccp.CTable = 1015 {1} And ccp.DiId = {0} Order By CreateTime", _dto.DiId, _dto.isAudit ? "And ccp.IsAuditGM = 1 And ccp.IsPay = 1 " : " ");
+
+                //    List<Gsd_ExtraCostsView> _ExtraCostsViews = await _sqlSugar.SqlQueryable<Gsd_ExtraCostsView>(ecSql).ToListAsync();
+
+                //    #region 超支费用 - 模拟数据
+
+                //    //if (_ExtraCostsViews.Count < 1)
+                //    //{
+                //    //    _ExtraCostsViews.Add(new Gsd_ExtraCostsView()
+                //    //    {
+                //    //        GECId = 0,
+                //    //        GECDiId = 2334,
+                //    //        PriceName = "模拟数据-超支费用名称",
+                //    //        PayMoney = 1000.00M,
+                //    //        PaymentCurrency = "CNY",
+                //    //        DayRate = 1.0000M,
+                //    //        CNYPrice = 1000.00M,
+                //    //        Payee = "模拟数据-超支费用收款方",
+                //    //        OrbitalPrivateTransfer = 1,
+                //    //        PayWay = "刷卡",
+                //    //        CardType = "招行卡",
+                //    //        IsPay = 1,
+                //    //        Applicant = "刘华举"
+                //    //    });
+                //    //    _ExtraCostsViews.Add(new Gsd_ExtraCostsView()
+                //    //    {
+                //    //        GECId = 0,
+                //    //        GECDiId = 2334,
+                //    //        PriceName = "模拟数据-超支费用名称",
+                //    //        PayMoney = 1000.00M,
+                //    //        PaymentCurrency = "CNY",
+                //    //        DayRate = 1.0000M,
+                //    //        CNYPrice = 1000.00M,
+                //    //        Payee = "模拟数据-超支费用收款方",
+                //    //        OrbitalPrivateTransfer = 1,
+                //    //        PayWay = "刷卡",
+                //    //        CardType = "招行卡",
+                //    //        IsPay = 1,
+                //    //        Applicant = "刘华举"
+                //    //    });
+                //    //}
+                //    #endregion
+
+
+                //    exTotalAmount = _ExtraCostsViews.Sum(it => it.CNYPrice);
+
+                //    _giView.ExtraCostsViews = _ExtraCostsViews;
+                //    _giView.ExtraCostsStr = string.Format(@"人民币总费用:{0} CNY", exTotalAmount.ConvertToDecimal1().ToString("#0.00"));
+
+                /*
+                    * 收款退还
+                    */
+                decimal promTotalAmount = 0.00M;// 收款退还总金额
+                List<Gsd_PaymentRefundAndOtherMoneyView> _promView = new List<Gsd_PaymentRefundAndOtherMoneyView>();
+
+                //删除了  And prom.PriceType = 1
+                string _ropSql = string.Format(@"Select u.CnName As Appliction,prom.Id As PrId,prom.DiId As PrDiId,prom.Price As PrPrice,
+										        prom.PriceName AS PrPriceName,prom.CurrencyId As PrCurrencyId,
+										        prom.PayType As PrPayType,prom.PriceType As PrPriceType,
+												ccp.RMBPrice * ccp.DayRate As RMBPrice,ccp.*,prom.CreateTime As PrCreateTime
+										        From Fin_PaymentRefundAndOtherMoney prom
+										        Left Join Grp_CreditCardPayment ccp On prom.DiId = ccp.DIId And prom.Id = ccp.CId
+										        Left Join Sys_Users u On ccp.CreateUserId = u.Id
+										        Where prom.IsDel = 0  
+                                                And prom.PayType = 1 
+                                                And ccp.CTable = 285
+										        {1} 
+										        And prom.DiId = {0} Order By PrCreateTime", _dto.DiId, _dto.isAudit ? "And ccp.IsAuditGM = 1" : " ");
+                var _promDatas = await _sqlSugar.SqlQueryable<Gsd_PaymentRefundAndOtherMoneyDataSource1View>(_ropSql).ToListAsync();
+
+                foreach (var ropItem in _promDatas)
+                {
+                    string thisCueencyCode = "Unknown";
+                    string thisCueencyName = "Unknown";
+                    var currency = _setDatas.Where(it => it.Id == ropItem.PaymentCurrency).FirstOrDefault();
+                    if (currency != null)
+                    {
+                        thisCueencyCode = currency.Name;
+                        thisCueencyName = currency.Remark;
+                    }
+
+                    string orbitalPrivateTransferStr = "Unknown";
+                    var orbitalPrivateTransfer = _setDatas.Where(it => it.Id == ropItem.OrbitalPrivateTransfer).FirstOrDefault();
+                    if (orbitalPrivateTransfer != null)
+                    {
+                        orbitalPrivateTransferStr = orbitalPrivateTransfer.Name;
+                    }
+
+                    string payStr = "Unknown";
+                    var pay = _setDatas.Where(it => it.Id == ropItem.PayDId).FirstOrDefault();
+                    if (pay != null)
+                    {
+                        payStr = pay.Name;
+                    }
+
+                    Gsd_PaymentRefundAndOtherMoneyView gsd_PaymentRefund = new Gsd_PaymentRefundAndOtherMoneyView()
+                    {
+                        Id = ropItem.Id,
+                        DiId = ropItem.DIId,
+                        PriceName = ropItem.PrPriceName,
+                        PayCurrencyCode = thisCueencyCode,
+                        PayCurrencyName = thisCueencyName,
+                        Price = ropItem.PrPrice,
+                        CNYPrice = ropItem.PayMoney * ropItem.DayRate,
+                        ThisRate = ropItem.DayRate,
+                        Payee = ropItem.Payee,
+                        PayTime = ropItem.AuditGMDate,
+                        OrbitalPrivateTransfer = ropItem.OrbitalPrivateTransfer,
+                        PayType = payStr,
+                        IsPay = ropItem.IsPay,
+                        Applicant = ropItem.Appliction
+
+                    };
+
+                    _promView.Add(gsd_PaymentRefund);
+                }
+
+                #region 收款退还 - 模拟数据
+
+                //if (_promView.Count < 1)
+                //{
+                //    _promView.Add(new Gsd_PaymentRefundAndOtherMoneyView()
+                //    {
+                //        Id = 0,
+                //        DiId = 2334,
+                //        PriceName = "模拟数据-费用名称",
+                //        PayCurrencyCode = "CNY",
+                //        PayCurrencyName = "人民币",
+                //        Price = 1000.00M,
+                //        CNYPrice = 1000.00M,
+                //        ThisRate = 1.00M,
+                //        Payee = "模拟数据-收款方",
+                //        PayTime = "2023-01-01 15:20:01",
+                //        OrbitalPrivateTransfer = 1,
+                //        PayType = "刷卡",
+                //        IsPay = 1,
+                //        Applicant = "刘华举"
+                //    });
+                //    _promView.Add(new Gsd_PaymentRefundAndOtherMoneyView()
+                //    {
+                //        Id = 0,
+                //        DiId = 2334,
+                //        PriceName = "模拟数据-费用名称",
+                //        PayCurrencyCode = "CNY",
+                //        PayCurrencyName = "人民币",
+                //        Price = 1000.00M,
+                //        CNYPrice = 1000.00M,
+                //        ThisRate = 1.00M,
+                //        Payee = "模拟数据-收款方",
+                //        PayTime = "2023-01-01 15:20:01",
+                //        OrbitalPrivateTransfer = 1,
+                //        PayType = "刷卡",
+                //        IsPay = 1,
+                //        Applicant = "刘华举"
+                //    });
+                //}
+                #endregion
+
+                promTotalAmount = _promView.Sum(it => it.CNYPrice);
+                _giView.PaymentRefundAndOtherMoneyViews = _promView;
+                _giView.PaymentRefundAndOtherMoneyStr = string.Format(@"人民币总费用:{0} CNY", promTotalAmount.ConvertToDecimal1().ToString("#0.00"));
+
+                decimal BalancePayment = frTotalAmount - prTotalAmount + promTotalAmount;
+                _view.GroupIncome = _giView;
+                _view.GroupIncomeStr = string.Format(@"<span style='color:red;'>剩余尾款:{0} CNY(包含了收款退还费用数据)</span>", BalancePayment.ConvertToDecimal1().ToString("#0.00"));
+                #endregion
+
+                #region 团组支出
+                GroupExpenditureView _geView = new GroupExpenditureView();
+
+                #region 酒店预定费用
+                List<GroupHotelFeeView> groupHotelFeeViews = new List<GroupHotelFeeView>();
+
+                //ccp.RMBPrice As CNYPrice
+                //(((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100) As CNYPrice
+                string hotelFeeSql = string.Format(@"
+SELECT
+  hr.Id AS HrId,
+  hr.DiId AS HrDiId,
+  hr.City,
+  hr.HotelName,
+  hr.CheckInDate,
+  hr.CheckOutDate,
+  hr.CardPrice AS RoomPrice,
+  sd1.Name AS PaymentCurrency,
+  hr.SingleRoomPrice,
+  hr.SingleRoomCount,
+  hr.DoubleRoomPrice,
+  hr.DoubleRoomCount,
+  hr.SuiteRoomPrice,
+  hr.SuiteRoomCount,
+  hr.OtherRoomPrice,
+  hr.OtherRoomCount,
+  hr.BreakfastPrice,
+  sd4.Name AS BreakfastCurrency,
+  hr.Isoppay,
+  hr.GovernmentRent,
+  sd5.Name AS GovernmentRentCurrency,
+  hr.CityTax,
+  sd6.Name AS CityTaxCurrency,
+  ccp.PayMoney,
+  (
+    ((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100
+  ) AS CNYPrice,
+  ccp.PayPercentage,
+  ccp.DayRate,
+  ccp.Payee,
+  ccp.OrbitalPrivateTransfer,
+  sd2.Name AS PayWay,
+  sd3.Name AS CardType,
+  ccp.IsPay,
+  u.CnName AS Applicant
+FROM
+  Grp_HotelReservations hr
+  INNER JOIN Grp_CreditCardPayment ccp ON hr.Id = ccp.CId
+  LEFT JOIN Sys_SetData sd1 ON ccp.PaymentCurrency = sd1.Id
+  LEFT JOIN Sys_SetData sd2 ON ccp.PayDId = sd2.Id
+  LEFT JOIN Sys_SetData sd3 ON ccp.CTDId = sd3.Id
+  LEFT JOIN Sys_Users u ON ccp.CreateUserId = u.Id
+  LEFT JOIN Sys_SetData sd4 ON hr.BreakfastCurrency = sd4.Id
+  LEFT JOIN Sys_SetData sd5 ON hr.GovernmentRentCurrency = sd5.Id
+  LEFT JOIN Sys_SetData sd6 ON hr.CityTaxCurrency = sd6.Id
+WHERE
+  hr.IsDel = 0
+  AND ccp.IsDel = 0
+  AND ccp.CTable = 76 {1}
+  AND ccp.PayMoney <> 0
+  AND hr.DiId = {0}
+ORDER BY
+  CheckInDate Asc", _dto.DiId, _dto.isAudit ? "AND (ccp.IsAuditGM = 1 Or ccp.IsAuditGM = 3)" : " ");
+
+                groupHotelFeeViews = await _sqlSugar.SqlQueryable<GroupHotelFeeView>(hotelFeeSql).ToListAsync();
+
+                List<int> hotelSubIds = groupHotelFeeViews.Select(it => it.HrId).ToList();
+
+                var groupHotelContentFeeViews = await _sqlSugar.Queryable<Grp_HotelReservationsContent>().Where(it => hotelSubIds.Contains(it.HrId)).ToListAsync();
+
+                decimal HotelCNYTotalPrice = 0.00M;
+
+                var teamRateData = await _teamRateRep.PostGroupRateInfoByDiId(_dto.DiId);
+                foreach (var item in groupHotelFeeViews)
+                {
+                    if (groupHotelContentFeeViews.Count > 0)
+                    {
+
+                        string paymentStr = string.Empty;
+
+                        var roomData = groupHotelContentFeeViews.Find(it => it.HrId == item.HrId && it.PriceType == 1); //房费 
+
+
+                        item.RoomPrice = roomData?.Price ?? 0.00M;
+                        if (item.RoomPrice != 0)
+                        {
+                            if (roomData.IsPay == 0) paymentStr += $"房费:未付款<br/>";
+
+                            item.RoomPriceCurrency = _setDatas.Find(it => it.Id == roomData?.Currency)?.Name;
+                            string feeMark1 = roomData?.OrbitalPrivateTransfer == 0 ? "公转" : "私转";
+                            string isFeeMark1 = roomData?.IsOppay == 1 ? "是" : "否";
+                            item.RoomInfoTips = @$"当时汇率:{roomData?.Rate.ToString("#0.0000")} <br/>
+                                           收款方:{roomData?.Payee}<br/>
+                                           费用标识:{feeMark1} <br/>
+                                           支付方式:{_setDatas.Find(it => it.Id == roomData?.PayDId)?.Name} <br/>
+                                           卡类型:{_setDatas.Find(it => it.Id == roomData?.CTDId)?.Name}<br/>
+                                           是否由地接支付:{isFeeMark1} <br/>";
+                        }
+
+                        var breakfastData = groupHotelContentFeeViews.Find(it => it.HrId == item.HrId && it.PriceType == 2); //早餐 
+
+                        item.BreakfastPrice = breakfastData?.Price ?? 0.00M;
+
+                        if (item.BreakfastPrice != 0)
+                        {
+                            if (breakfastData.IsPay == 0) paymentStr += $"早餐:未付款<br/>";
+
+                            item.BreakfastCurrency = _setDatas.Find(it => it.Id == breakfastData?.Currency)?.Name;
+                            string feeMark2 = breakfastData?.OrbitalPrivateTransfer == 0 ? "公转" : "私转";
+                            string isFeeMark2 = breakfastData?.IsOppay == 1 ? "是" : "否";
+                            item.BreakfastInfoTips = @$"当时汇率:{breakfastData?.Rate.ToString("#0.0000")} <br/>
+                                                收款方:{breakfastData?.Payee}<br/>
+                                                费用标识:{feeMark2} <br/>
+                                                支付方式:{_setDatas.Find(it => it.Id == roomData?.PayDId)?.Name} <br/>
+                                                卡类型:{_setDatas.Find(it => it.Id == roomData?.CTDId)?.Name} <br/>
+                                                是否由地接支付:{isFeeMark2} <br/>";
+                        }
+
+                        var landTaxData = groupHotelContentFeeViews.Find(it => it.HrId == item.HrId && it.PriceType == 3); //地税
+
+                        item.GovernmentRent = landTaxData?.Price ?? 0.00M;
+
+                        if (item.GovernmentRent != 0)
+                        {
+                            if (landTaxData.IsPay == 0) paymentStr += $"地税:未付款<br/>";
+
+                            item.GovernmentRentCurrency = _setDatas.Find(it => it.Id == landTaxData?.Currency)?.Name;
+                            string feeMark3 = landTaxData?.OrbitalPrivateTransfer == 0 ? "公转" : "私转";
+                            string isFeeMark3 = landTaxData?.IsOppay == 1 ? "是" : "否";
+                            item.GovernmentRentTips = @$"当时汇率:{landTaxData?.Rate.ToString("#0.0000")} <br/>
+                                                 收款方:{landTaxData?.Payee}<br/>
+                                                 费用标识:{feeMark3} <br/>
+                                                 支付方式:{_setDatas.Find(it => it.Id == landTaxData?.PayDId)?.Name} <br/>
+                                                 卡类型:{_setDatas.Find(it => it.Id == landTaxData?.CTDId)?.Name} <br/>
+                                                 是否由地接支付:{isFeeMark3} <br/>";
+                        }
+
+                        var cityTaxData = groupHotelContentFeeViews.Find(it => it.HrId == item.HrId && it.PriceType == 4); //城市税 
+
+                        item.CityTax = cityTaxData?.Price ?? 0.00M;
+
+                        if (item.CityTax != 0)
+                        {
+                            if (cityTaxData.IsPay == 0) paymentStr += $"城市税:未付款<br/>";
+                            item.CityTaxCurrency = _setDatas.Find(it => it.Id == cityTaxData?.Currency)?.Name;
+                            string feeMark4 = cityTaxData?.OrbitalPrivateTransfer == 0 ? "公转" : "私转";
+                            string isFeeMark4 = landTaxData?.IsOppay == 1 ? "是" : "否";
+                            item.CityTaxTips = @$"当时汇率:{cityTaxData?.Rate.ToString("#0.0000")} <br/>
+                                          收款方:{cityTaxData?.Payee}<br/>
+                                          费用标识:{feeMark4} <br/>
+                                          支付方式:{_setDatas.Find(it => it.Id == cityTaxData?.PayDId)?.Name} <br/>
+                                          卡类型:{_setDatas.Find(it => it.Id == cityTaxData?.CTDId)?.Name} <br/>
+                                          是否由地接支付:{isFeeMark4} <br/>";
+                        }
+
+                        if (!string.IsNullOrEmpty(paymentStr))
+                        {
+                            item.IsPay = 2;
+                            item.PayTips = paymentStr;
+                        }
+                        //item.CNYPrice = roomData?.Price ?? 0.00M * roomData?.Rate ?? 0.00M +
+                        //                breakfastData?.Price ?? 0.00M * breakfastData?.Rate ?? 0.00M +
+                        //                landTaxData?.Price ?? 0.00M * landTaxData?.Rate ?? 0.00M +
+                        //                cityTaxData?.Price ?? 0.00M * cityTaxData?.Rate ?? 0.00M;
+                    }
+                    else
+                    {
+                        decimal roomPrice = (item.SingleRoomCount * item.SingleRoomPrice) +
+                                            (item.DoubleRoomCount * item.DoubleRoomPrice) +
+                                            (item.SuiteRoomCount * item.SuiteRoomPrice) +
+                                            (item.OtherRoomCount * item.OtherRoomPrice);
+                        //item.RoomPrice = item.CardPrice;
+                        item.RoomPriceCurrency = item.PaymentCurrency;
+                    }
+
+                    HotelCNYTotalPrice += item.CNYPrice;
+                    item.PayMoney = item.PayMoney.ConvertToDecimal1();
+                    item.CNYPrice = item.CNYPrice.ConvertToDecimal1();
+                }
+
+                _geView.GroupHotelFeeViews = groupHotelFeeViews;
+                _geView.GroupHotelFeeStr = string.Format(@"人民币总费用:{0} CNY", HotelCNYTotalPrice.ToString("#0.00"));
+
+                #endregion
+
+                #region 地接费用
+
+                List<GroupCTGGRFeeView> groupCTGGRFeeViews = new List<GroupCTGGRFeeView>();
+                string CTGGRFeeSql = string.Empty;
+                if (visitDate > Convert.ToDateTime("2024-04-17"))
+                {
+                    CTGGRFeeSql = string.Format(@"Select ctggr.Id As CTGGRId,ctggr.DiId As CTGGRDiId,ctggr.PriceName As Area,ctggrc.*,ctggrc.Price As PayMoney,
+                                                     sd2.name As PaymentCurrency,ccp.PayPercentage,
+                                                     (ctggrc.Price * (ccp.PayPercentage / 100)) As AmountPaid,
+                                                     (ctggrc.Price - ctggrc.Price * (ccp.PayPercentage / 100)) As BalancePayment,
+                                                     ccp.DayRate,(ctggrc.Price * (ccp.PayPercentage / 100) * ccp.DayRate) As CNYPrice,ccp.Payee,ccp.AuditGMDate,
+                                                     ccp.OrbitalPrivateTransfer,sd1.Name As PayWay,ccp.IsPay,u.CnName As Applicant,ctggr.CreateTime
+                                                     From Grp_CarTouristGuideGroundReservations ctggr
+                                                     Left Join ( Select cggrc.CTGGRId,sd1.Name As PriceName,cggrc.Price*cggrc.Count As Price,sd2.Name As PriceCurrency,
+                                                                        cggrc.DatePrice,cggrc.PriceContent
+                                                             From Grp_CarTouristGuideGroundReservationsContent cggrc
+                                                             Left Join Sys_SetData sd1 On cggrc.SId = sd1.Id
+                                                             Left Join Sys_SetData sd2 On cggrc.Currency = sd2.Id
+                                                             Where cggrc.ISdel = 0 And cggrc.Price != 0.00 
+                                                             ) ctggrc On ctggr.Id = ctggrc.CTGGRId 
+                                                     Left Join Grp_CreditCardPayment ccp On ccp.IsDel = 0  And ccp.CTable = 79 And ctggr.Id = ccp.CId
+                                                     Left Join Sys_SetData sd1 On ccp.PayDId = sd1.Id
+                                                     Left Join Sys_SetData sd2 On ccp.PaymentCurrency = sd2.Id
+                                                     Left Join Sys_Users u On ccp.CreateUserId = u.Id
+                                                     Where ctggr.IsDel = 0 {1} And ctggr.DiId = {0}
+                                                     Order By CreateTime", _dto.DiId, _dto.isAudit ? "And (ccp.IsAuditGM = 1 OR ccp.IsAuditGM = 3)" : " ");
+                }
+                else
+                {
+                    CTGGRFeeSql = string.Format(@"Select ctggr.Id As CTGGRId,ctggr.DiId As CTGGRDiId,ctggr.PriceName As Area,
+													 ccp.PayMoney,sd2.name As PaymentCurrency,ccp.PayPercentage,
+													 (ccp.PayMoney * (ccp.PayPercentage / 100)) As AmountPaid,
+													 (ccp.PayMoney -ccp.PayMoney * (ccp.PayPercentage / 100)) As BalancePayment,
+                                                     ccp.DayRate,(ccp.PayMoney * (ccp.PayPercentage / 100) * ccp.DayRate) As CNYPrice,
+													 ccp.Payee,ccp.AuditGMDate,
+                                                     ccp.OrbitalPrivateTransfer,sd1.Name As PayWay,ccp.IsPay,u.CnName As Applicant,ctggr.CreateTime
+                                                     From Grp_CarTouristGuideGroundReservations ctggr
+                                                     Left Join Grp_CreditCardPayment ccp On ccp.IsDel = 0  And ccp.CTable = 79 And ctggr.Id = ccp.CId
+                                                     Left Join Sys_SetData sd1 On ccp.PayDId = sd1.Id
+                                                     Left Join Sys_SetData sd2 On ccp.PaymentCurrency = sd2.Id
+                                                     Left Join Sys_Users u On ccp.CreateUserId = u.Id
+                                                     Where ctggr.IsDel = 0 {1} And ctggr.DiId = {0}
+                                                     Order By CreateTime", _dto.DiId, _dto.isAudit ? "And (ccp.IsAuditGM = 1 OR ccp.IsAuditGM = 3)" : " ");
+                }
+
+                groupCTGGRFeeViews = await _sqlSugar.SqlQueryable<GroupCTGGRFeeView>(CTGGRFeeSql).ToListAsync();
+
+                string CTGGRFeeStr = "";
+                decimal CTGGRCNYTotalPrice = 0.00M;
+
+                //按1 地区,2 币种,3 汇率 分组计算
+                var groupCTGGRFeeDatas = groupCTGGRFeeViews.GroupBy(it => it.Area);
+
+                foreach (var ctggfr in groupCTGGRFeeDatas)
+                {
+                    var ctggfr_curr = ctggfr.GroupBy(it => it.PaymentCurrency);
+
+                    if (ctggfr_curr.Count() > 0)
+                    {
+                        foreach (var curr in ctggfr_curr)
+                        {
+
+                            var ctggfr_rate = curr.GroupBy(it => it.DayRate);
+
+                            if (ctggfr_rate.Count() > 0)
+                            {
+                                foreach (var rate in ctggfr_rate)
+                                {
+                                    CTGGRFeeStr += string.Format(@$"{ctggfr.Key} 总费用:{rate.Sum(it => it.AmountPaid).ToString("#0.00")} 
+                                                        {rate.FirstOrDefault()?.PaymentCurrency}(人民币:
+                                                        {rate.Sum(it => Convert.ToDecimal(it.CNYPrice.ToString("#0.00"))).ToString("#0.00")} CNY 当时支付汇率:
+                                                        {rate.FirstOrDefault()?.DayRate.ToString("#0.0000")})\r\n");
+                                    CTGGRCNYTotalPrice += rate.Sum(it => Convert.ToDecimal(it.CNYPrice.ToString("#0.00")));
+                                }
+                            }
+                            else
+                            {
+                                CTGGRFeeStr += string.Format(@$"{ctggfr.Key} 总费用:{curr.Sum(it => it.AmountPaid).ToString("#0.00")} 
+                                                        {curr.FirstOrDefault()?.PaymentCurrency}(人民币:
+                                                        {curr.Sum(it => Convert.ToDecimal(it.CNYPrice.ToString("#0.00"))).ToString("#0.00")} CNY 当时支付汇率:
+                                                        {curr.FirstOrDefault()?.DayRate.ToString("#0.0000")})\r\n");
+                                CTGGRCNYTotalPrice += curr.Sum(it => Convert.ToDecimal(it.CNYPrice.ToString("#0.00")));
+                            }
+                        }
+                    }
+                    else
+                    {
+                        CTGGRFeeStr += string.Format(@$"{ctggfr.Key} 总费用:{ctggfr.Sum(it => it.AmountPaid).ToString("#0.00")} 
+                                                        {ctggfr.FirstOrDefault()?.PaymentCurrency}(人民币:
+                                                        {ctggfr.Sum(it => Convert.ToDecimal(it.CNYPrice.ToString("#0.00"))).ToString("#0.00")} CNY 当时支付汇率:
+                                                        {ctggfr.FirstOrDefault()?.DayRate.ToString("#0.0000")})\r\n");
+                        CTGGRCNYTotalPrice += ctggfr.Sum(it => Convert.ToDecimal(it.CNYPrice.ToString("#0.00")));
+                    }
+
+                }
+
+                foreach (var item in groupCTGGRFeeViews)
+                {
+                    if (!string.IsNullOrEmpty(item.AuditGMDate))
+                    {
+                        item.AuditGMDate = Convert.ToDateTime(item.AuditGMDate).ToString("yyyy-MM-dd HH:mm:ss");
+                    }
+
+                    if (item.DatePrice != null)
+                    {
+                        item.PriceName = $"{item.PriceName}({Convert.ToDateTime(item.DatePrice).ToString("yyyy-MM-dd")})";
+                    }
+
+                    //CTGGRFeeStr += string.Format(@"{0} 总费用:{1} {2}(人民币:{3} CNY 当时支付汇率:{4})\r\n", 
+                    //    item.Area, item.AmountPaid.ConvertToDecimal1().ToString("#0.00"), item.PaymentCurrency, item.CNYPrice.ToString("#0.0000"), item.DayRate.ToString("#0.0000"));
+                    //CTGGRCNYTotalPrice += item.CNYPrice;
+                }
+                _geView.GroupCTGGRFeeViews = groupCTGGRFeeViews;
+
+                _geView.GroupCTGGRFeeStr = string.Format(@"{0}人民币总费用:{1} CNY", CTGGRFeeStr, CTGGRCNYTotalPrice.ToString("#0.00"));
+                #endregion
+
+                #region 机票预订费用
+                //(((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100) As CNYPrice
+                //ccp.RMBPrice As CNYPrice
+                List<GroupAirFeeView> groupAirFeeViews = new List<GroupAirFeeView>();
+                string groupAirFeeSql = string.Format(@"Select atr.Id As AirId,atr.DIId As AirDiId,atr.FlightsCode,atr.FlightsCity,sd4.Name As AirTypeName,
+                                                        atr.FlightsDate,atr.FlightsTime,atr.ClientName,atr.ClientNum,ccp.PayMoney,
+                                                        sd1.Name As PayMoneyCurrency,(((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100) As CNYPrice,ccp.DayRate,ccp.Payee,ccp.AuditGMDate,
+                                                        ccp.OrbitalPrivateTransfer,sd2.Name As PayWay,sd3.Name As CardType,ccp.IsPay,u.CnName As Applicant,atr.CreateTime,
+                                                        atr.CType
+                                                        From Grp_AirTicketReservations atr
+                                                        Left Join Grp_CreditCardPayment ccp On ccp.isdel = 0 And ccp.CTable = 85 And atr.Id = ccp.CId
+                                                        Left Join Sys_SetData sd1 On ccp.PaymentCurrency = sd1.Id
+                                                        Left Join Sys_SetData sd2 On ccp.PayDId = sd2.Id
+                                                        Left Join Sys_SetData sd3 On ccp.CTDId = sd3.Id
+                                                        Left Join Sys_SetData sd4 On atr.CType = sd4.Id
+                                                        Left Join Sys_Users u On ccp.CreateUserId = u.Id
+                                                        Where atr.IsDel = 0 {1} And atr.DiId = {0} Order By CreateTime", _dto.DiId, _dto.isAudit ? "And ccp.IsAuditGM = 1" : " ");
+                groupAirFeeViews = await _sqlSugar.SqlQueryable<GroupAirFeeView>(groupAirFeeSql).ToListAsync();
+
+                string str = "";
+                List<dynamic> airClientPris = new List<dynamic>();
+                decimal AirCNYTotalPrice = 0.00M;
+                decimal JJCCNYTotalPrice = 0.00M, JJCPeopleNum = 0.00M, JJCAveragePrice = 0.00M;
+                decimal GWCCNYTotalPrice = 0.00M, GWCPeopleNum = 0.00M, GWCAveragePrice = 0.00M;
+
+                //if (groupAirFeeViews.Count > 0)
+                //{
+                //    JJCCNYTotalPrice = groupAirFeeViews.Where(it => it.AirTypeName.Equals("经济舱")).Sum(it => it.CNYPrice);
+                //    JJCPeopleNum = groupAirFeeViews.Where(it => it.AirTypeName.Equals("经济舱")).Sum(it => it.ClientNum);
+                //    JJCAveragePrice = (JJCCNYTotalPrice / JJCPeopleNum).ConvertToDecimal1();
+                //    GWCCNYTotalPrice = groupAirFeeViews.Where(it => it.AirTypeName.Equals("公务舱")).Sum(it => it.CNYPrice);
+                //    GWCPeopleNum = groupAirFeeViews.Where(it => it.AirTypeName.Equals("公务舱")).Sum(it => it.ClientNum);
+                //    GWCAveragePrice = (GWCCNYTotalPrice / GWCPeopleNum).ConvertToDecimal1();
+                //}
+
+                int Index = 0;
+                foreach (var item in groupAirFeeViews)
+                {
+                    if (item.AirId > 2924)
+                    {
+                        string itemClientName = "";
+                        if (!string.IsNullOrEmpty(item.ClientName))
+                        {
+                            System.Text.RegularExpressions.Match m_EnName = Regex.Match(item.ClientName, @"[A-Za-z]+");
+                            System.Text.RegularExpressions.Match m_ZHName = Regex.Match(item.ClientName, @"[\u4e00-\u9fa5]");
+
+                            if (m_EnName.Success || m_ZHName.Success)
+                            {
+                                itemClientName = item.ClientName;
+
+                                decimal unitCost = 0.00M;
+                                AirCNYTotalPrice += item.CNYPrice;
+                                continue;
+                            }
+
+                            string[] clientIds = new string[] { };
+                            if (item.ClientName.Contains(','))
+                            {
+                                clientIds = item.ClientName.Split(',');
+                            }
+                            else
+                            {
+                                clientIds = new string[] { item.ClientName };
+                            }
+                            if (clientIds.Length > 0)
+                            {
+                                int[] output = Array.ConvertAll<string, int>(clientIds, delegate (string s) { return int.Parse(s); });
+
+                                if (output.Contains(-1))
+                                {
+                                    itemClientName += $@"行程单";
+                                    output = output.Where(val => val != -1).ToArray();
+                                }
+
+                                var clients = _clientDatas.Where(it => output.Contains(it.Id)).ToList();
+                                decimal unitCost = 0.00M;
+                                unitCost = (item.PayMoney / item.ClientNum).ConvertToDecimal1();
+
+                                int clienIndex = 1;
+                                foreach (var client in clients)
+                                {
+
+                                    airClientPris.Add(new
+                                    {
+                                        CnName = client.LastName + client.FirstName,
+                                        EnName = client.Pinyin,
+                                        Price = unitCost,
+                                        AirType = item.AirTypeName
+                                    });
+
+                                    string six = "";
+                                    if (client.Sex == 0) six = "Mr";
+                                    else if (client.Sex == 1) six = "Ms";
+
+                                    itemClientName += string.Format(@"{0}.{1} {2};", clienIndex, client.LastName + client.FirstName, six);
+                                    clienIndex++;
+                                }
+                            }
+                        }
+                        item.ClientName = itemClientName;
+                    }
+                    else
+                    {
+                        string clientPinYinName = "";
+                        decimal unitCost = 0.00M;
+                        int cNum = item.ClientNum == 0 ? 1 : item.ClientNum;
+                        unitCost = (item.PayMoney / cNum).ConvertToDecimal1();
+
+                        Regex r = new Regex("[0-9]");
+                        string name1 = item.ClientName;
+                        name1 = r.Replace(name1, "");
+                        string[] clientNames = name1.Split('.');
+                        for (int i = 0; i < item.ClientNum; i++)
+                        {
+                            string name = "";
+                            if (clientNames.Length > 0)
+                            {
+                                int index = i + 1;
+                                if (index < clientNames.Length)
+                                {
+                                    name = clientNames[index].Replace("MR", "").Replace("MS", "").Trim();
+                                    if (!string.IsNullOrEmpty(name))
+                                    {
+                                        airClientPris.Add(new
+                                        {
+                                            CnName = name,
+                                            EnName = name,
+                                            Price = unitCost,
+                                            AirType = item.AirTypeName
+                                        });
+                                    }
+
+                                    //if (name.Length > 0)
+                                    //{
+                                    //    string nameLastStr = name[name.Length - 1].ToString();
+                                    //    if (nameLastStr.IsNumeric())
+                                    //    {
+                                    //        name = name.Substring(0, name.Length - 1).Trim();
+                                    //    }
+                                    //}
+                                }
+                            }
+
+                            clientPinYinName += string.Format(@"{0}.{1}出票价为:{2} CNY;", Index + 1, name, unitCost.ToString("#0.00"));
+                        }
+                    }
+                    if (!string.IsNullOrEmpty(item.AuditGMDate))
+                    {
+                        item.AuditGMDate = Convert.ToDateTime(item.AuditGMDate).ToString("yyyy-MM-dd HH:mm:ss");
+                    }
+                    AirCNYTotalPrice += item.CNYPrice;
+                }
+
+                _geView.GroupAirFeeViews = groupAirFeeViews;
+                if (airClientPris.Count > 0)
+                {
+                    var peoplePriStr = "";
+                    var airClientPris1 = airClientPris.GroupBy(item => item.CnName)
+                                                      .Select(group => group.First())
+                                                      .ToList();
+                    int airClientPrisIndex = 1;
+                    foreach (var item in airClientPris1)
+                    {
+                        decimal price = 0.00M;
+                        var prices = airClientPris.Where(it => it.CnName == item.CnName).ToList();
+                        foreach (var pri in prices)
+                        {
+                            price += pri.Price;
+                        }
+                        peoplePriStr += $@"{airClientPrisIndex}.{item.EnName}出票价为: {price.ToString("#0.00")} CNY;";
+
+                        airClientPrisIndex++;
+                    }
+
+                    if (!string.IsNullOrEmpty(peoplePriStr))
+                    {
+                        str = $@"其中:{peoplePriStr}";
+                    }
+
+                    //经济舱均价
+                    var airJJCPris = airClientPris.Where(it => it.AirType == "经济舱").ToList();
+                    if (airJJCPris.Count > 0)
+                    {
+                        decimal jjcTotalPrice = 0.00M;
+                        foreach (var item in airJJCPris)
+                        {
+                            jjcTotalPrice += item.Price;
+                        }
+                        decimal jjcPeopleNum = airJJCPris.GroupBy(item => item.CnName)
+                                                      .Select(group => group.First())
+                                                      .ToList().Count;
+                        JJCAveragePrice = jjcTotalPrice / jjcPeopleNum;
+                    }
+
+                    //公务舱均价
+                    var airGWCPris = airClientPris.Where(it => it.AirType == "公务舱").ToList();
+                    if (airGWCPris.Count > 0)
+                    {
+                        decimal gwcTotalPrice = 0.00M;
+                        foreach (var item in airGWCPris)
+                        {
+                            gwcTotalPrice += item.Price;
+                        }
+                        decimal gwcPeopleNum = airGWCPris.GroupBy(item => item.CnName)
+                                                      .Select(group => group.First())
+                                                      .ToList().Count;
+                        GWCAveragePrice = gwcTotalPrice / gwcPeopleNum;
+                    }
+                }
+
+
+
+                _geView.GroupAirFeeStr = $@"人民币总费用:{AirCNYTotalPrice.ToString("#0.00")} CNY\r\n{str}\r\n经济舱均价为:{JJCAveragePrice.ToString("#0.00")}CNY/人;公务舱均价为:{GWCAveragePrice.ToString("#0.00")}CNY/人;";
+                #endregion
+
+                #region 签证费用
+
+                List<GroupVisaFeeView> groupVisaFeeViews = new List<GroupVisaFeeView>();
+                string groupVisaFeeSql = string.Format(@"Select vi.Id As VisaId,vi.DIId As VisaDiId,vi.VisaClient,ccp.PayMoney,sd1.Name As PayMoneyCurrency,
+                                                         ccp.DayRate,ccp.Payee,ccp.AuditGMDate,ccp.OrbitalPrivateTransfer,sd2.Name As PayWay,
+                                                         sd3.Name As CardTypeName,ccp.IsPay,u.CnName As Applicant,vi.CreateTime,
+(((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100) As CNYPrice
+                                                         From Grp_VisaInfo vi
+                                                         Left Join Grp_CreditCardPayment ccp On ccp.isdel = 0 And ccp.CTable = 80 And vi.Id = ccp.CId
+                                                         Left Join Sys_SetData sd1 On ccp.PaymentCurrency = sd1.Id
+                                                         Left Join Sys_SetData sd2 On ccp.PayDId = sd2.Id
+                                                         Left Join Sys_SetData sd3 On ccp.CTDId = sd3.Id
+                                                         Left Join Sys_Users u On ccp.CreateUserId = u.Id
+                                                         Where vi.IsDel = 0 {1} And vi.DIId = {0} Order By CreateTime", _dto.DiId, _dto.isAudit ? "And ccp.IsAuditGM = 1" : " ");
+
+                groupVisaFeeViews = await _sqlSugar.SqlQueryable<GroupVisaFeeView>(groupVisaFeeSql).ToListAsync();
+
+                decimal VisaCNYTotalPirce = 0.00M;
+
+                foreach (var item in groupVisaFeeViews)
+                {
+                    string itemClientName = "";
+                    string visaClients = item.VisaClient;
+                    if (!string.IsNullOrEmpty(visaClients))
+                    {
+                        string[] clientIds = new string[] { };
+                        if (visaClients.Contains(','))
+                        {
+                            clientIds = visaClients.Split(',');
+                        }
+                        else
+                        {
+                            clientIds = new string[] { visaClients };
+                        }
+
+                        if (clientIds.Length > 0)
+                        {
+                            List<int> clientIds1 = new List<int>() { };
+                            foreach (var clientIdStr in clientIds)
+                            {
+                                if (clientIdStr.IsNumeric())
+                                {
+                                    clientIds1.Add(int.Parse(clientIdStr));
+                                }
+                            }
+                            if (clientIds1.Count > 0)
+                            {
+                                var clients = _clientDatas.Where(it => clientIds1.Contains(it.Id)).ToList();
+                                foreach (var client in clients)
+                                {
+                                    itemClientName += $"{client.LastName + client.FirstName},";
+                                }
+                            }
+                            else
+                            {
+                                itemClientName = visaClients;
+                            }
+                        }
+                    }
+                    if (itemClientName.Length > 0)
+                    {
+                        itemClientName = itemClientName.Substring(0, itemClientName.Length - 1);
+                    }
+                    item.VisaClient = itemClientName;
+                    VisaCNYTotalPirce += item.CNYPrice;
+                    if (!string.IsNullOrEmpty(item.AuditGMDate))
+                    {
+                        item.AuditGMDate = Convert.ToDateTime(item.AuditGMDate).ToString("yyyy-MM-dd HH:mm:ss");
+                    }
+                }
+
+                _geView.GroupVisaFeeViews = groupVisaFeeViews;
+                _geView.GroupVisaFeeStr = string.Format(@"人民币总费用:{0} CNY", VisaCNYTotalPirce.ConvertToDecimal1().ToString("#.00"));
+                #endregion
+
+                #region 邀请/公务活动  CTable = 81
+
+                List<GroupInvitationalFeeView> groupInvitationalFeeViews = new List<GroupInvitationalFeeView>();
+                string groupInvitationalFeeSql = string.Format(@"Select ioa.Id As IOAId,ioa.DiId As IOADiId,ioa.InviterArea,ioa.Inviter,ioa.InviteTime,
+                                                                 ioa.InviteCost,sd3.Name As InviteCurrency,ioa.SendCost,sd4.Name As SendCurrency,ioa.EventsCost,
+                                                                 sd5.Name As EventsCurrency,ioa.TranslateCost,sd6.Name As TranslateCurrency,ccp.PayMoney,
+                                                                 sd7.Name As PaymentCurrency,ccp.RMBPrice As CNYPrice,
+                                                                 (((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100) As CNYPrice2,ccp.Payee,ccp.AuditGMDate,
+                                                                 ccp.OrbitalPrivateTransfer,sd2.Name As PayWay,ccp.IsPay,u.CnName As Applicant,ioa.CreateTime
+                                                                 From  Grp_InvitationOfficialActivities ioa
+                                                                 Left Join Grp_CreditCardPayment ccp On ccp.isdel = 0 And ccp.CTable = 81 And ioa.Id = ccp.CId
+                                                                 Left Join Sys_SetData sd1 On ccp.PaymentCurrency = sd1.Id
+                                                                 Left Join Sys_SetData sd2 On ccp.PayDId = sd2.Id
+                                                                 Left Join Sys_SetData sd3 On ioa.InviteCurrency = sd3.Id
+                                                                 Left Join Sys_SetData sd4 On ioa.SendCurrency = sd4.Id
+                                                                 Left Join Sys_SetData sd5 On ioa.EventsCurrency = sd5.Id
+                                                                 Left Join Sys_SetData sd6 On ioa.TranslateCurrency = sd6.Id
+                                                                 Left Join Sys_SetData sd7 On ccp.PaymentCurrency = sd7.Id
+                                                                 Left Join Sys_Users u On ccp.CreateUserId = u.Id
+                                                                 Where ioa.IsDel = 0 {1} And  ioa.Diid = {0} Order By CreateTime", _dto.DiId, _dto.isAudit ? "And ccp.IsAuditGM = 1" : " ");
+
+                groupInvitationalFeeViews = await _sqlSugar.SqlQueryable<GroupInvitationalFeeView>(groupInvitationalFeeSql).ToListAsync();
+
+                #region 邀请/公务活动 - 模拟数据
+                //if (groupInvitationalFeeViews.Count < 1)
+                //{
+                //    groupInvitationalFeeViews.Add(new GroupInvitationalFeeView()
+                //    {
+                //        IOAId = 0,
+                //        IOADiId = 2334,
+                //        InviterArea = "模拟数据-邀请方地区",
+                //        Inviter = "模拟数据-邀请方",
+                //        InviteTime = "2023-10-10",
+                //        InviteCost = 100.00M,
+                //        InviteCurrency = "EUR",
+                //        SendCost = 100.00M,
+                //        SendCurrency = "EUR",
+                //        EventsCost = 10000.00M,
+                //        EventsCurrency = "EUR",
+                //        TranslateCost = 300.00M,
+                //        TranslateCurrency = "EUR",
+                //        PayMoney = 10500.00M,
+                //        PaymentCurrency = "EUR",
+                //        CNYPrice = 76765.50M,
+                //        Payee = "模拟数据-收款方",
+                //        AuditGMDate = "2023-12-05",
+                //        OrbitalPrivateTransfer = 1,
+                //        PayWay = "刷卡",
+                //        IsPay = 1,
+                //        Applicant = "刘华举"
+                //    });
+                //    groupInvitationalFeeViews.Add(new GroupInvitationalFeeView()
+                //    {
+                //        IOAId = 0,
+                //        IOADiId = 2334,
+                //        InviterArea = "模拟数据-邀请方地区",
+                //        Inviter = "模拟数据-邀请方",
+                //        InviteTime = "2023-10-10",
+                //        InviteCost = 100.00M,
+                //        InviteCurrency = "EUR",
+                //        SendCost = 100.00M,
+                //        SendCurrency = "EUR",
+                //        EventsCost = 10000.00M,
+                //        EventsCurrency = "EUR",
+                //        TranslateCost = 300.00M,
+                //        TranslateCurrency = "EUR",
+                //        PayMoney = 10500.00M,
+                //        PaymentCurrency = "EUR",
+                //        CNYPrice = 76765.50M,
+                //        Payee = "模拟数据-收款方",
+                //        AuditGMDate = "2023-12-05",
+                //        OrbitalPrivateTransfer = 1,
+                //        PayWay = "刷卡",
+                //        IsPay = 1,
+                //        Applicant = "刘华举"
+                //    });
+                //}
+                #endregion
+
+                decimal InvitationalCNYTotalPrice = 0.00M;
+
+                foreach (var item in groupInvitationalFeeViews)
+                {
+                    InvitationalCNYTotalPrice += item.CNYPrice2;
+
+                    if (!string.IsNullOrEmpty(item.AuditGMDate))
+                    {
+                        item.AuditGMDate = Convert.ToDateTime(item.AuditGMDate).ToString("yyyy-MM-dd HH:mm:ss");
+                    }
+
+                    string currencyRateStr = "";
+                    List<string> currencys = new List<string>();
+                    if (!string.IsNullOrEmpty(item.InviteCurrency)) currencys.Add(item.InviteCurrency);
+                    if (!string.IsNullOrEmpty(item.SendCurrency)) currencys.Add(item.SendCurrency);
+                    if (!string.IsNullOrEmpty(item.EventsCurrency)) currencys.Add(item.EventsCurrency);
+                    if (!string.IsNullOrEmpty(item.TranslateCurrency)) currencys.Add(item.TranslateCurrency);
+                    if (!string.IsNullOrEmpty(item.PaymentCurrency)) currencys.Add(item.PaymentCurrency);
+
+                    currencyRateStr = await GeneralMethod.PostGroupRateByCTableAndCurrency(teamRateData, 81, currencys);
+
+                    item.CurrencyRateStr = currencyRateStr;
+                }
+
+                _geView.GroupInvitationalFeeViews = groupInvitationalFeeViews;
+                _geView.GroupInvitationalFeeStr = string.Format(@"人民币总费用:{0} CNY", InvitationalCNYTotalPrice.ToString("#.00"));
+                #endregion
+
+                #region 保险费用
+                List<GroupInsuranceFeeView> groupInsuranceFeeViews = new List<GroupInsuranceFeeView>();
+                string groupInsuranceFeeSql = string.Format(@"Select ic.Id As InsuranceId,ic.Diid As InsuranceDiId,ClientName,ccp.PayMoney,ccp.PayMoney * ccp.DayRate As CNYPrice,
+                                                              sd1.Name As PayMoneyCurrency,ccp.Payee,ccp.AuditGMDate,ccp.OrbitalPrivateTransfer,
+                                                              sd2.Name As PayWay,ccp.IsPay,u.CnName As Applicant,ic.CreateTime
+                                                              From Grp_Customers ic
+                                                              Left Join Grp_CreditCardPayment ccp On ccp.isdel = 0 And ccp.CTable = 82 And ic.Id = ccp.CId
+                                                              Left Join Sys_SetData sd1 On ccp.PaymentCurrency = sd1.Id
+                                                              Left Join Sys_SetData sd2 On ccp.PayDId = sd2.Id
+                                                              Left Join Sys_Users u On ccp.CreateUserId = u.Id
+                                                              Where ic.IsDel = 0 {1} And ic.DiId = {0} Order By CreateTime", _dto.DiId, _dto.isAudit ? "And ccp.IsAuditGM = 1" : " ");
+                groupInsuranceFeeViews = await _sqlSugar.SqlQueryable<GroupInsuranceFeeView>(groupInsuranceFeeSql).ToListAsync();
+
+                decimal InsuranceCNYTotalPrice = 0.00M;
+                foreach (var item in groupInsuranceFeeViews)
+                {
+                    InsuranceCNYTotalPrice += item.CNYPrice;
+
+                    string itemClientName = "";
+                    string insClients = item.ClientName;
+                    if (!string.IsNullOrEmpty(insClients))
+                    {
+                        //System.Text.RegularExpressions.Match m_EnName = Regex.Match(item.ClientName, @"[A-Za-z]+");
+                        //System.Text.RegularExpressions.Match m_ZHName = Regex.Match(item.ClientName, @"[\u4e00-\u9fa5]");
+
+                        //if (m_EnName.Success || m_ZHName.Success)
+                        //{
+                        //    itemClientName = insClients;
+                        //    continue;
+                        //}
+
+                        string[] clientIds = new string[] { };
+                        if (insClients.Contains(','))
+                        {
+                            clientIds = insClients.Split(',');
+                        }
+                        else
+                        {
+                            clientIds = new string[] { insClients };
+                        }
+
+                        if (clientIds.Length > 0)
+                        {
+                            List<int> output = new List<int>();
+                            foreach (var clientId in clientIds)
+                            {
+                                if (clientId.IsNumeric())
+                                {
+                                    output.Add(int.Parse(clientId));
+                                }
+
+                            }
+
+                            if (output.Count > 0)
+                            {
+                                var clients = _clientDatas.Where(it => output.Contains(it.Id)).ToList();
+                                foreach (var client in clients)
+                                {
+                                    itemClientName += $"{client.LastName + client.FirstName},";
+                                }
+                                if (itemClientName.Length > 0)
+                                {
+                                    itemClientName = itemClientName.Substring(0, itemClientName.Length - 1);
+                                }
+                            }
+                            else
+                            {
+                                itemClientName = insClients;
+                            }
+                        }
+                    }
+
+                    item.ClientName = itemClientName;
+
+                    if (!string.IsNullOrEmpty(item.AuditGMDate))
+                    {
+                        item.AuditGMDate = Convert.ToDateTime(item.AuditGMDate).ToString("yyyy-MM-dd HH:mm:ss");
+                    }
+                }
+                _geView.GroupInsuranceFeeViews = groupInsuranceFeeViews;
+                _geView.GroupInsuranceFeeStr = string.Format(@"人民币总费用:{0} CNY", InsuranceCNYTotalPrice.ToString("#0.00"));
+                #endregion
+
+                #region 其他款项费用  98
+                List<GroupDecreaseFeeView> groupDecreaseFeeViews = new List<GroupDecreaseFeeView>();
+                string groupDecreaseFeeSql = string.Format(@"Select dp.Id As DPId,dp.DiId As DPDiId,dp.PriceName,ccp.PayMoney,sd1.Name As PayMoneyCurrency,
+                                                              (((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100) As CNYPrice,   
+                                                             ccp.DayRate,ccp.Payee,ccp.AuditGMDate,ccp.OrbitalPrivateTransfer,
+                                                             sd2.Name As PayWay,ccp.IsPay,u.CnName As Applicant,dp.CreateTime
+                                                             From Grp_DecreasePayments dp
+                                                             Left Join Grp_CreditCardPayment ccp On ccp.isdel = 0 And ccp.CTable = 98 And dp.Id = ccp.CId
+                                                             Left Join Sys_SetData sd1 On ccp.PaymentCurrency = sd1.Id
+                                                             Left Join Sys_SetData sd2 On ccp.PayDId = sd2.Id
+                                                             Left Join Sys_Users u On ccp.CreateUserId = u.Id
+                                                             Where dp.IsDel = 0 And ccp.Ctable = 98 {1} And dp.Diid = {0} 
+                                                             Order By CreateTime", _dto.DiId, _dto.isAudit ? "And ccp.IsAuditGM = 1" : " ");
+                groupDecreaseFeeViews = await _sqlSugar.SqlQueryable<GroupDecreaseFeeView>(groupDecreaseFeeSql).ToListAsync();
+
+                #region 保险费用 - 模拟数据
+
+                //if (groupDecreaseFeeViews.Count < 1)
+                //{
+                //    groupDecreaseFeeViews.Add(new GroupDecreaseFeeView()
+                //    {
+                //        DPId = 0,
+                //        DPDiId = 2334,
+                //        PriceName = "模拟数据-费用名称",
+                //        PayMoney = 1000.00M,
+                //        PayMoneyCurrency = "CNY",
+                //        DayRate = 1.0000M,
+                //        CNYPrice = 1.0000M,
+                //        AuditGMDate = "2023-12-10 12:13:00",
+                //        Payee = "模拟数据-付款方",
+                //        OrbitalPrivateTransfer = 1,
+                //        PayWay = "现金",
+                //        IsPay = 1,
+                //        Applicant = "刘华举"
+                //    });
+                //    groupDecreaseFeeViews.Add(new GroupDecreaseFeeView()
+                //    {
+                //        DPId = 0,
+                //        DPDiId = 2334,
+                //        PriceName = "模拟数据-费用名称",
+                //        PayMoney = 1000.00M,
+                //        PayMoneyCurrency = "CNY",
+                //        DayRate = 1.0000M,
+                //        CNYPrice = 1.0000M,
+                //        AuditGMDate = "2023-12-10 12:13:00",
+                //        Payee = "模拟数据-付款方",
+                //        OrbitalPrivateTransfer = 1,
+                //        PayWay = "现金",
+                //        IsPay = 1,
+                //        Applicant = "刘华举"
+                //    });
+                //}
+
+                #endregion
+
+                decimal DecreaseCNYTotalPrice = 0.00M;
+                foreach (var item in groupDecreaseFeeViews)
+                {
+                    item.CNYPrice = Convert.ToDecimal(item.CNYPrice.ToString("#0.00"));
+                    DecreaseCNYTotalPrice += item.CNYPrice;
+
+
+                    if (!string.IsNullOrEmpty(item.AuditGMDate))
+                    {
+                        item.AuditGMDate = Convert.ToDateTime(item.AuditGMDate).ToString("yyyy-MM-dd HH:mm:ss");
+                    }
+                }
+
+                _geView.GroupDecreaseFeeViews = groupDecreaseFeeViews;
+                _geView.GroupDecreaseFeeStr = string.Format(@"人民币总费用:{0} CNY", DecreaseCNYTotalPrice.ToString("#0.00"));
+                #endregion
+
+                #region 公司内部操作人员提成
+
+                var royaltyDatas = await _sqlSugar
+                    .Queryable<Fin_RoyaltyConfirm, Sys_Users, Sys_Users>((rc, u1, u2) =>
+                        new JoinQueryInfos(
+                            JoinType.Left, rc.UserId == u1.Id,
+                            JoinType.Left, rc.CreateUserId == u2.Id
+                        ))
+                    .Where((rc, u1, u2) => rc.IsDel == 0 && rc.TeamId == _dto.DiId && rc.IsConfirm == 1)
+                    .Select((rc, u1, u2) => new GroupRoyaltyFeeInfo()
+                    {
+                        GroupId = rc.TeamId,
+                        OverviewInfo = rc.Temp,
+                        DetailedInfo = rc.ChiArr,
+                        Amount = rc.Price,
+                        IsConfirm = rc.IsConfirm,
+                        IsSeed = rc.IsSeed,
+                        RoyaltyUserName = u1.CnName,
+                        CreateUserName = u2.CnName,
+                        CreateTime = rc.CreateTime
+                    })
+                    .ToListAsync();
+                decimal royaltyCNYTotalPrice = royaltyDatas.Sum(x => x.Amount);
+                _geView.GroupRoyaltyFeeViews = _mapper.Map<List<GroupRoyaltyFeeView>>(royaltyDatas);
+                _geView.GroupRoyaltyFeeStr = string.Format(@"人民币总费用:{0} CNY", royaltyCNYTotalPrice.ToString("#0.00"));
+                #endregion
+
+                _view.GroupExpenditure = _geView;
+                #endregion
+
+                /* 
+                * 团组报表计算方式
+                * 当前总支出 = 团组支出.Sum() + 超支费用.Sum()
+                * 应收金额 = 应收表.Sum()
+                * 已收金额 = 已收表.Sum()
+                * 应收利润(应收-支出) = 应收金额 - 收款退还 - 当前总支出
+                * 已收利润(已收-支出) = 已收金额 - 收款退还 - 当前总支出
+                * 
+                */
+                decimal _totalExpenditure = 0.00M; //总支出
+                decimal _amountReceivable = 0.00M; //应收金额
+                decimal _amountReceived = 0.00M;   //已收金额
+                decimal _receivableProfit = 0.00M; //应收利润
+                decimal _receivedProfit = 0.00M;   //已收利润
+                _totalExpenditure = HotelCNYTotalPrice + CTGGRCNYTotalPrice + AirCNYTotalPrice + VisaCNYTotalPirce + InvitationalCNYTotalPrice +
+                                    InsuranceCNYTotalPrice + DecreaseCNYTotalPrice + exTotalAmount + royaltyCNYTotalPrice;
+                _amountReceivable = frTotalAmount;
+                _amountReceived = prTotalAmount;
+                _receivableProfit = _amountReceivable - promTotalAmount - _totalExpenditure;
+                _receivedProfit = _amountReceived - promTotalAmount - _totalExpenditure;
+                _view.FeeTotalStr = string.Format(@$"<span>
+                                                    <span>当前总支出:{_totalExpenditure.ToString("#0.00")} CNY</span> 
+                                                    <span style='padding-left:10px;color: Green;'>应收金额:{_amountReceivable.ToString("#0.00")} CNY</span> 
+                                                    <span style='padding-left:10px;color: Green;'>已收金额:{_amountReceived.ToString("#0.00")} CNY</span>
+                                                    <span style='padding-left:10px;color: Green;'>应收利润(应收-支出):{_receivableProfit.ToString("#0.00")} CNY</span>
+                                                    <span style='padding-left:10px;color: Green;'>已收利润(已收-支出):{_receivedProfit.ToString("#0.00")} CNY</span>
+                                                    </span>");
+
+
+                index1++;
+                _views.Add(new GroupStatisticsInfo()
+                {
+                    Index = index1,
+                    Id = info.Id,
+                    GroupName = info.TeamName,
+                    VisitDate = info.VisitDate,
+                    Receivable = Math.Floor(_amountReceivable * 100) / 100,
+                    Cost = Math.Floor(_totalExpenditure * 100) / 100,
+                    Grossprofit = Math.Floor((_amountReceivable - _totalExpenditure) * 100) / 100,
+
+                });
+            }
+            return Ok(JsonView(true, "查询成功!", _views));
+
+        }
+        private class GroupStatisticsInfo
+            {
+            public int Index { get; set; }
+            public int Id { get; set; }
+            public string GroupName { get; set; }
+            public DateTime VisitDate { get; set; }
+            public decimal Receivable { get; set; }
+            public decimal Cost { get; set; }
+
+            public decimal Grossprofit { get; set; }
+
+        }
+
         private void StatementExportExcelSetCell(WorkbookDesigner designer, Worksheet sheet, DataTable dt, Style style, string judgeLable, int startIndex, string startRange, string endRange)
         {
             if (designer == null) return;

+ 13 - 0
OASystem/OASystem.Domain/AutoMappers/_baseMappingProfile.cs

@@ -122,6 +122,15 @@ namespace OASystem.Domain.AutoMappers
             CreateMap<EnterExitCostOperateDto, Grp_EnterExitCost>();
             CreateMap<DayAndCostAddView, Grp_DayAndCost>();
 
+
+            CreateMap<Grp_EnterExitCostDraft, EnterExitCostDraftInfoView>();
+
+            CreateMap<EnterExitCostDraftOpDto, Grp_EnterExitCostDraft>();
+            CreateMap<DayAndCostDraftAddView, Grp_DayAndCostDraft>();
+            CreateMap<Grp_DayAndCostDraft, DayAndCostDraftAddView>();
+
+
+
             CreateMap<Grp_EnterExitCost, EnterExitCostMobileInfoView>();
             CreateMap<Grp_EnterExitCost, EnterExitCostMobileParentInfoView>();
 
@@ -133,6 +142,10 @@ namespace OASystem.Domain.AutoMappers
             CreateMap<PostEnterExitCostMobileOpSingleStep3To6Dto, Grp_DayAndCost>();
             CreateMap<PostEnterExitCostMobileOpSingleStep7Dto, Grp_DayOtherPrice>();
 
+            CreateMap<Grp_EnterExitCostDraft, Grp_EnterExitCost>();
+            CreateMap<Grp_DayAndCostDraft, Grp_DayAndCost>();
+            CreateMap<Grp_DayOtherPriceDraft, Grp_DayOtherPrice>();
+
             #endregion
 
             #region 出入境国家费用标准

+ 300 - 0
OASystem/OASystem.Domain/Dtos/Groups/EnterExitCostDraftDto.cs

@@ -0,0 +1,300 @@
+using OASystem.Domain.ViewModels.Groups;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Dtos.Groups
+{
+    public class EnterExitCostDraftDto
+    {
+    }
+
+    /// <summary>
+    /// 出入境费用详情 Dto
+    /// </summary>
+    public class EnterExitCostDraftInfoByIdDto : PortDtoBase
+    {
+        /// <summary>
+        /// Id
+        /// </summary>
+        public int Id { get; set; }
+    }
+
+    /// <summary>
+    /// 出入境费用 Add And Update  Dto
+    /// </summary>
+    public class EnterExitCostDraftOpDto : PortDtoBase
+    {
+        public int UserId { get; set; }
+
+        /// <summary>
+        /// Id
+        /// </summary>
+        public int Id { get; set; }
+
+        /// <summary>
+        /// 草稿名称
+        /// </summary>
+        public string DraftName { get; set; }
+
+        #region 境内费用(其他费用)
+
+        /// <summary>
+        ///  境内费用(其他费用)选择框
+        /// </summary>
+        public int ChoiceOne { get; set; }
+
+        /// <summary>
+        /// 境内费用(其他费用)
+        /// </summary>
+        public decimal InsidePay { get; set; }
+
+        #region 境内费用(其他费用)子项
+
+        /// <summary>
+        /// 签证费
+        /// </summary>
+        public decimal Visa { get; set; }
+
+        /// <summary>
+        /// 签证费描述
+        /// </summary>
+        public string? VisaRemark { get; set; }
+
+        /// <summary>
+        /// 疫苗费
+        /// </summary>
+        public decimal YiMiao { get; set; }
+
+        /// <summary>
+        /// 核酸检测费用
+        /// </summary>
+        public decimal HeSuan { get; set; }
+
+        /// <summary>
+        /// 服务费用
+        /// </summary>
+        public decimal Service { get; set; }
+
+        /// <summary>
+        /// 参展门票
+        /// </summary>
+        public decimal Ticket { get; set; }
+
+        /// <summary>
+        /// 保险费
+        /// </summary>
+        public decimal Safe { get; set; }
+
+        public string FirstItemRemark { get; set; }
+
+        #endregion
+
+        #endregion
+
+        #region 国际旅费
+
+        /// <summary>
+        ///  国际旅费合计选择框
+        /// </summary>
+        public int ChoiceTwo { get; set; }
+
+        /// <summary>
+        ///  经济舱小计选择框
+        /// </summary>
+        public int SumJJC { get; set; }
+
+        /// <summary>
+        ///  公务舱小计选择框
+        /// </summary>
+        public int SumGWC { get; set; }
+
+        /// <summary>
+        ///  公务舱小计选择框
+        /// </summary>
+        public int SumTDC { get; set; }
+
+
+        #region 国际旅费子项
+        /// <summary>
+        /// 国际旅费合计(经济舱)
+        /// </summary>
+        public decimal OutsideJJPay { get; set; }
+
+        /// <summary>
+        ///  国际旅费合计(公务舱)
+        /// </summary>
+        public decimal OutsideGWPay { get; set; }
+
+        /// <summary>
+        /// 国际旅费合计(头等舱)
+        /// </summary>
+        public decimal OutsideTDPay { get; set; }
+
+        /// <summary>
+        ///  国际机票(经济舱)
+        /// </summary>
+        public decimal AirJJ { get; set; }
+
+        /// <summary>
+        ///  国际机票(公务舱)
+        /// </summary>
+        public decimal AirGW { get; set; }
+
+        /// <summary>
+        ///  国际机票(头等舱)
+        /// </summary>
+        public decimal AirTD { get; set; }
+
+        /// <summary>
+        ///  国外城市间交通费
+        /// </summary>
+        public decimal CityTranffic { get; set; }
+
+        public string TwoItemRemark { get; set; }
+
+        /// <summary>
+        ///  多个币种存储
+        ///  存储方式: 美元(USD):6.2350|.......|墨西哥比索(MXN):1.0000
+        /// </summary>
+        public List<CurrencyInfo>? Currencys { get; set; }
+
+        #endregion
+
+        #endregion
+
+        #region 住宿费
+
+        /// <summary>
+        ///  住宿费合计选择框
+        /// </summary>
+        public int ChoiceThree { get; set; }
+
+        /// <summary>
+        /// 住宿费子项Data
+        /// </summary>
+        public List<DayAndCostDraftAddView>? QuarterageData { get; set; }
+
+        #endregion
+
+        #region 伙食费
+
+        /// <summary>
+        ///  伙食费合计选择框
+        /// </summary>
+        public int ChoiceFour { get; set; }
+
+        /// <summary>
+        /// 伙食费子项Data
+        /// </summary>
+        public List<DayAndCostDraftAddView>? BoardWagesData { get; set; }
+
+        #endregion
+
+        #region 公杂费
+
+        /// <summary>
+        ///  公杂费合计选择框
+        /// </summary>
+        public int ChoiceFive { get; set; }
+
+        /// <summary>
+        /// 公杂费子项Data
+        /// </summary>
+        public List<DayAndCostDraftAddView>? MiscellaneousFeeData { get; set; }
+
+        #endregion
+
+        #region 培训费
+
+        /// <summary>
+        ///  培训费用选择框
+        /// </summary>
+        public int ChoiceSix { get; set; }
+
+        /// <summary>
+        /// 培训费子项Data
+        /// </summary>
+        public List<DayAndCostDraftAddView>? TrainingExpenseData { get; set; }
+
+        #endregion
+
+        #region 其他费用
+
+        /// <summary>
+        ///  其他费用选择框
+        /// </summary>
+        public int OtherExpenses_Checked { get; set; }
+
+        /// <summary>
+        /// 其他费用子项Data
+        /// </summary>
+        public List<DayOtherPriceDraftAddView> DayOtherPriceData { get; set; }
+        #endregion
+
+        #region 最下面 选择框状态
+
+        /// <summary>
+        /// 经济舱选择框
+        /// </summary>
+        public int AirJJC_Checked { get; set; }
+
+        /// <summary>
+        /// 公务舱选择框
+        /// </summary>
+        public int AirGWC_Checked { get; set; }
+
+        /// <summary>
+        /// 公务舱选择框
+        /// </summary>
+        public int AirTDC_Checked { get; set; }
+
+        #endregion
+
+    }
+
+    public class EnterExitCostDraftCorrelationTipsDto : PortDtoBase { }
+
+    /// <summary>
+    /// 出入境费用 - 表格导出 Dto
+    /// </summary>
+    public class EnterExitCostDraftDownloadDto : PortDtoBase
+    {
+        public int Id { get; set; }
+
+        /// <summary>
+        /// 模板类型
+        /// 1 明细表
+        /// 2 表格
+        /// 3 团组成员名单
+        /// </summary>
+        public int ExportType { get; set; }
+
+        /// <summary>
+        /// 类型Id
+        /// </summary>
+        public int SubTypeId { get; set; }
+    }
+
+    /// <summary>
+    /// 出入境费用 - 一键清空 dto
+    /// </summary>
+    public class EnterExitCostDraftOneClickEmptyDto : PortDtoBase
+    {
+        public int UserId { get; set; }
+
+        public int Id { get; set; }
+    }
+
+    public class EnterExitCostDraftOtherExpensesDelDto : DelBaseDto { }
+
+
+    public class EnterExitCostDraftImportDataDto: PortDtoBase {
+        public int UserId { get; set; }
+        public int DraftId { get; set; }
+        public int GroupId { get; set; }
+
+    }
+}

+ 5 - 0
OASystem/OASystem.Domain/Dtos/Groups/EnterExitCostDto.cs

@@ -125,6 +125,10 @@ namespace OASystem.Domain.Dtos.Groups
         /// </summary>
         public int SumTDC { get; set; }
 
+        /// <summary>
+        /// 第二项备注
+        /// </summary>
+        public string TwoItemRemark { get; set; }
 
         #region 国际旅费子项
         /// <summary>
@@ -660,6 +664,7 @@ namespace OASystem.Domain.Dtos.Groups
         ///  国外城市间交通费
         /// </summary>
         public decimal CityTranffic { get; set; }
+        public string TwoItemRemark { get; set; }
     }
 
     public class PostEnterExitCostMobileOpStep3To6Dto

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

@@ -369,6 +369,13 @@ namespace OASystem.Domain.Dtos.Groups
         public string Job { get; set; }
     }
 
+    public class ClientInfoInfo_Group : ClientInfo
+    {
+        public int DiId { get; set; }
+        public DateTime CreateTime { get; set; }
+    }
+
+
     public class ClientAirInfo: ClientInfo
     {
         public int AirType { get; set; }

+ 1 - 1
OASystem/OASystem.Domain/Dtos/Resource/OfficialActivitiesDto.cs

@@ -156,7 +156,7 @@ namespace OASystem.Domain.Dtos.Resource
         /// <summary>
         /// 翻译人员Info
         /// </summary>
-        public TranslatorView TranslatorInfo { get; set; }
+        public TranslatorView? TranslatorInfo { get; set; }
 
 
     }

+ 64 - 0
OASystem/OASystem.Domain/Entities/Groups/Grp_DayAndCostDraft.cs

@@ -0,0 +1,64 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Entities.Groups
+{
+    /// <summary>
+    /// 团组 - 出入境费用 - 子项 - 草稿
+    /// </summary>
+    [SugarTable("Grp_DayAndCostDraft")]
+    public class Grp_DayAndCostDraft : EntityBase
+    {
+        /// <summary>
+        /// 团组Id
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int ParentId { get; set; }
+
+        /// <summary>
+        /// 类型:1为住宿费;2为伙食费;3为公杂费;4培训费用
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int Type { get; set; }
+
+        /// <summary>
+        /// 天数
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int Days { get; set; }
+
+        /// <summary>
+        /// 地名Id
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int NationalTravelFeeId { get; set; }
+
+        /// <summary>
+        /// 地名 - 弃用字段不删
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(100)")]
+        public string? Place { get; set; }
+
+        /// <summary>
+        /// 费用标准
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
+        public decimal Cost { get; set; }
+
+        /// <summary>
+        /// 币种
+        /// Sys_SetData STid = 66
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int Currency { get; set; }
+
+        /// <summary>
+        /// 小计
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
+        public decimal SubTotal { get; set; }
+    }
+}

+ 32 - 0
OASystem/OASystem.Domain/Entities/Groups/Grp_DayOtherPriceDraft.cs

@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Entities.Groups
+{
+    /// <summary>
+    /// 三公费用其他费用表 草稿
+    /// </summary>
+    [SugarTable("Grp_DayOtherPriceDraft")]
+    public class Grp_DayOtherPriceDraft : EntityBase
+    {
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int ParentId { get; set; }
+
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int SetDataId { get; set; }
+
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int Index { get; set; }
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
+        public decimal Cost { get; set; }
+
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int Currency { get; set; }
+
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
+        public decimal SubTotal { get; set; }
+    }
+}

+ 11 - 1
OASystem/OASystem.Domain/Entities/Groups/Grp_EnterExitCost.cs

@@ -68,7 +68,12 @@ namespace OASystem.Domain.Entities.Groups
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
         public decimal Safe { get; set; }
-
+        
+        /// <summary>
+        /// 第一项费用描述
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(500)")]
+        public string? FirstItemRemark { get; set; }
         #endregion
 
         /// <summary>
@@ -116,6 +121,11 @@ namespace OASystem.Domain.Entities.Groups
         [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
         public decimal CityTranffic { get; set; }
 
+        /// <summary>
+        ///  第二项费用描述
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(500)")]
+        public string TwoItemRemark { get; set; }
 
         #region 汇率币种
 

+ 258 - 0
OASystem/OASystem.Domain/Entities/Groups/Grp_EnterExitCostDraft.cs

@@ -0,0 +1,258 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Entities.Groups
+{
+    /// <summary>
+    /// 团组 - 出入境费用 - 草稿
+    /// </summary>
+    [SugarTable("Grp_EnterExitCostDraft")]
+    public class Grp_EnterExitCostDraft : EntityBase
+    {
+        /// <summary>
+        /// 草稿名称
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(200)")]
+        public string DraftName { get; set; }
+
+        /// <summary>
+        /// 境内费用(其他费用)
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
+        public decimal InsidePay { get; set; }
+
+        #region 境内费用(其他费用)子项
+
+        /// <summary>
+        /// 签证费
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
+        public decimal Visa { get; set; }
+
+        /// <summary>
+        /// 签证费描述
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(200)")]
+        public string? VisaRemark { get; set; }
+
+        /// <summary>
+        /// 疫苗费
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
+        public decimal YiMiao { get; set; }
+
+        /// <summary>
+        /// 核酸检测费用
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
+        public decimal HeSuan { get; set; }
+
+        /// <summary>
+        /// 服务费用
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
+        public decimal Service { get; set; }
+
+        /// <summary>
+        /// 参展门票
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
+        public decimal Ticket { get; set; }
+
+        /// <summary>
+        /// 保险费
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
+        public decimal Safe { get; set; }
+
+        /// <summary>
+        /// 第一项备注
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "nvarchar(500)")]
+        public string FirstItemRemark { get; set; }
+
+        #endregion
+
+        /// <summary>
+        /// 国际旅费合计(经济舱)
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
+        public decimal OutsideJJPay { get; set; }
+
+        /// <summary>
+        ///  国际旅费合计(公务舱)
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
+        public decimal OutsideGWPay { get; set; }
+
+        /// <summary>
+        /// 国际旅费合计(头等舱)
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
+        public decimal OutsideTDPay { get; set; }
+
+
+        #region 国际旅费合计(经济舱\公务舱\头等舱)
+
+        /// <summary>
+        ///  国际机票(经济舱)
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
+        public decimal AirJJ { get; set; }
+
+        /// <summary>
+        ///  国际机票(公务舱)
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
+        public decimal AirGW { get; set; }
+
+        /// <summary>
+        ///  国际机票(头等舱)
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
+        public decimal AirTD { get; set; }
+
+        /// <summary>
+        ///  国外城市间交通费
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
+        public decimal CityTranffic { get; set; }
+
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(500)")]
+        public string TwoItemRemark { get; set; }
+        #region 汇率币种
+
+        /// <summary>
+        ///  美元
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,4)")]
+        public decimal RateUSD { get; set; }
+
+        /// <summary>
+        ///  日元
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,4)")]
+        public decimal RateJPY { get; set; }
+
+        /// <summary>
+        ///  欧元
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,4)")]
+        public decimal RateEUR { get; set; }
+
+        /// <summary>
+        ///  英镑 
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,4)")]
+        public decimal RateGBP { get; set; }
+
+        /// <summary>
+        ///  港币 
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,4)")]
+        public decimal RateHKD { get; set; }
+
+
+        /// <summary>
+        ///  多个币种存储
+        ///  存储方式: 美元(USD):6.2350|.......|墨西哥比索(MXN):1.0000
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(500)")]
+        public string? CurrencyRemark { get; set; }
+
+        #endregion
+
+        #endregion
+
+        #region 选择框状态
+
+        /// <summary>
+        ///  境内费用(其他费用)选择框
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int ChoiceOne { get; set; }
+
+        /// <summary>
+        ///  国际旅费合计选择框
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int ChoiceTwo { get; set; }
+
+        /// <summary>
+        ///  经济舱小计选择框
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int SumJJC { get; set; }
+
+        /// <summary>
+        ///  公务舱小计选择框
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int SumGWC { get; set; }
+
+        /// <summary>
+        ///  头等舱小计选择框
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int SumTDC { get; set; }
+
+        /// <summary>
+        ///  住宿费合计选择框
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int ChoiceThree { get; set; }
+
+        /// <summary>
+        ///  伙食费合计选择框
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int ChoiceFour { get; set; }
+
+        /// <summary>
+        ///  公杂费合计选择框
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int ChoiceFive { get; set; }
+
+        /// <summary>
+        ///  境内费用(其他费用)选择框
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int ChoiceSix { get; set; }
+
+        /// <summary>
+        /// 经济舱选择框 - bottom(老OA使用 新OA弃用)
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int AirJJC_Checked { get; set; }
+
+        /// <summary>
+        /// 公务舱选择框 - bottom(老OA使用 新OA弃用)
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int AirGWC_Checked { get; set; }
+
+        /// <summary>
+        /// 头等舱选择框 - bottom(老OA使用 新OA弃用)
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int AirTDC_Checked { get; set; }
+
+        #endregion
+
+        /// <summary>
+        /// 确认费用(确认费用后 不可更改)
+        /// 1:未确认 2:已确认
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int IsConfirm { get; set; } = 1;
+
+        /// <summary>
+        /// 其他费用选择框
+        /// </summary>
+        public int OtherExpenses_Checked { get; set; }
+    }
+}

+ 4 - 0
OASystem/OASystem.Domain/ViewModels/Groups/DelegationInfoView.cs

@@ -496,6 +496,10 @@ namespace OASystem.Domain.ViewModels.Groups
         public int GrpScheduleId { get; set; } = 0;
 
         public DateTime CreateTime { get; set; }
+
+        public string GroupFirst { get; set; }
+
+        public string CreateUserName { get; set; }
     }
 
     

+ 428 - 0
OASystem/OASystem.Domain/ViewModels/Groups/EnterExitCostDraftView.cs

@@ -0,0 +1,428 @@
+using OASystem.Domain.Dtos;
+using OASystem.Domain.Entities.Groups;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.ViewModels.Groups
+{
+    public class EnterExitCostDraftView:Grp_EnterExitCostDraft
+    {
+    }
+
+    /// <summary>
+    /// 出入境费用info
+    /// </summary>
+    public class EnterExitCostDraftInfoView
+    {
+        /// <summary>
+        /// Id
+        /// </summary>
+        public int Id { get; set; }
+
+        /// <summary>
+        /// 团组Id
+        /// </summary>
+        public string DraftName { get; set; }
+
+        /// <summary>
+        /// 境内费用(其他费用)
+        /// </summary>
+        public decimal InsidePay { get; set; }
+
+        #region 境内费用(其他费用)子项
+
+        /// <summary>
+        /// 签证费
+        /// </summary>
+        public decimal Visa { get; set; }
+
+        /// <summary>
+        /// 签证费描述
+        /// </summary>
+        public string? VisaRemark { get; set; }
+
+        /// <summary>
+        /// 疫苗费
+        /// </summary>
+        public decimal YiMiao { get; set; }
+
+        /// <summary>
+        /// 核酸检测费用
+        /// </summary>
+        public decimal HeSuan { get; set; }
+
+        /// <summary>
+        /// 服务费用
+        /// </summary>
+        public decimal Service { get; set; }
+
+        /// <summary>
+        /// 参展门票
+        /// </summary>
+        public decimal Ticket { get; set; }
+
+        /// <summary>
+        /// 保险费
+        /// </summary>
+        public decimal Safe { get; set; }
+
+        public string FirstItemRemark { get; set; }
+
+        #endregion
+
+        /// <summary>
+        /// 国际旅费合计(经济舱)
+        /// </summary>
+        public decimal OutsideJJPay { get; set; }
+
+        /// <summary>
+        ///  国际旅费合计(公务舱)
+        /// </summary>
+        public decimal OutsideGWPay { get; set; }
+
+
+        /// <summary>
+        /// 国际旅费合计(头等舱)
+        /// </summary>
+        public decimal OutsideTDPay { get; set; }
+
+        #region 国际旅费合计(经济舱\公务舱\头等舱)
+
+        /// <summary>
+        ///  国际机票(经济舱)
+        /// </summary>
+        public decimal AirJJ { get; set; }
+
+        /// <summary>
+        ///  国际机票(公务舱)
+        /// </summary>
+        public decimal AirGW { get; set; }
+
+        /// <summary>
+        ///  国际机票(头等舱)
+        /// </summary>
+        public decimal AirTD { get; set; }
+
+        /// <summary>
+        ///  国外城市间交通费
+        /// </summary>
+        public decimal CityTranffic { get; set; }
+
+        public string TwoItemRemark { get; set; }
+
+        #region 汇率币种
+
+        /// <summary>
+        ///  多个币种存储
+        ///  存储方式: 美元(USD):6.2350|.......|墨西哥比索(MXN):1.0000
+        /// </summary>
+        public List<CurrencyInfo>? Currencys { get; set; }
+
+        #endregion
+
+        #endregion
+
+        #region 选择框状态
+
+        /// <summary>
+        ///  境内费用(其他费用)选择框
+        /// </summary>
+        public int ChoiceOne { get; set; }
+
+        /// <summary>
+        ///  国际旅费合计选择框
+        /// </summary>
+        public int ChoiceTwo { get; set; }
+
+        /// <summary>
+        ///  经济舱小计选择框
+        /// </summary>
+        public int SumJJC { get; set; }
+
+        /// <summary>
+        ///  公务舱小计选择框
+        /// </summary>
+        public int SumGWC { get; set; }
+
+        /// <summary>
+        ///  头等舱小计选择框
+        /// </summary>
+        public int SumTDC { get; set; }
+
+        /// <summary>
+        ///  住宿费合计选择框
+        /// </summary>
+        public int ChoiceThree { get; set; }
+
+        /// <summary>
+        /// 住宿费子项Data
+        /// </summary>
+        public List<DayAndCostDraftInfoView>? QuarterageData { get; set; }
+
+        /// <summary>
+        ///  伙食费合计选择框
+        /// </summary>
+        public int ChoiceFour { get; set; }
+
+        /// <summary>
+        /// 伙食费子项Data
+        /// </summary>
+        public List<DayAndCostDraftInfoView>? BoardWagesData { get; set; }
+
+        /// <summary>
+        ///  公杂费合计选择框
+        /// </summary>
+        public int ChoiceFive { get; set; }
+
+        /// <summary>
+        /// 公杂费子项Data
+        /// </summary>
+        public List<DayAndCostDraftInfoView>? MiscellaneousFeeData { get; set; }
+
+        /// <summary>
+        ///  培训费用选择框
+        /// </summary>
+        public int ChoiceSix { get; set; }
+
+        /// <summary>
+        /// 培训费子项Data
+        /// </summary>
+        public List<DayAndCostDraftInfoView>? TrainingExpenseData { get; set; }
+
+        /// <summary>
+        /// 经济舱选择框
+        /// </summary>
+        public int AirJJC_Checked { get; set; }
+
+        /// <summary>
+        /// 公务舱选择框
+        /// </summary>
+        public int AirGWC_Checked { get; set; }
+
+        /// <summary>
+        /// 头等舱选择框
+        /// </summary>
+        public int AirTDC_Checked { get; set; }
+
+        /// <summary>
+        /// 其他款项选择框
+        /// </summary>
+        public int OtherExpenses_Checked { get; set; }
+
+        /// <summary>
+        /// 其他款项子项Data
+        /// </summary>
+        public List<DayOtherPriceDraftView> DayOtherPriceData { get; set; }
+        #endregion
+    }
+
+    /// <summary>
+    /// 出入境国家(城市)费用标准子项Info  View
+    /// </summary>
+    public class DayAndCostDraftInfoView
+    {
+        /// <summary>
+        /// Id
+        /// </summary>
+        public int Id { get; set; }
+
+        /// <summary>
+        /// 团组Id
+        /// </summary>
+        public int ParentId { get; set; }
+
+        /// <summary>
+        /// 类型:1为住宿费;2为伙食费;3为公杂费;4培训费用
+        /// </summary>
+        public int Type { get; set; }
+
+        /// <summary>
+        /// 类型名称
+        /// </summary>
+        public string? TypeName
+        {
+            get
+            {
+                string str = "";
+                if (Type == 1) str = string.Format("住宿费");
+                else if (Type == 2) str = string.Format("伙食费");
+                else if (Type == 3) str = string.Format("公杂费");
+                else if (Type == 4) str = string.Format("培训费");
+                return str;
+            }
+        }
+
+        /// <summary>
+        /// 天数
+        /// </summary>
+        public int Days { get; set; }
+
+        /// <summary>
+        /// 出入境国家费用标准 - Id
+        /// </summary>
+        public int NationalTravelFeeId { get; set; }
+
+        /// <summary>
+        /// 出入境国家费用标准 - 国家
+        /// </summary>
+        public string? Country { get; set; }
+
+        /// <summary>
+        /// 出入境国家费用标准 - 城市
+        /// </summary>
+        public string? City { get; set; }
+
+        ///// <summary>
+        ///// 地名
+        ///// </summary>
+        //public string? Place { get; set; }
+
+        /// <summary>
+        /// 地名
+        /// </summary>
+        public string? PlaceName
+        {
+            get
+            {
+                string str = "";
+                if (!string.IsNullOrEmpty(Country))
+                {
+                    if (City.Contains("城市")) str = Country;
+                    else str = City;
+                }
+
+                return str;
+
+            }
+        }
+
+        /// <summary>
+        /// 费用标准
+        /// </summary>
+        public decimal Cost { get; set; }
+
+        /// <summary>
+        /// 币种 Id
+        /// Sys_SetData STid = 66
+        /// </summary>
+        public int Currency { get; set; }
+
+        /// <summary>
+        /// 币种Code
+        /// </summary>
+        public string? CurremcyCode { get; set; }
+
+        /// <summary>
+        /// 币种名称
+        /// </summary>
+        public string? CurrencyName { get; set; }
+
+        /// <summary>
+        /// 小计
+        /// </summary>
+        public decimal SubTotal { get; set; }
+
+        /// <summary>
+        /// 备注
+        /// </summary>
+        public string? Remark { get; set; } = "";
+    }
+
+    public class DayOtherPriceDraftView
+    {
+        public int Id { get; set; }
+
+        public int ParentId { get; set; }
+
+        public int SetDataId { get; set; }
+
+        public int Index { get; set; }
+
+        public decimal Cost { get; set; }
+
+        public int Currency { get; set; }
+
+        public decimal SubTotal { get; set; }
+        public string Remark { get; set; }
+    }
+
+
+    /// <summary>
+    /// 出入境国家(城市)费用标准子项Add  View
+    /// </summary>
+    public class DayAndCostDraftAddView
+    {
+        /// <summary>
+        /// 主键编号
+        /// </summary>
+        public int Id { get; set; }
+
+        /// <summary>
+        /// 主表Id
+        /// </summary>
+        public int ParentId { get; set; }
+
+        /// <summary>
+        /// 类型:1为住宿费;2为伙食费;3为公杂费;4培训费用
+        /// </summary>
+        public int Type { get; set; }
+
+        /// <summary>
+        /// 天数
+        /// </summary>
+        public int Days { get; set; }
+
+        /// <summary>
+        /// 出入境国家费用标准 - Id
+        /// </summary>
+        public int NationalTravelFeeId { get; set; }
+
+        /// <summary>
+        /// 费用标准
+        /// </summary>
+        public decimal Cost { get; set; }
+
+        /// <summary>
+        /// 币种 Id
+        /// Sys_SetData STid = 66
+        /// </summary>
+        public int Currency { get; set; }
+
+        /// <summary>
+        /// 小计
+        /// </summary>
+        public decimal SubTotal { get; set; }
+
+        /// <summary>
+        /// 备注
+        /// </summary>
+        public string? Remark { get; set; } = "";
+    }
+
+    public class DayOtherPriceDraftAddView
+    {
+        public int Id { get; set; }
+
+        public int ParentId { get; set; }
+
+        public int SetDataId { get; set; }
+
+        public int Index { get; set; }
+
+        public decimal Cost { get; set; }
+
+        public int Currency { get; set; }
+
+        public decimal SubTotal { get; set; }
+        public string Remark { get; set; }
+    }
+
+    /// <summary>
+    /// 出入境费用子项删除
+    /// </summary>
+    public class EnterExitCostDraftSubItemDelDto : DelBaseDto
+    { }
+}

+ 17 - 0
OASystem/OASystem.Domain/ViewModels/Groups/EnterExitCostView.cs

@@ -14,6 +14,16 @@ namespace OASystem.Domain.ViewModels.Groups
     /// </summary>
     public class EnterExitCostView:Grp_EnterExitCost { }
 
+
+    public class EnterExitCostGroupNameView
+    {
+        public int Id { get; set; }
+
+        public string GroupName { get; set; }
+
+        public string IsNull { get; set; }
+    }
+
     /// <summary>
     /// 出入境国家(城市)费用标准 View
     /// </summary>
@@ -343,6 +353,11 @@ namespace OASystem.Domain.ViewModels.Groups
         /// </summary>
         public decimal CityTranffic { get; set; }
 
+        /// <summary>
+        /// 第二项备注
+        /// </summary>
+        public string TwoItemRemark { get; set; }
+
         #region 汇率币种
 
         /// <summary>
@@ -710,6 +725,8 @@ namespace OASystem.Domain.ViewModels.Groups
         ///  国外城市间交通费
         /// </summary>
         public decimal CityTranffic { get; set; }
+
+        public string TwoItemRemark { get; set; }
     }
 
     public class ChoiceTwoMobileSubInfoView : ChoiceTwoMobileInfoView

+ 9 - 2
OASystem/OASystem.Domain/ViewModels/Resource/OfficialActivitiesView.cs

@@ -14,7 +14,7 @@ namespace OASystem.Domain.ViewModels.Resource
         /// <summary>
         /// 翻译人员Id 
         /// </summary>
-        public int[] TranslatorIdItem { get; set; }
+        public int[] TranslatorIdItem { get; set; } = Array.Empty<int>();
 
         public List<string> ScreenshotOfMailUrls
         {
@@ -45,7 +45,7 @@ namespace OASystem.Domain.ViewModels.Resource
             }
         }
 
-        public TranslatorView TranslatorInfo { get; set; }
+        public TranslatorView TranslatorInfo { get; set; } = new TranslatorView { };
     }
 
     public class TranslatorView
@@ -55,11 +55,13 @@ namespace OASystem.Domain.ViewModels.Resource
         /// <summary>
         /// 所在地区
         /// </summary>
+        [Encrypted]
         public string Area { get; set; }
 
         /// <summary>
         /// 姓名
         /// </summary>
+        [Encrypted]
         public string Name { get; set; }
 
         /// <summary>
@@ -70,26 +72,31 @@ namespace OASystem.Domain.ViewModels.Resource
         /// <summary>
         /// 联系电话
         /// </summary>
+        [Encrypted]
         public string Tel { get; set; }
 
         /// <summary>
         /// 邮箱号
         /// </summary>
+        [Encrypted]
         public string Email { get; set; }
 
         /// <summary>
         /// 微信号
         /// </summary>
+        [Encrypted]
         public string WechatNo { get; set; }
 
         /// <summary>
         /// 其他社交账号
         /// </summary>
+        [Encrypted]
         public string OtherSocialAccounts { get; set; }
 
         /// <summary>
         /// 语种
         /// </summary>
+        [Encrypted]
         public string Language { get; set; }
 
         /// <summary>

+ 85 - 50
OASystem/OASystem.Infrastructure/Repositories/Groups/DelegationInfoRepository.cs

@@ -1,6 +1,7 @@
 using AutoMapper;
 using Newtonsoft.Json;
 using NPOI.OpenXmlFormats.Wordprocessing;
+using NPOI.SS.Formula.Functions;
 using OASystem.Domain;
 using OASystem.Domain.AesEncryption;
 using OASystem.Domain.Dtos;
@@ -493,64 +494,56 @@ namespace OASystem.Infrastructure.Repositories.Groups
         {
             Result result = new Result() { Code = -2, Msg = "未知错误" };
 
-            try
+            if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3) //web
             {
-                if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3) //web
+                dynamic? teamTypeData1 = null;
+                string teamTypeSql = string.Format(@"Select Id,Name From  Sys_SetData Where STid = {0} And IsDel = {1}", 10, 0);
+                var teamTypeData = await _sqlSugar.SqlQueryable<SetDataInfoView>(teamTypeSql).ToListAsync(); ;  //团组分类 10
+                if (teamTypeData.Any())
                 {
-                    dynamic? teamTypeData1 = null;
-                    string teamTypeSql = string.Format(@"Select Id,Name From  Sys_SetData Where STid = {0} And IsDel = {1}", 10, 0);
-                    var teamTypeData = await _sqlSugar.SqlQueryable<SetDataInfoView>(teamTypeSql).ToListAsync(); ;  //团组分类 10
-                    if (teamTypeData.Count > 0)
-                    {
-                        teamTypeData1 = teamTypeData;
-                    }
-
-                    dynamic? teamLevData1 = null;
-                    string teamLevSql = string.Format(@"Select Id,Name From  Sys_SetData Where STid = {0} And IsDel = {1}", 56, 0);
-                    var teamLevData = await _sqlSugar.SqlQueryable<SetDataInfoView>(teamLevSql).ToListAsync(); ;  //团组等级 56
-                    if (teamLevData.Count > 0)
-                    {
-                        teamLevData1 = teamLevData;
-                    }
+                    teamTypeData1 = teamTypeData;
+                }
 
-                    dynamic? userData1 = null;
-                    string userSql = string.Format(@"Select Id,CnName From  Sys_Users Where IsDel = {0}", 0);
-                    var userData = await _sqlSugar.SqlQueryable<UserNameView>(userSql).ToListAsync(); 
-                    if (userData.Count > 0)
-                    {
-                        userData1 = userData;
-                    }
+                dynamic? teamLevData1 = null;
+                string teamLevSql = string.Format(@"Select Id,Name From  Sys_SetData Where STid = {0} And IsDel = {1}", 56, 0);
+                var teamLevData = await _sqlSugar.SqlQueryable<SetDataInfoView>(teamLevSql).ToListAsync(); ;  //团组等级 56
+                if (teamLevData.Any())
+                {
+                    teamLevData1 = teamLevData;
+                }
 
-                    //客户单位数据源 来源市场客户资料
-                    dynamic? clientData1 = null;
-                    string clientSql = $@"Select Client,Contact,Telephone,WeChat From Crm_NewClientData Where IsDel = 0";
-                    var clientData = await _sqlSugar.SqlQueryable<Crm_NewClientData>(clientSql).ToListAsync();
-                    if (clientData.Count > 0)
-                    {
-                        clientData1 = clientData.Select(it => new
-                        {
-                            Client = AesEncryptionHelper.Decrypt(it.Client),
-                            Contact = AesEncryptionHelper.Decrypt(it.Contact),
-                            Telephone = AesEncryptionHelper.Decrypt(it.Telephone),
-                            Wechat = AesEncryptionHelper.Decrypt(it.Wechat)
-                        }).ToList();
-                    }
+                dynamic? userData1 = null;
+                string userSql = string.Format(@"Select Id,CnName From  Sys_Users Where IsDel = {0}", 0);
+                var userData = await _sqlSugar.SqlQueryable<UserNameView>(userSql).ToListAsync();
+                if (userData.Any())
+                {
+                    userData1 = userData;
+                }
 
-                    result.Code = 0;
-                    result.Msg = "成功!";
-                    result.Data = new
+                //客户单位数据源 来源市场客户资料
+                dynamic? clientData1 = null;
+                string clientSql = $@"Select Client,Contact,Telephone,WeChat From Crm_NewClientData Where IsDel = 0";
+                var clientData = await _sqlSugar.SqlQueryable<Crm_NewClientData>(clientSql).ToListAsync();
+                if (clientData.Any())
+                {
+                    clientData1 = clientData.Select(it => new
                     {
-                        teamTypeData = teamTypeData1,
-                        teamLevData = teamLevData1,
-                        userData = userData1,
-                        clientData = clientData1
-                    };
+                        Client = AesEncryptionHelper.Decrypt(it.Client),
+                        Contact = AesEncryptionHelper.Decrypt(it.Contact),
+                        Telephone = AesEncryptionHelper.Decrypt(it.Telephone),
+                        Wechat = AesEncryptionHelper.Decrypt(it.Wechat)
+                    }).ToList();
                 }
-            }
-            catch (Exception ex)
-            {
 
-                result.Msg = ex.Message;
+                result.Code = 0;
+                result.Msg = "成功!";
+                result.Data = new
+                {
+                    teamTypeData = teamTypeData1,
+                    teamLevData = teamLevData1,
+                    userData = userData1,
+                    clientData = clientData1
+                };
             }
 
 
@@ -1088,6 +1081,48 @@ namespace OASystem.Infrastructure.Repositories.Groups
         }
 
 
+        #endregion
+
+
+        #region 团组&出入境费用
+
+        /// <summary>
+        /// 获取单组名称并验证出入境费用明细是否填写
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        public async Task<Result> EnterExitCostGroupNameAsync()
+        {
+            var result = new Result() { Code = -2, Msg = "未知错误" };
+
+            var groupSql = string.Format(@$"SELECT
+  Id,
+  TeamName GroupName,
+  CASE
+    WHEN (
+      SELECT
+        COUNT(*)
+      FROM
+        Grp_EnterExitCost
+      WHERE
+        IsDel = 0
+        AND DiId = di.Id
+    ) > 0 THEN 'false'
+    ELSE 'true'
+  END AS [IsNull]
+FROM
+  Grp_DelegationInfo di
+WHERE
+  di.Isdel = 0
+ORDER BY
+  CreateTime Desc");
+
+            result.Data = await _sqlSugar.SqlQueryable<EnterExitCostGroupNameView>(groupSql).ToListAsync();
+            result.Code = 0;
+            return result;
+
+        }
+
         #endregion
     }
 }

+ 361 - 0
OASystem/OASystem.Infrastructure/Repositories/Groups/EnterExitCostDraftRepository.cs

@@ -0,0 +1,361 @@
+using OASystem.Domain.Dtos.Groups;
+using OASystem.Domain.Entities.Groups;
+using OASystem.Domain.ViewModels.Groups;
+using OASystem.Domain;
+using OASystem.Infrastructure.Repositories.System;
+using OASystem.Infrastructure.Tools;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using AutoMapper;
+
+namespace OASystem.Infrastructure.Repositories.Groups
+{
+    /// <summary>
+    /// 出入境费用-草稿 仓库
+    /// </summary>
+    public class EnterExitCostDraftRepository : BaseRepository<Grp_EnterExitCostDraft, EnterExitCostDraftView>
+    {
+        private readonly IMapper _mapper;
+        private readonly SetDataRepository _setDataRep;
+
+
+        public EnterExitCostDraftRepository(SqlSugarClient sqlSugar, IMapper mapper, SetDataRepository setDataRep)
+            : base(sqlSugar)
+        {
+            _setDataRep = setDataRep;
+            _mapper = mapper;
+        }
+
+        /// <summary>
+        /// 查询 根据 Id 查询
+        /// </summary>
+        /// <returns></returns>
+        public async Task<JsonView> EnterExitCostDraftInfoById(EnterExitCostDraftInfoByIdDto dto)
+        {
+            var result = new JsonView() { Code = 400, Msg = "暂无数据" };
+
+            var id = dto.Id;
+            var enterExitCostDraftData = await _sqlSugar.Queryable<Grp_EnterExitCostDraft>().OrderByDescending(x => x.CreateTime).FirstAsync(it => it.Id == id && it.IsDel == 0);
+
+            var enterExitCostInfoView = new EnterExitCostDraftInfoView();
+
+            if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3) 
+            {
+                if (enterExitCostDraftData != null)
+                {
+                    enterExitCostInfoView = _mapper.Map<EnterExitCostDraftInfoView>(enterExitCostDraftData);
+
+                    var dayAndCostDraftSql = string.Format(@"Select ntf.Country,ntf.City,ssd.Name CurremcyCode,ssd.Remark CurrencyName,gdac.* From Grp_DayAndCostDraft gdac
+                                                        Left Join Grp_NationalTravelFee ntf On ntf.Id = gdac.NationalTravelFeeId
+                                                        Left Join Sys_SetData ssd On ssd.STid = 66 And gdac.Currency = ssd.Id
+                                                        Where gdac.Isdel = 0 And ntf.IsDel = 0 And gdac.ParentId = {0} Order By [Type] ASC,[Days] ASC", id);
+                    var dayAndCostDraftData = await _sqlSugar.SqlQueryable<DayAndCostDraftInfoView>(dayAndCostDraftSql).ToListAsync();
+
+
+                    enterExitCostInfoView.QuarterageData = dayAndCostDraftData.Where(it => it.Type == 1).ToList(); //住宿费 1
+                    enterExitCostInfoView.BoardWagesData = dayAndCostDraftData.Where(it => it.Type == 2).ToList(); //伙食费 2
+                    enterExitCostInfoView.MiscellaneousFeeData = dayAndCostDraftData.Where(it => it.Type == 3).ToList();  //公杂费 3
+                    enterExitCostInfoView.TrainingExpenseData = dayAndCostDraftData.Where(it => it.Type == 4).ToList();  //培训费 4
+
+                    enterExitCostInfoView.DayOtherPriceData = _sqlSugar.Queryable<Grp_DayOtherPriceDraft>()
+                                                                .Where(x => x.IsDel == 0 && x.ParentId == id)
+                                                                .Select(x => new DayOtherPriceDraftView
+                                                                {
+                                                                    ParentId = x.ParentId,
+                                                                    Id = x.Id,
+                                                                    Cost = x.Cost,
+                                                                    Currency = x.Currency,
+                                                                    Index = x.Index,
+                                                                    SetDataId = x.SetDataId,
+                                                                    SubTotal = x.SubTotal,
+                                                                    Remark = x.Remark,
+                                                                })
+                                                                .OrderBy(x => x.Index)
+                                                                .ToList();
+
+                    enterExitCostInfoView.Currencys = (List<CurrencyInfo>?)CommonFun.GetCurrencyChinaToList(enterExitCostDraftData.CurrencyRemark);
+
+                    result.Msg = "操作成功";
+                    result.Code = 200;
+                }
+                else
+                {
+                    //    List<DayAndCostInfoView> views = new List<DayAndCostInfoView>()
+                    //    {
+                    //            new DayAndCostInfoView {Days=1},
+                    //            new DayAndCostInfoView {Days=2},
+                    //            new DayAndCostInfoView {Days=3},
+                    //            new DayAndCostInfoView {Days=4},
+                    //            new DayAndCostInfoView {Days=5},
+                    //            new DayAndCostInfoView {Days=6},
+                    //            new DayAndCostInfoView {Days=7},
+                    //            new DayAndCostInfoView {Days=8},
+                    //    };
+                    //    enterExitCostInfoView.QuarterageData = views;
+                    //    enterExitCostInfoView.BoardWagesData = views;
+                    //    enterExitCostInfoView.MiscellaneousFeeData = views;
+                    //    enterExitCostInfoView.TrainingExpenseData = views;
+                    //    result.Code = 0;
+                    result.Msg = "未查询出数据!!!";
+                }
+
+                result.Data = enterExitCostInfoView;
+            }
+            else result.Msg = MsgTips.Port;
+
+            return result;
+        }
+
+        /// <summary>
+        /// Add Or Update
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        public async Task<Result> EnterExitCostDraftOp(EnterExitCostDraftOpDto dto)
+        {
+            Result result = new Result() { Code = -1, Msg = "操作失败!" };
+
+            if (dto.SumJJC == 0) dto.OutsideJJPay = 0;
+            if (dto.SumGWC == 0) dto.OutsideGWPay = 0;
+            if (dto.SumTDC == 0) dto.OutsideTDPay = 0;
+
+            var enterExitCost = _mapper.Map<Grp_EnterExitCostDraft>(dto);
+            enterExitCost.Remark = dto.FirstItemRemark;
+            //enterExitCost.InsidePay = enterExitCost.Visa + enterExitCost.YiMiao + enterExitCost.HeSuan + enterExitCost.Service + enterExitCost.Safe + enterExitCost.Ticket;
+
+            var subData = new List<Grp_DayAndCostDraft>();
+            var quarterageData = _mapper.Map<List<Grp_DayAndCostDraft>>(dto.QuarterageData);  //住宿费 1
+            quarterageData = quarterageData.Select(it => { it.CreateUserId = dto.UserId; return it; }).ToList();
+            if (quarterageData.Any()) subData.AddRange(quarterageData);
+
+            var boardWagesData = _mapper.Map<List<Grp_DayAndCostDraft>>(dto.BoardWagesData);  //伙食费 2
+            boardWagesData = boardWagesData.Select(it => { it.CreateUserId = dto.UserId; return it; }).ToList();
+            if (boardWagesData.Any()) subData.AddRange(boardWagesData);
+
+            var miscellaneousFeeData = _mapper.Map<List<Grp_DayAndCostDraft>>(dto.MiscellaneousFeeData);  //公杂费 3
+            miscellaneousFeeData = miscellaneousFeeData.Select(it => { it.CreateUserId = dto.UserId; return it; }).ToList();
+            if (miscellaneousFeeData.Any()) subData.AddRange(miscellaneousFeeData);
+
+            var trainingExpenseData = _mapper.Map<List<Grp_DayAndCostDraft>>(dto.TrainingExpenseData);    //培训费 4
+            trainingExpenseData = trainingExpenseData.Select(it => { it.CreateUserId = dto.UserId; return it; }).ToList();
+            if (trainingExpenseData.Any()) subData.AddRange(trainingExpenseData);
+
+            //处理币种string
+            enterExitCost.CurrencyRemark = CommonFun.GetCurrencyChinaToString(dto.Currencys);
+            enterExitCost.CreateUserId = dto.UserId;
+
+            _sqlSugar.BeginTran();
+
+            if (dto.PortType == 1)
+            {
+                try
+                {
+                    int enterExitId = 0;
+
+                    var isNull = _sqlSugar.Queryable<Grp_EnterExitCostDraft>().Where(it => it.IsDel == 0 && it.DraftName.Equals(dto.DraftName)).First();
+                    if (isNull != null) //修改
+                    {
+                        var updateId = _sqlSugar.Updateable(enterExitCost)
+                                                .IgnoreColumns(it => new { it.DeleteUserId, it.DeleteTime, it.CreateUserId, it.CreateTime, it.IsDel })
+                                                .WhereColumns(it => it.DraftName)
+                                                .ExecuteCommand();
+                        if (updateId > 0)
+                        {
+                            enterExitId = isNull.Id;
+                        }
+                        else
+                        {
+                            _sqlSugar.RollbackTran();
+                            result.Msg = "修改操作失败!";
+                            return result;
+                        }
+                    }
+                    else //添加
+                    {
+                        //添加
+                        enterExitId = _sqlSugar.Insertable(enterExitCost).ExecuteReturnIdentity();
+                        if (enterExitId < 1)
+                        {
+                            _sqlSugar.RollbackTran();
+                            result.Msg = "添加操作失败!";
+                            return result;
+                        }
+                        subData.Select(x => { x.Id = 0; return x; }).ToList();
+                        dto.DayOtherPriceData.Select(x => { x.Id = 0; return x; }).ToList();
+
+                    }
+
+                    if (enterExitId > 0)
+                    {
+                        subData = subData.Select(x => { x.ParentId = enterExitId; return x; }).ToList();
+
+                        var addList = subData.Where(x => x.Id == 0).ToList();
+                        var updateList = subData.Where(x => x.Id > 0).ToList();
+
+                        if (addList.Any())
+                        {
+                            var rowCount = _sqlSugar.Insertable(addList).ExecuteCommand();
+                        }
+                        if (updateList.Any())
+                        {
+                            var rowCount = _sqlSugar.Updateable(updateList).ExecuteCommand();
+                        }
+
+                        if (dto.DayOtherPriceData.Any())
+                        {
+                            var inserList = dto.DayOtherPriceData
+                                .Where(x => x.Id == 0)
+                                .Select(x => new Grp_DayOtherPriceDraft
+                                {
+                                    Cost = x.Cost,
+                                    Id = x.Id,
+                                    CreateTime = DateTime.Now,
+                                    CreateUserId = dto.UserId,
+                                    Currency = x.Currency,
+                                    ParentId = enterExitId,
+                                    Index = x.Index,
+                                    IsDel = 0,
+                                    SetDataId = x.SetDataId,
+                                    SubTotal = x.SubTotal,
+                                    Remark = x.Remark,
+                                    
+                                })
+                                .ToList();
+                            var updateList1 = dto.DayOtherPriceData
+                                .Where(x => x.Id != 0)
+                                .Select(x => new Grp_DayOtherPriceDraft
+                                {
+                                    Cost = x.Cost,
+                                    Id = x.Id,
+                                    CreateTime = DateTime.Now,
+                                    CreateUserId = dto.UserId,
+                                    Currency = x.Currency,
+                                    ParentId = enterExitId,
+                                    Index = x.Index,
+                                    IsDel = 0,
+                                    SetDataId = x.SetDataId,
+                                    SubTotal = x.SubTotal,
+                                    Remark = x.Remark
+                                })
+                                .ToList();
+
+                            if (inserList.Any())
+                            {
+                                var rowCount = _sqlSugar.Insertable(inserList).ExecuteCommand();
+                            }
+                            if (updateList1.Any())
+                            {
+                                var rowCount = _sqlSugar.Updateable(updateList1).ExecuteCommand();
+                            }
+                        }
+
+                    }
+                    _sqlSugar.CommitTran();
+                    result.Code = 0;
+                    result.Msg = "操作成功!";
+                    result.Data = new { sign = enterExitId, draftName = enterExitCost.DraftName };
+
+                }
+                catch (Exception ex)
+                {
+                    _sqlSugar.RollbackTran();
+                    result.Msg = ex.Message;
+                }
+            }
+            else result.Msg = MsgTips.Port;
+
+
+            return result;
+        }
+
+        /// <summary>
+        /// Del
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        public async Task<Result> EnterExitCostDraftSubItemDel(EnterExitCostDraftSubItemDelDto dto)
+        {
+            Result result = new Result();
+
+            var data = new Grp_DayAndCostDraft()
+            {
+                Id = dto.Id,
+                IsDel = 1,
+                DeleteUserId = dto.DeleteUserId,
+                DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")
+            };
+
+            var del = _sqlSugar.Updateable(data).UpdateColumns(it => new { it.IsDel, it.DeleteUserId, it.DeleteTime }).ExecuteCommand();
+
+            if (del > 0) result.Code = 0;
+            else result.Msg = string.Format("删除失败!");
+
+            return result;
+        }
+
+        /// <summary>
+        /// 一键清空
+        /// 删除主表数据 Update
+        /// 删除子表数据 delete
+        /// </summary>
+        /// <param name="id"></param>
+        /// <param name="userId"></param>
+        /// <returns></returns>
+        public async Task<Result> OneClickEmpty(int id, int userId)
+        {
+            Result result = new Result() { Code = -1, Msg = "操作成功!" };
+
+            if (id < 1) return result = new Result() { Code = -1, Msg = "请传入有效的Id参数!" };
+            if (userId < 1) return result = new Result() { Code = -1, Msg = "请传入有效的UserId参数!" };
+
+            BeginTran();
+
+            int update = await _sqlSugar.Updateable<Grp_EnterExitCostDraft>()
+                .SetColumns(it => new Grp_EnterExitCostDraft()
+                {
+                    IsDel = 1,
+                    DeleteUserId = userId,
+                    DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+                })
+                .Where(it => it.Id == id)
+                .ExecuteCommandAsync();
+
+            if (update > 0)
+            {
+                await _sqlSugar.Updateable<Grp_DayAndCostDraft>()
+                    .SetColumns(it => new Grp_DayAndCostDraft()
+                    {
+                        IsDel = 1,
+                        DeleteUserId = userId,
+                        DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+                    })
+                    .Where(it => it.ParentId == id)
+                    .ExecuteCommandAsync();
+
+                await _sqlSugar.Updateable<Grp_DayOtherPriceDraft>()
+                    .SetColumns(it => new Grp_DayOtherPriceDraft()
+                    {
+                        IsDel = 1,
+                        DeleteUserId = userId,
+                        DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+                    })
+                    .Where(it => it.ParentId == id)
+                    .ExecuteCommandAsync();
+
+                result.Code = 0;
+                result.Msg = "操作成功!";
+                CommitTran();
+            }
+            else
+            {
+                result.Msg = "操作失败";
+                RollbackTran();
+            }
+
+            return result;
+        }
+    }
+}

+ 3 - 3
OASystem/OASystem.Infrastructure/Repositories/Groups/EnterExitCostRepository.cs

@@ -76,14 +76,14 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
             //Sys_PageFunctionPermission Function = _mapper.Map<Sys_PageFunctionPermission>(dto);
 
-            EnterExitCostInfoView enterExitCostInfoView = new EnterExitCostInfoView();
+            var enterExitCostInfoView = new EnterExitCostInfoView();
 
             if (dto.PortType == 1) // Web
             {
                 if (enterExitCostData != null)
                 {
                     enterExitCostInfoView = _mapper.Map<EnterExitCostInfoView>(enterExitCostData);
-                    enterExitCostInfoView.FirstItemRemark = enterExitCostData.Remark;
+                    //enterExitCostInfoView.FirstItemRemark = enterExitCostData.Remark;
                     var dayAndCostSql = string.Format(@"Select ntf.Country,ntf.City,ssd.Name CurremcyCode,ssd.Remark CurrencyName,gdac.* From Grp_DayAndCost gdac
                                                         Left Join Grp_NationalTravelFee ntf On ntf.Id = gdac.NationalTravelFeeId
                                                         Left Join Sys_SetData ssd On ssd.STid = 66 And gdac.Currency = ssd.Id
@@ -235,7 +235,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
             if (dto.SumTDC == 0) dto.OutsideTDPay = 0;
 
             var enterExitCost = _mapper.Map<Grp_EnterExitCost>(dto);
-            enterExitCost.Remark = dto.FirstItemRemark;
+            //enterExitCost.Remark = dto.FirstItemRemark;
             //enterExitCost.InsidePay = enterExitCost.Visa + enterExitCost.YiMiao + enterExitCost.HeSuan + enterExitCost.Service + enterExitCost.Safe + enterExitCost.Ticket;
 
             List<Grp_DayAndCost> subData = new List<Grp_DayAndCost>();

+ 122 - 109
OASystem/OASystem.Infrastructure/Repositories/Resource/OfficialActivitiesRepository.cs

@@ -160,20 +160,21 @@ FROM
   LEFT JOIN Sys_Users u ON oa.CreateUserId = u.Id
   LEFT JOIN Sys_SetData sd ON oa.OfficialForm = sd.Id
 {0}", sqlWhere);
-                var oa = await _sqlSugar.SqlQueryable<OfficialActivitiesView>(sql)
-                    .FirstAsync();
-                //OfficialActivities.ScreenshotOfMailUrls.ForEach(url => { url = AppSettingsHelper.Get("GrpFileBaseUrl") + url; });
+                var oa = await _sqlSugar.SqlQueryable<OfficialActivitiesView>(sql).FirstAsync();
 
-                oa.TranslatorIdItem = _sqlSugar.Queryable<Grp_OfficialDutyLinkTranslator>()
+                var array1 =  _sqlSugar.Queryable<Grp_OfficialDutyLinkTranslator>()
                     .Where(x => x.IsDel == 0 && x.OfficialDutyId == dto.Id)
                     .Select(x => x.TranslatorId)
                     .ToArray();
 
-                if (oa.TranslatorIdItem.Any())
+                if (array1.Any()) 
                 {
+                    oa.TranslatorIdItem = array1;
+
+                    int translatorId = array1[0];
                     var translatorInfo = await _sqlSugar.Queryable<Res_TranslatorLibrary>()
-                   .Where(x => x.IsDel == 0 && oa.TranslatorIdItem[0] == dto.Id)
-                   .FirstAsync();
+                        .Where(x => x.IsDel == 0 && x.Id == translatorId)
+                        .FirstAsync();
 
                     EncryptionProcessor.DecryptProperties(translatorInfo);
 
@@ -191,7 +192,7 @@ FROM
         }
         public async Task<Result> OpOfficialActivities(OpOfficialActivitiesDto dto)
         {
-            Result result = new Result() { Code = -2, Msg = "未知错误" };
+            var result = new Result() { Code = -2, Msg = "未知错误" };
 
             #region 特殊字符转码  037 - 4.28 15:17
 
@@ -220,19 +221,25 @@ FROM
             res_InvitationData.Field = dto.Field;
             EncryptionProcessor.EncryptProperties(res_InvitationData);
 
-            //翻译人员资料
-            var translatorInfo = _mapper.Map<Res_TranslatorLibrary>(dto.TranslatorInfo);
-            translatorInfo.CreateUserId = dto.CreateUserId;
-            if (dto.TranslatorIdItem.Any()) translatorInfo.Id = dto.TranslatorIdItem[0];
+            var isInserTranslator = false;
+            var translatorInfo = new Res_TranslatorLibrary();
+            if (true)
+            {
+                //翻译人员资料
+                translatorInfo = _mapper.Map<Res_TranslatorLibrary>(dto.TranslatorInfo);
+                translatorInfo.CreateUserId = dto.CreateUserId;
+                if (dto.TranslatorIdItem.Any()) translatorInfo.Id = dto.TranslatorIdItem[0];
 
-            EncryptionProcessor.EncryptProperties(translatorInfo);
+                EncryptionProcessor.EncryptProperties(translatorInfo);
+                isInserTranslator = true;
+            }
 
             int DataID = 0;
             if (dto.Status == 1)//添加
             {
                 //添加资料
                 DataID = await _sqlSugar.Insertable(res_InvitationData).ExecuteReturnIdentityAsync();
-                Res_OfficialActivities _InvitationOfficialActivityData = _mapper.Map<Res_OfficialActivities>(dto);
+                var _InvitationOfficialActivityData = _mapper.Map<Res_OfficialActivities>(dto);
                 _InvitationOfficialActivityData.DataId = DataID;
                 int id = await _sqlSugar.Insertable(_InvitationOfficialActivityData).ExecuteReturnIdentityAsync();
                 if (id == 0)
@@ -243,60 +250,62 @@ FROM
                 else
                 {
                     var translatorId = translatorInfo.Id;
-                    if (translatorId > 0) // 翻译人员资料更新
+
+                    if (isInserTranslator)
                     {
-                        var tiStatus = await _sqlSugar.Updateable<Res_TranslatorLibrary>(translatorInfo)
-                            .UpdateColumns(x => new
-                            {
-                                x.Area,
-                                x.Name,
-                                x.Sex,
-                                x.Tel,
-                                x.Email,
-                                x.WechatNo,
-                                x.OtherSocialAccounts,
-                                x.Language,
-                                x.Price,
-                                x.Currency,
-                            })
-                            .ExecuteCommandAsync();
-
-                        if (tiStatus < 1)
+                        if (translatorId > 0) // 翻译人员资料更新
                         {
-                            _sqlSugar.RollbackTran();
-                            return new Result() { Code = -1, Msg = "翻译人员资料更新失败!", Data = new { Id = id } };
+                            var tiStatus = await _sqlSugar.Updateable<Res_TranslatorLibrary>(translatorInfo)
+                                .UpdateColumns(x => new
+                                {
+                                    x.Area,
+                                    x.Name,
+                                    x.Sex,
+                                    x.Tel,
+                                    x.Email,
+                                    x.WechatNo,
+                                    x.OtherSocialAccounts,
+                                    x.Language,
+                                    x.Price,
+                                    x.Currency,
+                                })
+                                .ExecuteCommandAsync();
+
+                            if (tiStatus < 1)
+                            {
+                                _sqlSugar.RollbackTran();
+                                return new Result() { Code = -1, Msg = "翻译人员资料更新失败!", Data = new { Id = id } };
+                            }
                         }
-                    }
-                    else //添加翻译人员资料
-                    {
-                        translatorId = await _sqlSugar.Insertable(translatorInfo).ExecuteReturnIdentityAsync();
-                        if (translatorId == 0)
+                        else //添加翻译人员资料
                         {
-                            _sqlSugar.RollbackTran();
-                            return new Result() { Code = -1, Msg = "翻译人员资料添加失败!", Data = new { Id = id } };
+                            translatorId = await _sqlSugar.Insertable(translatorInfo).ExecuteReturnIdentityAsync();
+                            if (translatorId == 0)
+                            {
+                                _sqlSugar.RollbackTran();
+                                return new Result() { Code = -1, Msg = "翻译人员资料添加失败!", Data = new { Id = id } };
+                            }
                         }
-                    }
 
-                    #region 新增(公务信息关联翻译人员) 关联信息
+                        #region 新增(公务信息关联翻译人员) 关联信息
 
-                    var linkStatus = await _sqlSugar
-                        .Insertable(new Grp_OfficialDutyLinkTranslator()
+                        var linkStatus = await _sqlSugar
+                            .Insertable(new Grp_OfficialDutyLinkTranslator()
+                            {
+                                TranslatorId = translatorId,
+                                OfficialDutyId = id,
+                                CreateUserId = dto.CreateUserId,
+                                Remark = $"公务出访客户资料-->添加"
+                            }).ExecuteCommandAsync();
+
+                        if (linkStatus < 1)
                         {
-                            TranslatorId = translatorId,
-                            OfficialDutyId = id,
-                            CreateUserId = dto.CreateUserId,
-                            Remark = $"公务出访客户资料-->添加"
-                        }).ExecuteCommandAsync();
+                            _sqlSugar.RollbackTran();
+                            return new Result() { Code = -1, Msg = "公务出访关联翻译人员资料添加失败!", Data = new { Id = id } };
+                        }
 
-                    if (linkStatus < 1)
-                    {
-                        _sqlSugar.RollbackTran();
-                        return new Result() { Code = -1, Msg = "公务出访关联翻译人员资料添加失败!", Data = new { Id = id } };
+                        #endregion
                     }
-                    
-                    #endregion
-
-
                     _sqlSugar.CommitTran();
                     result = new Result() { Code = 0, Msg = "添加成功!", Data = new { Id = id } };
                 }
@@ -382,73 +391,77 @@ FROM
                 });
                 if (res)
                 {
-                    #region 更新(公务信息关联翻译人员) 关联信息
-
-                    if (translatorInfo.Id > 0) //资料更新
+                    if (isInserTranslator)
                     {
-                        var tiStatus = await _sqlSugar.Updateable<Res_TranslatorLibrary>(translatorInfo)
-                            .UpdateColumns(x => new
-                            {
-                                x.Area,
-                                x.Name,
-                                x.Sex,
-                                x.Tel,
-                                x.Email,
-                                x.WechatNo,
-                                x.OtherSocialAccounts,
-                                x.Language,
-                                x.Price,
-                                x.Currency,
-                            })
-                            .ExecuteCommandAsync();
-
-                        if (tiStatus < 1)
-                        {
-                            _sqlSugar.RollbackTran();
-                            return new Result() { Code = -1, Msg = "翻译人员资料更新失败!", Data = new { Id = dto.Id } };
-                        }
+                        #region 更新(公务信息关联翻译人员) 关联信息
 
-                        var dutyLink_select = await _sqlSugar.Queryable<Grp_OfficialDutyLinkTranslator>()
-                       .Where(x => x.IsDel == 0 && x.OfficialDutyId == dto.Id&& x.TranslatorId == translatorInfo.Id)
-                       .FirstAsync();
-                        if (dutyLink_select == null)
+                        if (translatorInfo.Id > 0) //资料更新
                         {
-                            var odltStatus = await _sqlSugar.Insertable(new Grp_OfficialDutyLinkTranslator()
+                            var tiStatus = await _sqlSugar.Updateable<Res_TranslatorLibrary>(translatorInfo)
+                                .UpdateColumns(x => new
+                                {
+                                    x.Area,
+                                    x.Name,
+                                    x.Sex,
+                                    x.Tel,
+                                    x.Email,
+                                    x.WechatNo,
+                                    x.OtherSocialAccounts,
+                                    x.Language,
+                                    x.Price,
+                                    x.Currency,
+                                })
+                                .ExecuteCommandAsync();
+
+                            if (tiStatus < 1)
+                            {
+                                _sqlSugar.RollbackTran();
+                                return new Result() { Code = -1, Msg = "翻译人员资料更新失败!", Data = new { Id = dto.Id } };
+                            }
+
+                            var dutyLink_select = await _sqlSugar.Queryable<Grp_OfficialDutyLinkTranslator>()
+                           .Where(x => x.IsDel == 0 && x.OfficialDutyId == dto.Id && x.TranslatorId == translatorInfo.Id)
+                           .FirstAsync();
+                            if (dutyLink_select == null)
+                            {
+                                var odltStatus = await _sqlSugar.Insertable(new Grp_OfficialDutyLinkTranslator()
                                 {
                                     TranslatorId = translatorInfo.Id,
                                     OfficialDutyId = dto.Id,
                                     CreateUserId = dto.CreateUserId,
                                     Remark = $"公务出访客户资料-->添加"
                                 }).ExecuteCommandAsync();
+                                if (odltStatus < 1)
+                                {
+                                    _sqlSugar.RollbackTran();
+                                    result = new Result() { Code = -1, Msg = "公务出访关联翻译人员资料添加失败!" };
+                                }
+                            }
+                        }
+                        else // 添加
+                        {
+                            translatorInfo.Id = await _sqlSugar.Insertable(translatorInfo).ExecuteReturnIdentityAsync();
+                            if (translatorInfo.Id == 0)
+                            {
+                                _sqlSugar.RollbackTran();
+                                return new Result() { Code = -1, Msg = "翻译人员资料添加失败!", Data = new { Id = dto.Id } };
+                            }
+                            var odltStatus = await _sqlSugar.Insertable(new Grp_OfficialDutyLinkTranslator()
+                            {
+                                TranslatorId = translatorInfo.Id,
+                                OfficialDutyId = dto.Id,
+                                CreateUserId = dto.CreateUserId,
+                                Remark = $"公务出访客户资料-->添加"
+                            }).ExecuteCommandAsync();
                             if (odltStatus < 1)
                             {
                                 _sqlSugar.RollbackTran();
                                 result = new Result() { Code = -1, Msg = "公务出访关联翻译人员资料添加失败!" };
                             }
                         }
+                        #endregion
                     }
-                    else // 添加
-                    {
-                        translatorInfo.Id = await _sqlSugar.Insertable(translatorInfo).ExecuteReturnIdentityAsync();
-                        if (translatorInfo.Id == 0)
-                        {
-                            _sqlSugar.RollbackTran();
-                            return new Result() { Code = -1, Msg = "翻译人员资料添加失败!", Data = new { Id = dto.Id } };
-                        }
-                        var odltStatus = await _sqlSugar.Insertable(new Grp_OfficialDutyLinkTranslator()
-                        {
-                            TranslatorId = translatorInfo.Id,
-                            OfficialDutyId = dto.Id,
-                            CreateUserId = dto.CreateUserId,
-                            Remark = $"公务出访客户资料-->添加"
-                        }).ExecuteCommandAsync();
-                        if (odltStatus < 1)
-                        {
-                            _sqlSugar.RollbackTran();
-                            result = new Result() { Code = -1, Msg = "公务出访关联翻译人员资料添加失败!" };
-                        }
-                    }
-                    #endregion
+
 
                     _sqlSugar.CommitTran();
                     result = new Result() { Code = 0, Msg = "修改成功!", Data = new { Id = dto.Id } };

+ 15 - 0
OASystem/OASystem.Infrastructure/Tools/CommonFun.cs

@@ -131,6 +131,21 @@ public static class CommonFun
         if (!Directory.Exists(dir))
             Directory.CreateDirectory(dir);
     }
+
+    /// <summary>
+    /// 验证文件名称
+    /// </summary>
+    /// <param name="fileName"></param>
+    /// <returns></returns>
+    public static string ValidFileName(string fileName)
+    {
+        if (string.IsNullOrEmpty(fileName)) return Guid.NewGuid().ToString();
+
+        // 获取非法文件名字符
+        char[] invalidChars = Path.GetInvalidFileNameChars();
+
+        return new string(fileName.Where(c => !invalidChars.Contains(c)).ToArray());
+    }
     #endregion
 
     #region IP

Some files were not shown because too many files changed in this diff