Przeglądaj źródła

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

yuanrf 1 rok temu
rodzic
commit
aacd26c1a8

+ 12 - 21
OASystem/OASystem.Api/Controllers/AuthController.cs

@@ -63,14 +63,15 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(LoginView), StatusCodes.Status200OK)]
         public async Task<IActionResult> LoginAsync(LoginDto dto)
         {
-            #region 校验用户信息 
-            var userData = _loginRep.Login(dto).Result;
-            if (userData.Code != 0)
+            if (string.IsNullOrWhiteSpace(dto.Number) || string.IsNullOrWhiteSpace(dto.Password))
             {
-                if (userData.Code != 0) { return Ok(JsonView(false, userData.Msg)); }
-                return Ok(JsonView(false, "暂无该员工信息!"));
+                return Ok(JsonView(false, "账号或密码不能为空!!"));
             }
 
+            #region 校验用户信息 
+            var userData = _loginRep.Login(dto).Result;
+            if (userData.Code != 0)  return Ok(JsonView(false, userData.Msg)); 
+
             #endregion
             Result authData = null;
             string uName = string.Empty;
@@ -270,23 +271,13 @@ namespace OASystem.API.Controllers
         [Route("UpdPassword")]
         public async Task<IActionResult> UpdateUserPassword(UpdateDto dto)
         {
-            Result result = new Result();
-
-            Sys_Users sys_Users = _mapper.Map<Sys_Users>(dto);
-            var _UpdateState = await _loginRep.UpdateAsync(s => s.Id == dto.UserId, ss => sys_Users);
-            if (_UpdateState)
-            {
-                result.Code = 0;
-                result.Msg = "申请成功!人事主管审核后且信息部经理分配了登录账号,可登录OA!";
-            }
-            else
-            {
-                result.Code = -2;
-                result.Msg = "用户修改失败!";
-            }
-
+            //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,"操作成功!"));
 
-            return Ok(JsonView(result));
+            return Ok(JsonView(false, _view.Msg));
         }
 
         /// <summary>

+ 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");
 

+ 37 - 39
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -2838,6 +2838,7 @@ namespace OASystem.API.Controllers
                 return Ok(JsonView(false, ex.Message));
             }
         }
+
         /// <summary>
         /// 根据团组Id查询团组增减款项
         /// </summary>
@@ -5050,7 +5051,7 @@ namespace OASystem.API.Controllers
         /// <returns></returns>
         [HttpPost]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> PostEnterExitCostOneClickClear(EnterExitCostOneClickClearDto dto) 
+        public async Task<IActionResult> PostEnterExitCostOneClickClear(EnterExitCostOneClickClearDto dto)
         {
             if (dto.DiId < 1) return Ok(JsonView(false, "请传入有效的DiId参数;"));
             if (dto.UserId < 1) return Ok(JsonView(false, "请传入有效的UserId参数;"));
@@ -9221,7 +9222,7 @@ namespace OASystem.API.Controllers
             }
 
         }
-       
+
         /// <summary>
         /// 导出确认单
         /// </summary>
@@ -9920,9 +9921,6 @@ namespace OASystem.API.Controllers
 
                 return Ok(JsonView(false, ex.Message));
             }
-
-
-
         }
 
         /// <summary>
