yuanrf 2 months ago
parent
commit
5a87138857

+ 47 - 68
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -807,7 +807,6 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostReceivablesSave(ForeignReceivablesSaveDto dto)
         {
-
             return Ok(await _ForForeignReceivablesRep.PostReceivablesSave(dto));
 
         }
@@ -1656,50 +1655,44 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostPaymentRefundAndOtherMoneyItemByDiId(PaymentRefundAndOtherMoneyItemByDiIdDto dto)
         {
-            try
-            {
-                if (dto == null) return Ok(JsonView(false, "参数不能为空!"));
 
-                if (dto.PageId <= 0) return Ok(JsonView(false, "请传入正确的的页面Id!"));
-
-                if (dto.UserId <= 0) return Ok(JsonView(false, "请传入正确的的员工Id!"));
+            if (dto == null) return Ok(JsonView(false, "参数不能为空!"));
 
-                #region 页面功能权限处理
-                PageFunAuthViewBase pageFunAuth = new PageFunAuthViewBase();
-                pageFunAuth = await GeneralMethod.PostUserPageFuncDatas(dto.UserId, dto.PageId);
+            if (dto.PageId <= 0) return Ok(JsonView(false, "请传入正确的的页面Id!"));
 
-                if (pageFunAuth.CheckAuth == 0)
-                {
-                    return Ok(JsonView(false, "您没有当前页面查询权限!"));
-                }
+            if (dto.UserId <= 0) return Ok(JsonView(false, "请传入正确的的员工Id!"));
 
-                #endregion
+            #region 页面功能权限处理
+            PageFunAuthViewBase pageFunAuth = new PageFunAuthViewBase();
+            pageFunAuth = await GeneralMethod.PostUserPageFuncDatas(dto.UserId, dto.PageId);
 
-                Result _result = await _paymentRefundAndOtherMoneyRep._ItemByDiId(dto.DiId);
+            if (pageFunAuth.CheckAuth == 0)
+            {
+                return Ok(JsonView(false, "您没有当前页面查询权限!"));
+            }
 
-                if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3)  //1 Web 2 Android 3 Ios
-                {
-                    if (_result.Code != 0)
-                    {
-                        return Ok(JsonView(false, _result.Msg));
-                    }
+            #endregion
 
-                    var data = new
-                    {
-                        PageFuncAuth = pageFunAuth,
-                        Data = _result.Data
-                    };
+            Result _result = await _paymentRefundAndOtherMoneyRep._ItemByDiId(dto.DiId);
 
-                    return Ok(JsonView(true, "操作成功!", data));
-                }
-                else
+            if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3)  //1 Web 2 Android 3 Ios
+            {
+                if (_result.Code != 0)
                 {
-                    return Ok(JsonView(false, "请输入正确的端口号! 1 Web 2 Android 3 Ios;"));
+                    return Ok(JsonView(false, _result.Msg));
                 }
+
+                var data = new
+                {
+                    PageFuncAuth = pageFunAuth,
+                    Data = _result.Data
+                };
+
+                return Ok(JsonView(true, "操作成功!", data));
             }
-            catch (Exception ex)
+            else
             {
-                return Ok(JsonView(false, ex.Message));
+                return Ok(JsonView(false, "请输入正确的端口号! 1 Web 2 Android 3 Ios;"));
             }
         }
 
@@ -1713,39 +1706,32 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostPaymentRefundAndOtherMoneyDel(PaymentRefundAndOtherMoneyDelDto dto)
         {
-            try
-            {
-                if (dto == null) return Ok(JsonView(false, "参数不能为空!"));
-                if (dto.PageId <= 0) return Ok(JsonView(false, "请传入正确的的页面Id!"));
-                if (dto.UserId <= 0) return Ok(JsonView(false, "请传入正确的的员工Id!"));
-
-                PageFunAuthViewBase pageFunAuth = new PageFunAuthViewBase();
+            if (dto == null) return Ok(JsonView(false, "参数不能为空!"));
+            if (dto.PageId <= 0) return Ok(JsonView(false, "请传入正确的的页面Id!"));
+            if (dto.UserId <= 0) return Ok(JsonView(false, "请传入正确的的员工Id!"));
 
-                #region 页面功能权限处理
+            PageFunAuthViewBase pageFunAuth = new PageFunAuthViewBase();
 
-                pageFunAuth = await GeneralMethod.PostUserPageFuncDatas(dto.UserId, dto.PageId);
+            #region 页面功能权限处理
 
-                #endregion
+            pageFunAuth = await GeneralMethod.PostUserPageFuncDatas(dto.UserId, dto.PageId);
 
-                if (pageFunAuth.DeleteAuth == 0)
-                {
-                    return Ok(JsonView(false, "您没有当前页面删除权限!"));
-                }
+            #endregion
 
+            if (pageFunAuth.DeleteAuth == 0)
+            {
+                return Ok(JsonView(false, "您没有当前页面删除权限!"));
+            }
 
-                Result _result = await _paymentRefundAndOtherMoneyRep._Del(dto);
 
-                if (_result.Code != 0)
-                {
-                    return Ok(JsonView(false, _result.Msg));
-                }
+            Result _result = await _paymentRefundAndOtherMoneyRep._Del(dto);
 
-                return Ok(JsonView(true, "操作成功!"));
-            }
-            catch (Exception ex)
+            if (_result.Code != 0)
             {
-                return Ok(JsonView(false, ex.Message));
+                return Ok(JsonView(false, _result.Msg));
             }
+
+            return Ok(JsonView(true, "操作成功!"));
         }
 
         /// <summary>
@@ -1758,21 +1744,14 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostPaymentRefundAndOtherMoneyInfoDataSource(PortDtoBase dto)
         {
-            try
-            {
-                Result _result = await _paymentRefundAndOtherMoneyRep._InfoDataSource(dto);
+            Result _result = await _paymentRefundAndOtherMoneyRep._InfoDataSource(dto);
 
-                if (_result.Code != 0)
-                {
-                    return Ok(JsonView(false, _result.Msg));
-                }
-
-                return Ok(JsonView(true, "查询成功!", _result.Data));
-            }
-            catch (Exception ex)
+            if (_result.Code != 0)
             {
-                return Ok(JsonView(false, ex.Message));
+                return Ok(JsonView(false, _result.Msg));
             }
+
+            return Ok(JsonView(true, "查询成功!", _result.Data));
         }
 
         /// <summary>

+ 483 - 183
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -42,6 +42,7 @@ using System.IO;
 using System.IO.Compression;
 using System.Net.Http;
 using System.Reflection.PortableExecutable;
+using System.Security.Cryptography;
 using Ubiety.Dns.Core;
 using static NPOI.POIFS.Crypt.CryptoFunctions;
 using static OASystem.API.OAMethodLib.JWTHelper;
@@ -6998,7 +6999,6 @@ FROM
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> QueryVisaByDiId(VisaPriceDto dto)
         {
-            
             Result groupData = await _visaPriceRep.PostVisaByDiId(dto);
             if (groupData.Code != 0)
             {
@@ -7016,19 +7016,12 @@ FROM
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> QueryVisaById(PostVisaByIdDto dto)
         {
-            try
-            {
-                Result groupData = await _visaPriceRep.PostVisaById(dto);
-                if (groupData.Code != 0)
-                {
-                    return Ok(JsonView(false, groupData.Msg));
-                }
-                return Ok(JsonView(true, groupData.Msg, groupData.Data));
-            }
-            catch (Exception ex)
+            Result groupData = await _visaPriceRep.PostVisaById(dto);
+            if (groupData.Code != 0)
             {
-                return Ok(JsonView(false, ex.Message));
+                return Ok(JsonView(false, groupData.Msg));
             }
+            return Ok(JsonView(true, groupData.Msg, groupData.Data));
         }
         /// <summary>
         /// 签证费用删除
@@ -7091,12 +7084,23 @@ FROM
             List<Sys_SetData> BankCard = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 15 && a.IsDel == 0).ToList();
             List<SetDataInfoView> _BankCard = _mapper.Map<List<SetDataInfoView>>(BankCard);
 
+            //代办费类型
+            var agencyFeeTypeData = new List<dynamic>() {
+                new { id = 0 , Text = "未选择" },
+                new { id = 1 , Text = "小公务" },
+                new { id = 2 , Text = "大公务" },
+            };
+
+            //签证费用标准国家Data
+            var visaCountryFeeData = _sqlSugar.Queryable<Res_CountryFeeCost>().Where(x => x.IsDel == 0).Select(x => new { x.Id, Country = x.VisaCountry }).ToList();
             var data = new
             {
                 Payment = _Payment,
                 CurrencyList = _CurrencyList,
                 PassengerType = _PassengerType,
-                BankCard = _BankCard
+                BankCard = _BankCard,
+                AgencyFeeType = agencyFeeTypeData,
+                CountryFeeData = visaCountryFeeData
             };
             return Ok(JsonView(true, "查询成功!", data));
         }
@@ -12253,219 +12257,515 @@ ORDER by  gctggrc.id DESC
 
             #endregion
             decimal _rate = 1.00M;
-            string _currency = "";
+            string _currency = string.Empty;
 
             var currDatas = _sqlSugar.Queryable<Sys_SetData>().Where(it => it.STid == 66).ToList();
-            List<Grp_HotelReservations> hrDtas = await _sqlSugar.Queryable<Grp_HotelReservations>().Where(it => it.IsDel == 0 && it.DiId == _dto.DiId).ToListAsync();
+            var hrDtas = _sqlSugar.Queryable<Grp_HotelReservations>().Where(it => it.IsDel == 0 && it.DiId == _dto.DiId).ToList();
             if (hrDtas.Count < 1) return Ok(JsonView(StatusCodes.Status400BadRequest, "酒店预订费用未录入,不支持预定成本Excel导出", ""));
-
-            Grp_GroupCostParameter _GroupCostParameter = await _sqlSugar.Queryable<Grp_GroupCostParameter>().Where(it => it.IsDel == 0 && it.DiId == _dto.DiId).FirstAsync();
-            if (_GroupCostParameter == null) return Ok(JsonView(StatusCodes.Status400BadRequest, "团组成本费用未录入,不支持预定成本Excel导出", ""));
-            if (string.IsNullOrEmpty(_GroupCostParameter.Currency))
+            var hotelSubData = _sqlSugar.Queryable<Grp_HotelReservationsContent>().Where(it => it.IsDel == 0 && it.DiId == _dto.DiId).ToList();
+            var ccpData = _sqlSugar.Queryable<Grp_CreditCardPayment>().Where(it => it.IsDel == 0 && it.DIId == _dto.DiId && it.CTable == 76).ToList();
+            
+            var _GroupCostParameter = _sqlSugar.Queryable<Grp_GroupCostParameter>().Where(it => it.IsDel == 0 && it.DiId == _dto.DiId).First();
+            //if (_GroupCostParameter == null) return Ok(JsonView(StatusCodes.Status400BadRequest, "团组成本费用未录入,不支持预定成本Excel导出", ""));
+            if (_GroupCostParameter == null)
             {
-                return Ok(JsonView(StatusCodes.Status400BadRequest, "团组成本费用“币种为录入”未录入,不支持预定成本Excel导出", ""));
-            }
-            _currency = _GroupCostParameter.Currency;
+                //return Ok(JsonView(StatusCodes.Status400BadRequest, "团组成本费用“币种为录入”未录入,不支持预定成本Excel导出", ""));
+                bool isIntType = int.TryParse(_currency, out int currId);
+                if (isIntType)
+                {
+                    _currency = currDatas.Find(it => it.Id == currId)?.Name ?? "";
+                }
 
-            bool isIntType = int.TryParse(_currency, out int currId);
-            if (isIntType)
-            {
-                _currency = currDatas.Find(it => it.Id == currId)?.Name ?? "";
+                var teamRate = await _teamRateRep.PostGroupTeamRateItemByDiIdAndCTableId(1, _dto.DiId, 76);
 
-            }
+                var currInfo = teamRate.Find(it => it.CurrencyCode.Equals(_currency));
+                if (currInfo == null)
+                {
 
-            var teamRate = await _teamRateRep.PostGroupTeamRateItemByDiIdAndCTableId(1, _dto.DiId, 76);
+                    //return Ok(JsonView(StatusCodes.Status400BadRequest, $"团组汇率-->酒店模块 {_currency} 币种未设置汇率,不支持预定成本Excel导出", ""));
 
-            var currInfo = teamRate.Find(it => it.CurrencyCode.Equals(_currency));
-            if (currInfo == null)
-            {
-                return Ok(JsonView(StatusCodes.Status400BadRequest, $"团组汇率-->酒店模块 {_currency} 币种未设置汇率,不支持预定成本Excel导出", ""));
+                }
+                else _rate = currInfo.Rate;
 
-            }
+                if (!string.IsNullOrEmpty(_currency) && !_currency.ToUpper().Equals("CNY"))
+                {
+                    _rate = _GroupCostParameter.Rate;
+                }
 
