浏览代码

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

jiangjc 1 年之前
父节点
当前提交
9d02b86cff

+ 3 - 3
OASystem/OASystem.Api/Controllers/AuthController.cs

@@ -271,9 +271,9 @@ namespace OASystem.API.Controllers
         [Route("UpdPassword")]
         public async Task<IActionResult> UpdateUserPassword(UpdateDto dto)
         {
-            Result result = new Result();
-            var httpContext = HttpContext.User.Claims.FirstOrDefault(it => it.Type == ClaimTypes.Name)?.Value;
-            Sys_Users sys_Users = _mapper.Map<Sys_Users>(dto);
+            //Result result = new Result();
+            //var httpContext = HttpContext.User.Claims.FirstOrDefault(it => it.Type == ClaimTypes.Name)?.Value;
+            //Sys_Users sys_Users = _mapper.Map<Sys_Users>(dto);
             var _view = await _loginRep.ChangePassword(dto.UserId,dto.Password);
             if (_view.Code == 0) return Ok(JsonView(true,"操作成功!"));
 

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

@@ -1668,6 +1668,7 @@ namespace OASystem.API.Controllers
 
             List<PostSyntheticalReceivableByDateRangeView> list_rst = _sqlSugar.SqlQueryable<PostSyntheticalReceivableByDateRangeView>(sql).ToList();
 
+            var setData = _sqlSugar.Queryable<Sys_SetData>().Where(it => it.IsDel == 0).ToList();
 
             decimal sumAll_fr = 0M; //应收
             decimal sumAll_pr = 0M; //已收
@@ -1706,11 +1707,21 @@ namespace OASystem.API.Controllers
                     //2.已收
                     string sql_pr = string.Format(@" Select * From Fin_ProceedsReceived Where IsDel=0 And Diid={0} ", diId);
                     List<Fin_ProceedsReceived> list_pr = _sqlSugar.SqlQueryable<Fin_ProceedsReceived>(sql_pr).ToList();
+                    List<ProceedsReceivedInfoView> prDatas = new List<ProceedsReceivedInfoView>();
                     foreach (var item_pr in list_pr)
                     {
                         sum_pr += item_pr.Price;
                         str_client += string.Format(@"{0};", item_pr.Client);
                         str_schedule += string.Format(@"{0};", item_pr.Remark);
+
+                        prDatas.Add(new ProceedsReceivedInfoView
+                        {
+                            time = item_pr.SectionTime,
+                            client = item_pr.Client,
+                            money = item_pr.Price.ToString("#0.00"),
+                            currency = setData.Find(it => it.Id == item_pr.Currency)?.Name ?? "",
+                            receivablesType = setData.Find(it => it.Id == item_pr.ReceivablesType)?.Name ?? ""
+                        });
                     }
                     if (str_schedule.Length > 0)
                     {
@@ -1744,6 +1755,7 @@ namespace OASystem.API.Controllers
                     item_rst.balPrice = ((sum_fr + sum_extra) - (sum_pr - sum_refund)).ToString("#0.00");
                     item_rst.prClient = str_client;
                     item_rst.schedule = str_schedule;
+                    item_rst.prItem = prDatas;
 
                     string tempVisitDate = Convert.ToDateTime(item_rst.visitDate).ToString("yyyy-MM-dd");
 

+ 0 - 13
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -9921,9 +9921,6 @@ namespace OASystem.API.Controllers
 
                 return Ok(JsonView(false, ex.Message));
             }
-
-
-
         }
 
         /// <summary>
@@ -11376,11 +11373,9 @@ namespace OASystem.API.Controllers
         //                else {
         //                    temp.PassengerType = -1;
         //                }
-
         //                temp.VisaNumber = item.VisaNumber;
         //                temp.VisaFreeNumber = item.VisaFreeNumber;
         //                temp.CreateUserId = item.Operators;
-
         //                DateTime dt_ct;
         //                bool b_ct = DateTime.TryParse(item.OperatorsDate, out dt_ct);
         //                if (b_ct)
@@ -11391,31 +11386,25 @@ namespace OASystem.API.Controllers
         //                {
         //                    temp.CreateTime = DateTime.Now;
         //                }
-
         //                temp.DeleteTime = "";
         //                temp.DeleteUserId = 0;
         //                temp.Remark = item.Remark;
         //                if (string.IsNullOrEmpty(temp.Remark)) {
         //                    temp.Remark = "";
         //                }
-
         //                temp.IsDel = item.IsDel;
         //                temp.VisaDescription = item.VisaAttachment;
-
         //                string sqlInsert = string.Format(@" INSERT INTO [dbo].[Grp_VisaInfo]
