Pārlūkot izejas kodu

优化控制器和仓储逻辑,新增签证流程管理

在 `CRMController.cs` 中调整构造函数参数顺序,优化返回消息处理逻辑。
在 `FinancialController.cs` 中进行代码格式化和逻辑优化。
在 `GroupsController.cs` 中添加私有字段 `transDic`,更新方法逻辑和注释。
在 `MarketCustomerResourcesController.cs` 中确保代码一致性和可读性。
在 `GeneralMethod.cs` 中新增 `EnterExitCostCheckRate` 方法以验证汇率。
在 `VisaFeeInfoRepository.cs` 中新增 `VisaInfoByCountryAndCityId` 方法以获取签证费用标准。
在 `Grp_VisaProcessControl.cs` 和 `Grp_VisaProcessSteps.cs` 中新增签证流程管控和步骤的实体类。
Lyyyi 4 dienas atpakaļ
vecāks
revīzija
0fe41f0c56

+ 14 - 14
OASystem/OASystem.Api/Controllers/CRMController.cs

@@ -33,11 +33,11 @@ namespace OASystem.API.Controllers
         /// <param name="customerCompanyRep"></param>
         /// <param name="geocodeService"></param>
         public CRMController(
-            VisaDeleClientCompanyRepository clientCompanyRepository, 
+            VisaDeleClientCompanyRepository clientCompanyRepository,
             VisaDeleClientRepository clientRepository,
             CustomerCertRepository customerCertRep,
-            CustomerFamilyRepository customerFamilyRep, 
-            CustomerSchoolRepository customerSchoolRep, 
+            CustomerFamilyRepository customerFamilyRep,
+            CustomerSchoolRepository customerSchoolRep,
             CustomerCompanyRepository customerCompanyRep,
             GeocodeService geocodeService
             )
@@ -64,7 +64,7 @@ namespace OASystem.API.Controllers
 
             if (clientCompanyData.Code != 0)
             {
-                return Ok(JsonView(false, clientCompanyData.Msg == null ? "操作失败" : clientCompanyData.Msg));
+                return Ok(JsonView(false, clientCompanyData.Msg ?? "操作失败"));
             }
 
             return Ok(JsonView(clientCompanyData.Data, clientCompanyData.Data.Count));
@@ -127,8 +127,7 @@ namespace OASystem.API.Controllers
             }
             catch (Exception ex)
             {
-                return Ok(JsonView(false, "程序错误!"));
-                throw;
+                return Ok(JsonView(false, $"程序错误!{ex.Message}"));
             }
         }
         /// <summary>
@@ -144,7 +143,7 @@ namespace OASystem.API.Controllers
 
             if (clientData.Code != 0)
             {
-                return Ok(JsonView(false, clientData.Msg == null ? "操作失败" : clientData.Msg));
+                return Ok(JsonView(false, clientData.Msg ?? "操作失败"));
             }
 
             return Ok(JsonView(clientData.Data, clientData.Data.Count));
@@ -329,7 +328,7 @@ namespace OASystem.API.Controllers
         /// <returns></returns>
         [HttpPost]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> ClientCompanyNautica(string province,string city,string area)
