Selaa lähdekoodia

优化代码结构和新增签证费用功能

在 `FinancialController.cs` 中,简化了 `Document` 和 `DocumentBuilder` 的实例化方式,使用 `var` 关键字和 `Length` 替代 `Count()` 提升可读性。
在 `StatisticsController.cs` 中,使用 `Array.Empty<string>()` 初始化空数组,减少内存分配。
在 `ResourceController.cs` 中,新增 `VisaFeeStandardInit` 和 `VisaFeeQuoteByProvince` 方法,提供签证费用静态数据和报价功能。
在 `CountryFeeCostDto.cs` 和 `DelegationInfoRepository.cs` 中,优化了属性实现和变量声明,提升代码简洁性。
在 `appsettings.json` 中,注释掉了一些用户信息。
在 `Res_VisaFeeStandardDetails.cs` 中,将 `UrgentTime` 的数据类型从 `string` 改为 `int`。
在 `CountryFeeCostView.cs` 中,调整了属性定义,增加了对省份签证费用描述的支持。
Lyyyi 1 kuukausi sitten
vanhempi
commit
7a359eabbe

+ 8 - 8
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -959,8 +959,8 @@ namespace OASystem.API.Controllers
 
                     string tempPath = AppSettingsHelper.Get("WordBasePath") + $"ForeignReceivables/Temp/{tempName}";
                     //载入模板
-                    Document doc = new Document(tempPath);
-                    DocumentBuilder builder = new DocumentBuilder(doc);
+                    var doc = new Document(tempPath);
+                    var builder = new DocumentBuilder(doc);
 
                     #region 替换Word模板书签内容
 
@@ -1126,7 +1126,7 @@ namespace OASystem.API.Controllers
 
                     string tempPath = AppSettingsHelper.Get("WordBasePath") + $"ForeignReceivables/Temp/汇款通知.docx";
                     //载入模板
-                    Document doc = new Document(tempPath);
+                    var doc = new Document(tempPath);
                     DocumentBuilder builder = null;
 
                     var filesToZip = new List<string>();