-            if (!_currency.ToUpper().Equals("CNY"))
-            {
-                _rate = _GroupCostParameter.Rate;
-            }
 
-            _rate = currInfo.Rate;
-            hrDtas = hrDtas.OrderBy(it => it.CheckInDate).ToList();
-            string strFileName = "HotelStatement/";
+                hrDtas = hrDtas.OrderBy(it => it.CheckInDate).ToList();
+                string strFileName = "HotelStatement/";
 
-            string guestNames = ""; //格式Mr.xxx Ms.xxx
-            List<HotelReservations_PCFD_View> pcfds = new List<HotelReservations_PCFD_View>();
-            var hotelSubData = _sqlSugar.Queryable<Grp_HotelReservationsContent>().Where(it => it.IsDel == 0 && it.DiId == _dto.DiId).ToList();
-            var ccpData = _sqlSugar.Queryable<Grp_CreditCardPayment>().Where(it => it.IsDel == 0 && it.DIId == _dto.DiId && it.CTable == 76).ToList();
-            #region 数据处理
+                string guestNames = ""; //格式Mr.xxx Ms.xxx
+                List<HotelReservations_PCFD_View> pcfds = new List<HotelReservations_PCFD_View>();
+                var rateDatas = new List<dynamic>();
+                #region 数据处理
 
-            foreach (var item in hrDtas)
-            {
-                var ccpInfo = ccpData.Where(it => it.DIId == _dto.DiId && it.CId == item.Id).First();
+                foreach (var item in hrDtas)
+                {
+                    var ccpInfo = ccpData.Where(it => it.DIId == _dto.DiId && it.CId == item.Id).First();
 
-                var roomInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 1).FirstOrDefault(); //房费
-                var breakfastInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 2).FirstOrDefault(); //早餐
-                var governmentRentInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 3).FirstOrDefault(); //地税
-                var cityTaxInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 4).FirstOrDefault(); //城市税
+                    var roomInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 1).FirstOrDefault(); //房费
+                    var breakfastInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 2).FirstOrDefault(); //早餐
+                    var governmentRentInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 3).FirstOrDefault(); //地税
+                    var cityTaxInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 4).FirstOrDefault(); //城市税
 
 
-                string roomCurr = currDatas.Find(it => it.Id == roomInfo?.Currency)?.Name ?? "";
+                    if (ccpInfo == null || roomInfo == null || breakfastInfo == null || governmentRentInfo == null || cityTaxInfo == null)
+                    {
+                        continue;
+                    }
 
-                string singleRoomFeeStr = string.Empty,
-                       doubleRoomFeeStr = string.Empty,
-                       suiteRoomFeeStr = string.Empty,
-                       otherRoomFeeStr = string.Empty,
-                       payMoneyStr = string.Empty,
-                       cardPriceStr = string.Empty;
-                if (roomCurr.Equals(_currency))
-                {
-                    singleRoomFeeStr = $"{item.SingleRoomPrice.ToString("#0.00")} {_currency}";
-                    doubleRoomFeeStr = $"{item.DoubleRoomPrice.ToString("#0.00")} {_currency}";
-                    suiteRoomFeeStr = $"{item.SuiteRoomPrice.ToString("#0.00")} {_currency}";
-                    otherRoomFeeStr = $"{item.OtherRoomPrice.ToString("#0.00")} {_currency}";
-                    payMoneyStr = $"{ccpInfo.PayMoney.ToString("#0.00")} {_currency}";
-                    cardPriceStr = $"{item.CardPrice.ToString("#0.00")} {_currency}";
+                    string roomCurr = currDatas.Find(it => it.Id == roomInfo?.Currency)?.Name ?? "";
+                    if (string.IsNullOrEmpty(_currency)) _currency = $"CNY";
+
+                    string singleRoomFeeStr = string.Empty,
+                           doubleRoomFeeStr = string.Empty,
+                           suiteRoomFeeStr = string.Empty,
+                           otherRoomFeeStr = string.Empty,
+                           payMoneyStr = string.Empty,
+                           cardPriceStr = string.Empty;
+                    if (roomCurr.Equals("CNY"))
+                    {
+                        rateDatas.Add(new { code = "CNY", rate = 1.0000 });
+                        singleRoomFeeStr = $"{item.SingleRoomPrice.ToString("#0.00")} {roomCurr}";
+                        doubleRoomFeeStr = $"{item.DoubleRoomPrice.ToString("#0.00")} {roomCurr}";
+                        suiteRoomFeeStr = $"{item.SuiteRoomPrice.ToString("#0.00")} {roomCurr}";
+                        otherRoomFeeStr = $"{item.OtherRoomPrice.ToString("#0.00")} {roomCurr}";
+                        payMoneyStr = $"{ccpInfo.PayMoney.ToString("#0.00")} {currDatas.Find(it => it.Id == ccpInfo?.PaymentCurrency)?.Name ?? ""}";
+                        cardPriceStr = $"{item.CardPrice.ToString("#0.00")} {currDatas.Find(it => it.Id == item.CardPriceCurrency)?.Name ?? ""}";
+                    }
+                    else
+                    {
+                        //singleRoomFeeStr = $"{((item.SingleRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.SingleRoomPrice.ToString("#0.00")} {roomCurr}";
+                        //doubleRoomFeeStr = $"{((item.DoubleRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.DoubleRoomPrice.ToString("#0.00")} {roomCurr}";
+                        //suiteRoomFeeStr = $"{((item.SuiteRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.SuiteRoomPrice.ToString("#0.00")} {roomCurr}";
+                        //otherRoomFeeStr = $"{((item.OtherRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.OtherRoomPrice.ToString("#0.00")} {roomCurr}";
+                        //payMoneyStr = $"{((ccpInfo.PayMoney * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{ccpInfo.PayMoney.ToString("#0.00")} {roomCurr}";
+                        //cardPriceStr = $"{((item.CardPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.CardPrice.ToString("#0.00")} {roomCurr}";
+                        singleRoomFeeStr = $"{item.SingleRoomPrice.ToString("#0.00")} {roomCurr}\r\n{((item.SingleRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}";
+                        doubleRoomFeeStr = $"{item.DoubleRoomPrice.ToString("#0.00")} {roomCurr}\r\n{((item.DoubleRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}";
+                        suiteRoomFeeStr = $"{item.SuiteRoomPrice.ToString("#0.00")} {roomCurr}\r\n{((item.SuiteRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}";
+                        otherRoomFeeStr = $"{item.OtherRoomPrice.ToString("#0.00")} {roomCurr}\r\n{((item.OtherRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}";
+                        rateDatas.Add(new { code = roomCurr, rate = roomInfo.Rate });
+                        var ccpPaymentCurrency = currDatas.Find(it => it.Id == ccpInfo?.PaymentCurrency)?.Name ?? "";
+                        if (ccpPaymentCurrency.Equals("CNY"))
+                        {
+                            payMoneyStr = $"{ccpInfo.PayMoney.ToString("#0.00")} CNY";
+                            cardPriceStr = $"{item.CardPrice.ToString("#0.00")} CNY";
+                        }
+                        else
+                        {
+
+                            rateDatas.Add(new { code = ccpPaymentCurrency, rate = ccpInfo.DayRate });
+                            payMoneyStr = $"{ccpInfo.PayMoney.ToString("#0.00")} {ccpPaymentCurrency}\r\n{((ccpInfo.PayMoney * ccpInfo.DayRate) / _rate).ToString("#0.00")} CNY";
+                        }
+
+                        var hotelcardPriceCurrency = currDatas.Find(it => it.Id == item?.CardPriceCurrency)?.Name ?? "";
+                        if (hotelcardPriceCurrency.Equals("CNY"))
+                        {
+                            cardPriceStr = $"{item.CardPrice.ToString("#0.00")} CNY";
+                        }
+                        else
+                        {
+                            cardPriceStr = $"{item.CardPrice.ToString("#0.00")} {hotelcardPriceCurrency}\r\n{((item.CardPrice * roomInfo.Rate) / _rate).ToString("#0.00")} CNY";
+                        }
+
+
+
+                    }
+                    string breakfastPriceStr = string.Empty,
+                           breakfastCurrency = currDatas.Find(it => it.Id == item.BreakfastCurrency)?.Name ?? "",
+                           governmentRentStr = string.Empty,
+                           governmentRentCurrency = currDatas.Find(it => it.Id == item.GovernmentRentCurrency)?.Name ?? "",
+                           cityTaxStr = string.Empty,
+                           cityTaxStrCurrency = currDatas.Find(it => it.Id == item.CityTaxCurrency)?.Name ?? "";
+
+                    var breakfastCurrency1 = currDatas.Find(it => it.Id == breakfastInfo?.Currency)?.Name;
+                    if (!string.IsNullOrEmpty(breakfastCurrency1))
+                    {
+                        if (breakfastCurrency1.Equals("CNY"))
+                        {
+                            breakfastPriceStr = $"{breakfastInfo?.Price.ToString("#0.00")} {breakfastCurrency1}";
+                        }
+                        else
+                        {
+                            rateDatas.Add(new { code = breakfastCurrency1, rate = breakfastInfo.Rate });
+                            var breakfastPriceCny = breakfastInfo.Price * breakfastInfo.Rate;
+                            breakfastPriceStr = $"{breakfastInfo?.Price.ToString("#0.00")} {breakfastCurrency1}\r\n{breakfastPriceCny.ToString("#0.00")} CNY";
+                        }
+
+                    }
+                    else breakfastPriceStr = $"{breakfastInfo?.Price.ToString("#0.00")} {breakfastCurrency1}";
+
+                    var governmentRentCurrency1 = currDatas.Find(it => it.Id == governmentRentInfo?.Currency)?.Name;
+                    if (!string.IsNullOrEmpty(governmentRentCurrency1))
+                    {
+                        if (governmentRentCurrency.Equals("CNY"))
+                        {
+                            governmentRentStr = $"{governmentRentInfo?.Price.ToString("#0.00")} {governmentRentCurrency1}";
+                        }
+                        else
+                        {
+                            rateDatas.Add(new { code = governmentRentCurrency1, rate = governmentRentInfo.Rate });
+                            var governmentRentCny = governmentRentInfo.Price * governmentRentInfo.Rate;
+                            governmentRentStr = $"{governmentRentInfo?.Price.ToString("#0.00")} {governmentRentCurrency1}\r\n{governmentRentCny.ToString("#0.00")} CNY";
+                        }
+                    }
+                    else governmentRentStr = $"{governmentRentInfo?.Price.ToString("#0.00")} {governmentRentCurrency1}";
+
+                    var cityTaxStrCurrency1 = currDatas.Find(it => it.Id == cityTaxInfo?.Currency)?.Name;
+                    if (!string.IsNullOrEmpty(cityTaxStrCurrency1))
+                    {
+                        if (cityTaxStrCurrency1.Equals("CNY"))
+                        {
+                            cityTaxStr = $"{cityTaxInfo?.Price.ToString("#0.00")} {cityTaxStrCurrency1}";
+                        }
+                        else
+                        {
+                            rateDatas.Add(new { code = cityTaxStrCurrency1, rate = cityTaxInfo.Rate });
+                            var cityTaxCny = cityTaxInfo.Price * cityTaxInfo.Rate;
+                            cityTaxStr = $"{cityTaxInfo?.Price.ToString("#0.00")} {cityTaxStrCurrency1}\r\n{cityTaxCny.ToString("#0.00")} CNY";
+                        }
+                    }
+                    else cityTaxStr = $"{cityTaxInfo?.Price.ToString("#0.00")} {cityTaxStrCurrency1}";
+
+
+
+                    int payDId = roomInfo?.PayDId ?? 0;
+                    pcfds.Add(new HotelReservations_PCFD_View()
+                    {
+                        City = item.City,
+                        HotelName = item.HotelName,
+                        Date = $"{item.CheckInDate} - {item.CheckOutDate}",
+                        // SingleRoomCount = item.SingleRoomCount,
+                        SingleRoomPrice = singleRoomFeeStr,
+                        // DoubleRoomCount = item.DoubleRoomCount,
+                        DoubleRoomPrice = doubleRoomFeeStr,
+                        //SuiteRoomCount = item.SuiteRoomCount,
+                        SuiteRoomPrice = suiteRoomFeeStr,
+                        OtherRoomPrice = otherRoomFeeStr,
+                        //OtherRoomCount = item.OtherRoomCount,
+
+                        BreakfastPrice = breakfastPriceStr,
+                        GovernmentRent = governmentRentStr,
+                        CityTax = cityTaxStr,
+
+                        RoomExplanation = item.RoomExplanation,
+                        PayTypeName = _sqlSugar.Queryable<Sys_SetData>().Where(it => it.Id == payDId).First()?.Name ?? "",
+                        PayTime = roomInfo?.ConsumptionDate,
+                        BankNo = roomInfo?.BankNo,
+                        PayMoney = payMoneyStr,
+                        //PayMoneys = ccpInfo.PayMoney.ToString("#0.00"),
+                        ConsumptionPatterns = roomInfo?.ConsumptionPatterns,
+                        CardPrice = cardPriceStr,
+                        Remark = ccpInfo.Remark
+
+                    });
                 }