+        public async Task<IActionResult> ClientCompanyNautica(string province, string city, string area)
         {
             if (string.IsNullOrEmpty(province) && string.IsNullOrEmpty(city) && string.IsNullOrEmpty(area))
             {
@@ -366,19 +365,20 @@ namespace OASystem.API.Controllers
                 var client = clients.Find(x => x.Address.Equals(item.Address))?.Client ?? "-";
                 if (item.Status.Equals("Success"))
                 {
-                    res.Add(new {
-                        client = client,
+                    res.Add(new
+                    {
+                        client,
                         address = item.Address,
-                        Longitude =item.Longitude,
-                        Latitude = item.Latitude,
+                        item.Longitude,
+                        item.Latitude,
                     });
                 }
                 else
                 {
                     res.Add(new
                     {
-                        client = client,
-                        address = item.Address,
+                        client,
+                        item.Address,
                         Longitude = 0d,
                         Latitude = 0d,
                     });

+ 88 - 83
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -6,8 +6,10 @@ using FluentValidation;
 using NPOI.SS.UserModel;
 using NPOI.XSSF.UserModel;
 using OASystem.API.OAMethodLib;
+using OASystem.API.OAMethodLib.APNs;
 using OASystem.API.OAMethodLib.File;
 using OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice;
+using OASystem.Domain.AesEncryption;
 using OASystem.Domain.Dtos.Financial;
 using OASystem.Domain.Dtos.Groups;
 using OASystem.Domain.Entities.Customer;
@@ -26,8 +28,6 @@ using System.Diagnostics;
 using System.Globalization;
 using System.IO.Compression;
 using static OASystem.API.OAMethodLib.JWTHelper;
-using OASystem.API.OAMethodLib.APNs;
-using OASystem.Domain.AesEncryption;
 
 namespace OASystem.API.Controllers
 {
@@ -57,18 +57,18 @@ namespace OASystem.API.Controllers
         /// 初始化
         /// </summary>
         public FinancialController(
-            IMapper mapper, 
+            IMapper mapper,
             IConfiguration configuration,
             ILogger<FinancialController> logger,
-            DailyFeePaymentRepository daiRep, 
-            SqlSugarClient sqlSugar, 
+            DailyFeePaymentRepository daiRep,
+            SqlSugarClient sqlSugar,
             SetDataTypeRepository setDataTypeRep,
-            TeamRateRepository teamRateRep, 
-            ForeignReceivablesRepository ForForeignReceivablesRep, 
+            TeamRateRepository teamRateRep,
+            ForeignReceivablesRepository ForForeignReceivablesRep,
             ProceedsReceivedRepository proceedsReceivedRep,
-            PaymentRefundAndOtherMoneyRepository paymentRefundAndOtherMoneyRep, 
-            HttpClient httpClient, 
-            DelegationInfoRepository delegationInfoRep, 
+            PaymentRefundAndOtherMoneyRepository paymentRefundAndOtherMoneyRep,
+            HttpClient httpClient,
+            DelegationInfoRepository delegationInfoRep,
             SetDataRepository setDataRep,
             ForeignReceivablesRepository foreignReceivablesRepository)
         {
@@ -102,7 +102,7 @@ namespace OASystem.API.Controllers
             var currUserInfo = JwtHelper.SerializeJwt(HttpContext.Request.Headers.Authorization);
             if (currUserInfo == null) return Ok(JsonView(false, "请传入token!"));
 
-            var result = await _daiRep.GetPagePriceTypeData(dto,currUserInfo.UserId);
+            var result = await _daiRep.GetPagePriceTypeData(dto, currUserInfo.UserId);
 
             if (result == null || result.Code != 0)
             {
@@ -911,7 +911,7 @@ namespace OASystem.API.Controllers
             ));
         }
 
-        private class EnterExitCostCurrency 
+        private class EnterExitCostCurrency
         {
             public string Name { get; set; }
             public string Code { get; set; }
@@ -1049,7 +1049,7 @@ namespace OASystem.API.Controllers
                     var _EnterExitCostCurrencys = new List<EnterExitCostCurrency>();
 
                     if (!string.IsNullOrEmpty(_EnterExitCosts.CurrencyRemark))
-                    { 
+                    {
                         var currency1 = _EnterExitCosts.CurrencyRemark.Split("|");
                         foreach (var item in currency1)
                         {
@@ -1434,7 +1434,7 @@ namespace OASystem.API.Controllers
                             }
                         }
                         //MemoryStream outSteam = new MemoryStream();
-                        string filsPath = AppSettingsHelper.Get("WordBasePath") + $"ForeignReceivables/File/{ClientItem.Key.Replace("\n", "")}_{_DelegationInfo.VisitCountry.Replace("|","、")}.docx";
+                        string filsPath = AppSettingsHelper.Get("WordBasePath") + $"ForeignReceivables/File/{ClientItem.Key.Replace("\n", "")}_{_DelegationInfo.VisitCountry.Replace("|", "、")}.docx";
                         //去水印
                         new Aspose.Words.License().SetLicense(new MemoryStream(Convert.FromBase64String(AsposeHelper.asposeKey)));
                         doc.Save(filsPath);
@@ -1473,30 +1473,30 @@ namespace OASystem.API.Controllers
             }
         }
 
-         /// <summary>
-         /// decimal保留指定位数小数
-         /// </summary>
-         /// <param name="num">原始数量</param>
-         /// <param name="scale">保留小数位数</param>
-         /// <returns>截取指定小数位数后的数量字符串</returns>
-         private static string DecimalToString(decimal num, int scale)
-         {
-             string numToString = num.ToString();
-
-             int index = numToString.IndexOf(".");
-             int length = numToString.Length;
-
-             if (index != -1)
-             {
-                 return string.Format("{0}.{1}",
-                     numToString.Substring(0, index),
-                     numToString.Substring(index + 1, Math.Min(length - index - 1, scale)));
-             }
-             else
-             {
-                 return num.ToString();
-             }
-         }
+        /// <summary>
+        /// decimal保留指定位数小数
+        /// </summary>
+        /// <param name="num">原始数量</param>
+        /// <param name="scale">保留小数位数</param>
+        /// <returns>截取指定小数位数后的数量字符串</returns>
+        private static string DecimalToString(decimal num, int scale)
+        {
+            string numToString = num.ToString();
+
+            int index = numToString.IndexOf(".");
+            int length = numToString.Length;
+
+            if (index != -1)
+            {
+                return string.Format("{0}.{1}",
+                    numToString.Substring(0, index),
+                    numToString.Substring(index + 1, Math.Min(length - index - 1, scale)));
+            }
+            else
+            {
+                return num.ToString();
+            }
+        }
 
         /// <summary>
         /// 保留小数位数
@@ -1634,7 +1634,7 @@ namespace OASystem.API.Controllers
                 var Fin_ProceedsReceived_SumPrice = _sqlSugar
                     .Queryable<Fin_ProceedsReceived>()
                     .Where(x => x.Diid == dto.DiId && x.IsDel == 0)
-                    .Sum(x=>x.Price);
+                    .Sum(x => x.Price);
 
                 //收款账单金额 (应收)
                 var Fin_ForeignReceivables_SumPrice = _sqlSugar
@@ -1744,7 +1744,8 @@ namespace OASystem.API.Controllers
             //已收款项信息验证
             var proceedInfos = await _sqlSugar.Queryable<Fin_ProceedsReceived>()
                 .Where(x => x.Diid == dto.GroupId && x.IsDel == 0)
-                .Select(x => new GroupAccFee‌ExcelView() {
+                .Select(x => new GroupAccFee‌ExcelView()
+                {
                     OrgName‌ = x.Client,
                     VisitorNum‌ = 1, //假设每条记录代表一个访客
                     ActualAR = 0.00M,
@@ -1764,7 +1765,7 @@ namespace OASystem.API.Controllers
             var hotelCostInfos = await _sqlSugar.Queryable<Grp_DayAndCost>()
                .LeftJoin<Sys_SetData>((x, y) => x.Currency == y.Id)
                .Where((x, y) => x.DiId == dto.GroupId && x.Type == 1 && x.IsDel == 0)
-               .Select((x, y) => new { x.Place, x.Cost, x.Currency, y.Name,CurrencyName = y.Remark, Rate = x.SubTotal / x.Cost, x.SubTotal })
+               .Select((x, y) => new { x.Place, x.Cost, x.Currency, y.Name, CurrencyName = y.Remark, Rate = x.SubTotal / x.Cost, x.SubTotal })
                .ToListAsync();
 
             decimal visaFee = costInfo?.Visa ?? 0.00M, //签证费
@@ -1799,7 +1800,8 @@ namespace OASystem.API.Controllers
             if (costInfosNew.Count > proceedInfos.Count) proceedInfos.AddRange(costInfosNew.Skip(proceedInfos.Count));
 
             int index = 1;
-            proceedInfos.ForEach( x=> {
+            proceedInfos.ForEach(x =>
+            {
                 x.Index = index;
                 index++;
             });
@@ -1829,7 +1831,7 @@ namespace OASystem.API.Controllers
             designer.Workbook.Save(AppSettingsHelper.Get("ExcelBasePath") + fileName);
             url = AppSettingsHelper.Get("ExcelBaseUrl") + AppSettingsHelper.Get("ExcelFtpPath") + fileName;
             #endregion
-            return Ok(JsonView(true,"操作成功!",url));
+            return Ok(JsonView(true, "操作成功!", url));
         }
 
         #endregion
@@ -2078,10 +2080,11 @@ namespace OASystem.API.Controllers
             var list_rst = await _sqlSugar.Queryable<Grp_DelegationInfo>()
                 .Where(x => x.IsDel == 0)
                 .WhereIF(startTimeFlag && endTimeFlag, x => x.VisitDate >= begintime && x.VisitDate <= endtime)
-                .WhereIF(!string.IsNullOrEmpty(groupName), x=> x.TeamName.Contains(groupName))
+                .WhereIF(!string.IsNullOrEmpty(groupName), x => x.TeamName.Contains(groupName))
                 .WhereIF(marketStaffFlag, x => x.JietuanOperator == currUserId)
                 .OrderBy(x => x.VisitDate)
-                .Select(x => new PostSyntheticalReceivableByDateRangeView() { 
+                .Select(x => new PostSyntheticalReceivableByDateRangeView()
+                {
                     diid = x.Id,
                     teamName = x.TeamName,
                     clientUnit = x.ClientUnit,
@@ -2226,7 +2229,7 @@ namespace OASystem.API.Controllers
                     #endregion
                 }
 
-               
+
                 result.total_fr = sumAll_fr.ToString("#0.00");
                 result.total_pr = sumAll_pr.ToString("#0.00");
                 result.total_balance = sumAll_balance.ToString("#0.00");
@@ -2240,10 +2243,11 @@ namespace OASystem.API.Controllers
                 {
                     //----------------------------
                     var list_Ex = new List<Excel_SyntheticalReceivableByDateRange>();
-                    var designer = new WorkbookDesigner() {
+                    var designer = new WorkbookDesigner()
+                    {
                         Workbook = new Workbook(AppSettingsHelper.Get("ExcelBasePath") + "Template/应收款项模板 - 副本.xls")
                     };
-                    
+
 
                     int excNo = 1;
                     foreach (var item in list_rst)
@@ -2561,7 +2565,7 @@ namespace OASystem.API.Controllers
                                 if (success)
                                 {
                                     SimplClientInfo tempInfo = arr.FirstOrDefault(s => s.Id == tempId);
-                                    
+
                                     if (tempInfo != null)
                                     {
                                         EncryptionProcessor.DecryptProperties(tempInfo);
@@ -3305,7 +3309,7 @@ namespace OASystem.API.Controllers
                 {
                     Id = it.Id,
                     ConpamyName = it.CompanyName
-                
+
                 }).ToList();
 
             var conpanyIds = conpanyDatas.Select(x => x.Id).ToList();
@@ -3592,7 +3596,7 @@ namespace OASystem.API.Controllers
                 DiId = dto.diId,
             });
 
-        _daiRep.CommitTran();
+            _daiRep.CommitTran();
             return Ok(JsonView(true, "操作成功"));
         }
 
@@ -3921,7 +3925,7 @@ namespace OASystem.API.Controllers
 
                 var overspendAuditUser = AppSettingsHelper.Get<OverspendAuditUserView>("OverspendAuditUser");
 
-                var result = new 
+                var result = new
                 {
                     CurrPageIndex = dto.PageIndex,
                     CurrPageSize = dto.PageSize,
@@ -3929,7 +3933,7 @@ namespace OASystem.API.Controllers
                     DataList = dataList,
                     overspendAuditUser = new
                     {
-                        jinliExpand = overspendAuditUser.Find(x=>x.Job == "opJinLi").Users.Select(x=>x.Id),
+                        jinliExpand = overspendAuditUser.Find(x => x.Job == "opJinLi").Users.Select(x => x.Id),
                         zhuguanExpand = overspendAuditUser.Find(x => x.Job == "opZhuGuan").Users.Select(x => x.Id),
                         syzhuguanExpand = overspendAuditUser.Find(x => x.Job == "syZhuGuan").Users.Select(x => x.Id),
                     }
@@ -4312,7 +4316,8 @@ Group by PriceType ", dto.diId);
                     f.SYsupervisorConfirm,
                 })
                 .ToList()
-                .Where(x=> {
+                .Where(x =>
+                {
                     var count = 0;
                     var stringArr = new string[] { "SYsupervisorConfirm", "SupervisorConfirm", "ManagerConfirm" };
                     var max = 0;
@@ -4343,7 +4348,7 @@ Group by PriceType ", dto.diId);
                     {
                         decimal cost = x.FoodCost;
                         //decimal.TryParse(x.FoodCost, out decimal cost);
-                         cost /= 2;
+                        cost /= 2;
 
                         decimal oldPrice = costPirce;
                         costPirce *= x.Rate; //转换币种
@@ -4780,7 +4785,7 @@ Group by PriceType ", dto.diId);
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostCreditCardBillInit()
         {
-            var data = await _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0 && x.STid == 15).Select(x => new { x.Id,x.Name}).ToListAsync();
+            var data = await _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0 && x.STid == 15).Select(x => new { x.Id, x.Name }).ToListAsync();
 
             return Ok(JsonView(true, "操作成功!", data));
         }
@@ -4795,7 +4800,7 @@ Group by PriceType ", dto.diId);
         /// <returns></returns>
         [HttpPost]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> PostCreditCardBill(IFormFile file, int cardType,  string beginDt,  string endDt)
+        public async Task<IActionResult> PostCreditCardBill(IFormFile file, int cardType, string beginDt, string endDt)
         {
             if (file == null || file.Length < 1)
             {
@@ -4818,7 +4823,7 @@ Group by PriceType ", dto.diId);
 
             //读取ExcelFile
             DataTable dt = ExcelFileToDataTable(file);
-            
+
             if (dt == null)
             {
                 return Ok(JsonView(false, $"您上传的Excel工作表没有内容,请检查!!!"));
@@ -5083,7 +5088,7 @@ Group by PriceType ", dto.diId);
 
                     string fileName1 = $"信用卡账单(欧元卡){DateTime.Now:yyyy.MM.dd}.xls";
                     var pairs = new Dictionary<string, object>();
-                   var datas = new List<DataTable>
+                    var datas = new List<DataTable>
                    {
                        dt
                    };
@@ -5149,7 +5154,7 @@ Group by PriceType ", dto.diId);
                                     ConsumptionDate = item.FirstOrDefault()?.ConsumptionDate ?? ""
                                 };
 
-                                
+
                                 List_ccp.Add(hotelInfo);
                             }
                         }
@@ -5351,7 +5356,7 @@ Group by PriceType ", dto.diId);
 
                     string fileName1 = $"信用卡账单(中信卡){DateTime.Now:yyyy.MM.dd}.xls";
                     var pairs = new Dictionary<string, object>();
-                        var datas = new List<DataTable>
+                    var datas = new List<DataTable>
                         {
                             dt
                         };
@@ -5452,7 +5457,7 @@ Group by PriceType ", dto.diId);
         /// <param name="pathName">带路径的Excel文件名</param>
         /// <param name="sheetName">工作表名</param>
         /// <returns></returns>
-        public static DataTable ExcelToDataTable(string pathName, string sheetName="")
+        public static DataTable ExcelToDataTable(string pathName, string sheetName = "")
         {
             var tbContainer = new DataTable();
             string strConn = string.Empty;
@@ -5545,7 +5550,7 @@ Group by PriceType ", dto.diId);
                                                 JoinType.Left, a.Id == x.DIId,
                                                 JoinType.Left, b.CTable == 85 && b.CId == x.Id)
                                             )
-                                        .Where((x, a, b) => x.IsDel == 0 && x.CreateUserId == userId && a.IsDel == 0 && a.VisitDate >= StartDateTime 
+                                        .Where((x, a, b) => x.IsDel == 0 && x.CreateUserId == userId && a.IsDel == 0 && a.VisitDate >= StartDateTime
                                                                          && a.VisitDate <= EndDateTime && b.IsDel == 0 && auditState.Contains(b.IsAuditGM)) // 取消团组确认状态 && a.IsSure == 1
                                         .Select((x, a, b) => new
                                         {
@@ -5683,23 +5688,23 @@ Group by PriceType ", dto.diId);
                                           JoinType.Left, x.DiId == a.Id,
                                           JoinType.Left, b.CTable == 76 && b.CId == x.Id))
                                          .Where((x, a, b) => x.IsDel == 0 && x.CreateUserId == userId && a.VisitDate >= StartDateTime
-                                              && a.VisitDate <= EndDateTime && a.IsDel == 0 && b.IsDel == 0 && x.CardPrice != 0  && auditState.Contains(b.IsAuditGM) && x.CheckType == 1001)
+                                              && a.VisitDate <= EndDateTime && a.IsDel == 0 && b.IsDel == 0 && x.CardPrice != 0 && auditState.Contains(b.IsAuditGM) && x.CheckType == 1001)
                                          .Select((x, a, b) => new  // && a.IsSure == 1
-                                        {
-                                            a.Id,
-                                            a.TeamName,
-                                            a.VisitDate,
-                                            a.TeamLevSId,
-                                            a.VisitPNumber,
-                                            x.SingleRoomCount,
-                                            x.SuiteRoomCount,
-                                            x.DoubleRoomCount,
-                                            x.OtherRoomCount,
-                                            x.CheckInDate,
-                                            x.CheckOutDate,
-                                            x.HotelName,
-                                            a.IsSure
-                                        })
+                                         {
+                                             a.Id,
+                                             a.TeamName,
+                                             a.VisitDate,
+                                             a.TeamLevSId,
+                                             a.VisitPNumber,
+                                             x.SingleRoomCount,
+                                             x.SuiteRoomCount,
+                                             x.DoubleRoomCount,
+                                             x.OtherRoomCount,
+                                             x.CheckInDate,
+                                             x.CheckOutDate,
+                                             x.HotelName,
+                                             a.IsSure
+                                         })
                                          .ToList();
 
                 var groupByid = listHotel.GroupBy(x => x.Id);
@@ -5756,7 +5761,7 @@ Group by PriceType ", dto.diId);
             else if (OP.Contains(userId))
             {
                 var OPList = _sqlSugar.Queryable<Grp_DelegationInfo>()
-                                      .Where((a) => a.IsDel == 0 && a.VisitDate >= StartDateTime && a.VisitDate <= EndDateTime )
+                                      .Where((a) => a.IsDel == 0 && a.VisitDate >= StartDateTime && a.VisitDate <= EndDateTime)
                                       .ToList(); // && a.IsSure == 1
 
                 var LvArr = _sqlSugar.Queryable<Sys_SetData>().Where(x => x.STid == 70 && x.IsDel == 0).ToList();
@@ -5867,7 +5872,7 @@ Group by PriceType ", dto.diId);
                             }
 
                         }
-                        else if(item.Type == 2 || item.Type == 1084)
+                        else if (item.Type == 2 || item.Type == 1084)
                         {
                             if (item.IsPay == 1) //付费公务
                             {
@@ -5882,7 +5887,7 @@ Group by PriceType ", dto.diId);
                         }
                     }
 
-                    temp = "本团人数" + groupinfo.VisitPNumber + ",该人员" + user.CnName + "共操作公务数" + group.Count() + $",付费公务提成金额为{payingOfficial}" + $",非付费公务提成金额为{notPayingOfficial},"+ user.CnName + "提成共" + money + "元"; ;
+                    temp = "本团人数" + groupinfo.VisitPNumber + ",该人员" + user.CnName + "共操作公务数" + group.Count() + $",付费公务提成金额为{payingOfficial}" + $",非付费公务提成金额为{notPayingOfficial}," + user.CnName + "提成共" + money + "元"; ;
 
                     resultArr.Add(new ComputeRoyaltiesView
                     {
@@ -5906,7 +5911,7 @@ Group by PriceType ", dto.diId);
                 var whereExpression = Expressionable.Create<Grp_VisaInfo, Grp_DelegationInfo, Grp_CreditCardPayment>()
                     .And(
                         (x, a, b) => x.IsDel == 0 && x.CreateUserId == userId && (b.IsAuditGM == 1 || b.IsAuditGM == 3)
-                                                  && a.IsDel == 0 && a.VisitDate >= StartDateTime && a.VisitDate <= EndDateTime 
+                                                  && a.IsDel == 0 && a.VisitDate >= StartDateTime && a.VisitDate <= EndDateTime
                                                   && b.IsDel == 0 && x.IsThird == 0 && x.PassengerType == 974
                                                   && auditState.Contains(b.IsAuditGM) // && a.IsSure == 1
                     );

+ 36 - 10
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -3,9 +3,7 @@ using Aspose.Words;
 using Aspose.Words.Drawing;
 using Aspose.Words.Tables;
 using DiffMatchPatch;
-using Humanizer;
 using Microsoft.AspNetCore.SignalR;
-using Npgsql.Replication.PgOutput.Messages;
 using NPOI.SS.UserModel;
 using NPOI.SS.Util;
 using NPOI.XSSF.UserModel;
@@ -4880,7 +4878,7 @@ FROM
         }
 
 
-        Dictionary<string, string> transDic = new Dictionary<string, string>();
+        private Dictionary<string, string> transDic = new Dictionary<string, string>();
 
         /// <summary>
         /// 行程单导出
@@ -5539,11 +5537,9 @@ FROM
             #endregion
 
             return Ok(JsonView(true, groupData.Msg, groupData.Data));
-
         }
 
         /// <summary>
-        /// 
         /// 团组增减款项操作 删除
         /// </summary>
         /// <param name="dto"></param>
@@ -7427,6 +7423,15 @@ FROM
                 //汇率信息记录
                 await GeneralMethod.RateRecordSave(dto.UserId, sign, "出入境费用");
 
+                //汇率验证、反推 
+                (bool isSendMsg,string msgContent) = await GeneralMethod.EnterExitCostCheckRate(dto.DiId);
+                if (isSendMsg)
+                {
+                    //消息推送
+                    await AppNoticeLibrary.SendUserMsg_GroupShare_ToFin(dto.DiId,dto.UserId,msgContent);
+                }
+
+
                 return Ok(JsonView(true, data.Msg, data.Data));
             }
             catch (Exception ex)
@@ -11657,6 +11662,8 @@ FROM
 
                 //if (provinceId < 1) provinceId = 122;
                 var info = new Grp_EnterExitCost() { DiId = groupId, CurrencyRemark = currencyStr, CreateUserId = dto.CurrUserId };
+                info.LastUpdateUserId = dto.CurrUserId;
+                info.LastUpdateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
 
                 var add = await _sqlSugar.Insertable(info).ExecuteCommandAsync();
 
@@ -11669,7 +11676,12 @@ FROM
                 //(bool isEdit, string msg) = await _enterExitCostRep.MobilePermissionsValidationAsync(dto.DiId, dto.CurrUserId, 2);
                 //if (!isEdit) return Ok(JsonView(false, msg));
 
-                var upd = await _sqlSugar.Updateable<Grp_EnterExitCost>().SetColumns(x => new Grp_EnterExitCost() { CurrencyRemark = currencyStr }).Where(x => x.Id == dto.Id).ExecuteCommandAsync();
+                var upd = await _sqlSugar.Updateable<Grp_EnterExitCost>().SetColumns(x => new Grp_EnterExitCost()
+                {
+                    CurrencyRemark = currencyStr,
+                    LastUpdateUserId = dto.CurrUserId,
+                    LastUpdateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+                }).Where(x => x.Id == dto.Id).ExecuteCommandAsync();
                 if (upd < 1) return Ok(JsonView(false));
             }
 
@@ -11779,6 +11791,8 @@ FROM
             //if (dto.ProvinceId < 1) dto.ProvinceId = 122;
 
             var checkboxInfo = _mapper.Map<Grp_EnterExitCost>(dto);
+            checkboxInfo.LastUpdateUserId = dto.CurrUserId;
+            checkboxInfo.LastUpdateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
 
             int id = dto.Id;
             if (id <= 0) //add 
@@ -11839,7 +11853,9 @@ FROM
                 Id = id,
                 //ProvinceId = provinceId,
                 DiId = diId,
-                CreateUserId = currUserId
+                CreateUserId = currUserId,
+                LastUpdateUserId = dto.CurrUserId,
+                LastUpdateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
             };
 
             if (itemTypeId == 3) checkboxInfo.ChoiceThree = isSelected;
@@ -11864,6 +11880,8 @@ FROM
                 //if (!isEdit) return Ok(JsonView(false, msg));
 
                 var upd = await _sqlSugar.Updateable<Grp_EnterExitCost>()
+                    .SetColumns(it => it.LastUpdateUserId == dto.CurrUserId)
+                    .SetColumns(it => it.LastUpdateTime == DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
                     .SetColumnsIF(itemTypeId == 3, it => it.ChoiceThree == isSelected)
                     .SetColumnsIF(itemTypeId == 4, it => it.ChoiceFour == isSelected)
                     .SetColumnsIF(itemTypeId == 5, it => it.ChoiceFive == isSelected)
@@ -11893,6 +11911,8 @@ FROM
 
             var info = _mapper.Map<Grp_EnterExitCost>(dto);
             info.FirstItemRemark = dto.FirstItemRemark;
+            info.LastUpdateUserId = dto.CurrUserId;
+            info.LastUpdateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
             info.InsidePay = dto.Visa + dto.Service + dto.Safe + dto.Ticket + dto.HeSuan + dto.YiMiao;
 
             int id = dto.Id;
@@ -11923,7 +11943,9 @@ FROM
                         x.Ticket,
                         x.HeSuan,
                         x.YiMiao,
-                        x.FirstItemRemark
+                        x.FirstItemRemark,
+                        x.LastUpdateUserId,
+                        x.LastUpdateTime
                     })
                     .Where(x => x.Id == id)
                     .ExecuteCommandAsync();
@@ -11964,10 +11986,12 @@ FROM
             info.SumJJC = dto.ChoiceTwoJJ;
             info.SumGWC = dto.ChoiceTwoGW;
             info.SumTDC = dto.ChoiceTwoTD;
+            info.LastUpdateUserId = dto.CurrUserId;
+            info.LastUpdateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
 
             int id = dto.Id;
             decimal jjcItemTotal = 0.00M, gwcItemTotal = 0.00M, tdcItemTotal = 0.00M;
-            if (id <= 0) //add 
+            if (id <= 0) //add i
             {
                 info.CreateUserId = dto.CurrUserId;
                 info.CurrencyRemark = JsonConvert.SerializeObject(await EnterExitCostMobileGetCurrencyInit());
@@ -11995,7 +12019,9 @@ FROM
                         x.AirGW,
                         x.AirTD,
                         x.CityTranffic,
-                        x.TwoItemRemark
+                        x.TwoItemRemark,
+                        x.LastUpdateTime,
+                        x.LastUpdateUserId
                     })
                     .Where(x => x.Id == id)
                     .ExecuteCommandAsync();

+ 62 - 66
OASystem/OASystem.Api/Controllers/MarketCustomerResourcesController.cs

@@ -1,19 +1,14 @@
 using Aspose.Cells;
-using Microsoft.AspNetCore.Mvc.RazorPages;
+using EyeSoft.Extensions;
 using OASystem.API.OAMethodLib;
 using OASystem.Domain.AesEncryption;
+using OASystem.Domain.Attributes;
 using OASystem.Domain.Dtos.CRM;
 using OASystem.Domain.Entities.Customer;
-using OASystem.Domain.ViewModels.CRM;
 using OASystem.Infrastructure.Repositories.CRM;
+using OASystem.RedisRepository;
 using System.Collections;
 using System.Data;
-using System.Diagnostics;
-using System.Linq;
-using OASystem.Domain.Attributes;
-using EyeSoft.Extensions;
-using OASystem.RedisRepository;
-using System.Linq.Expressions;
 
 namespace OASystem.API.Controllers
 {
@@ -345,13 +340,13 @@ namespace OASystem.API.Controllers
             {
                 407,408,409,410,449,451,452,453,567,754,1297,1304
             });
-            keyValuePairs.Add(421, new List<int>() { 424, 425, 426, 427, 428, 429, 754,1298, 1305,1307,1306 }); // 贵州
-            keyValuePairs.Add(422, new List<int>() { 415, 416, 754,1317,1316,1315, 455,1321, 1320, 1319, 1318 }); // 西藏
+            keyValuePairs.Add(421, new List<int>() { 424, 425, 426, 427, 428, 429, 754, 1298, 1305, 1307, 1306 }); // 贵州
+            keyValuePairs.Add(422, new List<int>() { 415, 416, 754, 1317, 1316, 1315, 455, 1321, 1320, 1319, 1318 }); // 西藏
             keyValuePairs.Add(423, new List<int>() { 417, 418, 454, 456, 754, 1313, 1314 }); // 重庆
-            keyValuePairs.Add(578, new List<int>() { 581, 582, 583, 754,1299,1300 }); // 青海
-            keyValuePairs.Add(605, new List<int>() { 588, 589, 590, 591, 592, 593, 754,1301,1310,1309,1308 }); // 陕西
-            keyValuePairs.Add(606, new List<int>() { 597, 598, 599, 600, 601, 602, 603, 604, 754,1324,1323,1322 }); // 宁夏
-            keyValuePairs.Add(625, new List<int>() { 617, 618, 619, 620, 621, 622, 622, 623, 624, 754,1302,1312,1311 }); // 甘肃
+            keyValuePairs.Add(578, new List<int>() { 581, 582, 583, 754, 1299, 1300 }); // 青海
+            keyValuePairs.Add(605, new List<int>() { 588, 589, 590, 591, 592, 593, 754, 1301, 1310, 1309, 1308 }); // 陕西
+            keyValuePairs.Add(606, new List<int>() { 597, 598, 599, 600, 601, 602, 603, 604, 754, 1324, 1323, 1322 }); // 宁夏
+            keyValuePairs.Add(625, new List<int>() { 617, 618, 619, 620, 621, 622, 622, 623, 624, 754, 1302, 1312, 1311 }); // 甘肃
             keyValuePairs.Add(634, new List<int>() { 630, 631, 632, 633, 754 }); // 新疆
 
             return keyValuePairs;
@@ -399,7 +394,7 @@ namespace OASystem.API.Controllers
             // 陕西
             keyValuePairs.Add(585, new List<int>() { 588, 589, 590, 591, 1301 }); // 陕西省级
             keyValuePairs.Add(586, new List<int>() { 589 }); // 陕西地市州
-            keyValuePairs.Add(587, new List<int>() { 592, 593, 1309, 1310 , 1308 }); // 西安市级
+            keyValuePairs.Add(587, new List<int>() { 592, 593, 1309, 1310, 1308 }); // 西安市级
             //keyValuePairs.Add(1308, new List<int>() { /* Add relevant IDs if available */ }); // 西安区市县 - Placeholder
 
 
@@ -418,9 +413,9 @@ namespace OASystem.API.Controllers
 
 
             // 新疆
-            keyValuePairs.Add(627, new List<int>() { 630, 631, 632 , 1327,1326 ,1325 }); // 新疆自治区级
+            keyValuePairs.Add(627, new List<int>() { 630, 631, 632, 1327, 1326, 1325 }); // 新疆自治区级
             keyValuePairs.Add(628, new List<int>() { 1326 }); // 新疆地市州 - No direct match
-            keyValuePairs.Add(629, new List<int>() { 633,1331,1330,1329 ,1328 }); // 乌鲁木齐市级
+            keyValuePairs.Add(629, new List<int>() { 633, 1331, 1330, 1329, 1328 }); // 乌鲁木齐市级
 
             // 中央直属企业 (Special case)
             keyValuePairs.Add(351, new List<int>() { 754 }); //  Using "未分级" for 中央直属企业
@@ -473,7 +468,7 @@ namespace OASystem.API.Controllers
         [HttpPost]
         public IActionResult QueryClientType(QueryClientTypeDto Dto)
         {
-            var jw = JsonView(true,"获取成功!");
+            var jw = JsonView(true, "获取成功!");
 
             var dic_lv = MCRLvSetting();
             var keyValuePairs = MCRSetting();
@@ -496,7 +491,7 @@ namespace OASystem.API.Controllers
 
             arr.AddRange(_sqlSugar.Queryable<Sys_SetData>()
                        .Where(u => ids.Contains(u.Id) && u.IsDel == 0)
-                       .Select(x => new { x.Id, x.Name , x.Remark })
+                       .Select(x => new { x.Id, x.Name, x.Remark })
                        .ToList());
 
             if (arr.Count == 0)
@@ -508,7 +503,7 @@ namespace OASystem.API.Controllers
 
             // 创建比较器实例
             IComparer remakeComparer = new RemakeComparer();
-            
+
             // 使用ArrayList.Sort方法和自定义比较器对arr进行排序
             arr.Sort(remakeComparer);
 
@@ -523,7 +518,7 @@ namespace OASystem.API.Controllers
             {
                 lvArr.AddRange(_sqlSugar.Queryable<Sys_SetData>()
                         .Where(u => u.STid == 33 && u.IsDel == 0)
-                        .Select(x => new { x.Id, x.Name}).ToList());
+                        .Select(x => new { x.Id, x.Name }).ToList());
             }
 
             jw.Data = new
@@ -531,7 +526,7 @@ namespace OASystem.API.Controllers
                 TypeArr = arr,
                 LvArr = lvArr,
             };
-            
+
             return Ok(jw);
         }
 
@@ -587,7 +582,7 @@ namespace OASystem.API.Controllers
             #region 参数验证
             if (dto.OperationUserId < 0) return Ok(JsonView(false, "请传入有效的OperationUserId参数!"));
 
-            if (dto.PortType < 0)  return Ok(JsonView(false, "请传入有效的PortType参数!"));
+            if (dto.PortType < 0) return Ok(JsonView(false, "请传入有效的PortType参数!"));
             if (dto.PageId < 0) return Ok(JsonView(false, "请传入有效的PageId参数!"));
             #endregion
 
@@ -597,7 +592,7 @@ namespace OASystem.API.Controllers
             if (pageFunAuthView.FilesDownloadAuth == 0) return Ok(JsonView(false, "您没有文件下载权!"));
             #endregion
 
-             var dt = await _clientDataRepository.NewClientDataExcelDownload(dto);
+            var dt = await _clientDataRepository.NewClientDataExcelDownload(dto);
             if (dt != null)
             {
                 string tempPath = (AppSettingsHelper.Get("ExcelBasePath") + "Template/公司客户资料导出模板.xlsx");
@@ -718,7 +713,8 @@ namespace OASystem.API.Controllers
                 }
             }
 
-            var data = new {
+            var data = new
+            {
                 operations = operation1,
                 userDatas = userDatas
             };
@@ -833,7 +829,7 @@ namespace OASystem.API.Controllers
             var updateCount = _sqlSugar.Updateable<Crm_NewClientData>().Where(x => updateid.Contains(x.Id))
                 .SetColumns(x => new Crm_NewClientData { Category = 456 }).ExecuteCommand();
 
-            return Ok( new
+            return Ok(new
             {
                 notCount = count,
                 updateCount = updateCount
@@ -879,11 +875,11 @@ namespace OASystem.API.Controllers
         public IActionResult ExportData()
         {
 
-           var soure =   _sqlSugar.Queryable<Crm_NewClientData>()
-                .InnerJoin<Crm_ClientDataAndUser>((a, b) => b.NewClientDataId == a.Id && b.IsDel == 0)
-                .Where((a, b) => a.IsDel == 0 && b.usersId == 95)
-                .Select((a, b) => a)
-                .ToList();
+            var soure = _sqlSugar.Queryable<Crm_NewClientData>()
+                 .InnerJoin<Crm_ClientDataAndUser>((a, b) => b.NewClientDataId == a.Id && b.IsDel == 0)
+                 .Where((a, b) => a.IsDel == 0 && b.usersId == 95)
+                 .Select((a, b) => a)
+                 .ToList();
 
             foreach (var item in soure)
             {
@@ -935,21 +931,21 @@ namespace OASystem.API.Controllers
         {
             var user_Client = _sqlSugar.Queryable<Crm_ClientDataAndUser>()
                       .Where(x => x.usersId == 302 && x.IsDel == 0)
-                      .Select(x=>new
+                      .Select(x => new
                       {
                           x.Id,
                           x.NewClientDataId
                       })
                       .ToList();
-            var ids = user_Client.Select(x=>x.NewClientDataId).ToList();
+            var ids = user_Client.Select(x => x.NewClientDataId).ToList();
 
             string setDataSql = $"select * from Sys_SetData where STid = 33 and isdel = 0 and (Name like '%重庆%')  ";
 
-            var setDataids =  _sqlSugar.SqlQueryable<Sys_SetData>(setDataSql).Select(x => x.Id).ToList();
+            var setDataids = _sqlSugar.SqlQueryable<Sys_SetData>(setDataSql).Select(x => x.Id).ToList();
 
             var clients = _sqlSugar.Queryable<Crm_NewClientData>().Where(x => ids.Contains(x.Id) && setDataids.Contains(x.Lvlid) && x.IsDel == 0).ToList();
 
-            var clients_ids = clients.Select(x=>x.Id).ToList();
+            var clients_ids = clients.Select(x => x.Id).ToList();
 
             int updateCount = 0;
 
@@ -958,13 +954,13 @@ namespace OASystem.API.Controllers
             if (clients.Count == 223)
             {
 
-               updateCount =  _sqlSugar.Updateable<Crm_ClientDataAndUser>()
-                         .Where(x => x.usersId == 302 && clients_ids.Contains(x.NewClientDataId) && x.IsDel == 0)
-                         .SetColumns( x => new Crm_ClientDataAndUser
-                         {
-                             usersId = 21
-                         })
-                         .ExecuteCommand();
+                updateCount = _sqlSugar.Updateable<Crm_ClientDataAndUser>()
+                          .Where(x => x.usersId == 302 && clients_ids.Contains(x.NewClientDataId) && x.IsDel == 0)
+                          .SetColumns(x => new Crm_ClientDataAndUser
+                          {
+                              usersId = 21
+                          })
+                          .ExecuteCommand();
             }
 
             if (updateCount == clients.Count)
@@ -977,7 +973,7 @@ namespace OASystem.API.Controllers
             }
 
 
-            return Ok( new
+            return Ok(new
             {
                 count = clients.Count,
                 updateCount,
@@ -993,7 +989,7 @@ namespace OASystem.API.Controllers
                 EncryptionProcessor.DecryptProperties(item);
             }
 
-            list_DB = list_DB.Where(x => !string.IsNullOrWhiteSpace(x.Client) &&(x.Client.Contains("学院") || x.Client.Contains("大学"))).ToList();
+            list_DB = list_DB.Where(x => !string.IsNullOrWhiteSpace(x.Client) && (x.Client.Contains("学院") || x.Client.Contains("大学"))).ToList();
 
             var arr = list_DB.Select(x => x.Id).ToList().Select(x => new Crm_ClientDataAndUser
             {
@@ -1017,7 +1013,7 @@ namespace OASystem.API.Controllers
 		                      and (Name like '%云%南%' or Name like '%昆%明%')
 	                      )";
 
-            var list =  _sqlSugar.SqlQueryable<Crm_NewClientData>(sql).Select(x => x.Id).ToList();
+            var list = _sqlSugar.SqlQueryable<Crm_NewClientData>(sql).Select(x => x.Id).ToList();
 
             var toUserList = new List<Crm_ClientDataAndUser>();
 
@@ -1036,7 +1032,7 @@ namespace OASystem.API.Controllers
             var updateCount = 0;
             if (toUserList.Count == 327)
             {
-                updateCount =  _sqlSugar.Insertable(toUserList).ExecuteCommand();
+                updateCount = _sqlSugar.Insertable(toUserList).ExecuteCommand();
             }
 
             return Ok(new
@@ -1058,7 +1054,7 @@ namespace OASystem.API.Controllers
                 item.usersId = dto.ToUserId;
             }
 
-            var count =  _sqlSugar.Insertable<Crm_ClientDataAndUser>(list).ExecuteCommand();
+            var count = _sqlSugar.Insertable<Crm_ClientDataAndUser>(list).ExecuteCommand();
 
             return Ok(new
             {
@@ -1096,7 +1092,7 @@ namespace OASystem.API.Controllers
 
             var view = new List<dynamic>();
 
-            if (datas.Any()) 
+            if (datas.Any())
             {
                 datas = datas.OrderByDescending(x => x.CreateTime).ToList();
                 foreach (var item in datas)
@@ -1124,18 +1120,18 @@ namespace OASystem.API.Controllers
         {
             var jw = JsonView(true);
             var expression = Expressionable.Create<Crm_NewClientData>()
-                                           .And(x=>x.IsDel == 0);
+                                           .And(x => x.IsDel == 0);
             this.keyName += "_" + dto.UserId;
             //获取个人的客户
             if (dto.UserId != 21)
             {
-                var userList = _clientDataRepository.GetNewExistClient(dto.UserId).Select(x=>x.Id);
+                var userList = _clientDataRepository.GetNewExistClient(dto.UserId).Select(x => x.Id);
                 var newClientData = _sqlSugar.Queryable<Crm_ClientDataAndUser>()
                          .Where(x => x.IsDel == 0 && userList.Contains(x.usersId))
-                         .Select(x=>x.NewClientDataId)
+                         .Select(x => x.NewClientDataId)
                          .Distinct()
                          .ToList();
-                expression = expression.And(x=> newClientData.Contains(x.Id));
+                expression = expression.And(x => newClientData.Contains(x.Id));
             }
 
             var exists = false;
@@ -1158,12 +1154,12 @@ namespace OASystem.API.Controllers
                 var matches = newClitnData
                         .Where(fullString => !string.IsNullOrWhiteSpace(fullString.Client) &&
                              keywordArray.All(keyword => fullString.Client.Contains(keyword)))
-                        .Select(x=> new
+                        .Select(x => new
                         {
                             x.Client,
                             x.Id
                         })
-                        .DistinctBy(x=>x.Client)
+                        .DistinctBy(x => x.Client)
                         .ToList();
 
                 if (matches.Any())
@@ -1211,7 +1207,7 @@ namespace OASystem.API.Controllers
                 jw.Data = new List<int>(1);
             }
 
-            return  Ok(jw);
+            return Ok(jw);
         }
 
 
@@ -1228,7 +1224,7 @@ namespace OASystem.API.Controllers
             var count = 0;
 
             //var notClentUser = new List<int>() { 21, 95  , 327 };
-            var notClentUser = new List<int>() { 213,327 };
+            var notClentUser = new List<int>() { 213, 327 };
 
             var insertList = new List<Crm_ClientDataAndUser>();
 
@@ -1266,9 +1262,9 @@ namespace OASystem.API.Controllers
                         {
                             //清除关联表数据
                             _sqlSugar.Updateable<Crm_ClientDataAndUser>()
-                                .Where(x => !notClentUser.Contains(x.usersId) 
+                                .Where(x => !notClentUser.Contains(x.usersId)
                                 && x.NewClientDataId == clientData.Id && x.IsDel == 0)
-                                .SetColumns(x=> new Crm_ClientDataAndUser
+                                .SetColumns(x => new Crm_ClientDataAndUser
                                 {
                                     IsDel = 1,
                                     DeleteTime = DateTime.Now.ToString(),
@@ -1304,7 +1300,7 @@ namespace OASystem.API.Controllers
         /// <param name="file"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult InsertDataExcel1(IFormFile file )
+        public IActionResult InsertDataExcel1(IFormFile file)
         {
 
             // 检查文件是否为空
@@ -1323,7 +1319,7 @@ namespace OASystem.API.Controllers
             var filePath = Path.Combine(uploadsFolder, file.FileName);
             using (var stream = new FileStream(filePath, FileMode.Create))
             {
-                 file.CopyToAsync(stream);
+                file.CopyToAsync(stream);
             }
 
             Workbook workbook = new Workbook(filePath);
@@ -1361,7 +1357,7 @@ namespace OASystem.API.Controllers
             var count = 0;
 
             //var notClentUser = new List<int>() { 21, 95  , 327 };
-            var notClentUser = new List<int>() { 21, 95, 327,213 };
+            var notClentUser = new List<int>() { 21, 95, 327, 213 };
 
             var insertList = new List<Crm_ClientDataAndUser>();
 
@@ -1431,7 +1427,7 @@ namespace OASystem.API.Controllers
         {
             var clients = _sqlSugar.Queryable<Crm_NewClientData>()
                .Where(x => x.IsDel == 0)
-               .Select(x => new Crm_NewClientData {Id = x.Id, Client = x.Client })
+               .Select(x => new Crm_NewClientData { Id = x.Id, Client = x.Client })
                .ToList();
 
             var keys = new List<string>()
@@ -1441,7 +1437,7 @@ namespace OASystem.API.Controllers
 
             var count = 0;
             var insertArr = new List<Crm_ClientDataAndBusiness>();
-            
+
             // --368  教育
 
             foreach (var item in clients)
@@ -1464,10 +1460,10 @@ namespace OASystem.API.Controllers
                 }
             }
 
-           count =  _sqlSugar.Insertable(insertArr)
-                .ExecuteCommand();  
+            count = _sqlSugar.Insertable(insertArr)
+                 .ExecuteCommand();
 
-           return count > 0 ? Ok(JsonView(true, "分配成功!", count)) : Ok(JsonView(false, "分配失败!"));
+            return count > 0 ? Ok(JsonView(true, "分配成功!", count)) : Ok(JsonView(false, "分配失败!"));
         }
 
         #region 回滚数据记录

+ 1 - 0
OASystem/OASystem.Api/Controllers/ResourceController.cs

@@ -2355,6 +2355,7 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
                         : string.Empty;
                 }
             }
+
             sw.Stop();
             return Ok(JsonView(true, $"操作成功!耗时:{sw.ElapsedMilliseconds}ms", groupInfos, total));
         }

+ 65 - 3
OASystem/OASystem.Api/OAMethodLib/GeneralMethod.cs

@@ -920,7 +920,8 @@ namespace OASystem.API.OAMethodLib
                 if (oaCurrncy == null) continue;
 
                 //美元(USD):7.5|
-                rateInfoStr += $"{rate.Name}({oaCurrncy.Name}):{rate.FSellPri}|";
+                string rateStr = rate.FSellPri ?? "0.00";
+                rateInfoStr += $"{rate.Name}({oaCurrncy.Name}):{rateStr}|";
             }
 
             if (string.IsNullOrEmpty(rateInfoStr)) return false;
@@ -937,7 +938,7 @@ namespace OASystem.API.OAMethodLib
                 })
                 .ExecuteCommandAsync();
 
-            return add > 0 ? true : false;
+            return add > 0;
         }
 
         /// <summary>
@@ -4206,6 +4207,7 @@ namespace OASystem.API.OAMethodLib
         #endregion
 
         #region 出入境费用
+
         #region 汇率
 
         /// <summary>
@@ -4274,7 +4276,7 @@ namespace OASystem.API.OAMethodLib
                     {
                         item.Rate = Convert.ToDecimal((Convert.ToDecimal(rateInfo.FSellPri == null ? 0.00M : rateInfo.FSellPri) / 100.00M).ToString("#0.0000"));
 
-                        decimal rate1 = item.Rate * 1.0300M;
+                        decimal rate1 = item.Rate * 1.0350M;
                         //rate1 += 0.01M;
 
                         reteInfos.Add(new
@@ -4290,6 +4292,66 @@ namespace OASystem.API.OAMethodLib
             return reteInfos;
         }
 
+        /// <summary>
+        /// 出入境费用 汇率验证
+        /// </summary>
+        /// <param name="groupId"></param>
+        /// <returns></returns>
+        public static async Task<(bool,string)> EnterExitCostCheckRate(int groupId)
+        {
+            var info = await _sqlSugar.Queryable<Grp_EnterExitCost>().FirstAsync(x => x.IsDel == 0 && x.DiId == groupId);
+            if (info == null) return (false, string.Empty);
+
+            List<CurrencyInfo> liveRates;
+            var cacheRateInfo = await _sqlSugar.Queryable<Sys_ExchangeRateRecord>()
+                .OrderByDescending(x => x.CreateTime)
+                .FirstAsync(x => x.IsDel == 0 && x.DiId == info.Id);
+            if (cacheRateInfo == null)
+            {
+                var _currencyRate = await _juHeApi.PostItemRateAsync(Array.Empty<string>());
+                if (_currencyRate.Count < 1) return (false, "获取汇率失败,请稍后再试!");
+
+                liveRates = _currencyRate.Select(it => new CurrencyInfo
+                {
+                    CurrencyCode = it.Name,
+                    CurrencyName = it.Name,
+                    Rate = Convert.ToDecimal((Convert.ToDecimal(it.FSellPri == null ? 0.00M : it.FSellPri) / 100.00M).ToString("#0.0000"))
+                }).ToList();
+            }
+            else
+            {
+                liveRates = CommonFun.GetCurrencyChinaToList(cacheRateInfo.RateInfo);
+                foreach (var x in liveRates)
+                    x.Rate = (x.Rate / 100.00M).TruncDecimals(4);
+            }
+
+            var cacheRateInfos = CommonFun.GetCurrencyChinaToList(info.CurrencyRemark);
+
+            var isSendMsg = false;
+            var msgContent = new StringBuilder();
+
+            if (cacheRateInfos.Any())
+            {
+                decimal rowthRate = 1.0350M;
+                foreach (var cacheRate in cacheRateInfos)
+                {
+                    var liveRate = liveRates.Find(x => x.CurrencyName.Equals(cacheRate.CurrencyName));
+                    if (liveRate == null) continue;
+
+                    var currRate = (rowthRate * liveRate.Rate).TruncDecimals(4);
+                    if (rowthRate > currRate)
+                    {
+                        isSendMsg = true;
+                        //>团组归属:<font color='info'>{groupName}</font>
+                        msgContent.Append($">- {cacheRate.CurrencyName}:存储汇率超过实时汇率,请注意!!!(存储汇率:{rowthRate.ToString("#0.0000")}  聚合API实时汇率:{currRate.ToString("#0.0000")}(已计算涨幅比例1.0350))");
+                    }
+                }
+                return (isSendMsg, msgContent.ToString());
+            }
+
+            return (false, string.Empty);
+        }
+
         #endregion
 
         #region 三公费用明细 文件下载

+ 47 - 0
OASystem/OASystem.Api/OAMethodLib/QiYeWeChatAPI/AppNotice/Library.cs

@@ -883,6 +883,53 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
         #endregion
 
         #region 费用保存发送消息
+
+        #region 三公费用更改通知
+
+        /// <summary>
+        /// 三公费用汇率大于实时汇率 通知发送(22、208、5)
+        /// </summary>
+        /// <param name="diId"></param>
+        /// <param name="operationId"></param>
+        /// <returns></returns>
+        public static async Task<bool> SendUserMsg_GroupShare_ToFin(int diId,int operationId, string msgContent)
+        {
+            Grp_DelegationInfo groupInfo = _grpDeleRep.Query<Grp_DelegationInfo>(s => s.Id == diId).First();
+
+            var operationName = _grpDeleRep.Query<Sys_Users>(s => s.IsDel == 0 && s.Id == operationId).First()?.CnName ?? "Unknown";
+           
+            var defaultUserIds = new List<string>() { "208", "22", "5" };
+            
+            if (defaultUserIds.Count > 0)
+            {
+                List<string> qwUserIdList = GetQiyeChatUserIdList(defaultUserIds);
+
+                string resMsg = string.Format(@" `出入境费用汇率变更通知`  
+
+>团组:<font color='info'>{0}</font> 
+
+>**汇率明细**   
+{1}
+
+>操作人员:<font color='comment'>{2}</font> 
+>操作时间:<font color='comment'>{3}</font> 
+
+[详细信息请前往OA系统查看](http://oa.pan-american-intl.com:4399/)   ", groupInfo.TeamName, msgContent, operationName, DateTime.Now.ToString("yyyy-MM-dd HH:mm"));
+
+
+                ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(qwUserIdList, resMsg);
+                if (result.errcode != 0)
+                {
+                    //抄送日志 
+                    return false;
+                }
+            }
+
+            return true;
+        }
+
+        #endregion
+
         #region 三公费用更改通知
 
         /// <summary>

+ 12 - 0
OASystem/OASystem.Domain/Entities/Groups/Grp_EnterExitCost.cs

@@ -257,5 +257,17 @@
         /// 其他费用选择框
         /// </summary>
         public int OtherExpenses_Checked { get; set; }
+
+        /// <summary>
+        /// 最后修改人
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int LastUpdateUserId { get; set; }
+
+        /// <summary>
+        /// 最后修改时间
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(30)")]
+        public string LastUpdateTime { get; set; }
     }
 }

+ 0 - 2
OASystem/OASystem.Domain/Entities/Groups/Grp_VisaFeeInfo.cs

@@ -33,7 +33,6 @@ namespace OASystem.Domain.Entities.Groups
         [SugarColumn(IsNullable = true,ColumnDataType = "int")]
         public int CountryVisaFeeId { get; set; }
 
-
         /// <summary>
         /// 代办费 - 公务 类型 1 大公务 2 小公务
         /// 新增字段
@@ -50,7 +49,6 @@ namespace OASystem.Domain.Entities.Groups
         [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
         public decimal AgencyFee { get; set; }
 
-
         /// <summary>
         /// 其他费用
         /// </summary>

+ 21 - 0
OASystem/OASystem.Domain/Entities/Groups/Grp_VisaProcessControl.cs

@@ -0,0 +1,21 @@
+namespace OASystem.Domain.Entities.Groups
+{
+    /// <summary>
+    /// 签证流程管控
+    /// </summary>
+    [SugarTable(tableName: "Grp_VisaProcessControl",TableDescription = "签证流程管控")]
+    public class Grp_VisaProcessControl:EntityBase
+    {
+        /// <summary>
+        /// 团组Id(Grp_DelegationInfo)
+        /// </summary>
+        [SugarColumn(ColumnName = "GroupId", ColumnDescription = "团组Id(Grp_DelegationInfo)", IsNullable = true, ColumnDataType = "int")]
+        public int GroupId { get; set; }
+
+        /// <summary>
+        /// 是否确认完成
+        /// </summary>
+        [SugarColumn(ColumnName = "IsCompleted", ColumnDescription = "确认完成", IsNullable = true, ColumnDataType = "bit")]
+        public bool IsCompleted { get; set; } = false;
+    }
+}

+ 72 - 0
OASystem/OASystem.Domain/Entities/Groups/Grp_VisaProcessSteps.cs

@@ -0,0 +1,72 @@
+namespace OASystem.Domain.Entities.Groups
+{
+    /// <summary>
+    /// 签证流程管控步骤
+    /// </summary>
+    [SugarTable(tableName: "Grp_VisaProcessSteps", TableDescription = "签证流程步骤")]
+    public class Grp_VisaProcessSteps : EntityBase
+    {
+        /// <summary>
+        /// 团组Id(Grp_DelegationInfo)
+        /// </summary>
+        [SugarColumn(ColumnName = "GroupId", ColumnDescription = "团组Id(Grp_DelegationInfo)", IsNullable = true, ColumnDataType = "int")]
+        public int GroupId { get; set; }
+
+        /// <summary>
+        /// 步骤
+        /// </summary>
+        [SugarColumn(ColumnName = "Step", ColumnDescription = "步骤", IsNullable = true, ColumnDataType = "int")]
+        public int Step { get; set; }
+
+        /// <summary>
+        /// 存储值(办理日期(2025-01-01))、bool(false,true))
+        /// </summary>
+        [SugarColumn(ColumnName = "ProcDate", ColumnDescription = "存储值(办理日期(2025-01-01))、bool(false,true))", IsNullable = true, ColumnDataType = "varchar(50)")]
+        public string StoreVal { get; set; }
+
+        /// <summary>
+        /// 附件地址
+        /// </summary>
+        [SugarColumn(ColumnName = "ProcDate", ColumnDescription = "附件地址", IsNullable = true, ColumnDataType = "varchar(120)")]
+        public string AttachUrl { get; set; }
+
+        /// <summary>
+        /// 是否确认完成
+        /// </summary>
+        [SugarColumn(ColumnName = "IsCompleted", ColumnDescription = "确认完成", IsNullable = true, ColumnDataType = "bit")]
+        public bool IsCompleted { get; set; } = false;
+
+        /// <summary>
+        /// 最后更新人
+        /// </summary>
+        [SugarColumn(ColumnName = "LastUpdateUserId", ColumnDescription = "最后更新人", IsNullable = true, ColumnDataType = "int")]
+        public int LastUpdateUserId { get; set; }
+        /// <summary>
+        /// 最后更新时间
+        /// </summary>
+        [SugarColumn(ColumnName = "LastUpdateTime", ColumnDescription = "最后更新时间", IsNullable = true, ColumnDataType = "varchar(30)")]
+        public string LastUpdateTime { get; set; }
+
+
+        public Grp_VisaProcessSteps() { }
+
+        /// <summary>
+        /// 流程步骤初始化
+        /// </summary>
+        /// <param name="groupId"></param>
+        /// <returns></returns>
+        public static List<Grp_VisaProcessSteps> StepsInit(int groupId)
+        {
+            return new List<Grp_VisaProcessSteps>() {
+                new(){ GroupId = groupId, Step = 1 , }, //第一步:签证启动日(团组信息操作里面打勾确认出团)
+                new(){ GroupId = groupId, Step = 2 , }, //第二步:分配工作(从倒退表里-出批件、护照办理取时间)
+                new(){ GroupId = groupId, Step = 3 , }, //第三步:送外办时间(从倒退表里-送签签证取时间)
+                new(){ GroupId = groupId, Step = 4 , }, //第四步:读取预计出签时间(从签证费用标准-签证时间工作日取时间,送外办时间+签证时间(工作日))
+                new(){ GroupId = groupId, Step = 5 , }, //第五步:实际出签时间(手动填写) 附件
+                new(){ GroupId = groupId, Step = 6 , }, //第六步:是否需要开出境证明 (否,是) 附件
+                new(){ GroupId = groupId, Step = 7 , }, //第七步:是否需要办理电子入境卡手续(否,是) -> 如果是,系统生成附件(个人信息资料+机票航班信息+酒店信息)【在出发前三天内填写,取具体的日期】
+                new(){ GroupId = groupId, Step = 8 , }, //第八步:确认完成操作 (确认完成操作后,不可更改该流程数据)
+            };
+        }
+    }
+}

+ 6 - 6
OASystem/OASystem.Domain/Entities/Resource/Res_VisaFeeStandardDetails.cs

@@ -43,9 +43,9 @@
         public string VisaTime { get; set; }
 
         /// <summary>
-        ///  是否免签(大公务) 0:是 1:否
+        ///  是否免签(大公务) 
         /// </summary>
-        [SugarColumn(ColumnName = "IsVisaExemptionLarge", ColumnDescription = "是否免签(大公务) 0:是 1:否", IsNullable = true, ColumnDataType = "bit")]
+        [SugarColumn(ColumnName = "IsVisaExemptionLarge", ColumnDescription = "是否免签(大公务)", IsNullable = true, ColumnDataType = "bit")]
         public bool IsVisaExemptionLarge { get; set; }
 
         /// <summary>
@@ -61,9 +61,9 @@
         public decimal LargeAgencyFee { get; set; } = 0.00m;
 
         /// <summary>
-        ///  是否免签(小公务) 0:是 1:否
+        ///  是否免签(小公务) 
         /// </summary>
-        [SugarColumn(ColumnName = "IsVisaExemptionSmall", ColumnDescription = "是否免签(小公务) 0:是 1:否", IsNullable = true, ColumnDataType = "bit")]
+        [SugarColumn(ColumnName = "IsVisaExemptionSmall", ColumnDescription = "是否免签(小公务)", IsNullable = true, ColumnDataType = "bit")]
         public bool IsVisaExemptionSmall { get; set; }
 
         /// <summary>
@@ -91,9 +91,9 @@
         public decimal UrgExtFee { get; set; } = 0.00m;
 
         /// <summary>
-        /// 签证是否加急 0:加急  1: 不加急
+        /// 签证是否加急
         /// </summary>
-        [SugarColumn(ColumnName = "IsUrgent", ColumnDescription = "签证是否加急 0:加急  1: 不加急", IsNullable = true, ColumnDataType = "bit")]
+        [SugarColumn(ColumnName = "IsUrgent", ColumnDescription = "签证是否加急", IsNullable = true, ColumnDataType = "bit")]
         public bool IsUrgent { get; set; }
 
         /// <summary>

+ 5 - 0
OASystem/OASystem.Domain/ViewModels/Resource/CountryFeeCostView.cs

@@ -147,6 +147,11 @@ namespace OASystem.Domain.ViewModels.Resource
         }
     }
 
+    public class VisaFeeStandardDetailsView : VisaFeeStandardDetails
+    {
+        public string CountryName { get; set; }
+    }
+
     /// <summary>
     /// 签证info
     /// </summary>

+ 0 - 1
OASystem/OASystem.Infrastructure/Repositories/Groups/DecreasePaymentsRepository.cs

@@ -508,7 +508,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
                                     .Where(a => a.CId == dto.Id && a.CTable == 98 && a.DIId == 2590)
                                     .ExecuteCommand();
                             }
-
                         }
                         #endregion
 

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

@@ -486,6 +486,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
             if (dto.SumTDC == 0) dto.OutsideTDPay = 0;
 
             var enterExitCost = _mapper.Map<Grp_EnterExitCost>(dto);
+            enterExitCost.LastUpdateUserId = dto.UserId;
+            enterExitCost.LastUpdateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
             //enterExitCost.Remark = dto.FirstItemRemark;
             //enterExitCost.InsidePay = enterExitCost.Visa + enterExitCost.YiMiao + enterExitCost.HeSuan + enterExitCost.Service + enterExitCost.Safe + enterExitCost.Ticket;
 

+ 178 - 35
OASystem/OASystem.Infrastructure/Repositories/Groups/VisaFeeInfoRepository.cs

@@ -12,7 +12,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
     /// 团组签证费用详情 info
     /// 仓储
     /// </summary>
-    public class VisaFeeInfoRepository:BaseRepository<Grp_VisaFeeInfo,VisaInfoView>
+    public class VisaFeeInfoRepository : BaseRepository<Grp_VisaFeeInfo, VisaInfoView>
     {
         private readonly IMapper _mapper;
         private Result _result;
@@ -23,7 +23,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
             : base(sqlSugar)
         {
             _mapper = mapper;
-            _result = new Result() { Code = -2,Msg = "操作失败!"};
+            _result = new Result() { Code = -2, Msg = "操作失败!" };
             _countryFeeRep = countryFeeRep;
             _groupRep = groupRep;
         }
@@ -44,7 +44,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
             return _result;
         }
 
-
         /// <summary>
         /// List
         /// </summary>
@@ -74,9 +73,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     .FirstAsync(x => x.IsDel == 0 && x.Id == diId);
 
                 if (groupInfo == null)
-                {
                     return new JsonView() { Code = StatusCodes.Status200OK, Data = data, Msg = "团组信息不存在!" };
-                }
 
                 var countrys = _groupRep.GroupSplitCountry(groupInfo.VisitCountry ?? "");
                 if (countrys.Count > 0)
@@ -132,8 +129,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
                                         IsChecked = 0,
                                         Country = country,
                                         //大公务签证费用为0时,使用小公务签证费用
-                                        VisaFee = cityVisaFeeInfo.LargeVisaPrice == 0.00M 
-                                                  ? cityVisaFeeInfo.SmallVisaPrice 
+                                        VisaFee = cityVisaFeeInfo.LargeVisaPrice == 0.00M
+                                                  ? cityVisaFeeInfo.SmallVisaPrice
                                                   : cityVisaFeeInfo.LargeVisaPrice,
                                         OBType = 1,
                                         AgencyFee = cityVisaFeeInfo.LargeAgencyFee
@@ -188,7 +185,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
         /// </summary>
         /// <param name="list"></param>
         /// <param name="totalRows"></param>
-        private void AddDefaultRows(List<VisaFeeInfosView> list, int totalRows)
+        private static void AddDefaultRows(List<VisaFeeInfosView> list, int totalRows)
         {
             int defaultRow = totalRows - list.Count;
             for (int i = 0; i < defaultRow; i++)
@@ -204,7 +201,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
         /// <returns></returns>
         public async Task<Result> Update(VisaFeeAddAndUpdateDto dto)
         {
-            if (dto.VisaFeeInfos.Count  < 1) return _result = new Result() { Code = -1, Msg = "请传入有效的签证费用集合参数" };
+            if (dto.VisaFeeInfos.Count < 1) return _result = new Result() { Code = -1, Msg = "请传入有效的签证费用集合参数" };
             if (dto.PortType < 1 || dto.PortType > 3) return _result = new Result() { Code = -1, Msg = "请传入有效的portType参数" };
 
             var visaInfos = new List<Grp_VisaFeeInfo>();
@@ -291,27 +288,166 @@ namespace OASystem.Infrastructure.Repositories.Groups
             var add = _sqlSugar.Insertable(visaInfos).ExecuteCommand();
             if (add > 0)
             {
-                CommitTran(); 
-                return new Result() {Code = 0 ,Msg = "操作成功!" };
+                CommitTran();
+                return new Result() { Code = 0, Msg = "操作成功!" };
             }
-           
+
             RollbackTran();
             return _result;
         }
 
+        /// <summary>
+        /// 根据Country和城市Id获取签证费用标准详情
+        /// </summary>
+        /// <param name="countrys">国家名称</param>
+        /// <param name="cityId">城市Id</param>
+        /// <returns></returns>
+        public async Task<List<VisaFeeStandardDetailsView>> VisaInfoByCountryAndCityId(List<string> countrys, int cityId)
+        {
+            if (countrys == null || countrys.Count == 0 || cityId < 1)
+                return new List<VisaFeeStandardDetailsView>();
+
+            var countryIds = await _sqlSugar.Queryable<Res_VisaFeeStandard>()
+                .Where(it => it.IsDel == 0 && countrys.Contains(it.Country))
+                .Select(it => it.Id)
+                .ToListAsync();
+
+            if (countryIds.Count == 0)
+                return new List<VisaFeeStandardDetailsView>();
+
+            var visaFeeStandardDetails = await _sqlSugar.Queryable<Res_VisaFeeStandardDetails>()
+                .LeftJoin<Res_VisaFeeStandard>((x, y) => x.ProvinceId == y.Id)
+                .LeftJoin<Sys_Cities>((x, y, z) => x.ProvinceId == z.Id && (z.Level == 1 || z.Level == 4))
+                .Where((x, y, z) => x.IsDel == 0 && countryIds.Contains(x.ParentId))
+                .Select((x, y, z) => new VisaFeeStandardDetailsView
+                {
+                    Id = x.Id,
+                    ParentId = x.ParentId,
+                    CountryName = y.Country,
+                    ProvinceId = x.ProvinceId,
+                    ProvinceName = z.Name_CN,
+                    VisaAddress = x.VisaAddress,
+                    IsVisaOnArrival = x.IsVisaOnArrival,
+                    IsElectronicSign = x.IsElectronicSign,
+                    VisaTime = x.VisaTime,
+                    IsVisaExemptionLarge = x.IsVisaExemptionLarge,
+                    LargeVisaPrice = x.LargeVisaPrice,
+                    LargeAgencyFee = x.LargeAgencyFee,
+                    IsVisaExemptionSmall = x.IsVisaExemptionSmall,
+                    SmallVisaPrice = x.SmallVisaPrice,
+                    SmallAgencyFee = x.SmallAgencyFee,
+                    NormExtFee = x.NormExtFee,
+                    UrgExtFee = x.UrgExtFee,
+                    IsUrgent = x.IsUrgent,
+                    UrgentTime = x.UrgentTime,
+                    UrgentPrice = x.UrgentPrice,
+                    UrgentPriceDesc = x.UrgentPriceDesc,
+                    Remark = x.Remark,
+                })
+                .ToListAsync();
+
+            // 默认四川省ID
+            const int defaultProvinceId = 122;
+            var visaFeeInfoDefaultList = visaFeeStandardDetails.Where(it => it.ProvinceId == defaultProvinceId).ToList();
+
+            var provCityDatas = await _groupRep.ProvinceCityBasicSource();
+            int provinceId = _groupRep.FindParentIdByChildId(provCityDatas, cityId) ?? 0;
+
+            if (provinceId == defaultProvinceId)
+                return visaFeeInfoDefaultList;
+
+            // 其他省份优先返回对应省份数据,否则用四川数据
+            //其他省份单项信息为空或者费用为0时,使用四川的签证费用信息
+            var visaInfosGroup = visaFeeStandardDetails.GroupBy(x => x.ParentId);
+            var resultList = new List<VisaFeeStandardDetailsView>();
+
+            var VisaInfoOtherProvs = new List<VisaFeeStandardDetailsView>();
+            foreach (var group in visaInfosGroup)
+            {
+                var scInfo = group.FirstOrDefault(x => x.ProvinceId == defaultProvinceId);
+                var provInfo = group.FirstOrDefault(x => x.ProvinceId == provinceId);
+
+                if (provInfo != null)
+                {
+                    //送签地址
+                    if (!string.IsNullOrEmpty(provInfo.VisaAddress)) scInfo.VisaAddress = provInfo.VisaAddress;
+
+                    //签证时间(工作日)
+                    if (!string.IsNullOrEmpty(provInfo.VisaTime)) scInfo.VisaTime = provInfo.VisaTime;
+
+                    //是否免签(大公务) 
+                    if (provInfo.IsVisaExemptionLarge) scInfo.IsVisaExemptionLarge = true;
+
+                    //签证费用(大公务)
+                    if (provInfo.LargeVisaPrice > 0.00M) scInfo.LargeVisaPrice = provInfo.LargeVisaPrice;
+
+                    //代办费(大公务)
+                    if (provInfo.LargeAgencyFee > 0.00M) scInfo.LargeAgencyFee = provInfo.LargeAgencyFee;
+
+                    //是否免签(小公务) 
+                    if (provInfo.IsVisaExemptionSmall) scInfo.IsVisaExemptionSmall = true;
+
+                    //签证费用(小公务)
+                    if (provInfo.SmallVisaPrice > 0.00M) scInfo.SmallVisaPrice = provInfo.SmallVisaPrice;
+
+                    //代办费(小公务)
+                    if (provInfo.SmallAgencyFee > 0.00M) scInfo.SmallAgencyFee = provInfo.SmallAgencyFee;
+
+                    //外办费用(普通)
+                    if (provInfo.NormExtFee > 0.00M) scInfo.NormExtFee = provInfo.NormExtFee;
+
+                    //外办费用(加急)
+                    if (provInfo.UrgExtFee > 0.00M) scInfo.UrgExtFee = provInfo.UrgExtFee;
+
+                    //签证是否加急
+                    if (provInfo.IsUrgent) scInfo.IsUrgent = true;
+
+                    //加急费用
+                    if (provInfo.UrgentPrice > 0.00M) scInfo.UrgentPrice = provInfo.UrgentPrice;
+
+                    //加急费用描述 
+                    if (!string.IsNullOrEmpty(provInfo.UrgentPriceDesc)) scInfo.UrgentPriceDesc = provInfo.UrgentPriceDesc;
+
+                    //备注 
+                    if (!string.IsNullOrEmpty(provInfo.Remark)) scInfo.Remark = provInfo.Remark;
+
+                    resultList.Add(scInfo);
+                }
+            }
+
+            return resultList;
+        }
+
+
         /// <summary>
         /// 出入境费用签证费用提示
         /// </summary>
-        /// <param name="portType"></param>
         /// <param name="diId"></param>
         /// <returns></returns>
         public async Task<Result> EnterExitCostVisaTips(int diId)
         {
             if (diId < 1) return _result = new Result() { Code = -1, Msg = "请传入有效的DiId参数" };
 
-            var visaData = await _sqlSugar.Queryable<Grp_VisaFeeInfo>().Where(it => it.IsDel == 0 && it.DiId == diId).ToListAsync();
-            List<int> ids = visaData.Select (it => it.CountryVisaFeeId).ToList();
-            var visaCountryDatas = await _sqlSugar.Queryable<Res_CountryFeeCost>().Where(it => ids.Contains(it.Id)).ToListAsync();
+            var groupInfo = await _sqlSugar.Queryable<Grp_DelegationInfo>()
+               .FirstAsync(it => it.IsDel == 0 && it.Id == diId);
+
+            if (groupInfo == null)
+                return _result = new Result() { Code = -1, Msg = "团组信息不存在!" };
+
+            var visaData = await _sqlSugar.Queryable<Grp_VisaFeeInfo>()
+                .Where(it => it.IsDel == 0 && it.DiId == diId)
+                .ToListAsync();
+
+            var visaFeeIds = visaData.Select(x => x.Id).ToList();
+            var visaCountryNames = await _sqlSugar.Queryable<Res_CountryFeeCost>()
+                .Where(it => visaFeeIds.Contains(it.Id))
+                .Select(it => it.VisaCountry)
+                .ToListAsync();
+
+            var visaCountryDatas = await VisaInfoByCountryAndCityId(visaCountryNames, groupInfo.CityId);
+
+            //if (visaCountryDatas.Count == 0)
+            //    return _result = new Result() { Code = -1, Msg = "签证费用信息不存在!" };
 
             var datas = new List<dynamic>();
             string remark = "";
@@ -319,24 +455,26 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
             visaData = visaData.Where(it => it.IsChecked == 1).ToList();
             var visaData1 = visaData.GroupBy(it => it.CountryVisaFeeId);
-            
+
             //费用报价系数
-            decimal priceCoeff = 1.00M; 
+            decimal priceCoeff = 1.00M;
             foreach (var kvp in visaData1)
             {
                 var countryData = visaCountryDatas.Find(it => it.Id == kvp.Key);
                 decimal _otherFee = kvp.FirstOrDefault()?.OtherFee * priceCoeff ?? 0;
-                decimal _visaFee = Convert.ToDecimal(countryData?.VisaPrice ?? 0.00M) * priceCoeff;
-                decimal visaFeeTotal = _visaFee + _otherFee;
-                decimal _agencyFee = 0;
-                decimal _GrandBusinessAgencyFee = 0;
-                decimal _PettyBusinessAgencyFee = 0;
-                
-                string remark1 = $"签证费:{_visaFee:#0.00}元、";
+                decimal _visaFee = 0.00M;
+                decimal visaFeeTotal = 0.00M;
+                decimal _agencyFee = 0.00M;
+                decimal _GrandBusinessAgencyFee = 0.00M;
+                decimal _PettyBusinessAgencyFee = 0.00M;
+
+                string remark1 = "";
                 foreach (var item in kvp.ToList())
                 {
                     if (item.OBType == 1)
                     {
+                        _visaFee = Convert.ToDecimal(countryData?.LargeVisaPrice ?? 0.00M) * priceCoeff;
+                        remark1 = $"签证费:{_visaFee:#0.00}元、";
                         if (item.AgencyFee > 0)
                         {
                             remark1 += $@"大公务代办费:{item.AgencyFee:#0.00}元、";
@@ -344,30 +482,34 @@ namespace OASystem.Infrastructure.Repositories.Groups
                             _GrandBusinessAgencyFee = item.AgencyFee * priceCoeff;
                         }
                     }
-                    else if (item.OBType == 1)
+                    else if (item.OBType == 2)
                     {
+                        _visaFee = Convert.ToDecimal(countryData?.SmallVisaPrice ?? 0.00M) * priceCoeff; 
+                        remark1 = $"签证费:{_visaFee:#0.00}元、";
                         if (item.AgencyFee > 0)
                         {
-                            remark1 += $@"小公务代办费:{item.AgencyFee.ToString("#0.00")}元、";
+                            remark1 += $@"小公务代办费:{item.AgencyFee:#0.00}元、";
                             _agencyFee += item.AgencyFee;
                             _PettyBusinessAgencyFee = item.AgencyFee * priceCoeff;
                         }
                     }
+                    //_visaFee += _otherFee;
                 }
+
                 if (remark1.Length > 0) remark1 = remark1.Substring(0, remark1.Length - 1);
 
                 if (_otherFee > 0) remark1 += $@"其他费用:{_otherFee:#0.00}元";
 
                 visaFeeTotal += (_GrandBusinessAgencyFee + _PettyBusinessAgencyFee);
-                remark += $@"{countryData?.VisaCountry ?? ""}:签证总费用:{visaFeeTotal}元/人 其中({remark1});";
+                remark += $@"{countryData?.CountryName ?? ""}:签证总费用:{visaFeeTotal}元/人 其中({remark1});";
 
                 feeTotal += visaFeeTotal;
 
                 datas.Add(new
                 {
-                    Country = countryData?.VisaCountry ?? "",
+                    Country = countryData?.CountryName ?? "",
                     visaFeeTotal,
-                    VisaFee = countryData?.VisaPrice ?? 0.00M,
+                    VisaFee = _visaFee,
                     GrandBusinessAgencyFee = _GrandBusinessAgencyFee,
                     PettyBusinessAgencyFee = _PettyBusinessAgencyFee,
                     OtherFee = _otherFee
@@ -375,7 +517,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
             }
 
             _result.Code = 0;
-            _result.Data = new { 
+            _result.Data = new
+            {
                 feeTotal,
                 data = datas,
                 remark
@@ -383,13 +526,14 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
             return _result;
         }
+
         /// <summary>
         /// 出入境费用草稿签证费用提示
         /// </summary>
         /// <param name="portType"></param>
         /// <param name="diId"></param>
         /// <returns></returns>
-        public async Task<(decimal,string)> EnterExitCostDraftVisaTips(string[] countrys)
+        public async Task<(decimal, string)> EnterExitCostDraftVisaTips(string[] countrys)
         {
             var visaCountryDatas = await _sqlSugar.Queryable<Res_CountryFeeCost>().Where(it => countrys.Contains(it.VisaCountry)).ToListAsync();
 
@@ -409,7 +553,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 }
 
                 decimal visaFee = Convert.ToDecimal(kvp?.VisaPrice ?? 0.00M) * priceCoeff;
-                
 
                 decimal gbAgencyFee = kvp.GrandBusinessAgencyFee;
                 decimal pbAgencyFee = kvp.PettyBusinessAgencyFee;
@@ -418,7 +561,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 if (gbAgencyFee > 0.00M)
                 {
                     remark1 += $@"大公务代办费:{gbAgencyFee:#0.00}元、";
-                    gbAgencyFee *=  priceCoeff;
+                    gbAgencyFee *= priceCoeff;
                 }
 
                 if (pbAgencyFee > 0.00M)
@@ -436,7 +579,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
             }
 
-            return (feeTotal,remark);
+            return (feeTotal, remark);
         }
     }
 }

+ 1 - 4
OASystem/OASystem.Infrastructure/Repositories/Resource/CountryFeeRepository.cs

@@ -84,10 +84,7 @@ namespace OASystem.Infrastructure.Repositories.Resource
         /// <summary>
         /// Page List Async
         /// </summary>
-        /// <param name="pageIndex"></param>
-        /// <param name="pageSize"></param>
-        /// <param name="feeType"></param>
-        /// <param name="countryName"></param>
+        /// <param name="dto"></param>
         /// <returns></returns>
         public async Task<JsonView> PageListAsync(VisaFeeStandardListDto dto)
         {

+ 13 - 9
OASystem/OASystem.Infrastructure/Tools/CommonFun.cs

@@ -501,18 +501,22 @@ public static class CommonFun
         if (rateStr.Contains("|"))
         {
             string[] currencyArr = rateStr.Split("|");
+            
             foreach (string currency in currencyArr)
             {
-                string[] currency1 = currency.Split(":");
-                string[] currency2 = currency1[0].Split("(");
-
-                CurrencyInfo rateInfo = new CurrencyInfo()
+                if (!string.IsNullOrEmpty(currency))
                 {
-                    CurrencyCode = currency2[1].Replace(")", "").TrimEnd(),
-                    CurrencyName = currency2[0],
-                    Rate = decimal.Parse(currency1[1]),
-                };
-                currencyInfos.Add(rateInfo);
+                    string[] currency1 = currency.Split(":");
+                    string[] currency2 = currency1[0].Split("(");
+
+                    CurrencyInfo rateInfo = new CurrencyInfo()
+                    {
+                        CurrencyCode = currency2[1].Replace(")", "").TrimEnd(),
+                        CurrencyName = currency2[0],
+                        Rate = decimal.Parse(currency1[1]),
+                    };
+                    currencyInfos.Add(rateInfo);
+                }
             }
         }
         return currencyInfos;