@@ -9936,22 +9934,22 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostHotelReservationsCreateVoucher(HotelReservationsCreateVoucherDto _dto)
         {
-                #region  参数验证
-                if (_dto.UserId < 1) return Ok(JsonView(false, "员工Id为空"));
-                if (_dto.PageId < 1) _dto.PageId = 28; //酒店预定Id
-                if (_dto.DiId < 1) return Ok(JsonView(false, "团组Id为空"));
+            #region  参数验证
+            if (_dto.UserId < 1) return Ok(JsonView(false, "员工Id为空"));
+            if (_dto.PageId < 1) _dto.PageId = 28; //酒店预定Id
+            if (_dto.DiId < 1) return Ok(JsonView(false, "团组Id为空"));
 
-                #region 团组操作权限验证 76 酒店预定模块
-                var groupAuthView = await GeneralMethod.PostGroupOperationAuth(_dto.DiId, _dto.UserId, 76);
-                if (groupAuthView.Code != 0) return Ok(JsonView(false, groupAuthView.Msg));
-                #endregion
+            #region 团组操作权限验证 76 酒店预定模块
+            var groupAuthView = await GeneralMethod.PostGroupOperationAuth(_dto.DiId, _dto.UserId, 76);
+            if (groupAuthView.Code != 0) return Ok(JsonView(false, groupAuthView.Msg));
+            #endregion
 
-                PageFunAuthViewBase pageFunAuthView = new PageFunAuthViewBase();
+            PageFunAuthViewBase pageFunAuthView = new PageFunAuthViewBase();
 
-                #region 页面操作权限验证
-                pageFunAuthView = await GeneralMethod.PostUserPageFuncDatas(_dto.UserId, _dto.PageId);
+            #region 页面操作权限验证
+            pageFunAuthView = await GeneralMethod.PostUserPageFuncDatas(_dto.UserId, _dto.PageId);
 
-                if (pageFunAuthView.FilesDownloadAuth == 0) return Ok(JsonView(false, "您没有文件下载权限!"));
+            if (pageFunAuthView.FilesDownloadAuth == 0) return Ok(JsonView(false, "您没有文件下载权限!"));
 
             #endregion
 
@@ -9971,7 +9969,7 @@ namespace OASystem.API.Controllers
             #region 数据处理
 
             List<int> guestIds = new List<int>();
-            int index = 0; 
+            int index = 0;
             foreach (var item in hrDtas)
             {
                 if (item.GuestName.Contains(","))
@@ -9979,7 +9977,7 @@ namespace OASystem.API.Controllers
                     string[] guestIdArr = item.GuestName.Split(',');
                     foreach (var guestIdStr in guestIdArr)
                     {
-                        bool guestBool = int.TryParse(guestIdStr,out int guestId);
+                        bool guestBool = int.TryParse(guestIdStr, out int guestId);
                         if (guestBool)
                         {
                             guestIds.Add(guestId);
@@ -10006,21 +10004,21 @@ namespace OASystem.API.Controllers
                 guestIds = guestIds.Distinct().ToList();
 
                 var guestDatas = await _sqlSugar.Queryable<Crm_DeleClient>().Where(it => it.IsDel == 0 && guestIds.Contains(it.Id)).ToListAsync();
-                if (guestDatas.Count > 0 )
+                if (guestDatas.Count > 0)
                 {
                     guestNames = "";
-                    foreach ( var guest in guestDatas ) 
+                    foreach (var guest in guestDatas)
                     {
                         string guestName = "";
                         if (guest.Sex == 0) guestName += @"MR.";
                         else if (guest.Sex == 1) guestName += @"MS.";
 
                         if (guest.Pinyin == null) guestName += $"{string.Join("", guest.LastName.GetTotalPingYin()).ToUpper()}/{string.Join("", guest.FirstName.GetTotalPingYin()).ToUpper()}";
-                        else guestName += @$"{guest.Pinyin.Replace(" ","")}";
+                        else guestName += @$"{guest.Pinyin.Replace(" ", "")}";
 
                         guestNames += @$"{guestName.Trim()}、";
                     }
-                    if (guestNames.Length > 0 )
+                    if (guestNames.Length > 0)
                     {
                         guestNames = guestNames.Substring(0, guestNames.Length - 1);
                     }
@@ -10048,7 +10046,7 @@ namespace OASystem.API.Controllers
             for (int i = 1; i <= vouchers.Count; i++)
             {
 
-                HotelVoucherInfoView hviv = vouchers[i-1];
+                HotelVoucherInfoView hviv = vouchers[i - 1];
 
                 builder.MoveToCell(0, i, 0, 0);
                 builder.Write(hviv.HotelName);
@@ -10068,7 +10066,7 @@ namespace OASystem.API.Controllers
             }
 
             //删除多余行
-            int currRowIndex = vouchers.Count+1;
+            int currRowIndex = vouchers.Count + 1;
             int delRows = 21 - currRowIndex;
             if (delRows > 0)
             {
@@ -11043,9 +11041,19 @@ namespace OASystem.API.Controllers
                 //循环赋值
                 for (int i = 0; i < DcList.Count; i++)
                 {
-                    string PY_Last = DcList[i].Pinyin.Split('/')[0];
-                    string PY_First = DcList[i].Pinyin.Split('/')[1];
-                    string PYName = PY_First + " " + PY_Last;
+                    string PYName = "";
+                    if (DcList[i].Pinyin.Length > 0 && DcList[i].Pinyin.IndexOf('/') > -1)
+                    {
+                        string PY_Last = DcList[i].Pinyin.Split('/')[0];
+                        string PY_First = DcList[i].Pinyin.Split('/')[1];
+                        PYName = PY_First + " " + PY_Last;
+                    }
+                    else
+                    {
+                        string PY_Last = DcList[i].LastName.GetTotalPingYin().Count > 0 ? DcList[i].LastName.GetTotalPingYin()[0].ToUpper() : "";
+                        string PY_First = DcList[i].FirstName.GetTotalPingYin().Count > 0 ? DcList[i].FirstName.GetTotalPingYin()[0].ToUpper() : "";
+                        PYName = PY_First + " " + PY_Last;
+                    }
                     builder.MoveToCell(0, i + 1, 0, 0);
                     builder.Write(PYName);
 
@@ -11102,7 +11110,7 @@ namespace OASystem.API.Controllers
                             }
                         }
                     }
-                    catch (Exception)
+                    catch (Exception ex)
                     {
 
                     }
@@ -11365,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)
@@ -11380,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]
@@ -11420,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
 

+ 23 - 15
OASystem/OASystem.Api/Program.cs

@@ -26,6 +26,8 @@ using OASystem.API.OAMethodLib.SignalR.HubService;
 using OASystem.API.OAMethodLib.Auth;
 using OASystem.API.OAMethodLib.Hub.HubClients;
 using Microsoft.Extensions.Options;
+using Microsoft.AspNetCore.Identity;
+using static OpenAI.GPT3.ObjectModels.SharedModels.IOpenAiModels;
 
     var builder = WebApplication.CreateBuilder(args);
 var basePath = AppContext.BaseDirectory;
@@ -127,6 +129,26 @@ builder.Services.AddScoped(options =>
 });
 #endregion
 
+//#region Identity 配置
+//builder.Services.AddDataProtection();
+////不要用 AddIdentity , AddIdentity 是于MVC框架中的
+//builder.Services.AddIdentityCore<User>(opt =>
+//{
+//    opt.Password.RequireDigit = false; //数字
+//    opt.Password.RequireLowercase = false;//小写字母
+//    opt.Password.RequireNonAlphanumeric = false;//特殊符号 例如 ¥#@! 
+//    opt.Password.RequireUppercase = false; //大写字母
+//    opt.Password.RequiredLength = 6;//密码长度 6 
+//    opt.Password.RequiredUniqueChars = 1;//相同字符可以出现几次
+//    opt.Lockout.MaxFailedAccessAttempts = 5; //允许最多输入五次用户名/密码错误
+//    opt.Lockout.DefaultLockoutTimeSpan = new TimeSpan(0, 5, 0);//锁定五分钟
+//    opt.Tokens.PasswordResetTokenProvider = TokenOptions.DefaultEmailProvider; // 修改密码使用邮件【验证码模式】
+//    opt.Tokens.EmailConfirmationTokenProvider = TokenOptions.DefaultEmailProvider;  //// 
+//});
+//var idBuilder = new IdentityBuilder(typeof(User), typeof(UserRole), services);
+//idBuilder.AddEntityFrameworkStores<swapDbContext>().AddDefaultTokenProviders().AddRoleManager<RoleManager<UserRole>>().AddUserManager<UserManager<User>>();
+//#endregion
+
 #region 注入Swagger注释(启用)
 
 if (AppSettingsHelper.Get("UseSwagger").ToBool())
@@ -206,22 +228,8 @@ builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
                     return Task.CompletedTask;
                 }
             };