-                else
+
+                #endregion
+
+                //载入模板
+                WorkbookDesigner designer = new WorkbookDesigner();
+                designer.Workbook = new Workbook(AppSettingsHelper.Get("ExcelBasePath") + "Template/酒店预订成本.xls");
+
+                var groupInfo = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.Id == _dto.DiId).First();
+                var userInfo = _sqlSugar.Queryable<Sys_Users>().Where(it => it.Id == hrDtas[0].CreateUserId).First();
+                designer.SetDataSource("TourNo", groupInfo.TourCode);
+
+               var rateDatas1 = rateDatas.Distinct();
+                var rateStr = string.Empty;
+                foreach (var item in rateDatas1)
                 {
-                    singleRoomFeeStr = $"{((item.SingleRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.SingleRoomPrice.ToString("#0.00")} {roomCurr}";
-                    doubleRoomFeeStr = $"{((item.DoubleRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.DoubleRoomPrice.ToString("#0.00")} {roomCurr}";
-                    suiteRoomFeeStr = $"{((item.SuiteRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.SuiteRoomPrice.ToString("#0.00")} {roomCurr}";
-                    otherRoomFeeStr = $"{((item.OtherRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.OtherRoomPrice.ToString("#0.00")} {roomCurr}";
-                    payMoneyStr = $"{((ccpInfo.PayMoney * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{ccpInfo.PayMoney.ToString("#0.00")} {roomCurr}";
-                    cardPriceStr = $"{((item.CardPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.CardPrice.ToString("#0.00")} {roomCurr}";
+                    rateStr += $"{item.code} {item.rate.ToString("#0.0000")} \t\t";
                 }
-                string breakfastPriceStr = string.Empty,
-                       breakfastCurrency = currDatas.Find(it => it.Id == item.BreakfastCurrency)?.Name ?? "",
-                       governmentRentStr = string.Empty,
-                       governmentRentCurrency = currDatas.Find(it => it.Id == item.GovernmentRentCurrency)?.Name ?? "",
-                       cityTaxStrStr = string.Empty,
-                       cityTaxStrCurrency = currDatas.Find(it => it.Id == item.CityTaxCurrency)?.Name ?? "";
 
-                breakfastPriceStr = $"{breakfastInfo?.Price.ToString("#0.00")} {currDatas.Find(it => it.Id == breakfastInfo?.Currency)?.Name}";
-                governmentRentStr = $"{governmentRentInfo?.Price.ToString("#0.00")} {currDatas.Find(it => it.Id == governmentRentInfo?.Currency)?.Name}";
-                cityTaxStrStr = $"{cityTaxInfo?.Price.ToString("#0.00")} {currDatas.Find(it => it.Id == cityTaxInfo?.Currency)?.Name}";
+                designer.SetDataSource("TeamName", $"酒店模块汇率:{rateStr}");
+                designer.SetDataSource("Opertor", userInfo.CnName);
 
-                int payDId = roomInfo?.PayDId ?? 0;
-                pcfds.Add(new HotelReservations_PCFD_View()
+                DataTable dt = CommonFun.GetDataTableFromIList<HotelReservations_PCFD_View>(pcfds);
+                dt.TableName = "ViewMyHotelReservations";
+                designer.SetDataSource(dt);
+                designer.Process();
+
+                string fileName = $"HotelReservation/{groupInfo.TeamName.Replace("/", "").Replace(@"\", "").Trim()}_酒店预订成本_{DateTime.Now.ToString("yyyyMMddHHmmss")}.xls";
+                string serverPath = AppSettingsHelper.Get("ExcelBasePath") + fileName;
+
+                designer.Workbook.Save(serverPath);
+                string rst = AppSettingsHelper.Get("ExcelBaseUrl") + AppSettingsHelper.Get("ExcelFtpPath") + fileName;
+
+                #region 删除指定行
+
+                bool singleDel = true, doubleDel = true, suiteDel = true, otherDel = true, zcDel = true, dsDel = true, cssDel = true, cpDel = true, remarkDel = true;
+                int singleIndex = dt.Columns["SingleRoomPrice"].Ordinal,
+                    doubleIndex = dt.Columns["DoubleRoomPrice"].Ordinal,
+                    suiteIndex = dt.Columns["SuiteRoomPrice"].Ordinal,
+                    otherIndex = dt.Columns["OtherRoomPrice"].Ordinal,
+                    zcIndex = dt.Columns["BreakfastPrice"].Ordinal,
+                    dsIndex = dt.Columns["GovernmentRent"].Ordinal,
+                    cssIndex = dt.Columns["CityTax"].Ordinal,
+                    cpIndex = dt.Columns["ConsumptionPatterns"].Ordinal,
+                    remarkIndex = dt.Columns["Remark"].Ordinal;
+                //删除指定列
+                foreach (DataRow item in dt.Rows)
                 {
-                    City = item.City,
-                    HotelName = item.HotelName,
-                    Date = $"{item.CheckInDate} - {item.CheckOutDate}",
-                    // SingleRoomCount = item.SingleRoomCount,
-                    SingleRoomPrice = singleRoomFeeStr,
-                    // DoubleRoomCount = item.DoubleRoomCount,
-                    DoubleRoomPrice = doubleRoomFeeStr,
-                    //SuiteRoomCount = item.SuiteRoomCount,
-                    SuiteRoomPrice = suiteRoomFeeStr,
-                    OtherRoomPrice = otherRoomFeeStr,
-                    //OtherRoomCount = item.OtherRoomCount,
-
-                    BreakfastPrice = breakfastPriceStr,
-                    GovernmentRent = governmentRentStr,
-                    CityTax = cityTaxStrStr,
-
-                    RoomExplanation = item.RoomExplanation,
-                    PayTypeName = _sqlSugar.Queryable<Sys_SetData>().Where(it => it.Id == payDId).First()?.Name ?? "",
-                    PayTime = roomInfo?.ConsumptionDate,
-                    BankNo = roomInfo?.BankNo,
-                    PayMoney = payMoneyStr,
-                    //PayMoneys = ccpInfo.PayMoney.ToString("#0.00"),
-                    ConsumptionPatterns = roomInfo?.ConsumptionPatterns,
-                    CardPrice = cardPriceStr,
-                    Remark = ccpInfo.Remark
+                    string singleStr = item["SingleRoomPrice"].ToString();
+                    bool containsDigitButNotZero1 = !singleStr.StartsWith("0") && Regex.IsMatch(singleStr, @"[1-9]");
+                    if (containsDigitButNotZero1) singleDel = false;
+                    singleIndex = dt.Columns["SingleRoomPrice"].Ordinal;
 
-                });
-            }
+                    string doubleStr = item["DoubleRoomPrice"].ToString();
+                    bool containsDigitButNotZero2 = !doubleStr.StartsWith("0") && Regex.IsMatch(doubleStr, @"[1-9]");
+                    if (containsDigitButNotZero2) doubleDel = false;
 
-            #endregion
+                    string suiteStr = item["SuiteRoomPrice"].ToString();
+                    bool containsDigitButNotZero3 = !singleStr.StartsWith("0") && Regex.IsMatch(doubleStr, @"[1-9]");
+                    if (containsDigitButNotZero3) suiteDel = false;
 
-            //载入模板
-            WorkbookDesigner designer = new WorkbookDesigner();
-            designer.Workbook = new Workbook(AppSettingsHelper.Get("ExcelBasePath") + "Template/酒店预订成本.xls");
+                    string otherStr = item["OtherRoomPrice"].ToString();
+                    bool containsDigitButNotZero4 = !otherStr.StartsWith("0") && Regex.IsMatch(otherStr, @"[1-9]");
+                    if (containsDigitButNotZero4) otherDel = false;
 