-
         //([Id]
         //           ,[DIId]
         //           ,[VisaClient]
         //           ,[VisaPrice]
         //           ,[VisaCurrency]
-
         //           ,[IsThird]
         //           ,[PassengerType]
         //           ,[VisaNumber]
         //           ,[VisaFreeNumber]
         //           ,[CreateUserId]
-
         //           ,[CreateTime]
         //           ,[DeleteTime]
         //           ,[DeleteUserId]
@@ -11431,8 +11420,6 @@ namespace OASystem.API.Controllers
         //);
         //               await _airTicketResRep.ExecuteCommandAsync(sqlInsert);
         //            }
-
-
         //            return Ok(JsonView(true, "操作成功!"));
         //        }
 

+ 41 - 71
OASystem/OASystem.Api/Controllers/ResourceController.cs

@@ -783,39 +783,31 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> QueryCountryFeeCost(DtoBase dto)
         {
-            try
+
+            if (dto.PortType == 1)
             {
-                if (dto.PortType == 1)
-                {
-                    var CountryFee = _countryFeeRep.QueryDto<Res_CountryFeeCost, CountryFeeCostView>().ToList();
-                    if (CountryFee.Count == 0)
-                    {
-                        return Ok(JsonView(false, "暂无数据!"));
-                    }
-                    CountryFee = CountryFee.OrderByDescending(s => s.CreateTime).ToList();
-                    return Ok(JsonView(true, "查询成功", CountryFee));
-                }
-                else if (dto.PortType == 2)
+                var CountryFee = _countryFeeRep.QueryDto<Res_CountryFeeCost, CountryFeeCostView>().ToList();
+                if (CountryFee.Count == 0)
                 {
-                    var CountryFee = _countryFeeRep.QueryDto<Res_CountryFeeCost, CountryFeeCostView>().ToList();
-                    if (CountryFee.Count == 0)
-                    {
-                        return Ok(JsonView(false, "暂无数据!"));
-                    }
-                    CountryFee = CountryFee.OrderByDescending(s => s.CreateTime).ToList();
-                    return Ok(JsonView(true, "查询成功", CountryFee));
+                    return Ok(JsonView(false, "暂无数据!"));
                 }
-                else
+                CountryFee = CountryFee.OrderByDescending(s => s.CreateTime).ToList();
+                return Ok(JsonView(true, "查询成功", CountryFee));
+            }
+            else if (dto.PortType == 2)
+            {
+                var CountryFee = _countryFeeRep.QueryDto<Res_CountryFeeCost, CountryFeeCostView>().ToList();
+                if (CountryFee.Count == 0)
                 {
-                    return Ok(JsonView(false, "请传入PortType参数!1:Web,2:Android,3:IOS"));
+                    return Ok(JsonView(false, "暂无数据!"));
                 }
+                CountryFee = CountryFee.OrderByDescending(s => s.CreateTime).ToList();
+                return Ok(JsonView(true, "查询成功", CountryFee));
             }
-            catch (Exception ex)
+            else
             {
-                return Ok(JsonView(false, ex.Message));
-                throw;
+                return Ok(JsonView(false, "请传入PortType参数!1:Web,2:Android,3:IOS"));
             }
-
         }
 
         /// <summary>
@@ -827,45 +819,30 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> OperationCountryFeeCost(OperationCountryFeeCostDto dto)
         {
-            try
+            if (string.IsNullOrWhiteSpace(dto.VisaContinent))
             {
-                if (dto.VisaContinent == "")
-                {
-                    return Ok(JsonView(false, "请检查州名是否填写!"));
-                }
-                if (dto.VisaCountry == "")
-                {
-                    return Ok(JsonView(false, "请检查国家名是否填写!"));
-                }
-                if (dto.VisaTime == "1")
-                {
-                    return Ok(JsonView(false, "请检一般签证时间是否填写正确!"));
-                }
-                if (dto.UrgentTime == "1")
-                {
-                    return Ok(JsonView(false, "请检加急时间是否填写正确!"));
-                }
-                if (dto.VisaPrice == 0)
-                {
-                    return Ok(JsonView(false, "请检查签证费用是否填写正确,小数点后可1到2位!"));
-                }
-                if (dto.VisaPrice == 1)
-                {
-                    return Ok(JsonView(false, "请检查签证加急费用是否填写正确,小数点后可1到2位!"));
-                }
-                Result result = await _countryFeeRep.OperationCountryFeeCost(dto);
-                if (result.Code != 0)
-                {
-                    return Ok(JsonView(false, result.Msg));
-                }
-                return Ok(JsonView(true, result.Msg));
+                return Ok(JsonView(false, "请检查州名是否填写!"));
             }
-            catch (Exception ex)
+            if (string.IsNullOrWhiteSpace(dto.VisaCountry))
             {
-                return Ok(JsonView(false, "程序错误!"));
-                throw;
+                return Ok(JsonView(false, "请检查国家名是否填写!"));
+            }
+            if (string.IsNullOrWhiteSpace(dto.VisaTime))
+            {
+                return Ok(JsonView(false, "请检一般签证时间是否填写正确!"));
+            }
+            if (string.IsNullOrWhiteSpace(dto.UrgentTime))
+            {
+                return Ok(JsonView(false, "请检加急时间是否填写正确!"));
             }
 
+            Result result = await _countryFeeRep.OperationCountryFeeCost(dto);
+            if (result.Code == 0)
+            {
+                return Ok(JsonView(true, result.Msg));
+            }
+            return Ok(JsonView(false, result.Msg));
+
         }
 
         /// <summary>
