Browse Source

三公费用明细
1. 签证费用实时提示
2. 汇率费用实时提示

leiy 10 months ago
parent
commit
b5715369c1

+ 48 - 50
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -3629,81 +3629,79 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> GetEnterExitCostRealTimeRateAndVisaTips(EnterExitCostInfobyDiIdDto dto)
         {
-            try
-            {
-                var groupInfo = await _sqlSugar.Queryable<Grp_DelegationInfo>().FirstAsync(it => it.Id == dto.DiId && it.IsDel == 0);
+            var groupInfo = await _sqlSugar.Queryable<Grp_DelegationInfo>().FirstAsync(it => it.Id == dto.DiId && it.IsDel == 0);
 
-                //签证费用 tips
-                List<dynamic> visaInfo = new List<dynamic>();
-                if (groupInfo != null)
+            //签证费用 tips
+            List<dynamic> visaInfos = new List<dynamic>();
+            if (groupInfo != null)
+            {
+                List<string> countrys = _groupRepository.GroupSplitCountry(groupInfo.VisitCountry);
+                if (countrys.Count > 0)
                 {
-                    List<string> countrys = _groupRepository.GroupSplitCountry(groupInfo.VisitCountry);
-                    if (countrys.Count > 0)
+                    foreach (var item in countrys)
                     {
-                        foreach (var item in countrys)
+                        var countryVisaFees = _sqlSugar.Queryable<Res_CountryFeeCost>().First(it => it.IsDel == 0 && countrys.Contains(it.VisaCountry));
+                        if (countryVisaFees != null)
                         {
-                            var countryVisaFees = _sqlSugar.Queryable<Res_CountryFeeCost>().First(it => it.IsDel == 0 && countrys.Contains(it.VisaCountry));
-                            if (countryVisaFees != null)
+                            visaInfos.Add(new
                             {
-                                visaInfo.Add(new { 
-                                    isExist = true,
-                                    country = item,
-                                    visaFee = countryVisaFees.VisaPrice,
-                                    lastUpdateDt = countryVisaFees.LastUpdateTime
-                                });
-                            }
-                            else
+                                isExist = true,
+                                country = item,
+                                visaFee = countryVisaFees.VisaPrice,
+                                lastUpdateDt = countryVisaFees.LastUpdateTime
+                            });
+                        }
+                        else
+                        {
+                            visaInfos.Add(new
                             {
-                                visaInfo.Add(new
-                                {
-                                    isExist = false,
-                                    country = $"“{item}”未在签证费用模块录入!",
-                                    visaFee = 0.00M,
-                                    lastUpdateDt = ""
-                                });
-                            }
+                                isExist = false,
+                                country = $"“{item}”未在签证费用模块录入!",
+                                visaFee = 0.00M,
+                                lastUpdateDt = ""
+                            });
                         }
                     }
                 }
+            }
 
 
-                //默认币种显示
-                List<CurrencyInfo> _currencyInfos = new List<CurrencyInfo>()
+            //默认币种显示
+            List<CurrencyInfo> _currencyInfos = new List<CurrencyInfo>()
                 {
                     new CurrencyInfo (){ CurrencyCode="USD",CurrencyName = "美元",Rate = 0.0000M },
                     new CurrencyInfo (){ CurrencyCode="EUR",CurrencyName = "欧元",Rate = 0.0000M },
                     new CurrencyInfo (){ CurrencyCode="GBP",CurrencyName = "英镑",Rate = 0.0000M },
                     new CurrencyInfo (){ CurrencyCode="JPY",CurrencyName = "日元",Rate = 0.0000M },
                     new CurrencyInfo (){ CurrencyCode="HKD",CurrencyName = "港币",Rate = 0.0000M },
-
                 };
 
-                var _currencyRate = await _juHeApi.PostItemRateAsync(_currencyInfos.Select(it => it.CurrencyCode).ToArray());
-                if (_currencyRate.Count > 0)
+            var _currencyRate = await _juHeApi.PostItemRateAsync(_currencyInfos.Select(it => it.CurrencyCode).ToArray());
+            List<dynamic> reteInfos = new List<dynamic>();
+            if (_currencyRate.Count > 0)
+            {
+                foreach (var item in _currencyInfos)
                 {
-
-                    foreach (var item in _currencyInfos)
+                    var rateInfo = _currencyRate.Where(it => it.Name.Equals(item.CurrencyName)).FirstOrDefault();
+                    if (rateInfo != null)
                     {
-                        var rateInfo = _currencyRate.Where(it => it.Name.Equals(item.CurrencyName)).FirstOrDefault();
-                        if (rateInfo != null)
-                        {
-                            item.Rate = Convert.ToDecimal(rateInfo.FSellPri) / 100.00M;
-                        }
+                        item.Rate = Convert.ToDecimal((Convert.ToDecimal(rateInfo.FSellPri == null ? 0.00M : rateInfo.FSellPri) / 100.00M).ToString("#0.0000"));
+                        reteInfos.Add(new { 
+                            currCode= item.CurrencyCode,
+                            currName = item.CurrencyName,
+                            rate = item.Rate,
+                            lastUpdateDt = rateInfo.Date + " "+ rateInfo.Time
+                        });
                     }
                 }
-
-
-                return Ok(JsonView(true, "查询成功!", new
-                {
-                    //GroupNameData = groupNameData.Data,
-                    CurrencyInit = _currencyInfos
-                }));
             }
-            catch (Exception ex)
+
+            return Ok(JsonView(true, "查询成功!", new
             {
-                return Ok(JsonView(false, ex.Message));
-                throw;
-            }
+                //GroupNameData = groupNameData.Data,
+                visaInfos = visaInfos,
+                reteInfos = reteInfos
+            }));
         }
 
 

+ 2 - 1
OASystem/OASystem.Domain/Entities/Resource/Res_OfficialActivities.cs

@@ -43,8 +43,9 @@ namespace OASystem.Domain.Entities.Resource
         public string Address { get; set; }
         /// <summary>
         /// 联系人
+        /// 可能会存在特殊字符 使用nverchar
         /// </summary>
-        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(120)")]
+        [SugarColumn(IsNullable = true, ColumnDataType = "nvarchar(120)")]
         public string Contact { get; set; }
         /// <summary>
         /// 联系人职务

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

@@ -204,6 +204,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
             if (!string.IsNullOrEmpty(visitCountry))
             {
                 if (visitCountry.Contains("、")) countrys = visitCountry.Split("、").ToList();
+                else if (visitCountry.Contains("|")) countrys = visitCountry.Split("|").ToList();
                 else countrys.Add(visitCountry);
             }
             return countrys;