-            var groupInfo = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.Id == _dto.DiId).First();
-            var userInfo = _sqlSugar.Queryable<Sys_Users>().Where(it => it.Id == hrDtas[0].CreateUserId).First();
-            designer.SetDataSource("TourNo", groupInfo.TourCode);
-            designer.SetDataSource("TeamName", $"{groupInfo.TeamName}  团组成本币种:{_currency}  团组汇率-->酒店模块汇率:{_rate.ToString("#0.0000")}");
-            designer.SetDataSource("Opertor", userInfo.CnName);
+                    string zcStr = item["BreakfastPrice"].ToString();
+                    bool containsDigitButNotZero5 = !zcStr.StartsWith("0") && Regex.IsMatch(zcStr, @"[1-9]");
+                    if (containsDigitButNotZero5) zcDel = false;
 
-            DataTable dt = CommonFun.GetDataTableFromIList<HotelReservations_PCFD_View>(pcfds);
-            dt.TableName = "ViewMyHotelReservations";
-            designer.SetDataSource(dt);
-            designer.Process();
+                    string dsStr = item["GovernmentRent"].ToString();
+                    bool containsDigitButNotZero6 = !dsStr.StartsWith("0") && Regex.IsMatch(dsStr, @"[1-9]");
+                    if (containsDigitButNotZero6) dsDel = false;
 
-            string fileName = $"HotelReservation/{groupInfo.TeamName.Replace("/", "").Replace(@"\", "").Trim()}_酒店预订成本_{DateTime.Now.ToString("yyyyMMddHHmmss")}.xls";
-            string serverPath = AppSettingsHelper.Get("ExcelBasePath") + fileName;
+                    string cssStr = item["CityTax"].ToString();
+                    bool containsDigitButNotZero7 = !cssStr.StartsWith("0") && Regex.IsMatch(cssStr, @"[1-9]");
+                    if (containsDigitButNotZero7) cssDel = false;
 
-            designer.Workbook.Save(serverPath);
-            string rst = AppSettingsHelper.Get("ExcelBaseUrl") + AppSettingsHelper.Get("ExcelFtpPath") + fileName;
-
-            #region 删除指定行
-
-            bool singleDel = true, doubleDel = true, suiteDel = true, otherDel = true, zcDel = true, dsDel = true, cssDel = true, cpDel = true, remarkDel = true;
-            int singleIndex = dt.Columns["SingleRoomPrice"].Ordinal,
-                doubleIndex = dt.Columns["DoubleRoomPrice"].Ordinal,
-                suiteIndex = dt.Columns["SuiteRoomPrice"].Ordinal,
-                otherIndex = dt.Columns["OtherRoomPrice"].Ordinal,
-                zcIndex = dt.Columns["BreakfastPrice"].Ordinal,
-                dsIndex = dt.Columns["GovernmentRent"].Ordinal,
-                cssIndex = dt.Columns["CityTax"].Ordinal,
-                cpIndex = dt.Columns["ConsumptionPatterns"].Ordinal,
-                remarkIndex = dt.Columns["Remark"].Ordinal;
-            //删除指定列
-            foreach (DataRow item in dt.Rows)
+                    string cpStr = item["ConsumptionPatterns"].ToString();
+                    if (!string.IsNullOrEmpty(cpStr)) cpDel = false;
+
+                    string remarkStr = item["Remark"].ToString();
+                    if (!string.IsNullOrEmpty(remarkStr)) remarkDel = false;
+
+                }
+
+                DeleteColumn(serverPath, remarkIndex, remarkDel);
+                DeleteColumn(serverPath, cpIndex, cpDel);
+                DeleteColumn(serverPath, dsIndex, dsDel);
+                DeleteColumn(serverPath, cssIndex, cssDel);
+                DeleteColumn(serverPath, zcIndex, zcDel);
+                DeleteColumn(serverPath, otherIndex, otherDel);
+                DeleteColumn(serverPath, suiteIndex, suiteDel);
+                DeleteColumn(serverPath, doubleIndex, doubleDel);
+                DeleteColumn(serverPath, singleIndex, singleDel);
+                #endregion
+                //只保留第一个表格
+                DeleteSheet(serverPath);
+
+                return Ok(JsonView(true, "操作成功", url = rst));
+            }
+            else
             {
-                string singleStr = item["SingleRoomPrice"].ToString();
-                bool containsDigitButNotZero1 = !singleStr.StartsWith("0") && Regex.IsMatch(singleStr, @"[1-9]");
-                if (containsDigitButNotZero1) singleDel = false;
-                singleIndex = dt.Columns["SingleRoomPrice"].Ordinal;
+                _currency = _GroupCostParameter.Currency;
+                bool isIntType = int.TryParse(_currency, out int currId);
+                if (isIntType)
+                {
+                    _currency = currDatas.Find(it => it.Id == currId)?.Name ?? "";
+
+                }
+
+                var teamRate = await _teamRateRep.PostGroupTeamRateItemByDiIdAndCTableId(1, _dto.DiId, 76);
+
+                var currInfo = teamRate.Find(it => it.CurrencyCode.Equals(_currency));
+                if (currInfo == null)
+                {
+                    return Ok(JsonView(StatusCodes.Status400BadRequest, $"团组汇率-->酒店模块 {_currency} 币种未设置汇率,不支持预定成本Excel导出", ""));
 
-                string doubleStr = item["DoubleRoomPrice"].ToString();
-                bool containsDigitButNotZero2 = !doubleStr.StartsWith("0") && Regex.IsMatch(doubleStr, @"[1-9]");
-                if (containsDigitButNotZero2) doubleDel = false;
+                }
 
-                string suiteStr = item["SuiteRoomPrice"].ToString();
-                bool containsDigitButNotZero3 = !singleStr.StartsWith("0") && Regex.IsMatch(doubleStr, @"[1-9]");
-                if (containsDigitButNotZero3) suiteDel = false;
+                if (!_currency.ToUpper().Equals("CNY"))
+                {
+                    _rate = _GroupCostParameter.Rate;
+                }
 
-                string otherStr = item["OtherRoomPrice"].ToString();
-                bool containsDigitButNotZero4 = !otherStr.StartsWith("0") && Regex.IsMatch(otherStr, @"[1-9]");
-                if (containsDigitButNotZero4) otherDel = false;
+                _rate = currInfo.Rate;
+                hrDtas = hrDtas.OrderBy(it => it.CheckInDate).ToList();
+                string strFileName = "HotelStatement/";
 
-                string zcStr = item["BreakfastPrice"].ToString();
-                bool containsDigitButNotZero5 = !zcStr.StartsWith("0") && Regex.IsMatch(zcStr, @"[1-9]");
-                if (containsDigitButNotZero5) zcDel = false;
+                string guestNames = ""; //格式Mr.xxx Ms.xxx
+                List<HotelReservations_PCFD_View> pcfds = new List<HotelReservations_PCFD_View>();
+                #region 数据处理
+
+                foreach (var item in hrDtas)
+                {
+                    var ccpInfo = ccpData.Where(it => it.DIId == _dto.DiId && it.CId == item.Id).First();
 
-                string dsStr = item["GovernmentRent"].ToString();
-                bool containsDigitButNotZero6 = !dsStr.StartsWith("0") && Regex.IsMatch(dsStr, @"[1-9]");
-                if (containsDigitButNotZero6) dsDel = false;
+                    var roomInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 1).FirstOrDefault(); //房费
+                    var breakfastInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 2).FirstOrDefault(); //早餐
+                    var governmentRentInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 3).FirstOrDefault(); //地税
+                    var cityTaxInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 4).FirstOrDefault(); //城市税
 
-                string cssStr = item["CityTax"].ToString();
-                bool containsDigitButNotZero7 = !cssStr.StartsWith("0") && Regex.IsMatch(cssStr, @"[1-9]");
-                if (containsDigitButNotZero7) cssDel = false;
 
-                string cpStr = item["ConsumptionPatterns"].ToString();
-                if (!string.IsNullOrEmpty(cpStr)) cpDel = false;
+                    string roomCurr = currDatas.Find(it => it.Id == roomInfo?.Currency)?.Name ?? "";
 
-                string remarkStr = item["Remark"].ToString();
-                if (!string.IsNullOrEmpty(remarkStr)) remarkDel = false;
+                    string singleRoomFeeStr = string.Empty,
+                           doubleRoomFeeStr = string.Empty,
+                           suiteRoomFeeStr = string.Empty,
+                           otherRoomFeeStr = string.Empty,
+                           payMoneyStr = string.Empty,
+                           cardPriceStr = string.Empty;
+                    if (roomCurr.Equals(_currency))
+                    {
+                        singleRoomFeeStr = $"{item.SingleRoomPrice.ToString("#0.00")} {_currency}";
+                        doubleRoomFeeStr = $"{item.DoubleRoomPrice.ToString("#0.00")} {_currency}";
+                        suiteRoomFeeStr = $"{item.SuiteRoomPrice.ToString("#0.00")} {_currency}";
+                        otherRoomFeeStr = $"{item.OtherRoomPrice.ToString("#0.00")} {_currency}";
+                        payMoneyStr = $"{ccpInfo.PayMoney.ToString("#0.00")} {_currency}";
+                        cardPriceStr = $"{item.CardPrice.ToString("#0.00")} {_currency}";
+                    }
+                    else
+                    {
+                        singleRoomFeeStr = $"{((item.SingleRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.SingleRoomPrice.ToString("#0.00")} {roomCurr}";
+                        doubleRoomFeeStr = $"{((item.DoubleRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.DoubleRoomPrice.ToString("#0.00")} {roomCurr}";
+                        suiteRoomFeeStr = $"{((item.SuiteRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.SuiteRoomPrice.ToString("#0.00")} {roomCurr}";
+                        otherRoomFeeStr = $"{((item.OtherRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.OtherRoomPrice.ToString("#0.00")} {roomCurr}";
+                        payMoneyStr = $"{((ccpInfo.PayMoney * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{ccpInfo.PayMoney.ToString("#0.00")} {roomCurr}";
+                        cardPriceStr = $"{((item.CardPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.CardPrice.ToString("#0.00")} {roomCurr}";
+                    }
+                    string breakfastPriceStr = string.Empty,
+                           breakfastCurrency = currDatas.Find(it => it.Id == item.BreakfastCurrency)?.Name ?? "",
+                           governmentRentStr = string.Empty,
+                           governmentRentCurrency = currDatas.Find(it => it.Id == item.GovernmentRentCurrency)?.Name ?? "",
+                           cityTaxStrStr = string.Empty,
+                           cityTaxStrCurrency = currDatas.Find(it => it.Id == item.CityTaxCurrency)?.Name ?? "";
+
+                    breakfastPriceStr = $"{breakfastInfo?.Price.ToString("#0.00")} {currDatas.Find(it => it.Id == breakfastInfo?.Currency)?.Name}";
+                    governmentRentStr = $"{governmentRentInfo?.Price.ToString("#0.00")} {currDatas.Find(it => it.Id == governmentRentInfo?.Currency)?.Name}";
+                    cityTaxStrStr = $"{cityTaxInfo?.Price.ToString("#0.00")} {currDatas.Find(it => it.Id == cityTaxInfo?.Currency)?.Name}";
+
+                    int payDId = roomInfo?.PayDId ?? 0;
+                    pcfds.Add(new HotelReservations_PCFD_View()
+                    {
+                        City = item.City,
+                        HotelName = item.HotelName,
+                        Date = $"{item.CheckInDate} - {item.CheckOutDate}",
+                        // SingleRoomCount = item.SingleRoomCount,
+                        SingleRoomPrice = singleRoomFeeStr,
+                        // DoubleRoomCount = item.DoubleRoomCount,
+                        DoubleRoomPrice = doubleRoomFeeStr,
+                        //SuiteRoomCount = item.SuiteRoomCount,
+                        SuiteRoomPrice = suiteRoomFeeStr,
+                        OtherRoomPrice = otherRoomFeeStr,
+                        //OtherRoomCount = item.OtherRoomCount,
+
+                        BreakfastPrice = breakfastPriceStr,
+                        GovernmentRent = governmentRentStr,
+                        CityTax = cityTaxStrStr,
+
+                        RoomExplanation = item.RoomExplanation,
+                        PayTypeName = _sqlSugar.Queryable<Sys_SetData>().Where(it => it.Id == payDId).First()?.Name ?? "",
+                        PayTime = roomInfo?.ConsumptionDate,
+                        BankNo = roomInfo?.BankNo,
+                        PayMoney = payMoneyStr,
+                        //PayMoneys = ccpInfo.PayMoney.ToString("#0.00"),
+                        ConsumptionPatterns = roomInfo?.ConsumptionPatterns,
+                        CardPrice = cardPriceStr,
+                        Remark = ccpInfo.Remark
 
+                    });
+                }
+
+                #endregion
+
+                //载入模板
+                WorkbookDesigner designer = new WorkbookDesigner();
+                designer.Workbook = new Workbook(AppSettingsHelper.Get("ExcelBasePath") + "Template/酒店预订成本.xls");
+
+                var groupInfo = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.Id == _dto.DiId).First();
+                var userInfo = _sqlSugar.Queryable<Sys_Users>().Where(it => it.Id == hrDtas[0].CreateUserId).First();
+                designer.SetDataSource("TourNo", groupInfo.TourCode);
+                designer.SetDataSource("TeamName", $"{groupInfo.TeamName}  团组成本币种:{_currency}  团组汇率-->酒店模块汇率:{_rate.ToString("#0.0000")}");
+                designer.SetDataSource("Opertor", userInfo.CnName);
+
+                DataTable dt = CommonFun.GetDataTableFromIList<HotelReservations_PCFD_View>(pcfds);
+                dt.TableName = "ViewMyHotelReservations";
+                designer.SetDataSource(dt);
+                designer.Process();
+
+                string fileName = $"HotelReservation/{groupInfo.TeamName.Replace("/", "").Replace(@"\", "").Trim()}_酒店预订成本_{DateTime.Now.ToString("yyyyMMddHHmmss")}.xls";
+                string serverPath = AppSettingsHelper.Get("ExcelBasePath") + fileName;
+
+                designer.Workbook.Save(serverPath);
+                string rst = AppSettingsHelper.Get("ExcelBaseUrl") + AppSettingsHelper.Get("ExcelFtpPath") + fileName;
+
+                #region 删除指定行
+
+                bool singleDel = true, doubleDel = true, suiteDel = true, otherDel = true, zcDel = true, dsDel = true, cssDel = true, cpDel = true, remarkDel = true;
+                int singleIndex = dt.Columns["SingleRoomPrice"].Ordinal,
+                    doubleIndex = dt.Columns["DoubleRoomPrice"].Ordinal,
+                    suiteIndex = dt.Columns["SuiteRoomPrice"].Ordinal,
+                    otherIndex = dt.Columns["OtherRoomPrice"].Ordinal,
+                    zcIndex = dt.Columns["BreakfastPrice"].Ordinal,
+                    dsIndex = dt.Columns["GovernmentRent"].Ordinal,
+                    cssIndex = dt.Columns["CityTax"].Ordinal,
+                    cpIndex = dt.Columns["ConsumptionPatterns"].Ordinal,
+                    remarkIndex = dt.Columns["Remark"].Ordinal;
+                //删除指定列
+                foreach (DataRow item in dt.Rows)
+                {
+                    string singleStr = item["SingleRoomPrice"].ToString();
+                    bool containsDigitButNotZero1 = !singleStr.StartsWith("0") && Regex.IsMatch(singleStr, @"[1-9]");
+                    if (containsDigitButNotZero1) singleDel = false;
+                    singleIndex = dt.Columns["SingleRoomPrice"].Ordinal;
+
+                    string doubleStr = item["DoubleRoomPrice"].ToString();
+                    bool containsDigitButNotZero2 = !doubleStr.StartsWith("0") && Regex.IsMatch(doubleStr, @"[1-9]");
+                    if (containsDigitButNotZero2) doubleDel = false;
+
+                    string suiteStr = item["SuiteRoomPrice"].ToString();
+                    bool containsDigitButNotZero3 = !singleStr.StartsWith("0") && Regex.IsMatch(doubleStr, @"[1-9]");
+                    if (containsDigitButNotZero3) suiteDel = false;
+
+                    string otherStr = item["OtherRoomPrice"].ToString();
+                    bool containsDigitButNotZero4 = !otherStr.StartsWith("0") && Regex.IsMatch(otherStr, @"[1-9]");
+                    if (containsDigitButNotZero4) otherDel = false;
+
+                    string zcStr = item["BreakfastPrice"].ToString();
+                    bool containsDigitButNotZero5 = !zcStr.StartsWith("0") && Regex.IsMatch(zcStr, @"[1-9]");
+                    if (containsDigitButNotZero5) zcDel = false;
+
+                    string dsStr = item["GovernmentRent"].ToString();
+                    bool containsDigitButNotZero6 = !dsStr.StartsWith("0") && Regex.IsMatch(dsStr, @"[1-9]");
+                    if (containsDigitButNotZero6) dsDel = false;
+
+                    string cssStr = item["CityTax"].ToString();
+                    bool containsDigitButNotZero7 = !cssStr.StartsWith("0") && Regex.IsMatch(cssStr, @"[1-9]");
+                    if (containsDigitButNotZero7) cssDel = false;
+
+                    string cpStr = item["ConsumptionPatterns"].ToString();
+                    if (!string.IsNullOrEmpty(cpStr)) cpDel = false;
+
+                    string remarkStr = item["Remark"].ToString();
+                    if (!string.IsNullOrEmpty(remarkStr)) remarkDel = false;
+
+                }
+
+                DeleteColumn(serverPath, remarkIndex, remarkDel);
+                DeleteColumn(serverPath, cpIndex, cpDel);
+                DeleteColumn(serverPath, dsIndex, dsDel);
+                DeleteColumn(serverPath, cssIndex, cssDel);
+                DeleteColumn(serverPath, zcIndex, zcDel);
+                DeleteColumn(serverPath, otherIndex, otherDel);
+                DeleteColumn(serverPath, suiteIndex, suiteDel);
+                DeleteColumn(serverPath, doubleIndex, doubleDel);
+                DeleteColumn(serverPath, singleIndex, singleDel);
+                #endregion
+                //只保留第一个表格
+                DeleteSheet(serverPath);
+
+                return Ok(JsonView(true, "操作成功", url = rst));
             }
 