@@ -876,20 +853,13 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> DelCountryFeeCost(DelCountryFeeCostDto dto)
         {
-            try
-            {
-                var res = await _countryFeeRep.SoftDeleteByIdAsync<Res_CountryFeeCost>(dto.Id.ToString(), dto.DeleteUserId);
-                if (!res)
-                {
-                    return Ok(JsonView(false, "删除失败"));
-                }
-                return Ok(JsonView(true, "删除成功!"));
-            }
-            catch (Exception ex)
+            var res = await _countryFeeRep.SoftDeleteByIdAsync<Res_CountryFeeCost>(dto.Id.ToString(), dto.DeleteUserId);
+            if (!res)
             {
-                return Ok(JsonView(false, "程序错误!"));
-                throw;
+                return Ok(JsonView(false, "删除失败"));
             }
+            return Ok(JsonView(true, "删除成功!"));
+
         }
         #endregion
 

+ 15 - 0
OASystem/OASystem.Domain/Dtos/Resource/CountryFeeCostDto.cs

@@ -75,6 +75,21 @@ namespace OASystem.Domain.Dtos.Resource
         /// </summary>
         public string VisaType { get; set; }
 
+        /// <summary>
+        /// 大公务费用 
+        /// 新增参数
+        /// 雷怡 2024-05-07 15:45:09
+        /// </summary>
+        public decimal GrandBusinessAgencyFee { get; set; }
+
+
+        /// <summary>
+        /// 小公务费用 
+        /// 新增参数
+        /// 雷怡 2024-05-07 15:45:09
+        /// </summary>
+        public decimal PettyBusinessAgencyFee { get; set; }
+
         private string visaTime;
         /// <summary>
         /// 一般签证时间

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

@@ -33,12 +33,24 @@ namespace OASystem.Domain.Entities.Groups
         [SugarColumn(IsNullable = true,ColumnDataType = "int")]
         public int CountryVisaFeeId { get; set; }
 
+
+        /// <summary>
+        /// 代办费 - 公务 类型 1 大公务 2 小公务
+        /// 新增字段
+        /// 雷怡 2024-05-07 15:45:09
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int OBType { get; set; }
+
         /// <summary>
         /// 代办费
+        /// 新增字段
+        /// 雷怡 2024-05-07 15:45:09
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
         public decimal AgencyFee { get; set; }
 
+
         /// <summary>
         /// 其他费用
         /// </summary>

+ 16 - 0
OASystem/OASystem.Domain/Entities/Resource/Res_CountryFeeCost.cs

@@ -58,6 +58,22 @@ namespace OASystem.Domain.Entities.Resource
         [SugarColumn(IsNullable = true, ColumnDataType = "varchar(50)")]
         public string VisaType { get; set; }
 
+        /// <summary>
+        /// 大公务代办费
+        /// 新增字段
+        /// 雷怡 2024-05-07 15:45:09 
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
+        public decimal GrandBusinessAgencyFee { get; set; }
+
+        /// <summary>
+        /// 小公务代办费
+        /// 新增字段
+        /// 雷怡 2024-05-07 15:45:09
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
+        public decimal PettyBusinessAgencyFee { get; set; }
+
         /// <summary>
         /// 一般签证时间
         /// </summary>

+ 38 - 0
OASystem/OASystem.Domain/ViewModels/Financial/Fin_ForeignReceivablesView.cs

@@ -380,6 +380,44 @@ namespace OASystem.Domain.ViewModels.Financial
         /// 收款进度
         /// </summary>
         public string schedule { get; set; }
