Browse Source

Res_CountryFeeCost
新增字段 对应操作(查询,修改)修改
--GrandBusinessAgencyFee 大公务代办费
--PettyBusinessAgencyFee 大公务代办费

leiy 10 months ago
parent
commit
d050e8d0bf

+ 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,"操作成功!"));
 

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

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

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

@@ -35,67 +35,46 @@ 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 = "添加失败!" };
+            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)//修改
+            {
+                _CountryFeeCost.LastUpdateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+                bool res = await UpdateAsync(a => a.Id == dto.Id, a => _CountryFeeCost);
+                if (!res)
                 {
-                    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;
         }
     }