-            DeleteColumn(serverPath, remarkIndex, remarkDel);
-            DeleteColumn(serverPath, cpIndex, cpDel);
-            DeleteColumn(serverPath, dsIndex, dsDel);
-            DeleteColumn(serverPath, cssIndex, cssDel);
-            DeleteColumn(serverPath, zcIndex, zcDel);
-            DeleteColumn(serverPath, otherIndex, otherDel);
-            DeleteColumn(serverPath, suiteIndex, suiteDel);
-            DeleteColumn(serverPath, doubleIndex, doubleDel);
-            DeleteColumn(serverPath, singleIndex, singleDel);
-            #endregion
-            //只保留第一个表格
-            DeleteSheet(serverPath);
 
-            return Ok(JsonView(true, "操作成功", url = rst));
+            return Ok(JsonView(false));
         }
 
         /// <summary>

+ 12 - 0
OASystem/OASystem.Api/Controllers/PersonnelModuleController.cs

@@ -2,6 +2,7 @@
 using FluentValidation;
 using Microsoft.AspNetCore.SignalR;
 using OASystem.API.OAMethodLib;
+using OASystem.API.OAMethodLib.APNs;
 using OASystem.API.OAMethodLib.Hub.HubClients;
 using OASystem.API.OAMethodLib.Hub.Hubs;
 using OASystem.API.OAMethodLib.QiYeWeChatAPI;
@@ -2337,6 +2338,17 @@ OPTION (MAXRECURSION 0); -- 允许无限递归      ";
             return Ok(jw);
         }
 
+        [HttpPost]
+        public IActionResult TempTest(QueryAssessmentSettingListOffsetAsyncDto Dto)
+        {
+            var jw = JsonView(false);
+
+
+            APNsLib.pushMsg("com.panamerican.oa2024", "db151df1d25823f84323c4597c5672460a983d49ba039c7ff54c4c8e36edd5c6", NotificationType.Alert, "测试", "测试字标题", "测试内容");
+
+            return Ok(jw);
+        }
+
         #endregion
     }
 }

File diff suppressed because it is too large
+ 806 - 304
OASystem/OASystem.Api/Controllers/ResourceController.cs


+ 15 - 0
OASystem/OASystem.Api/OAMethodLib/APNs/APNsLib.cs

@@ -0,0 +1,15 @@
+
+namespace OASystem.API.OAMethodLib.APNs
+{
+    public static class APNsLib
+    {
+        private static readonly IAPNsService _APNsService = AutofacIocManager.Instance.GetService<IAPNsService>();
+
+        public static bool pushMsg(string apnsTopic, string deviceToken, NotificationType type, string title, string subtitle, string body)
+        {
+            _APNsService.PushNotification(apnsTopic, deviceToken, type, title, subtitle, body);
+
+            return true;
+        }
+    }
+}

+ 185 - 0
OASystem/OASystem.Api/OAMethodLib/APNs/APNsService.cs

@@ -0,0 +1,185 @@
+using System.Security.Claims;
+using System.Security.Cryptography;
+using Microsoft.IdentityModel.Tokens;
+using System.IdentityModel.Tokens.Jwt;
+using static System.Net.Mime.MediaTypeNames;
+using Microsoft.Net.Http.Headers;
+using Microsoft.Extensions.Configuration;
+using NPOI.SS.Formula.Functions;
+
+namespace OASystem.API.OAMethodLib.APNs
+{
+    public enum NotificationType : int
+    {
+        Alert = 0,
+        Sound = 1,
+        Badge = 2,
+        Silent = 3
+    }
+
+    /// <summary>
+    /// APNs 生成 JWT token,添加服务的时候,使用单利
+    /// </summary>
+    public class APNsService : IAPNsService
+    {
+        static string token = null;
+        static string baseUrl = null;
+
+        private readonly IConfiguration _configuration;
+        private readonly IHttpClientFactory _httpClientFactory;
+        public APNsService(IConfiguration configuration, IHttpClientFactory httpClientFactory)
+        {
+            this._configuration = configuration;
+            this._httpClientFactory = httpClientFactory;
+
+            //APNsService.baseUrl = this._configuration["apple:pushNotificationServer"];
+            APNsService.baseUrl = this._configuration["apple:pushNotificationServer_Production"];
+        }
+
+        /// <summary>
+        /// 生成 APNs JWT token
+        /// </summary>
+        /// <returns></returns>
+        public string GetnerateAPNsJWTToken()
+        {
+            return this.GetnerateAPNsJWTToken(APNsService.token);
+        }
+
+        /// <summary>
+        /// 生成 APNs JWT token
+        /// </summary>
+        /// <returns></returns>
+        private string GetnerateAPNsJWTToken(string oldToken)
+        {
+            var tokenHandler = new JwtSecurityTokenHandler();
+            var iat = ((DateTime.UtcNow.Ticks - new DateTime(1970, 1, 1).Ticks) / TimeSpan.TicksPerSecond);
+
+            // 判断原 token 是否超过 50 分钟,如果未超过,直接返回
+            if (string.IsNullOrWhiteSpace(oldToken) == false)
+            {
+                JwtPayload oldPayload = tokenHandler.ReadJwtToken(oldToken).Payload;
+                var oldIat = oldPayload.Claims.FirstOrDefault(c => c.Type == "iat");
+                if (oldIat != null)
+                {
+                    if (long.TryParse(oldIat.Value, out long oldIatValue) == true)
+                    {
+                        // 两次间隔小于 50 分钟,使用原 token
+                        if ((iat - oldIatValue) < (50 * 60))
+                        {
+                            return oldToken;
+                        }
+                    }
+                }
+            }
+
+            var kid = _configuration["apple:kid"];
+            var securityKey = _configuration["apple:securityKey"].Replace("\n", "");
+            var iss = _configuration["apple:iss"];
+
+            var claims = new Claim[]
+            {
+            new Claim("iss", iss),
+            new Claim("iat", iat.ToString())
+            };
+
+            var eCDsa = ECDsa.Create();
+
+            eCDsa.ImportPkcs8PrivateKey(Convert.FromBase64String(securityKey), out _);
+
+            var key = new ECDsaSecurityKey(eCDsa);
+
+            key.KeyId = kid;
+
+            var signingCredentials = new SigningCredentials(key, SecurityAlgorithms.EcdsaSha256);
+            var jwtHeader = new JwtHeader(signingCredentials);
+            var jwtPayload = new JwtPayload(claims);
+
+            var jwtSecurityToken = new JwtSecurityToken(jwtHeader, jwtPayload);
+
+            APNsService.token = tokenHandler.WriteToken(jwtSecurityToken);
+
+            return APNsService.token;
+        }
+
+        /// <summary>
+        /// 发送推送通知
+        /// </summary>
+        /// <param name="apnsTopic">APP Id</param>
+        /// <param name="deviceToken">设备标识</param>
+        /// <param name="type">通知类型</param>
+        /// <param name="title">标题</param>
+        /// <param name="subtitle">子标题</param>
+        /// <param name="body">通知内容</param>
+        /// <returns></returns>
+        public async Task<string> PushNotification(string apnsTopic, string deviceToken, NotificationType type, string title, string subtitle, string body)
+        {
+            var responseData = FailedAPNsReponseData();
+            var token = this.GetnerateAPNsJWTToken();
+            var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, APNsService.baseUrl + deviceToken)
+            {
+                Headers =
+            {
+                { HeaderNames.Authorization, "bearer " +  token },
+                { "apns-topic", apnsTopic },
+                { "apns-expiration", "0" }
+            },
+                Version = new Version(2, 0)
+            };
+
+            var notContent = new
+            {
+                aps = new
+                {
+                    alert = new
+                    {
+                        title = title,
+                        subtitle = subtitle,
+                        body = body
+                    }
+                }
+            };
+            //var content = new StringContent(JsonSerializerTool.SerializeDefault(notContent), System.Text.Encoding.UTF8, Application.Json);
+
+            var content = new StringContent(System.Text.Json.JsonSerializer.Serialize(notContent));
+
+            httpRequestMessage.Content = content;
+
+            var httpClient = _httpClientFactory.CreateClient();
+            try
+            {
+                var httpResponseMessage = await httpClient.SendAsync(httpRequestMessage);
+
+                if (httpResponseMessage.IsSuccessStatusCode)
+                {
+                    responseData.Code = 200;
+                    return System.Text.Json.JsonSerializer.Serialize(responseData);
+                }
+                else
+                {
+                    responseData.Data = httpResponseMessage.StatusCode;
+                    return System.Text.Json.JsonSerializer.Serialize(responseData);
+                }
+            }
+            catch (Exception e)
+            {
+                responseData.Data = e.Message;
+                return System.Text.Json.JsonSerializer.Serialize(responseData);
+            }
+        }
+
+        public APNsReponseData FailedAPNsReponseData()
+        {
+            return new APNsReponseData() { Code = 400, Data = "" };
+        }
+    }
+
+    public class APNsReponseData
+    {
+        public int Code { get; set; } = 0;
+
+        public object Data { get; set; } = "";
+
+    }
+
+   
+}

+ 23 - 0
OASystem/OASystem.Api/OAMethodLib/APNs/IAPNsService.cs

@@ -0,0 +1,23 @@
+namespace OASystem.API.OAMethodLib.APNs
+{
+    public interface IAPNsService
+    {
+        /// <summary>
+        /// 生成 APNs JWT token
+        /// </summary>
+        /// <returns></returns>
+        string GetnerateAPNsJWTToken();
+
+        /// <summary>
+        /// 发送推送通知
+        /// </summary>
+        /// <param name="apnsTopic">APP Id</param>
+        /// <param name="deviceToken">设备标识</param>
+        /// <param name="type">通知类型</param>
+        /// <param name="title">标题</param>
+        /// <param name="subtitle">子标题</param>
+        /// <param name="body">通知内容</param>
+        /// <returns></returns>
+        Task<string> PushNotification(string apnsTopic, string deviceToken, NotificationType type, string title, string subtitle, string body);
+    }
+}

+ 3 - 0
OASystem/OASystem.Api/Program.cs

@@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core;
 using Microsoft.Extensions.DependencyInjection.Extensions;
 using OASystem.API.Middlewares;
 using OASystem.API.OAMethodLib;
+using OASystem.API.OAMethodLib.APNs;
 using OASystem.API.OAMethodLib.Hub.Hubs;
 using OASystem.API.OAMethodLib.JuHeAPI;
 using OASystem.API.OAMethodLib.QiYeWeChatAPI;