+
+        /// <summary>
+        /// 子项明细
+        /// </summary>
+        public List<ProceedsReceivedInfoView>? prItem { get; set; }
+    }
+
+    /// <summary>
+    /// 已收详情 Info View
+    /// 新增
+    /// 雷怡 2024-01-08 11:01:55
+    /// </summary>
+    public class ProceedsReceivedInfoView
+    {
+        /// <summary>
+        /// 到款时间
+        /// </summary>
+        public string time { get; set; }
+
+        /// <summary>
+        /// 付款单位
+        /// </summary>
+        public string client { get; set; }
+
+        /// <summary>
+        /// 付款金额
+        /// </summary>
+        public string money { get; set; }
+
+        /// <summary>
+        /// 付款币种
+        /// </summary>
+        public string currency { get; set; }
+
+        /// <summary>
+        /// 付款类型(转账,刷卡等)
+        /// </summary>
+        public string receivablesType { get; set; }
     }
 
     #endregion

+ 24 - 0
OASystem/OASystem.Domain/ViewModels/Groups/VisaFeeInfoView.cs

@@ -33,8 +33,32 @@ namespace OASystem.Domain.ViewModels.Groups
         /// </summary>
         public decimal VisaFee { get; set; }
 
+        /// <summary>
+        /// 代办费 - 公务 类型 1 大公务 2 小公务
+        /// 新增
+        /// 雷怡 2024-08-07 17:08:13
+        /// </summary>
+        public int OBType { get; set; } = 1;
+
+        /// <summary>
+        /// 代办费公务描述
+        /// 雷怡 2024-08-07 17:08:23
+        /// </summary>
+        public string OBTypeStr
+        {
+            get
+            {
+                string str = "Unknown";
+                if (OBType == 1) str = "大公务";
+                else if (OBType == 2) str = "小公务";
+                return str;
+            }
+        }
+
         /// <summary>
         /// 代办费
+        /// 新增
+        /// 雷怡 2024-05-07 15:45:09
         /// </summary>
         public decimal AgencyFee { get; set; }
 

+ 1 - 1
OASystem/OASystem.Infrastructure/Repositories/Groups/CarTouristGuideGroundRepository.cs

@@ -1010,7 +1010,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 //}
                 #endregion
 