-
-            //options.Events = new JwtBearerEvents
-            //{
-            //    OnMessageReceived = context =>
-            //    {
-            //        // 当我们收到消息时,去获取请求中的access_token字段
-            //        var accessToken = context.Request.Query["access_token"];
-            //        // 如果没有就去头上找,找到了就放入我们context.token中
-            //        if (!string.IsNullOrEmpty(accessToken))
-            //        {
-            //            context.Token = accessToken;
-            //        }
-            //        return Task.CompletedTask;
-            //    }
-            //};
         });
+
 #endregion
 
 #region 初始化日志

+ 1 - 0
OASystem/OASystem.Domain/AutoMappers/_baseMappingProfile.cs

@@ -30,6 +30,7 @@ namespace OASystem.Domain.AutoMappers
         {
             #region Login
             CreateMap<LoginDto, Sys_Users>();
+            CreateMap<UpdateDto, Sys_Users>();
             #endregion
 
             #region Systen

+ 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>
         /// 一般签证时间

+ 2 - 2
OASystem/OASystem.Domain/Dtos/UserDto/UpdateDto.cs

@@ -12,12 +12,12 @@ namespace OASystem.Domain.Dtos.UserDto
     public class UpdateDto
     {
         /// <summary>
-        /// 用户Id
+        /// 当前密码
         /// </summary>
         public int UserId { get; set; }
 
         /// <summary>
-        /// 修改后的密码
+        /// new 密码
         /// </summary>
         public string Password { get; set; }
     }

+ 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; }
 