@@ -339,6 +340,8 @@ builder.Services.AddSingleton<IJobFactory, IOCJobFactory>();
 
 #endregion
 
+builder.Services.AddSingleton<IAPNsService,APNsService>();
+
 #region SignalR
 builder.Services.AddSignalR()
                 .AddJsonProtocol(options =>

+ 356 - 351
OASystem/OASystem.Api/appsettings.json

@@ -1,364 +1,369 @@
 {
-  "ConnectionStrings": {
-    "OA2023DB": "server=132.232.92.186;uid=sa;pwd=Yjx@158291;database=OA2023DB;MultipleActiveResultSets=True;",
-    "OA2014DB": "server=132.232.92.186;uid=sa;pwd=Yjx@158291;database=OA2014;MultipleActiveResultSets=True;"
-  },
-  "JwtSecurityKey": "48d3f4fe770940a1068052f581536b81", //jwt密钥
-  "UseSwagger": "true", //启用Swagger
-  "GroupsConfig": {
-    "AutoCreate": "4",
-    "Leader": "149",
-    "ExBeginDays": "3",
-    "ExEndDays": "30",
-    "DefaultUser": "51",
-    "Boss": "21",
-    "FilterUser": "51,180"
-  },
-  "DeleReminderConfig": {
-    "PhoneNumber": "17380669807,13683474118,18780121225",
-    "Test": "18477317582"
-  },
-  "RateCurrency": [
-    {
-      "CurrencyName": "人民币",
-      "CurrencyCode": "CNY"
-    },
-    {
-      "CurrencyName": "美元",
-      "CurrencyCode": "USD"
-    },
-    {
-      "CurrencyName": "欧元",
-      "CurrencyCode": "EUR"
-    },
-    {
-      "CurrencyName": "港币",
-      "CurrencyCode": "HKD"
-    },
-    {
-      "CurrencyName": "日元",
-      "CurrencyCode": "JPY"
-    },
-    {
-      "CurrencyName": "英镑",
-      "CurrencyCode": "GBP"
-    },
-    {
-      "CurrencyName": "澳大利亚元",
-      "CurrencyCode": "AUD"
-    },
-    {
-      "CurrencyName": "加拿大元",
-      "CurrencyCode": "CAD"
-    },
-    {
-      "CurrencyName": "泰国铢",
-      "CurrencyCode": "THB"
-    },
-    {
-      "CurrencyName": "新加坡元",
-      "CurrencyCode": "SGD"
-    },
-    {
-      "CurrencyName": "瑞士法郎",
-      "CurrencyCode": "CHK"
-    },
-    {
-      "CurrencyName": "丹麦克朗",
-      "CurrencyCode": "DKK"
-    },
-    {
-      "CurrencyName": "澳门元",
-      "CurrencyCode": "MOP"
-    },
-    {
-      "CurrencyName": "林吉特",
-      "CurrencyCode": "MYR"
-    },
-    {
-      "CurrencyName": "挪威克朗",
-      "CurrencyCode": "NOK"
-    },
-    {
-      "CurrencyName": "新西兰元",
-      "CurrencyCode": "NZD"
-    },
-    {
-      "CurrencyName": "卢布",
-      "CurrencyCode": "RUB"
-    },
-    {
-      "CurrencyName": "瑞典克朗",
-      "CurrencyCode": "SEK"
-    },
-    {
-      "CurrencyName": "菲律宾比索",
-      "CurrencyCode": "PHP"
-    },
-    {
-      "CurrencyName": "新台币",
-      "CurrencyCode": "TWD"
-    },
-    {
-      "CurrencyName": "巴西雷亚尔",
-      "CurrencyCode": "BRL"
-    },
-    {
-      "CurrencyName": "韩国元",
-      "CurrencyCode": "ZAR"
-    }
-  ],
-  "ExcelBaseUrl": "http://132.232.92.186:24/",
-  "ExcelBasePath": "D:/FTP/File/OA2023/Office/Excel/",
-  "ExcelFtpPath": "Office/Excel/",
-  "OfficeBaseUrl": "http://132.232.92.186:24/",
-  "OfficeTempBasePath": "D:/FTP/File/OA2023/Office/",
+    "ConnectionStrings": {
+        "OA2023DB": "server=132.232.92.186;uid=sa;pwd=Yjx@158291;database=OA2023DB;MultipleActiveResultSets=True;",
+        "OA2014DB": "server=132.232.92.186;uid=sa;pwd=Yjx@158291;database=OA2014;MultipleActiveResultSets=True;"
+    },
+    "JwtSecurityKey": "48d3f4fe770940a1068052f581536b81", //jwt密钥
+    "UseSwagger": "true", //启用Swagger
+    "GroupsConfig": {
+        "AutoCreate": "4",
+        "Leader": "149",
+        "ExBeginDays": "3",
+        "ExEndDays": "30",
+        "DefaultUser": "51",
+        "Boss": "21",
+        "FilterUser": "51,180"
+    },
+    "apple:securityKey": "MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQglyUl7hjI75YJUVMbZLN6TpkiFzuTXUN+UIjuJA7+y8ugCgYIKoZIzj0DAQehRANCAAS8GR7lKNst4KENCp45OXCMyiytvzK0qdRBrx0l+bMaHjiU+Upfox82G+Xy4wd8hI+0wMDh341aNelqEdYUUx3O",
+    "apple:kid": "RMV7Y4KM9V",
+    "apple:iss": "HKF372JSMK",
+    "apple:pushNotificationServer": "https://api.sandbox.push.apple.com:443/3/device/",
+    "apple:pushNotificationServer_Production": "https://api.push.apple.com:443/3/device/",
+    "DeleReminderConfig": {
+        "PhoneNumber": "17380669807,13683474118,18780121225",
+        "Test": "18477317582"
+    },
+    "RateCurrency": [
+        {
+            "CurrencyName": "人民币",
+            "CurrencyCode": "CNY"
+        },
+        {
+            "CurrencyName": "美元",
+            "CurrencyCode": "USD"
+        },
+        {
+            "CurrencyName": "欧元",
+            "CurrencyCode": "EUR"
+        },
+        {
+            "CurrencyName": "港币",
+            "CurrencyCode": "HKD"
+        },
+        {
+            "CurrencyName": "日元",
+            "CurrencyCode": "JPY"
+        },
+        {
+            "CurrencyName": "英镑",
+            "CurrencyCode": "GBP"
+        },
+        {
+            "CurrencyName": "澳大利亚元",
+            "CurrencyCode": "AUD"
+        },
+        {
+            "CurrencyName": "加拿大元",
+            "CurrencyCode": "CAD"
+        },
+        {
+            "CurrencyName": "泰国铢",
+            "CurrencyCode": "THB"
+        },
+        {
+            "CurrencyName": "新加坡元",
+            "CurrencyCode": "SGD"
+        },
+        {
+            "CurrencyName": "瑞士法郎",
+            "CurrencyCode": "CHK"
+        },
+        {
+            "CurrencyName": "丹麦克朗",
+            "CurrencyCode": "DKK"
+        },
+        {
+            "CurrencyName": "澳门元",
+            "CurrencyCode": "MOP"
+        },
+        {
+            "CurrencyName": "林吉特",
+            "CurrencyCode": "MYR"
+        },
+        {
+            "CurrencyName": "挪威克朗",
+            "CurrencyCode": "NOK"
+        },
+        {
+            "CurrencyName": "新西兰元",
+            "CurrencyCode": "NZD"
+        },
+        {
+            "CurrencyName": "卢布",
+            "CurrencyCode": "RUB"
+        },
+        {
+            "CurrencyName": "瑞典克朗",
+            "CurrencyCode": "SEK"
+        },
+        {
+            "CurrencyName": "菲律宾比索",
+            "CurrencyCode": "PHP"
+        },
+        {
+            "CurrencyName": "新台币",
+            "CurrencyCode": "TWD"
+        },
+        {
+            "CurrencyName": "巴西雷亚尔",
+            "CurrencyCode": "BRL"
+        },
+        {
+            "CurrencyName": "韩国元",
+            "CurrencyCode": "ZAR"
+        }
+    ],
+    "ExcelBaseUrl": "http://132.232.92.186:24/",
+    "ExcelBasePath": "D:/FTP/File/OA2023/Office/Excel/",
+    "ExcelFtpPath": "Office/Excel/",
+    "OfficeBaseUrl": "http://132.232.92.186:24/",
+    "OfficeTempBasePath": "D:/FTP/File/OA2023/Office/",
 
-  "WordBaseUrl": "http://132.232.92.186:24/",
-  "WordBasePath": "D:/FTP/File/OA2023/Office/Word/",
-  "WordFtpPath": "Office/Word/",
+    "WordBaseUrl": "http://132.232.92.186:24/",
+    "WordBasePath": "D:/FTP/File/OA2023/Office/Word/",
+    "WordFtpPath": "Office/Word/",
 
-  "GrpFileBaseUrl": "http://132.232.92.186:24/",
-  "GrpFileBasePath": "D:/FTP/File/OA2023/Office/GrpFile/",
-  "GrpFileFtpPath": "Office/GrpFile/",
+    "GrpFileBaseUrl": "http://132.232.92.186:24/",
+    "GrpFileBasePath": "D:/FTP/File/OA2023/Office/GrpFile/",
+    "GrpFileFtpPath": "Office/GrpFile/",
 
-  "ExcelTempPath": "D:/FTP/File/OA2023/Office/Excel/Template/",
-  "GrpListFileBasePath": "D:/FTP/File/OA2023/Office/GrpFile/GroupList/",
-  "GrpListFileFtpPath": "Office/GrpFile/GroupList/",
-  //D:\FTP\File\OA2023\Office\GrpFile
-  "VisaProgressImageBaseUrl": "http://132.232.92.186:24/",
-  "VisaProgressImageBasePath": "D:/FTP/File/OA2023/Image/Visa/",
-  "VisaProgressImageFtpPath": "Image/Visa/",
+    "ExcelTempPath": "D:/FTP/File/OA2023/Office/Excel/Template/",
+    "GrpListFileBasePath": "D:/FTP/File/OA2023/Office/GrpFile/GroupList/",
+    "GrpListFileFtpPath": "Office/GrpFile/GroupList/",
+    //D:\FTP\File\OA2023\Office\GrpFile
+    "VisaProgressImageBaseUrl": "http://132.232.92.186:24/",
+    "VisaProgressImageBasePath": "D:/FTP/File/OA2023/Image/Visa/",
+    "VisaProgressImageFtpPath": "Image/Visa/",
 
-  "WageSheetExcelBaseUrl": "http://132.232.92.186:24/",
-  "WageSheetExcelFptPath": "D:/FTP/File/OA2023/Office/WageSheetFile/",
+    "WageSheetExcelBaseUrl": "http://132.232.92.186:24/",
+    "WageSheetExcelFptPath": "D:/FTP/File/OA2023/Office/WageSheetFile/",
 
-  "WageSheetTaxExcelBaseUrl": "http://132.232.92.186:24/",
-  "WageSheetTaxExcelFptPath": "D:/FTP/File/OA2023/Office/Excel/WageSheetTaxFile/",
+    "WageSheetTaxExcelBaseUrl": "http://132.232.92.186:24/",
+    "WageSheetTaxExcelFptPath": "D:/FTP/File/OA2023/Office/Excel/WageSheetTaxFile/",
 
-  "CTableCorrelationPageDatas": [
-    {
-      "CTableId": 76, //CtableId 酒店预订
-      "PageIdDatas": [ //页面Ids
-        28
-      ]
-    },
-    {
-      "CTableId": 77, //CtableId  行程
-      "PageIdDatas": [ //页面Id
-      ]
-    },
-    {
-      "CTableId": 79, //CtableId 车/导游地接
-      "PageIdDatas": [ //页面Id
-        30
-      ]
-    },
-    {
-      "CTableId": 80, //CtableId  签证
-      "PageIdDatas": [ //页面Id
-      ]
-    },
-    {
-      "CTableId": 81, //CtableId 邀请/公务活动
-      "PageIdDatas": [ //页面Id
-      ]
-    },
-    {
-      "CTableId": 82, //CtableId 团组客户保险
-      "PageIdDatas": [ //页面Id
-      ]
-    },
-    {
-      "CTableId": 85, //CtableId 机票预订
-      "PageIdDatas": [ //页面Id
-      ]
-    },
-    {
-      "CTableId": 98, //CtableId 其他款项
-      "PageIdDatas": [ //页面Id
-        69
-      ]
-    },
-    {
-      "CTableId": 285, //CtableId 其他款项与收款退还
-      "PageIdDatas": [ //页面Id
-        //69
-      ]
-    },
-    {
-      "CTableId": 751, //CtableId 酒店早餐
-      "PageIdDatas": [ //页面Id
-      ]
-    },
-    {
-      "CTableId": 1015, //CtableId 超支费用
-      "PageIdDatas": [ //页面Id
-        174
-      ]
-    }
-  ],
+    "CTableCorrelationPageDatas": [
+        {
+            "CTableId": 76, //CtableId 酒店预订
+            "PageIdDatas": [ //页面Ids
+                28
+            ]
+        },
+        {
+            "CTableId": 77, //CtableId  行程
+            "PageIdDatas": [ //页面Id
+            ]
+        },
+        {
+            "CTableId": 79, //CtableId 车/导游地接
+            "PageIdDatas": [ //页面Id
+                30
+            ]
+        },
+        {
+            "CTableId": 80, //CtableId  签证
+            "PageIdDatas": [ //页面Id
+            ]
+        },
+        {
+            "CTableId": 81, //CtableId 邀请/公务活动
+            "PageIdDatas": [ //页面Id
+            ]
+        },
+        {
+            "CTableId": 82, //CtableId 团组客户保险
+            "PageIdDatas": [ //页面Id
+            ]
+        },
+        {
+            "CTableId": 85, //CtableId 机票预订
+            "PageIdDatas": [ //页面Id
+            ]
+        },
+        {
+            "CTableId": 98, //CtableId 其他款项
+            "PageIdDatas": [ //页面Id
+                69
+            ]
+        },
+        {
+            "CTableId": 285, //CtableId 其他款项与收款退还
+            "PageIdDatas": [ //页面Id
+                //69
+            ]
+        },
+        {
+            "CTableId": 751, //CtableId 酒店早餐
+            "PageIdDatas": [ //页面Id
+            ]
+        },
+        {
+            "CTableId": 1015, //CtableId 超支费用
+            "PageIdDatas": [ //页面Id
+                174
+            ]
+        }
+    ],
 
-  //消息通知类型
-  "MessageNotificationType": [
-    {
-      "TypeId": 1022, //系统公告
-      "MsgTypeIds": [
-        1 // 公告消息
-      ]
-    },
-    {
-      "TypeId": 1021, //操作通知
-      "MsgTypeIds": [
-        2, // 团组流程管控消息
-        3, // 团组业务操作消息
-        4, // 团组费用审核消息
-        5 // 团组签证进度更新消息
-      ]
-    },
-    {
-      "TypeId": 1020, //任务通知
-      "MsgTypeIds": [
-        6 //任务进度更新消息
-      ]
-    }
-  ],
+    //消息通知类型
+    "MessageNotificationType": [
+        {
+            "TypeId": 1022, //系统公告
+            "MsgTypeIds": [
+                1 // 公告消息
+            ]
+        },
+        {
+            "TypeId": 1021, //操作通知
+            "MsgTypeIds": [
+                2, // 团组流程管控消息
+                3, // 团组业务操作消息
+                4, // 团组费用审核消息
+                5 // 团组签证进度更新消息
+            ]
+        },
+        {
+            "TypeId": 1020, //任务通知
+            "MsgTypeIds": [
+                6 //任务进度更新消息
+            ]
+        }
+    ],
 
 
-  //职位默认页面权限
-  "DefaultPostPageData": [
-    {
-      "DepId": -1, //部门: 公司公共页面
-      "PostPageAuths": [
-        {
-          "PostId": -1,
-          "PageIds": [
-            42 //Page: 日常费用付款申请
-            //16 //Page: 员工资料列表
-          ]
-        }
-      ]
-    },
-    {
-      "DepId": 0, //部门:人事部,信息部,策划部(部门页面一致归类在一起)
-      "PostPageAuths": [
-        {
-          "PostId": 0, //职位:普通员工(除经理主管外/公共页面)
-          "PageIds": [
-            149 //Page: 主页(员工)
-          ]
-        }
-      ]
-    },
-    {
-      "DepId": 1, //部门: 总经办
-      "PostPageAuths": [
-        {
-          "PostId": 3, //职位: 总经理助理
-          "PageIds": [
-            150 //Page: 主页(总助)
-          ]
-        }
-      ]
-    },
-    {
-      "DepId": 6, //部门:市场部
-      "PostPageAuths": [
-        {
-          "PostId": 21, //职位:普通员工(除经理主管外)
-          "PageIds": [
-            //153, //Page: 主页(市场部)
-            149, //Page: 主页(员工)
-            118, //Page: 出入境费用明细
-            168, //Page: 出入境国家三公费用标准
-            89 //Page: 公司客户资料
-          ]
-        }
-      ]
-    },
-    {
-      "DepId": 3, //部门:财务部
-      "PostPageAuths": [
-        {
-          "PostId": 10, //职位:会计
-          "PageIds": [
-            151 //Page: 主页(财务)
-          ]
-        }
-      ]
-    },
-    {
-      "DepId": 7, //国交部
-      "PostPageAuths": [
-        {
-          "PostId": -1, //职位:部门公共页面
-          "PageIds": [
-            //154, //Page: 主页(国交)
-            40, //Page: 其他款项
-            174 //Page: 超支费用
-          ]
-        },
-        {
-          "PostId": 0, //职位:经理/主管
-          "PageIds": [
-            154, //Page: 主页(国交)
-            27, //Page: 团组操作
-            104, //Page: 接团客户名单
-            118, //Page: 出入境费用明细
-            168 //Page: 出入境国家三公费用标准
-          ]
-        },
-        {
-          "PostId": 26, //职位:签证
-          "PageIds": [
-            149, //Page: 主页(员工)
-            31, //Page: 签证费用录入
-            158, //Page: OCR识别
-            32 //Page: 保险录入
-          ]
-        },
-        {
-          "PostId": 27, //职位:商邀
-          "PageIds": [
-            149, //Page: 主页(员工)
-            25, //Page: 邀请资料
-            29, //Page: 邀请公务费用
-            166, //Page: 公务出访
-            167 //Page:导出邀请函
-          ]
-        },
-        {
-          "PostId": 28, //职位:OP
-          "PageIds": [
-            149, //Page: 主页(员工)
-            24, //Page: 导游地接资料
-            30, //Page: 地接费用录入
-            122, //Page: OP行程单
-            111 //Page: 车公司资料
-          ]
-        },
-        {
-          "PostId": 24, //职位:机票
-          "PageIds": [
-            149, //Page: 主页(员工)
-            114, //Page: 机票行程代码录
-            120, //Page: 三字码资料表
-            160, //Page: 代理出票合作方
-            161 //Page: 机票费用录入
-          ]
-        },
-        {
-          "PostId": 25, //职位:酒店
-          "PageIds": [
-            149, //Page: 主页(员工)
-            23, //Page: 酒店资料 
-            28 //Page: 酒店预订
-          ]
+    //职位默认页面权限
+    "DefaultPostPageData": [
+        {
+            "DepId": -1, //部门: 公司公共页面
+            "PostPageAuths": [
+                {
+                    "PostId": -1,
+                    "PageIds": [
+                        42 //Page: 日常费用付款申请
+                        //16 //Page: 员工资料列表
+                    ]
+                }
+            ]
+        },
+        {
+            "DepId": 0, //部门:人事部,信息部,策划部(部门页面一致归类在一起)
+            "PostPageAuths": [
+                {
+                    "PostId": 0, //职位:普通员工(除经理主管外/公共页面)
+                    "PageIds": [
+                        149 //Page: 主页(员工)
+                    ]
+                }
+            ]
+        },
+        {
+            "DepId": 1, //部门: 总经办
+            "PostPageAuths": [
+                {
+                    "PostId": 3, //职位: 总经理助理
+                    "PageIds": [
+                        150 //Page: 主页(总助)
+                    ]
+                }
+            ]
+        },
+        {
+            "DepId": 6, //部门:市场部
+            "PostPageAuths": [
+                {
+                    "PostId": 21, //职位:普通员工(除经理主管外)
+                    "PageIds": [
+                        //153, //Page: 主页(市场部)
+                        149, //Page: 主页(员工)
+                        118, //Page: 出入境费用明细
+                        168, //Page: 出入境国家三公费用标准
+                        89 //Page: 公司客户资料
+                    ]
+                }
+            ]
+        },
+        {
+            "DepId": 3, //部门:财务部
+            "PostPageAuths": [
+                {
+                    "PostId": 10, //职位:会计
+                    "PageIds": [
+                        151 //Page: 主页(财务)
+                    ]
+                }
+            ]
+        },
+        {
+            "DepId": 7, //国交部
+            "PostPageAuths": [
+                {
+                    "PostId": -1, //职位:部门公共页面
+                    "PageIds": [
+                        //154, //Page: 主页(国交)
+                        40, //Page: 其他款项
+                        174 //Page: 超支费用
+                    ]
+                },
+                {
+                    "PostId": 0, //职位:经理/主管
+                    "PageIds": [
+                        154, //Page: 主页(国交)
+                        27, //Page: 团组操作
+                        104, //Page: 接团客户名单
+                        118, //Page: 出入境费用明细
+                        168 //Page: 出入境国家三公费用标准
+                    ]
+                },
+                {
+                    "PostId": 26, //职位:签证
+                    "PageIds": [
+                        149, //Page: 主页(员工)
+                        31, //Page: 签证费用录入
+                        158, //Page: OCR识别
+                        32 //Page: 保险录入
+                    ]
+                },
+                {
+                    "PostId": 27, //职位:商邀
+                    "PageIds": [
+                        149, //Page: 主页(员工)
+                        25, //Page: 邀请资料
+                        29, //Page: 邀请公务费用
+                        166, //Page: 公务出访
+                        167 //Page:导出邀请函
+                    ]
+                },
+                {
+                    "PostId": 28, //职位:OP
+                    "PageIds": [
+                        149, //Page: 主页(员工)
+                        24, //Page: 导游地接资料
+                        30, //Page: 地接费用录入
+                        122, //Page: OP行程单
+                        111 //Page: 车公司资料
+                    ]
+                },
+                {
+                    "PostId": 24, //职位:机票
+                    "PageIds": [
+                        149, //Page: 主页(员工)
+                        114, //Page: 机票行程代码录
+                        120, //Page: 三字码资料表
+                        160, //Page: 代理出票合作方
+                        161 //Page: 机票费用录入
+                    ]
+                },
+                {
+                    "PostId": 25, //职位:酒店
+                    "PageIds": [
+                        149, //Page: 主页(员工)
+                        23, //Page: 酒店资料 
+                        28 //Page: 酒店预订
+                    ]
+                }
+            ]
         }
-      ]
-    }
-  ],
+    ],
 
-  //日付类型Data
-  "Dailypayment": "666,667"
+    //日付类型Data
+    "Dailypayment": "666,667"
 }

+ 12 - 0
OASystem/OASystem.Domain/Dtos/Groups/VisaPriceDto.cs

@@ -144,5 +144,17 @@ namespace OASystem.Domain.Dtos.Groups
         /// 签证描述
         /// </summary>
         public string VisaDescription { get; set; }
+
+        /// <summary>
+        /// 地区
+        /// </summary>
+        public string Area { get; set; }
+
+        /// <summary>
+        /// 代办费类型
+        /// 0 未选择 1 小公务 2 大公务
+        /// </summary>
+        public int AgencyFeeType { get; set; }
+
     }
 }