-                var rate = await _setDataRep.PostCurrencyByDiid(dto.DiId, dto.CTGGRId, dto.Currency);
+                var rate = await _setDataRep.PostCurrencyByDiid(dto.DiId, 79 ,dto.Currency);
                 if (rate.Code == 0)
                 {
                     var rateData = rate.Data as CurrencyInfo;

+ 5 - 5
OASystem/OASystem.Infrastructure/Repositories/Groups/DecreasePaymentsRepository.cs

@@ -54,11 +54,11 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
                 //雷怡 2024-5-8 15:14 新增View字段 CreateTime
                 string sql = string.Format(@" Select gdp.Id,gdp.DiId,gdp.PriceName,gdp.Price,sd1.[Name] as Currency,gdp.FilePath,su.CnName as CreateUserName,
-ccp.IsAuditDM as isAudit,ccp.IsPay,gdp.CreateTime
-From Grp_DecreasePayments as gdp With(Nolock) Left Join Grp_CreditCardPayment as ccp With(Nolock) On gdp.Id = ccp.CId
-Left Join Sys_SetData as sd1 On gdp.Currency = sd1.Id
-Left Join Sys_Users as su On gdp.CreateUserId = su.Id
-Where gdp.DiId = {0} And ccp.CTable = 98 {2} And ccp.IsDel = 0 And gdp.IsDel = 0 And gdp.CreateUserId in ({1}) ", dto.DiId, dto.UserId, sqlWhere);
+                                              ccp.IsAuditGM as isAudit,ccp.IsPay,gdp.CreateTime
+                                              From Grp_DecreasePayments as gdp With(Nolock) Left Join Grp_CreditCardPayment as ccp With(Nolock) On gdp.Id = ccp.CId
+                                              Left Join Sys_SetData as sd1 On gdp.Currency = sd1.Id
+                                              Left Join Sys_Users as su On gdp.CreateUserId = su.Id
+                                              Where gdp.DiId = {0} And ccp.CTable = 98 {2} And ccp.IsDel = 0 And gdp.IsDel = 0 And gdp.CreateUserId in ({1}) ", dto.DiId, dto.UserId, sqlWhere);
                 List<DecreasePaymentsView> _DecreasePayments = await _sqlSugar.SqlQueryable<DecreasePaymentsView>(sql).ToListAsync();
                 if (_DecreasePayments.Count > 0)
                 {

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

@@ -185,7 +185,11 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 List<string> searchreplaces = new List<string>() { "|", " ", "/", ",", "," };
                 foreach (var item in searchreplaces)
                 {
-                    str = str.Replace(item, "、");
+                    if (str.Contains(item))
+                    {
+                        str = str.Replace(item, "、");
+                        break;
+                    }
                 }
             }
             return str.Trim();

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

@@ -1019,6 +1019,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
             if (string.IsNullOrEmpty(ids)) return clientStr;
             List<int> intList = new List<int>();
 
+
+
             //if (ids.Contains(","))
             //{
             //    string[] numbers = ids.Split(',');
@@ -1038,9 +1040,9 @@ namespace OASystem.Infrastructure.Repositories.Groups
             //    }
             //}
 
-            string sql = string.Format(@$"Select * From Crm_GroupCustomer Where IsDel = 0 And Id  In ({ids})");
+            string sql = string.Format(@$"Select * From Crm_DeleClient Where IsDel = 0 And Id  In ({ids})");
 
-            var infos = _sqlSugar.SqlQueryable<Crm_GroupCustomer>(sql).ToList();
+            var infos = _sqlSugar.SqlQueryable<Crm_DeleClient>(sql).ToList();
 
             if (infos.Count > 0)
             {

+ 184 - 42
OASystem/OASystem.Infrastructure/Repositories/Groups/VisaFeeInfoRepository.cs

@@ -22,13 +22,15 @@ namespace OASystem.Infrastructure.Repositories.Groups
         private readonly IMapper _mapper;
         private Result _result;
         private readonly CountryFeeRepository _countryFeeRep;
+        private readonly DelegationInfoRepository _groupRep;
 
-        public VisaFeeInfoRepository(SqlSugarClient sqlSugar, IMapper mapper, CountryFeeRepository countryFeeRep)
+        public VisaFeeInfoRepository(SqlSugarClient sqlSugar, IMapper mapper, CountryFeeRepository countryFeeRep, DelegationInfoRepository groupRep)
             : base(sqlSugar)
         {
             _mapper = mapper;
             _result = new Result() { Code = -2,Msg = "操作失败!"};
             _countryFeeRep = countryFeeRep;
+            _groupRep = groupRep;
         }
 
 
@@ -40,8 +42,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
         /// <returns></returns>
         public async Task<Result> _Init()
         {
-            
-
             var data = await _sqlSugar.Queryable<Res_CountryFeeCost>().Where(it => it.IsDel == 0).ToListAsync();
             _result.Code = 0;
             _result.Data = data;
@@ -62,11 +62,105 @@ namespace OASystem.Infrastructure.Repositories.Groups
             if (portType < 1  || portType > 3) return _result = new Result() { Code = -1, Msg = "请传入有效的portType参数" };
 
             string sql = string.Format($@"Select vfi.Id,vfi.IsChecked,cfc.VisaCountry AS Country,cfc.VisaPrice As VisaFee,
-                                            vfi.AgencyFee,vfi.OtherFee,vfi.Remark 
-                                            From Grp_VisaFeeInfo vfi
-                                            Left Join Res_CountryFeeCost cfc On vfi.CountryVisaFeeId = cfc.Id
-                                            Where vfi.Isdel = 0 And vfi.Diid = {diId}");
+                                          vfi.OBType,vfi.AgencyFee,vfi.OtherFee,vfi.Remark 
+                                          From Grp_VisaFeeInfo vfi
+                                          Left Join Res_CountryFeeCost cfc On vfi.CountryVisaFeeId = cfc.Id
+                                          Where vfi.Isdel = 0  And vfi.Diid = {diId}");
             var data = await _sqlSugar.SqlQueryable<VisaFeeInfosView>(sql).ToListAsync();
+
+            //默认十行 雷怡 2024-26-08 11:26:40 
+
+            if (data.Count == 0)
+            {
+                var groupInfo = await _groupRep.PostShareGroupInfo(new ShareGroupInfoDto() { PortType = 1, Id = diId });
+                List<string> countrys = new List<string>();
+                if (groupInfo.Code == 0)
+                {
+                    countrys = _groupRep.GroupSplitCountry((groupInfo.Data as Web_ShareGroupInfoView)?.VisitCountry ?? "");
+                }
+
+                if (countrys.Count > 0)
+                {
+                    int dataRow = 0;
+
+                    foreach (var country in countrys)
+                    {
+                        var countryInfo = _sqlSugar.Queryable<Res_CountryFeeCost>().Where(it => it.IsDel == 0 && it.VisaCountry.Equals(country)).First();
+                        if (countryInfo != null)
+                        {
+                            data.Add(new VisaFeeInfosView()
+                            {
+                                IsChecked = 0,
+                                Country = country,
+                                VisaFee = countryInfo.VisaPrice,
+                                OBType = 1,
+                                AgencyFee = countryInfo.GrandBusinessAgencyFee
+                            });
+
+                            data.Add(new VisaFeeInfosView()
+                            {
+                                IsChecked = 0,
+                                Country = country,
+                                VisaFee = countryInfo.VisaPrice,
+                                OBType = 2,
+                                AgencyFee = countryInfo.PettyBusinessAgencyFee
+                            });
+                        }
+                        else
+                        {
+                            data.Add(new VisaFeeInfosView()
+                            {
+                                IsChecked = 0,
+                                Country = country,
+                                OBType = 1,
+                            });
+
+                            data.Add(new VisaFeeInfosView()
+                            {
+                                IsChecked = 0,
+                                Country = country,
+                                OBType = 2,
+                            });
+                        }
+                    }
+
+                    if (data.Count < 10)
+                    {
+                        int defaultRow = 10 - data.Count;
+                        for (int i = 0; i < defaultRow; i++)
+                        {
+                            data.Add(new VisaFeeInfosView()
+                            {
+                                Id = 0,
+                                OBType = 1
+                            });
+                        }
+                    }
+                }
+                else
+                {
+                    for (int i = 0; i < 10; i++)
+                    {
+                        data.Add(new VisaFeeInfosView()
+                        {
+                            Id = 0,
+                            OBType = 1
+                        });
+                    }
+                }
+            }
+            else if (data.Count <= 10)
+            {
+                int defaultRow = 10 - data.Count;
+                for (int i = 0; i < defaultRow; i++)
+                {
+                    data.Add(new VisaFeeInfosView()
+                    {
+                        Id = 0,
+                        OBType = 1
+                    });
+                }
+            }
             _result.Code = 0;
             _result.Data = data;
             _result.Msg = "操作成功!";
@@ -88,17 +182,32 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
             BeginTran();
             bool visaFeeUpdate = false;
-            foreach (var item in dto.VisaFeeInfos)
+
+            var countrys = dto.VisaFeeInfos.GroupBy(x => x.Country);
+
+            foreach (var country in countrys)
             {
                 int countryVisaFeeId = 0;
-                var info =await _countryFeeRep._InfoByCountryName(item.Country);
+                decimal _grandBusinessAgencyFee = 0;
+                decimal _pettyBusinessAgencyFee = 0;
+                decimal _visaFee = 0;
+                foreach (var item in country.ToList())
+                {
+                    _visaFee = item.VisaFee;
+                    if (item.OBType == 1) _grandBusinessAgencyFee = item.AgencyFee;
+                    else if (item.OBType == 2) _pettyBusinessAgencyFee = item.AgencyFee;
+                }
+
+                var info = await _countryFeeRep._InfoByCountryName(country.Key);
                 if (info == null) //添加
                 {
                     int addId = _sqlSugar.Insertable(
                         new Res_CountryFeeCost()
                         {
-                            VisaCountry = item.Country,
-                            VisaPrice = item.VisaFee,
+                            VisaCountry = country.Key,
+                            VisaPrice = _visaFee,
+                            GrandBusinessAgencyFee = _grandBusinessAgencyFee,
+                            PettyBusinessAgencyFee = _pettyBusinessAgencyFee,
                             LastUpdateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                             CreateUserId = dto.OpUserId,
                         }).ExecuteReturnIdentity();
@@ -107,12 +216,14 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 else //修改
                 {
                     countryVisaFeeId = info.Id;
-                    if (item.VisaFee != info.VisaPrice) //价格不同的时候执行修改
+                    if (_visaFee != info.VisaPrice) //价格不同的时候执行修改
                     {
                         Res_CountryFeeCost _CountryFeeCost = new Res_CountryFeeCost()
                         {
                             Id = info.Id,
-                            VisaPrice = item.VisaFee,
+                            VisaPrice = _visaFee,
+                            GrandBusinessAgencyFee = _grandBusinessAgencyFee,
+                            PettyBusinessAgencyFee = _pettyBusinessAgencyFee,
                             LastUpdateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                         };
                         int update1 = _sqlSugar.Updateable(_CountryFeeCost).UpdateColumns(it => new { it.VisaPrice, it.LastUpdateTime }).WhereColumns(it => it.Id).ExecuteCommand();
@@ -120,21 +231,25 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         {
                             visaFeeUpdate = true;
                         }
-                       
                     }
                 }
 
-                visaInfos.Add(new Grp_VisaFeeInfo()
+                foreach (var item in country.ToList())
                 {
-                    Id = item.Id,
-                    DiId = dto.DiId,
-                    IsChecked = item.IsChecked,
-                    CountryVisaFeeId = countryVisaFeeId,
-                    AgencyFee = item.AgencyFee,
-                    OtherFee = item.OtherFee
-                });
+                    visaInfos.Add(new Grp_VisaFeeInfo()
+                    {
+                        Id = item.Id,
+                        DiId = dto.DiId,
+                        IsChecked = item.IsChecked,
+                        CountryVisaFeeId = countryVisaFeeId,
+                        OBType = item.OBType,
+                        AgencyFee = item.AgencyFee,
+                        OtherFee = item.OtherFee
+                    });
+                }
             }
 
+
             //执行删除
             var update = _sqlSugar.Updateable<Grp_VisaFeeInfo>().SetColumns(it => new Grp_VisaFeeInfo()
             {
@@ -172,32 +287,59 @@ namespace OASystem.Infrastructure.Repositories.Groups
             List<dynamic> datas = new List<dynamic>();
             string remark = "";
             decimal feeTotal = 0.00M;
-            foreach (var item in visaData)
+
+            visaData = visaData.Where(it => it.IsChecked == 1).ToList();
+            var visaData1 = visaData.GroupBy(it => it.CountryVisaFeeId);
+
+            foreach (var kvp in visaData1)
             {
-                if (item.IsChecked == 1)
+                var countryData = visaCountryDatas.Find(it => it.Id == kvp.Key);
+                decimal _otherFee = kvp.FirstOrDefault()?.OtherFee ?? 0;
+                decimal _visaFee = Convert.ToDecimal(countryData?.VisaPrice ?? 0.00M);
+                decimal visaFeeTotal = _visaFee + _otherFee;
+                decimal _agencyFee = 0;
+                decimal _GrandBusinessAgencyFee = 0;
+                decimal _PettyBusinessAgencyFee = 0;
+                
+                string remark1 = $"签证费:{_visaFee.ToString("#0.00")}元、";
+                foreach (var item in kvp.ToList())
                 {
-                    var countryData = visaCountryDatas.Find(it => it.Id == item.CountryVisaFeeId);
+                    if (item.OBType == 1)
+                    {
+                        if (item.AgencyFee > 0)
+                        {
+                            remark1 += $@"大公务代办费:{item.AgencyFee.ToString("#0.00")}元、";
+                            _agencyFee += item.AgencyFee;
+                            _GrandBusinessAgencyFee = item.AgencyFee;
+                        }
+                    }
+                    else if (item.OBType == 1)
+                    {
+                        if (item.AgencyFee > 0)
+                        {
+                            remark1 += $@"小公务代办费:{item.AgencyFee.ToString("#0.00")}元、";
+                            _agencyFee += item.AgencyFee;
+                            _PettyBusinessAgencyFee = item.AgencyFee;
+                        }
+                    }
+                }
 
-                    decimal visaFeeTotal = Convert.ToDecimal( countryData?.VisaPrice ?? 0.00M) + item.AgencyFee + item.OtherFee;
-                    remark += $@"{countryData?.VisaCountry ?? ""}:签证总费用:{visaFeeTotal}元/人 其中(";
-                    if (countryData?.VisaPrice > 0) remark += $@"签证费用:{countryData?.VisaPrice.ToString("#0.00")}元、";
-                    if (item.AgencyFee > 0) remark += $@"代办费:{item.AgencyFee.ToString("#0.00")}元、";
-                    if (item.OtherFee > 0) remark += $@"其他费用:{item.OtherFee.ToString("#0.00")}元";
+                if (_otherFee > 0) remark1 += $@"其他费用:{_otherFee.ToString("#0.00")}元";
 
-                    if (visaFeeTotal > 0) remark = remark.Substring(0,remark.Length -1);
+                visaFeeTotal += (_GrandBusinessAgencyFee + _PettyBusinessAgencyFee);
+                remark += $@"{countryData?.VisaCountry ?? ""}:签证总费用:{visaFeeTotal}元/人 其中({remark1});";
 
-                    remark += ");";
-                    feeTotal += visaFeeTotal;
-                    datas.Add(new
-                    {
-                        Country = countryData?.VisaCountry ?? "",
-                        visaFeeTotal = visaFeeTotal,
-                        VisaFee = countryData?.VisaPrice ?? 0.00M,
-                        item.AgencyFee,
-                        item.OtherFee
+                feeTotal += visaFeeTotal;
 
-                    });
-                }
+                datas.Add(new
+                {
+                    Country = countryData?.VisaCountry ?? "",
+                    visaFeeTotal = visaFeeTotal,
+                    VisaFee = countryData?.VisaPrice ?? 0.00M,
+                    GrandBusinessAgencyFee = _GrandBusinessAgencyFee,
+                    PettyBusinessAgencyFee = _PettyBusinessAgencyFee,
+                    OtherFee = _otherFee
+                });
             }
 
             _result.Code = 0;

+ 31 - 48
OASystem/OASystem.Infrastructure/Repositories/Resource/CountryFeeRepository.cs

@@ -35,67 +35,50 @@ namespace OASystem.Infrastructure.Repositories.Resource
         public async Task<Result> OperationCountryFeeCost(OperationCountryFeeCostDto dto)
         {
             Result result = new Result() { Code = -2, Msg = "未知错误" };
-            try
-            {
-                if (dto.Status == 1)//添加
-                {
-                    string selectSql = string.Format(@"select * from Res_CountryFeeCost where VisaContinent='{0}' and VisaCountry='{1}' and IsDel='{2}'"
-                                                       , dto.VisaContinent,dto.VisaCountry, 0);
-                    var CountryFeeCost = await _sqlSugar.SqlQueryable<Res_CountryFeeCost>(selectSql).FirstAsync();//查询是否存在
-                    if (CountryFeeCost != null)
-                    {
-                        return result = new Result() { Code = -1, Msg = "该国家已存在,请勿重复添加!" };
 
-                    }
-                    else//不存在,可添加
-                    {
-                        Res_CountryFeeCost _CountryFeeCost = _mapper.Map<Res_CountryFeeCost>(dto);
+            Res_CountryFeeCost _CountryFeeCost = _mapper.Map<Res_CountryFeeCost>(dto);
 
-                        int id = await AddAsyncReturnId(_CountryFeeCost);
-                        if (id == 0)
-                        {
-                            return result = new Result() { Code = -1, Msg = "添加失败!" };
+            _CountryFeeCost.LastUpdateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+            if (dto.Status == 1)//添加
+            {
+                string selectSql = string.Format(@"select * from Res_CountryFeeCost where VisaContinent='{0}' and VisaCountry='{1}' and IsDel='{2}'"
+                                                   , dto.VisaContinent, dto.VisaCountry, 0);
+                var CountryFeeCost = await _sqlSugar.SqlQueryable<Res_CountryFeeCost>(selectSql).FirstAsync();//查询是否存在
+                if (CountryFeeCost != null)
+                {
+                    return result = new Result() { Code = -1, Msg = "该国家已存在,请勿重复添加!" };
 
-                        }
-                        result = new Result() { Code = 0, Msg = "添加成功!", Data = new { Id = id } };
-                    }
                 }
-                else if (dto.Status == 2)//修改
+                else//不存在,可添加
                 {
-                    bool res = await UpdateAsync(a => a.Id == dto.Id, a => new Res_CountryFeeCost
-                    {
-                        VisaContinent = dto.VisaContinent,
-                        VisaCountry = dto.VisaCountry,
-                        IsVisaExemption = dto.IsVisaExemption,
-                        IsVisaOnArrival = dto.IsVisaOnArrival,
-                        IsElectronicSignature = dto.IsElectronicSignature,
-                        VisaPrice = dto.VisaPrice,
-                        VisaPriceDesc = dto.VisaPriceDesc,
-                        VisaType = dto.VisaType,
-                        VisaTime = dto.VisaTime,
-                        IsUrgent = dto.IsUrgent,
-                        UrgentTime = dto.UrgentTime,
-                        UrgentPrice = dto.UrgentPrice,
-                        UrgentPriceDesc = dto.UrgentPriceDesc,
-                        VisaAddress = dto.VisaAddress,
-                        Remark = dto.Remark,
-                        LastUpdateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
-                    });
-                    if (!res)
+
+                    int id = await AddAsyncReturnId(_CountryFeeCost);
+                    if (id == 0)
                     {
-                        return result = new Result() { Code = -1, Msg = "修改失败!" };
+                        return result = new Result() { Code = -1, Msg = "添加失败!" };
+
                     }
-                    result = new Result() { Code = 0, Msg = "修改成功!" };
+                    result = new Result() { Code = 0, Msg = "添加成功!", Data = new { Id = id } };
                 }
-                else
+            }
+            else if (dto.Status == 2)//修改
+            {
+                var update = await _sqlSugar.Updateable(_CountryFeeCost)
+                                            .IgnoreColumns(it => new { it.Id, it.DeleteUserId, it.DeleteTime, it.CreateUserId, it.CreateTime, it.IsDel })
+                                            .Where(it => it.Id == _CountryFeeCost.Id)
+                                            .ExecuteCommandAsync();
+                //bool res = await UpdateAsync(a => a.Id == dto.Id, a => _CountryFeeCost);
+                if (update < 1)
                 {
-                    return result = new Result() { Code = -1, Msg = "请传入Status参数,1添加 2修改!" };
+                    return result = new Result() { Code = -1, Msg = "修改失败!" };
                 }
+                result = new Result() { Code = 0, Msg = "修改成功!" };
             }
-            catch (Exception ex)
+            else
             {
-                return result = new Result() { Code = -2, Msg = ex.Message };
+                return result = new Result() { Code = -1, Msg = "请传入Status参数,1添加 2修改!" };
             }
+
             return result;
         }
     }