+ 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();

+ 13 - 3
OASystem/OASystem.Infrastructure/Repositories/Groups/EnterExitCostRepository.cs

@@ -429,12 +429,22 @@ namespace OASystem.Infrastructure.Repositories.Groups
             BeginTran();
             Grp_EnterExitCost _EnterExitCost = new Grp_EnterExitCost() { 
                 Id = id,
+                IsDel = 1,
+                DeleteUserId = userId,
+                DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
             };
 
-            int update = await _sqlSugar.Updateable<Grp_EnterExitCost>(_EnterExitCost).Where(it => it.Id == id).ExecuteCommandAsync();
+            //int update = await _sqlSugar.Updateable<Grp_EnterExitCost>(_EnterExitCost).Where(it => it.Id == id).ExecuteCommandAsync();
+            int update = await _sqlSugar.Updateable<Grp_EnterExitCost>(_EnterExitCost)
+                                        .UpdateColumns(it => new { 
+                                            it.IsDel,
+                                            it.DeleteUserId ,
+                                            it.DeleteTime
+                                        })
+                                        .Where(it => it.Id == id).ExecuteCommandAsync();
 
             if (update > 0) {
-                string sqlDelete = string.Format(@" Delete From Grp_DayAndCost Where Diid = {0} ", diId);
+                string sqlDelete = string.Format(@"Delete From Grp_DayAndCost Where Diid = {0} ", diId);
                 await ExecuteCommandAsync(sqlDelete);
                 result.Code = 0;
                 result.Msg = "操作成功!";
@@ -445,7 +455,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 result.Msg = "操作失败";
                 RollbackTran();
             }
-           
+            
             return result;
         }
 

+ 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;

+ 27 - 0
OASystem/OASystem.Infrastructure/Repositories/Login/LoginRepository.cs

@@ -204,5 +204,32 @@ namespace OASystem.Infrastructure.Repositories.Login
 
             return number;
         }
+    
+        public async Task<Result> ChangePassword(int userId,string password)
+        {
+            Result result = new Result() {Code = -1,Msg="操作失败!" };
+            if (userId < 1) {
+                result.Msg = "请输入有效的UserId参数";
+                return result;
+            }
+
+            if (string.IsNullOrWhiteSpace(password))
+            {
+                result.Msg = "请输入有效的password参数";
+                return result;
+            }
+
+            var change = await _sqlSugar.Updateable<Sys_Users>()
+                                        .SetColumns(it => it.Password ==  password)
+                                        .Where(it => it.Id == userId)
+                                        .ExecuteCommandAsync();
+            if (change >  0)
+            {
+                result.Code = 0;
+                result.Msg = "操作成功!";
+            }
+
+            return result;
+        }
     }
 }

+ 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;
         }
     }