+ 13 - 0
OASystem/OASystem.Domain/Entities/Groups/Grp_VisaInfo.cs

@@ -17,7 +17,20 @@ namespace OASystem.Domain.Entities.Groups
         /// </summary>
         [SugarColumn(IsNullable =true,ColumnDataType ="int")]
         public int DIId { get; set; }
+        
         /// <summary>
+        /// 区域
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(100)")]
+        public string Area { get; set; }
+
+        /// <summary>
+        /// 代办费类型
+        /// 0 未选择 1 小公务 2 大公务
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int AgencyFeeType { get; set; }
+
         /// 签证客户
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "varchar(120)")]

+ 8 - 10
OASystem/OASystem.Infrastructure/Repositories/Financial/ForeignReceivablesRepository.cs

@@ -29,7 +29,7 @@ namespace OASystem.Infrastructure.Repositories.Financial
         private readonly IMapper _mapper;
         private readonly DelegationInfoRepository _delegationRep;
         private readonly SetDataRepository _setDataRep;
-        
+        private readonly List<int> _portTypes = new List<int>() { 1, 2, 3 };
 
         public ForeignReceivablesRepository(SqlSugarClient sqlSugar, IMapper mapper, DelegationInfoRepository delegationRep, SetDataRepository setDataRep)
             : base(sqlSugar)