@@ -2554,7 +2554,7 @@ namespace OASystem.API.Controllers
                             {
                                 string[] temparr = visaClientName.Split(',');
                                 string fistrStr = temparr[0];
-                                int count = temparr.Count();
+                                int count = temparr.Length;
 
                                 int tempId;
                                 bool success = int.TryParse(fistrStr, out tempId);
@@ -2600,7 +2600,7 @@ namespace OASystem.API.Controllers
                             {
                                 string[] temparr = bx_ClientName.Split(',');
                                 string fistrStr = temparr[0];
-                                int count = temparr.Count();
+                                int count = temparr.Length;
 
                                 int tempId;
                                 bool success = int.TryParse(fistrStr, out tempId);
@@ -5584,7 +5584,7 @@ Group by PriceType ", dto.diId);
 
                         string errMsg = string.Empty;
 
-                        if (air.FlightsDescription.Contains("\r\n") || Regex.Split(air.FlightsDescription, "\\d+\\.", RegexOptions.IgnoreCase).Count() > 1)
+                        if (air.FlightsDescription.Contains("\r\n") || Regex.Split(air.FlightsDescription, "\\d+\\.", RegexOptions.IgnoreCase).Length > 1)
                         {
                             var rowCode = Regex.Split(air.FlightsDescription, "\\d+\\.", RegexOptions.IgnoreCase).Where(x => !string.IsNullOrWhiteSpace(x)).ToArray();
                             for (int i = 0; i < rowCode.Length; i++)
@@ -6751,7 +6751,7 @@ Group by PriceType ", dto.diId);
                                 {
                                     string[] temparr = visaClientName.Split(',');
                                     string fistrStr = temparr[0];
-                                    int count = temparr.Count();
+                                    int count = temparr.Length;
 
                                     int tempId;
                                     bool success = int.TryParse(fistrStr, out tempId);
@@ -6795,7 +6795,7 @@ Group by PriceType ", dto.diId);
                                 {
                                     string[] temparr = bx_ClientName.Split(',');
                                     string fistrStr = temparr[0];
-                                    int count = temparr.Count();
+                                    int count = temparr.Length;
 
                                     int tempId;
                                     bool success = int.TryParse(fistrStr, out tempId);

+ 1 - 1
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -9043,7 +9043,7 @@ FROM
             if (dto.UserId < 1) return Ok(JsonView(false, "请传入有效的UserId参数;"));
             if (dto.Id < 1) return Ok(JsonView(false, "请传入有效的Id参数;"));
 
-            var _view = await _enterExitCostRep._OneClickClear(dto.Id, dto.DiId, dto.UserId);
+            var _view = await _enterExitCostRep.OneClickClear(dto.Id, dto.DiId, dto.UserId);
             await _sqlSugar.Updateable<Grp_DayOtherPrice>()
                             .Where(x => x.Diid == dto.DiId && x.IsDel == 0)
                             .SetColumns(x => new Grp_DayOtherPrice

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

@@ -45,6 +45,16 @@ namespace OASystem.API.Controllers
         private readonly List<int> _portIds;
         private readonly BasicInsuranceCostRepository _insuranceCostRep;
         private readonly GamesBudgetMasterRepository _gamesBudgetMasterRep;
+        /// <summary>
+        /// 签证费用归属省份静态数据
+        /// </summary>
+        private static readonly List<KeyValuePair<int, string>> _provinceData = new()
+        {
+            new(122, "四川"),
+            new(132, "云南"),
+            new(103, "重庆"),
+            new(108, "贵州")
+        };
 
         public ResourceController(
             IMapper mapper,
@@ -885,6 +895,33 @@ namespace OASystem.API.Controllers
 
         #region 签证费用资料 New
 
+        /// <summary>
+        /// 签证费用标准 Init 
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> VisaFeeStandardInit()
+        {
+            //签证费用类型数据
+            var visaFeeTypeData = new List<KeyValuePair<int, string>>
+            {
+                new(0, "因公"),
+                new(1, "因私")
+            };
+
+            //签证费用归属省份
+
+            var data = new
+            {
+                VisaFeeType = visaFeeTypeData.Select(x => new { Id = x.Key, Text = x.Value }),
+                Province = _provinceData.Select(x => new { Id = x.Key, Text = x.Value })
+            };
+
+            return Ok(JsonView(data));
+        }
+
+
         /// <summary>
         /// 签证费用标准 Info 
         /// </summary>
@@ -938,6 +975,27 @@ namespace OASystem.API.Controllers
             return Ok(await _countryFeeRep.SoftDelAsync(dto.CurrUserId, dto.Id));
         }
 
+        /// <summary>
+        /// 根据省份获取签证费用报价
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> VisaFeeQuoteByProvince(VisaFeesByProvinceDto dto)
+        {
+            //省份验证
+            var provinceIds = _provinceData.Select(x => x.Key).ToList();
+            if (!provinceIds.Contains(dto.ProvinceId))
+            {
+                return Ok(JsonView(false, "请选择有效的省份!"));
+            }
+
+
+            return Ok(await _countryFeeRep.VisaFeeQuoteAsync(dto.ProvinceId, dto.CountryName));
+        }
+
+
         #endregion
 
         #region 物料信息、供应商维护

+ 10 - 10
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -798,7 +798,7 @@ ORDER BY
                                 continue;
                             }
 
-                            string[] clientIds = new string[] { };
+                            string[] clientIds = Array.Empty<string>();
                             if (item.ClientName.Contains(','))
                             {
                                 clientIds = item.ClientName.Split(',');
@@ -984,7 +984,7 @@ ORDER BY
                     string visaClients = item.VisaClient;
                     if (!string.IsNullOrEmpty(visaClients))
                     {
-                        string[] clientIds = new string[] { };
+                        string[] clientIds = Array.Empty<string>();
                         if (visaClients.Contains(','))
                         {
                             clientIds = visaClients.Split(',');
@@ -1174,7 +1174,7 @@ ORDER BY
                         //    continue;
                         //}
 
-                        string[] clientIds = new string[] { };
+                        string[] clientIds = Array.Empty<string>();
                         if (insClients.Contains(','))
                         {
                             clientIds = insClients.Split(',');
@@ -1837,7 +1837,7 @@ ORDER BY
                     string visaClients = item.VisaClient;
                     if (!string.IsNullOrEmpty(visaClients))
                     {
-                        var clientIds = new string[] { };
+                        var clientIds = Array.Empty<string>();
                         if (visaClients.Contains(',')) clientIds = visaClients.Split(',');
                         else clientIds = new string[] { visaClients };
 
@@ -1958,7 +1958,7 @@ ORDER BY
                     string insClients = item.ClientName;
                     if (!string.IsNullOrEmpty(insClients))
                     {
-                        string[] clientIds = new string[] { };
+                        string[] clientIds = Array.Empty<string>();
                         if (insClients.Contains(',')) clientIds = insClients.Split(',');
                         else clientIds = new string[] { insClients };
 
@@ -2973,7 +2973,7 @@ ORDER BY
                                 continue;
                             }
 
-                            string[] clientIds = new string[] { };
+                            string[] clientIds = Array.Empty<string>();
                             if (item.ClientName.Contains(','))
                             {
                                 clientIds = item.ClientName.Split(',');
@@ -3158,7 +3158,7 @@ ORDER BY
                     string visaClients = item.VisaClient;
                     if (!string.IsNullOrEmpty(visaClients))
                     {
-                        string[] clientIds = new string[] { };
+                        string[] clientIds = Array.Empty<string>();
                         if (visaClients.Contains(','))
                         {
                             clientIds = visaClients.Split(',');
@@ -3346,7 +3346,7 @@ ORDER BY
                         //    continue;
                         //}
 
-                        string[] clientIds = new string[] { };
+                        string[] clientIds = Array.Empty<string>();
                         if (insClients.Contains(','))
                         {
                             clientIds = insClients.Split(',');
@@ -7030,7 +7030,7 @@ ORDER BY
                                                 samePeriodFee: 0.00M,
                                                 currPeriodGroupTotal: 0,
                                                 samePeriodGroupTotal: 0,
-                                                subFeeData: new StatisticsOPSubFeeYOY[] { }
+                                                subFeeData: Array.Empty<StatisticsOPSubFeeYOY>()
                                                 ));
                     }
                     yearData = yearData.OrderBy(x => x.FeeId).ToList();
@@ -8702,7 +8702,7 @@ WHERE
                         yearSsGross = yearSsIncomes - yearSsCost,
                         yearQtGross = yearQtIncomes - yearQtCost;
                 //年-团数量
-                int yearAllCount = yearGroupItems.Count(),
+                int yearAllCount = yearGroupItems.Length,
                     yearTzCount = yearGroupItems.Where(x => groupTypeIds.Contains(x.TeamDid)).Count(),
                     yearHwCount = yearGroupItems.Where(x => inforTypeIds.Contains(x.TeamDid)).Count(),
                     yearSsCount = yearGroupItems.Where(x => competitionTypeIds.Contains(x.TeamDid)).Count(),

+ 7 - 7
OASystem/OASystem.Api/OAMethodLib/GeneralMethod.cs

@@ -906,7 +906,7 @@ namespace OASystem.API.OAMethodLib
             //    .FirstAsync();
             //if (selectData != null) return false;
 
-            var _currencyRate = await _juHeApi.PostItemRateAsync(new string[] { });
+            var _currencyRate = await _juHeApi.PostItemRateAsync(Array.Empty<string>());
 
             string rateInfoStr = string.Empty;
 
@@ -1972,7 +1972,7 @@ namespace OASystem.API.OAMethodLib
             dt.Columns.Add("Sign", typeof(string));//标识:0表示为原生黑屏代码、1表示“+1”新增的黑屏代码
 
             //判断是否录入黑屏代码
-            if (listcode.Count() == 0 || listcode == null)
+            if (listcode.Count == 0 || listcode == null)
             {
                 dt.Rows.Add(null, null, null, null, null, null, null, null, null, null, null, "黑屏代码未录入!", null);
             }
@@ -1991,7 +1991,7 @@ namespace OASystem.API.OAMethodLib
                     int year = Convert.ToInt32(DateTime.Now.Year.ToString());
 
                     //读取单条黑屏代码
-                    for (int j = 0; j < CodeList.Count(); j++)
+                    for (int j = 0; j < CodeList.Length; j++)
                     {
                         //去除多余空格,方法二使用Split()方法进行分割,分割有一个选项是RemoveEmptyEntries
                         CodeList[j] = CodeList[j].Replace("\r\n", string.Empty).Replace("\\r\\n", string.Empty).TrimStart().TrimEnd();
@@ -2005,7 +2005,7 @@ namespace OASystem.API.OAMethodLib
                         Info = Info.Where(str => str != " ").ToArray();
 
                         //判断黑屏代码是否正确拆分; 理应拆成9段
-                        if (Info.Count() < 9)
+                        if (Info.Length < 9)
                         {
                             dt.Rows.Add(null, null, null, null, null, null, null, null, null, null, null, "本团组第" + (i + 1) + "段黑屏代码中第" + (j + 1) + " 条有误,请联系机票同事核对", null);
                         }
@@ -2212,7 +2212,7 @@ namespace OASystem.API.OAMethodLib
             dt.Columns.Add("isTransitShipment", typeof(bool));
 
             //判断是否录入黑屏代码
-            if (listcode.Count() == 0 || listcode == null)
+            if (listcode.Count == 0 || listcode == null)
             {
                 dt.Rows.Add(null, null, null, null, null, null, null, null, null, null, null, "黑屏代码未录入!", null, false);
             }
@@ -2227,7 +2227,7 @@ namespace OASystem.API.OAMethodLib
                     CodeList = CodeList.Where(str => !string.IsNullOrWhiteSpace(str)).ToArray();
 
                     //读取单条黑屏代码
-                    for (int j = 0; j < CodeList.Count(); j++)
+                    for (int j = 0; j < CodeList.Length; j++)
                     {
                         //去除多余空格,方法二使用Split()方法进行分割,分割有一个选项是RemoveEmptyEntries
                         CodeList[j] = CodeList[j].Replace("\r\n", string.Empty).Replace("\\r\\n", string.Empty).TrimStart().TrimEnd();
@@ -2353,7 +2353,7 @@ namespace OASystem.API.OAMethodLib
                     CodeList = CodeList.Where(str => !string.IsNullOrWhiteSpace(str)).ToArray();
 
                     //读取单条黑屏代码
-                    for (int j = 0; j < CodeList.Count(); j++)
+                    for (int j = 0; j < CodeList.Length; j++)
                     {
                         //去除多余空格,方法二使用Split()方法进行分割,分割有一个选项是RemoveEmptyEntries
                         CodeList[j] = CodeList[j].Replace("\r\n", string.Empty).Replace("\\r\\n", string.Empty).TrimStart().TrimEnd();

+ 3 - 3
OASystem/OASystem.Api/OAMethodLib/QiYeWeChatAPI/AppNotice/Library.cs

@@ -1224,7 +1224,7 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
                         .ToList();
                     if (auditUserList.Any())
                     {
-                        if (auditUserList.Count() > 1) isCheckValuable = true;
+                        if (auditUserList.Count > 1) isCheckValuable = true;
 
                         userIds.AddRange(auditUserList.Select(x => x.UserId.ToString()).ToList());
                         userIds = userIds.Distinct().ToList();
@@ -1320,7 +1320,7 @@ DateTime.Now.ToString("yyyy-MM-dd HH:mm"));
 [详细信息请前往OA系统查看](http://oa.pan-american-intl.com:4399/)   ",
 auditUserLabel,
 operationName,
-valuableUserNames.Count() - 1 ,
+valuableUserNames.Count - 1 ,
 groupLabel,
 goodsMsg,
 receiveInfo.Reason,
@@ -1415,7 +1415,7 @@ DateTime.Now.ToString("yyyy-MM-dd HH:mm"));
             {
                 string[] temparr = origin.Split(',');
                 string fistrStr = temparr[0];
-                int count = temparr.Count();
+                int count = temparr.Length;
 
                 int tempId;
                 bool success = int.TryParse(fistrStr, out tempId);

+ 6 - 2
OASystem/OASystem.Api/appsettings.json

@@ -415,9 +415,13 @@
           "Id": 149,
           "Name": "王鸽"
         },
+        //{
+        //  "Id": 330,
+        //  "Name": "刘琪"
+        //},
         {
-          "Id": 330,
-          "Name": "刘琪"
+          "Id": 383,
+          "Name": "李夏"
         },
         {
           "Id": 334,

+ 5 - 11
OASystem/OASystem.Domain/Dtos/Groups/GrpCreditCardPaymentDto.cs

@@ -1,15 +1,9 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace OASystem.Domain.Dtos.Groups
+namespace OASystem.Domain.Dtos.Groups
 {
     /// <summary>
     /// 费用审核 团组Item
     /// </summary>
-    public class ExpenseAuditGroupPageItemsDto: UserPageFuncDtoBase
+    public class ExpenseAuditGroupPageItemsDto : UserPageFuncDtoBase
     {
         public int PageIndex { get; set; }
 
@@ -29,7 +23,7 @@ namespace OASystem.Domain.Dtos.Groups
     }
 
 
-    public class Search_GrpCreditCardPaymentDto:UserPageFuncDtoBase
+    public class Search_GrpCreditCardPaymentDto : UserPageFuncDtoBase
     {
         /// <summary>
         /// 团组Id
@@ -47,10 +41,10 @@ namespace OASystem.Domain.Dtos.Groups
         public int AuditStatus { get; set; }
     }
 
-    public class Edit_GrpCreditCardPaymentDto:UserPageFuncDtoBase
+    public class Edit_GrpCreditCardPaymentDto : UserPageFuncDtoBase
     {
         public string CreditIdStr { get; set; }
         public int AuditCode { get; set; }
-       
+
     }
 }

+ 24 - 17
OASystem/OASystem.Domain/Dtos/Resource/CountryFeeCostDto.cs

@@ -1,11 +1,6 @@
 using OASystem.Domain.ViewModels.Resource;
-using System;
-using System.Collections.Generic;
 using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Text;
 using System.Text.RegularExpressions;
-using System.Threading.Tasks;
 
 namespace OASystem.Domain.Dtos.Resource
 {
@@ -54,7 +49,7 @@ namespace OASystem.Domain.Dtos.Resource
             get { return visaPrice; }
             set
             {
-                Regex reg = new Regex(@"[^0-9]{1,17}([.]{1}[^0-9]{1,4})?$");
+                var reg = new Regex(@"[^0-9]{1,17}([.]{1}[^0-9]{1,4})?$");
                 if (!reg.IsMatch(value.ToString()))
                 {
                     visaPrice = Convert.ToDecimal(value);
@@ -96,13 +91,12 @@ namespace OASystem.Domain.Dtos.Resource
         /// <summary>
         /// 一般签证时间
         /// </summary>
-        public string VisaTime 
-        { 
+        public string VisaTime
+        {
             get { return visaTime; }
             set
             {
-                int s = -1;
-                if (int.TryParse(value,out s))
+                if (int.TryParse(value, out _))
                 {
                     visaTime = value;
                 }
@@ -127,8 +121,7 @@ namespace OASystem.Domain.Dtos.Resource
             get { return ugentTime; }
             set
             {
-                int s = -1;
-                if (int.TryParse(value, out s))
+                if (int.TryParse(value, out _))
                 {
                     ugentTime = value;
                 }
@@ -147,7 +140,7 @@ namespace OASystem.Domain.Dtos.Resource
             get { return urgentPrice; }
             set
             {
-                Regex reg = new Regex(@"[^0-9]{1,17}([.]{1}[^0-9]{1,4})?$");
+                var reg = new Regex(@"[^0-9]{1,17}([.]{1}[^0-9]{1,4})?$");
                 if (!reg.IsMatch(value.ToString()))
                 {
                     urgentPrice = Convert.ToDecimal(value);
@@ -218,9 +211,9 @@ namespace OASystem.Domain.Dtos.Resource
         public int DeleteUserId { get; set; }
     }
 
-    public class QueryVisaCountryFeeCostsDto:DtoBase
+    public class QueryVisaCountryFeeCostsDto : DtoBase
     {
-        [Range(-1,1,ErrorMessage = $"请选择正确的签证费用类型,-1:全部 0:因公 1:因私 ")]
+        [Range(-1, 1, ErrorMessage = $"请选择正确的签证费用类型,-1:全部 0:因公 1:因私 ")]
         public int VisaFeeType { get; set; }
 
         public string CountryName { get; set; }
@@ -247,8 +240,8 @@ namespace OASystem.Domain.Dtos.Resource
     }
 
 
-    
-    public class VisaFeeStandardSaveDto : VisaFeeStandardInfoView 
+
+    public class VisaFeeStandardSaveDto : VisaFeeStandardInfoView
     {
         public int CurrUserId { get; set; }
     }
@@ -267,4 +260,18 @@ namespace OASystem.Domain.Dtos.Resource
         [Range(1, int.MaxValue, ErrorMessage = "请传入有效的CurrUserId!")]
         public int CurrUserId { get; set; }
     }
+
+    public class VisaFeesByProvinceDto : DtoBase
+    {
+        /// <summary>
+        /// 省份Id
+        /// </summary>
+        public int ProvinceId { get; set; }
+
+        /// <summary>
+        /// 国家名称
+        /// </summary>
+        [Required(ErrorMessage = "国家名称不能为空!")]
+        public string CountryName { get; set; }
+    }
 }

+ 3 - 0
OASystem/OASystem.Domain/Entities/Groups/Grp_CreditCardPayment.cs

@@ -175,16 +175,19 @@ namespace OASystem.Domain.Entities.Groups
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10, 2)")]
         public decimal PayThenMoneyOld { get; set; }
+
         /// <summary>
         /// 上次付款时间
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "varchar(30)")]
         public string UpdateDate { get; set; }
+
         /// <summary>
         /// 收款方
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "varchar(255)")]
         public string Payee { get; set; }
+
         /// <summary>
         /// 人民币费用
         /// </summary>

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

@@ -99,8 +99,8 @@
         /// <summary>
         /// 加急时间(工作日)
         /// </summary>
-        [SugarColumn(ColumnName = "UrgentTime", ColumnDescription = "加急时间(工作日)", IsNullable = true, ColumnDataType = "varchar(50)")]
-        public string UrgentTime { get; set; }
+        [SugarColumn(ColumnName = "UrgentTime", ColumnDescription = "加急时间(工作日)", IsNullable = true, ColumnDataType = "int")]
+        public int UrgentTime { get; set; }
 
         /// <summary>
         /// 加急费用

+ 16 - 47
OASystem/OASystem.Domain/ViewModels/Resource/CountryFeeCostView.cs

@@ -1,5 +1,4 @@
 using OASystem.Domain.Entities.Resource;
-using System;
 using System.Text.Json.Serialization;
 
 namespace OASystem.Domain.ViewModels.Resource
@@ -49,7 +48,7 @@ namespace OASystem.Domain.ViewModels.Resource
         /// <summary>
         /// 送签地址
         /// </summary>
-        public string VisaAddress { get; set; } 
+        public string VisaAddress { get; set; }
 
         /// <summary>
         /// 是否落地签
@@ -114,7 +113,7 @@ namespace OASystem.Domain.ViewModels.Resource
         /// <summary>
         /// 加急时间(工作日)
         /// </summary>
-        public string UrgentTime { get; set; }
+        public int UrgentTime { get; set; }
 
         /// <summary>
         /// 加急费用
@@ -195,50 +194,16 @@ namespace OASystem.Domain.ViewModels.Resource
         public List<VisaFeeStandardDetails> VisaFees { get; set; }
 
         /// <summary>
-        /// 四川签证费用描述
+        /// 省份签证费用描述
         /// </summary>
-        public string SiChuanVisaFeeLabel
+        public string ProvinceVisaFeeLabel
         {
             get
             {
-                return GetVisaFeeLabel(122);
+                return GetVisaFeeLabel();
             }
         }
 
-        /// <summary>
-        /// 重庆签证费用描述
-        /// </summary>
-        public string ChongQingVisaFeeLabel
-        {
-            get
-            {
-                return GetVisaFeeLabel(103);
-            }
-        }
-
-        /// <summary>
-        /// 贵州签证费用描述
-        /// </summary>
-        public string GuiZhouVisaFeeLabel
-        {
-            get
-            {
-                return GetVisaFeeLabel(108);
-            }
-        }
-
-        /// <summary>
-        /// 云南签证费用描述
-        /// </summary>
-        public string YunNanVisaFeeLabel
-        {
-            get
-            {
-                return GetVisaFeeLabel(132);
-            }
-        }
-
-       
         /// <summary>
         /// 最后更新人
         /// </summary>
@@ -261,16 +226,17 @@ namespace OASystem.Domain.ViewModels.Resource
         }
 
         /// <summary>
-        /// 获取城市签证描述
+        /// 获取省份签证描述
         /// </summary>
-        /// <param name="provinceId"></param>
         /// <returns></returns>
-        private string GetVisaFeeLabel(int provinceId)
+        private string GetVisaFeeLabel()
         {
             var label = new StringBuilder();
-            var info = VisaFees.FirstOrDefault(x => x.ProvinceId == provinceId);
-            if (info != null)
+
+            VisaFees.ForEach(info =>
             {
+                label.AppendLine($"{info.ProvinceName}");
+                label.AppendLine();
 
                 if (FeeType == 0) //因公
                 {
@@ -289,7 +255,7 @@ namespace OASystem.Domain.ViewModels.Resource
                     label.AppendLine($"公务普通护照签证费:{info.SmallVisaPrice:#0.00}");
                     label.AppendLine($"公务普通护照代办费:{info.SmallAgencyFee:#0.00}");
 
-                    if (provinceId == 103)
+                    if (info.ProvinceId == 103)
                     {
                         label.AppendLine($"重庆外办出入境证明费用(普通):{info.NormExtFee:#0.00}");
                         label.AppendLine($"重庆外办出入境证明费用(加急):{info.UrgExtFee:#0.00}");
@@ -310,7 +276,10 @@ namespace OASystem.Domain.ViewModels.Resource
                     label.AppendLine($"送签地点:{info.VisaAddress}");
                     label.AppendLine($"办理时间(工作日):{info.VisaTime}");
                 }
-            }
+
+                label.AppendLine();
+                label.AppendLine();
+            });
 
             return label.ToString();
         }

+ 27 - 28
OASystem/OASystem.Infrastructure/Repositories/Groups/DelegationInfoRepository.cs

@@ -163,7 +163,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
         /// <returns></returns>
         public async Task<Result> PostShareGroupInfos(int portType)
         {
-            Result result = new Result() { Code = -2, Msg = "未知错误", Data = new List<object>() { } };
+            var result = new Result() { Code = -2, Msg = "未知错误", Data = new List<object>() { } };
 
             string sql = string.Format(@"Select Id,TeamName,TourCode,ClientName,VisitCountry,VisitStartDate,VisitEndDate,VisitDays,VisitPNumber 
                                              From Grp_DelegationInfo With(NoLock) Where IsDel = 0 Order By VisitStartDate Desc");
@@ -204,7 +204,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
         /// <returns></returns>
         public async Task<Result> PostGroupInfo(GroupInfoDto dto)
         {
-            Result result = new Result() { Code = -2, Msg = "未知错误" };
+            var result = new Result() { Code = -2, Msg = "未知错误" };
 
             if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3) //Web Or Android
             {
@@ -242,7 +242,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
             if (!string.IsNullOrEmpty(teamName))
             {
                 str = teamName;
-                List<string> searchreplaces = new List<string>() { "|", " ", "/", ",", "," };
+                var searchreplaces = new List<string>() { "|", " ", "/", ",", "," };
                 foreach (var item in searchreplaces)
                 {
                     if (str.Contains(item))
@@ -263,7 +263,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
         /// <returns></returns>
         public List<string> GroupSplitCountry(string visitCountry)
         {
-            List<string> countrys = new List<string>();
+            var countrys = new List<string>();
 
             if (!string.IsNullOrEmpty(visitCountry))
             {
@@ -281,9 +281,9 @@ namespace OASystem.Infrastructure.Repositories.Groups
         /// <returns></returns>
         public async Task<Result> GetGroupPageList(GroupCommissionDto dto)
         {
-            Result result = new Result() { Code = -2, Msg = "未知错误" };
+            var result = new Result() { Code = -2, Msg = "未知错误" };
 
-            ListViewBase<DelegationPageListView> groupsInfoPageList = new ListViewBase<DelegationPageListView>()
+            var groupsInfoPageList = new ListViewBase<DelegationPageListView>()
             {
                 ReceiveDt = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
             };
@@ -352,7 +352,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
         /// <returns></returns>
         public async Task<Result> GetGroupList(GroupListDto dto)
         {
-            Result result = new Result() { Code = -2, Msg = "未知错误" };
+            var result = new Result() { Code = -2, Msg = "未知错误" };
 
             if (dto.PortType == 1)
             {
@@ -415,7 +415,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
         /// <returns></returns>
         public async Task<Result> GetGroupInfo(GroupInfoDto dto)
         {
-            Result result = new Result() { Code = -2, Msg = "未知错误" };
+            var result = new Result() { Code = -2, Msg = "未知错误" };
 
             if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3) //Web Or Android
             {
@@ -466,11 +466,11 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         {
                             var param = new TourClientListProcessInfo();
                             var clientInfo = DeleClientArr.FirstOrDefault(x => x.Id == item.ClientId);
-                            if (clientInfo == null) clientInfo = new Crm_DeleClient();
+                            clientInfo ??= new Crm_DeleClient();
                             var clientIDInfo = _CustomerCerts.FirstOrDefault(x => x.DcId == item.ClientId); //身份证信息
-                            if (clientIDInfo == null) clientIDInfo = new Crm_CustomerCert();
+                            clientIDInfo ??= new Crm_CustomerCert();
                             var Company = CompanyArr.FirstOrDefault(x => x.Id == clientInfo.CrmCompanyId);
-                            if (Company == null) Company = new Crm_CustomerCompany();
+                            Company ??= new Crm_CustomerCompany();
 
                             param.IDCardNo = clientIDInfo.CertNo;
                             param.Remark = item.Remark;
@@ -513,11 +513,11 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         {
                             var param = new TourClientListProcessInfo();
                             var clientInfo = DeleClientArr.FirstOrDefault(x => x.Id == item.ClientId);
-                            if (clientInfo == null) clientInfo = new Crm_DeleClient();
+                            clientInfo ??= new Crm_DeleClient();
                             var clientIDInfo = _CustomerCerts.FirstOrDefault(x => x.DcId == item.ClientId); //身份证信息
-                            if (clientIDInfo == null) clientIDInfo = new Crm_CustomerCert();
+                            clientIDInfo ??= new Crm_CustomerCert();
                             var Company = CompanyArr.FirstOrDefault(x => x.Id == clientInfo.CrmCompanyId);
-                            if (Company == null) Company = new Crm_CustomerCompany();
+                            Company ??= new Crm_CustomerCompany();
 
                             param.IDCardNo = clientIDInfo.CertNo;
                             param.Remark = item.Remark;
@@ -659,7 +659,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
             return info;
         }
 
-        private List<CityTree> MoveElementToFront(List<CityTree> list, string elementName)
+        private static List<CityTree> MoveElementToFront(List<CityTree> list, string elementName)
         {
             var element = list.FirstOrDefault(x => x.Name_CN == elementName);
             if (element != null)
@@ -678,7 +678,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
         /// <returns></returns>
         public async Task<Result> GroupEditBasicSource(GroupListDto dto)
         {
-            Result result = new Result() { Code = -2, Msg = "未知错误" };
+            var result = new Result() { Code = -2, Msg = "未知错误" };
 
             if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3) //web
             {
@@ -764,7 +764,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
         /// <returns></returns>
         public async Task<Result> GroupOperation(GroupOperationDto dto)
         {
-            Result result = new Result() { Code = -2, Msg = "未知错误" };
+            var result = new Result() { Code = -2, Msg = "未知错误" };
 
             if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3) //web
             {
@@ -831,7 +831,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         }
                     }
 
-                    Grp_DelegationInfo delegationInfo = new Grp_DelegationInfo()
+                    var delegationInfo = new Grp_DelegationInfo()
                     {
                         CityId = dto.CityId,
                         SalesQuoteNo = dto.SalesQuoteNo,
@@ -975,7 +975,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
         /// <returns></returns>
         public async Task<Result> GroupDel(GroupDelDto dto)
         {
-            Result result = new Result() { Code = -2, Msg = "未知错误" };
+            var result = new Result() { Code = -2, Msg = "未知错误" };
 
             if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3) //web
             {
@@ -1007,12 +1007,12 @@ namespace OASystem.Infrastructure.Repositories.Groups
         /// <returns></returns>
         public async Task<Result> GetGroupSalesQuoteNo()
         {
-            Result result = new Result() { Code = -2, Msg = "未知错误" };
+            var result = new Result() { Code = -2, Msg = "未知错误" };
 
             string teamCodeSql = string.Format("Select SalesQuoteNo From Grp_DelegationInfo");
             var teamCodeItem = await _sqlSugar.SqlQueryable<SalesQuoteNoView>(teamCodeSql).ToListAsync();
 
-            string teamCode = "";
+            string teamCode;
             while (true)
             {
                 teamCode = Tools.CommonFun.GetRandomAllStr(6);
@@ -1035,12 +1035,12 @@ namespace OASystem.Infrastructure.Repositories.Groups
         /// <returns></returns>
         public async Task<Result> GroupDeleteById()
         {
-            Result result = new Result() { Code = -2, Msg = "未知错误" };
+            var result = new Result() { Code = -2, Msg = "未知错误" };
 
             string teamCodeSql = string.Format("Select TourCode From Grp_DelegationInfo");
             var teamCodeItem = await _sqlSugar.SqlQueryable<TeamCodeView>(teamCodeSql).ToListAsync();
 
-            string teamCode = "";
+            string teamCode;
             while (true)
             {
                 teamCode = Tools.CommonFun.GetRandomAllStr(6);
@@ -1063,8 +1063,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
         /// <returns></returns>
         public async Task<Result> ConfirmationGroup(ConfirmationGroupDto dto)
         {
-            Result result = new Result() { Code = -2, Msg = "未知错误" };
-
+            var result = new Result() { Code = -2, Msg = "未知错误" };
 
             string teamCode = "";
             if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3) //web
@@ -1166,7 +1165,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 mobileSqlWhere += string.Format($@"GroupName Like '%{groupName}%'");
             }
 
-            List<int> userIds = new List<int>() { -1, 21 };
+            var userIds = new List<int>() { -1, 21 };
 
             if (!userIds.Contains(userId))
             {
@@ -1229,7 +1228,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
         /// <returns></returns>
         public async Task<Result> GetGroupNameAndVisaNationality(GroupNameDto dto)
         {
-            Result result = new Result() { Code = -2, Msg = "未知错误" };
+            var result = new Result() { Code = -2, Msg = "未知错误" };
 
             if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3) //web
             {
@@ -1265,7 +1264,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
         /// <returns></returns>
         public async Task<Result> GetCrmByGroupId(ClientByGroupIdDto dto)
         {
-            Result result = new Result() { Code = -2 };
+            var result = new Result() { Code = -2 };
             if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3)
             {
                 string sql = string.Format(@"Select gdjc.GrpDCId grpId,cdc.Id,cdc.LastName+cdc.FirstName clientName,cdc.Tel,ccc.CertNo CerdNo 

+ 18 - 28
OASystem/OASystem.Infrastructure/Repositories/Groups/EnterExitCostRepository.cs

@@ -1,21 +1,11 @@
 
 using AutoMapper;
-using EyeSoft.Collections.Generic;
-using EyeSoft.Runtime.InteropServices;
-using NPOI.SS.Formula.Functions;
 using OASystem.Domain;
 using OASystem.Domain.Dtos.Groups;
-using OASystem.Domain.Dtos.System;
 using OASystem.Domain.Entities.Groups;
 using OASystem.Domain.ViewModels.Groups;
 using OASystem.Infrastructure.Repositories.System;
 using OASystem.Infrastructure.Tools;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Security.Policy;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace OASystem.Infrastructure.Repositories.Groups
 {
@@ -32,7 +22,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
             : base(sqlSugar)
         {
             _setDataRep = setDataRep;
-            _mapper = mapper; 
+            _mapper = mapper;
             _groupRep = groupRep;
         }
 
@@ -80,7 +70,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
         /// <param name="groupId"></param>
         /// <param name="currUserId"></param>
         /// <returns></returns>
-        public async Task<bool> InitPerm(int groupId,int currUserId)
+        public async Task<bool> InitPerm(int groupId, int currUserId)
         {
             var feeBasePerm = AppSettingsHelper.Get<FeeBasePermView>("FeeBasePerm");
             var intlDplmcyBasePerm = new List<PermissionViewUserview>(); //国交部
@@ -97,7 +87,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
             /*
              * 权限分配规则
-             * 刘琪、王鸽、朱琳的账号:默认只能、王、朱查看
+             * 刘琪、王鸽、朱琳的账号:默认只能李夏、王、朱查看
              * 舒庆的账号 默认只能舒、刘、王、朱查看
              * 其他销售 默认只能自己、舒、刘、王、朱查看
              */
@@ -135,7 +125,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     feeBasePermIds.Add(380);
                 }
                 //2.通过城市Id判断是否包含城市
-                else 
+                else
                 {
                     var groupCity = await _sqlSugar.Queryable<Sys_Cities>().FirstAsync(x => x.Id == groupInfo.CityId && x.IsDel == 0);
                     if (groupCity != null)
@@ -144,7 +134,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                             .FirstAsync(x => x.Id == groupCity.ParentId && cityPerm.Contains(x.Name_CN) && x.IsDel == 0);
                         if (groupProvince != null) feeBasePermIds.Add(380);
                     }
-                }    
+                }
             }
 
 
@@ -187,12 +177,12 @@ namespace OASystem.Infrastructure.Repositories.Groups
             if (!permissionIds.Contains(permission)) return (false, false);
 
             var feeBasePerm = AppSettingsHelper.Get<FeeBasePermView>("FeeBasePerm");
-            var feeBasePermUserIds = new List<int>(); 
+            var feeBasePermUserIds = new List<int>();
 
             if (feeBasePerm.Any())
             {
                 var intlDplmcyData = feeBasePerm.Find(x => x.Dept.Equals("IntlDplmcy"));
-                if (intlDplmcyData != null) if (intlDplmcyData.Users.Any()) feeBasePermUserIds.AddRange(intlDplmcyData.Users.Select(x=>x.Id).ToList());
+                if (intlDplmcyData != null) if (intlDplmcyData.Users.Any()) feeBasePermUserIds.AddRange(intlDplmcyData.Users.Select(x => x.Id).ToList());
 
                 var mktStratData = feeBasePerm.Find(x => x.Dept.Equals("MktStrat"));
                 if (mktStratData != null) if (mktStratData.Users.Any()) feeBasePermUserIds.AddRange(mktStratData.Users.Select(x => x.Id).ToList());
@@ -214,7 +204,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
         /// <returns></returns>
         public async Task<Result> SetEnterExitCostCurrencyChange()
         {
-            Result result = new Result { Code = -1, Msg = "未知错误" };
+            var result = new Result { Code = -1, Msg = "未知错误" };
 
             var enterExitList = await _sqlSugar.Queryable<Grp_EnterExitCost>().ToListAsync();
 
@@ -249,7 +239,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
         public async Task<(bool, string)> MobilePermissionsValidationAsync(int groupId, int currUserId, int permissionType = 1)
         {
             string msg = string.Empty;
-            (bool viewPerm,bool assignPerm) = await PermissionValidationAsync(groupId, currUserId);//分配权限
+            (bool viewPerm, bool assignPerm) = await PermissionValidationAsync(groupId, currUserId);//分配权限
 
             var enterExitCostData = await _sqlSugar
                 .Queryable<Grp_EnterExitCost>()
@@ -329,13 +319,13 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
                     int provinceId = 122;
                     var groupNames = await _groupRep.EnterExitCostGroupNameInfoAsync(dto.DiId);
-                    if (groupNames!=null)
+                    if (groupNames != null)
                     {
                         provinceId = groupNames.ProvinceId;
                     }
 
                     //云南暂无三公费用标准 暂时先用四川的
-                    if (provinceId == 132) provinceId = 122; 
+                    if (provinceId == 132) provinceId = 122;
 
                     enterExitCostInfoView.ProvinceId = provinceId;
 
@@ -531,7 +521,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     if (enterExitCost.Id > 0) //修改
                     {
                         //操作权限验证 可查看人员亦可编辑
-                        (bool viewPerm,bool assignPerm) = await PermissionValidationAsync(enterExitCost.DiId, dto.UserId);
+                        (bool viewPerm, bool assignPerm) = await PermissionValidationAsync(enterExitCost.DiId, dto.UserId);
                         if (!viewPerm)
                         {
                             _sqlSugar.RollbackTran();
@@ -651,7 +641,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
         /// <returns></returns>
         public Task<Result> PostEnterExitCostSubItemDel(EnterExitCostSubItemDelDto dto)
         {
-            Result result = new Result();
+            var result = new Result();
 
             var data = new Grp_DayAndCost()
             {
@@ -700,14 +690,14 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         return result;
                     }
 
-                    await _sqlSugar.Insertable(info) .ExecuteCommandAsync();   
+                    await _sqlSugar.Insertable(info).ExecuteCommandAsync();
                 }
                 else
                 {
                     await _sqlSugar.Updateable(info)
                     .IgnoreColumns(it => new { it.CreateUserId, it.CreateTime, it.IsDel })
                     .WhereColumns(it => it.Id)
-                    .ExecuteCommandAsync();  
+                    .ExecuteCommandAsync();
                 }
 
                 result.Code = 200;
@@ -734,16 +724,16 @@ namespace OASystem.Infrastructure.Repositories.Groups
         /// <param name="id"></param>
         /// <param name="diid"></param>
         /// <returns></returns>
-        public async Task<Result> _OneClickClear(int id, int diId, int userId)
+        public async Task<Result> OneClickClear(int id, int diId, int userId)
         {
-            Result result = new Result() { Code = -1, Msg = "操作成功!" };
+            var result = new Result() { Code = -1, Msg = "操作成功!" };
 
             if (id < 1) return result = new Result() { Code = -1, Msg = "请传入有效的Id参数!" };
             if (diId < 1) return result = new Result() { Code = -1, Msg = "请传入有效的Id参数!" };
             if (userId < 1) return result = new Result() { Code = -1, Msg = "请传入有效的UserId参数!" };
 
             BeginTran();
-            Grp_EnterExitCost _EnterExitCost = new Grp_EnterExitCost()
+            var _EnterExitCost = new Grp_EnterExitCost()
             {
                 Id = id,
                 IsDel = 1,