@@ -333,7 +333,7 @@ namespace OASystem.Infrastructure.Repositories.Financial
         /// <returns></returns>
         public async Task<JsonView> PostGroupReceivablesInfoByDiId(ForForeignReceivablesNewDto dto)
         {
-            JsonView result = new() { Code = 400,Msg="" };
+            JsonView result = new() { Code = 400, Msg = "" };
 
             //var groupInfoData = await _delegationRep.GetGroupInfo(new GroupInfoDto() { Id = dto.DiId });
             var groupInfoData = await _delegationRep.Query(x => x.Id == dto.DiId)
@@ -387,8 +387,9 @@ Where ffr.IsDel=0 And ffr.Diid={0}", dto.DiId);
             }
 
             int addCount = 0, updateCount = 0;
-            if (dto.PortType == 1)
-            {
+             
+            //if (dto.PortType == 1)
+            //{
                 //查询值是否更改
                 var selectInfos = await _sqlSugar.Queryable<Fin_ForeignReceivables>().Where(it => it.Diid == dto.DiId && it.Status == 1).ToListAsync();
 
@@ -443,7 +444,7 @@ Where ffr.IsDel=0 And ffr.Diid={0}", dto.DiId);
                 }
                 result.Code = 200;
                 result.Msg = string.Format(@"操作成功!添加:{0}条;更新:{1};", addCount, updateCount);
-            }
+            //}
 
             return result;
         }
@@ -488,10 +489,7 @@ Where ffr.IsDel=0 And ffr.Diid={0}", dto.DiId);
                 result.Msg = "操作成功!";
                 result.Code = 200;
             }
-            else
-            {
-                result.Msg = "操作失败!";
-            }
+            else result.Msg = "操作失败!";
             return result;
         }
 
@@ -531,7 +529,7 @@ Where ffr.IsDel=0 And ffr.Diid={0}", dto.DiId);
         public void OverSpSeteceivables(OverSpSeteceivablesDto dto)
         {
             var querySaveReceivables = _sqlSugar.Queryable<Fin_ForeignReceivables>()
-    .First(x => x.Diid == dto.DiId && x.AddingWay == 3 && x.IsDel == 0);
+                .First(x => x.Diid == dto.DiId && x.AddingWay == 3 && x.IsDel == 0);
 
             //获取所有超支数据
             //整理超支数据

+ 0 - 2
OASystem/OASystem.Infrastructure/Repositories/Groups/TourClientListRepository.cs

@@ -37,8 +37,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
             _mapper = mapper;
         }
 
-
-
         /// <summary>
         /// 根据团组Id客人名单List
         /// </summary>

+ 48 - 25
OASystem/OASystem.Infrastructure/Repositories/Groups/VisaPriceRepository.cs

@@ -7,6 +7,7 @@ using OASystem.Domain.Dtos.Groups;
 using OASystem.Domain.Entities.Customer;
 using OASystem.Domain.Entities.Financial;
 using OASystem.Domain.Entities.Groups;
+using OASystem.Domain.Entities.Resource;
 using OASystem.Domain.ViewModels.Financial;
 using OASystem.Domain.ViewModels.Groups;
 using OASystem.Infrastructure.Repositories.System;
@@ -297,22 +298,17 @@ Left Join Sys_SetData as sd With(Nolock) On c.PayDId = sd.Id
         /// <returns></returns>
         public async Task<Result> PostVisaById(PostVisaByIdDto dto)
         {
-            Result result = new Result() { Code = -2, Msg = "未知错误" };
-            try
-            {
-                Grp_VisaInfo _VisaInfo = _sqlSugar.Queryable<Grp_VisaInfo>().First(a => a.Id == dto.Id && a.IsDel == 0);
-                Grp_CreditCardPayment _CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == dto.Id && a.IsDel == 0 && a.CTable == 80);
-                var data = new
-                {
-                    VisaInfo = _VisaInfo,
-                    CreditCardPayment = _CreditCardPayment
-                };
-                return result = new Result() { Code = 0, Msg = "暂无数据!", Data = data };
-            }
-            catch (Exception ex)
+            var result = new Result() { Code = -2, Msg = "未知错误" };
+
+            Grp_VisaInfo _VisaInfo = _sqlSugar.Queryable<Grp_VisaInfo>().First(a => a.Id == dto.Id && a.IsDel == 0);
+            Grp_CreditCardPayment _CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == dto.Id && a.IsDel == 0 && a.CTable == 80);
+            var data = new
             {
-                return result = new Result() { Code = -2, Msg = "未知错误" };
-            }
+                VisaInfo = _VisaInfo,
+                CreditCardPayment = _CreditCardPayment
+            };
+            return result = new Result() { Code = 0, Msg = "暂无数据!", Data = data };
+
         }
         /// <summary>
         /// 签证费用录入操作(Status:1.新增,2.修改)
@@ -339,8 +335,32 @@ Left Join Sys_SetData as sd With(Nolock) On c.PayDId = sd.Id
 
             c.RMBPrice = c.PayMoney;
             c.DayRate = 1.0000M;
-            Grp_TeamRate _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == dto.DiId && a.IsDel == 0 && a.CTable == 80);
-            List<CurrencyInfo> currencyInfos = new List<CurrencyInfo>();
+
+            #region 自动审核处理
+            var isAutoAudit = false;
+            if (dto.IsThird == 0)
+            {
+                var visaFeeInfo = _sqlSugar.Queryable<Res_CountryFeeCost>().Where(x => x.IsDel == 0 && x.VisaCountry.Equals(dto.Area)).First();
+                if (visaFeeInfo != null) {
+
+                    var visaFeePrice = visaFeeInfo.VisaPrice;
+                    if (dto.AgencyFeeType == 1) visaFeePrice += visaFeeInfo.PettyBusinessAgencyFee;
+                    else if (dto.AgencyFeeType == 2) visaFeePrice += visaFeeInfo.GrandBusinessAgencyFee;
+                    var visaFeeTotalPrice = visaFeePrice * dto.VisaNumber;
+                    if (dto.VisaPrice <= visaFeeTotalPrice)
+                    {
+                        isAutoAudit = true;
+                        c.IsAuditGM = 3;
+                        c.AuditGMOperate = 4; //系统管理员
+                        c.AuditGMDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+                    }
+                }
+            }
+
+            #endregion
+
+            var _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == dto.DiId && a.IsDel == 0 && a.CTable == 80);
+            var currencyInfos = new List<CurrencyInfo>();
             if (_TeamRate != null)
             {
                 Sys_SetData _SetData = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == c.PaymentCurrency);
@@ -358,13 +378,14 @@ Left Join Sys_SetData as sd With(Nolock) On c.PayDId = sd.Id
 
             if (dto.Status == 1)//添加
             {
-                Grp_VisaInfo grp_Visa = _sqlSugar.Queryable<Grp_VisaInfo>()
-                                                 .First(a => a.IsDel == 0 &&
-                                                             a.VisaDescription.Equals(dto.VisaDescription) &&
-                                                             a.VisaCurrency == dto.VisaCurrency &&
-                                                             a.VisaPrice == dto.VisaPrice &&
-                                                             a.VisaClient == dto.VisaClient
-                                                  );
+                var grp_Visa = _sqlSugar.Queryable<Grp_VisaInfo>()
+                    .First(a => a.IsDel == 0 &&
+                                a.DIId == dto.DiId &&
+                                a.VisaDescription.Equals(dto.VisaDescription) &&
+                                a.VisaCurrency == dto.VisaCurrency &&
+                                a.VisaPrice == dto.VisaPrice &&
+                                a.VisaClient == dto.VisaClient
+                    );
                 if (grp_Visa != null)
                 {
                     return result = new Result() { Code = -1, Msg = "该笔费用已存在,请勿重复添加!" };
@@ -433,8 +454,10 @@ Left Join Sys_SetData as sd With(Nolock) On c.PayDId = sd.Id
                                                     BankNo = c.BankNo,
                                                     CardholderName = c.CardholderName,
                                                     Remark = c.Remark,
-
                                                 })
+                                                .SetColumnsIF(isAutoAudit, x => x.IsAuditGM == 3)
+                                                .SetColumnsIF(isAutoAudit, x => x.AuditGMOperate == 4)
+                                                .SetColumnsIF(isAutoAudit, x => x.AuditGMDate == DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
                                                 .ExecuteCommandAsync();
 
                     var ccp = Query<Grp_CreditCardPayment>(a => a.CId == grp_Visa1.Id && a.CTable == 80).First();

+ 25 - 36
OASystem/OASystem.Infrastructure/Repositories/Resource/AskDataRepository.cs

@@ -23,46 +23,35 @@ namespace OASystem.Infrastructure.Repositories.Resource
 
         public async Task<Result> QueryAskData(QueryAskDataDto dto)
         {
-            Result result = new Result() { Code = -2, Msg = "未知错误" };
-            try
-            {
-                string sqlWhere = string.Empty;
-                if (!string.IsNullOrWhiteSpace(dto.Country))
-                {
-                    sqlWhere += string.Format(@"And Country like '%{0}%'", dto.Country);
-                }
-                if (!string.IsNullOrWhiteSpace(dto.Area))
-                {
-                    sqlWhere += string.Format(@"And Area like '%{0}%'", dto.Area);
-                }
-                if (!string.IsNullOrWhiteSpace(dto.Field))
-                {
-                    sqlWhere += string.Format(@"And Field like '%{0}%'", dto.Field);
-                }
-                sqlWhere += string.Format(@"And IsDel={0}", 0);
 
-                if (!string.IsNullOrEmpty(sqlWhere.Trim()))
-                {
-                    Regex r = new Regex("And");
-                    sqlWhere = r.Replace(sqlWhere, "Where", 1);
-                }
-                string sql = string.Format(@"select * from Res_AskData {0} order by CreateTime desc", sqlWhere);
-                List<Res_AskData> askDatd = await _sqlSugar.SqlQueryable<Res_AskData>(sql).ToListAsync();
-                List<Grp_DelegationInfo> delegationInfo=await _sqlSugar.Queryable<Grp_DelegationInfo>().Where(a=>a.IsDel==0).ToListAsync();
-                if (askDatd.Count != 0 && delegationInfo.Count!=0)
-                {
-                    result = new Result() { Code = 0, Msg = "查询成功!", Data = new { askDatd= askDatd, delegationInfo= delegationInfo } };
-                }
-                else
-                {
-                    result = new Result() { Code = 0, Msg = "暂无数据!", Data = new { askDatd = askDatd, delegationInfo = delegationInfo } };
-                }
+            string sqlWhere = string.Empty;
+            if (!string.IsNullOrWhiteSpace(dto.Country))
+            {
+                sqlWhere += string.Format(@"And Country like '%{0}%'", dto.Country);
             }
-            catch (Exception ex)
+            if (!string.IsNullOrWhiteSpace(dto.Area))
             {
-                result = new Result() { Code = -2, Msg = "未知错误" };
+                sqlWhere += string.Format(@"And Area like '%{0}%'", dto.Area);
             }
-            return result;
+            if (!string.IsNullOrWhiteSpace(dto.Field))
+            {
+                sqlWhere += string.Format(@"And Field like '%{0}%'", dto.Field);
+            }
+            sqlWhere += string.Format(@"And IsDel={0}", 0);
+
+            if (!string.IsNullOrEmpty(sqlWhere.Trim()))
+            {
+                Regex r = new Regex("And");
+                sqlWhere = r.Replace(sqlWhere, "Where", 1);
+            }
+            string sql = string.Format(@"select * from Res_AskData {0} order by CreateTime desc", sqlWhere);
+            List<Res_AskData> askDatd = await _sqlSugar.SqlQueryable<Res_AskData>(sql).ToListAsync();
+            List<Grp_DelegationInfo> delegationInfo = await _sqlSugar.Queryable<Grp_DelegationInfo>().Where(a => a.IsDel == 0).ToListAsync();
+            var msg = string.Empty;
+            if (askDatd.Count != 0 && delegationInfo.Count != 0) msg = "查询成功!";
+            else msg = "查询成功!";
+
+            return new Result() { Code = 0, Msg = msg, Data = new { askDatd = askDatd, delegationInfo = delegationInfo } };
         }
 
         /// <summary>