Browse Source

签证费用录入(自动审核)-->增加字段(地区(Area)、代办费类型(AgencyFeeType))及相API关逻辑代码更新

LEIYI 2 months ago
parent
commit
996adb4e58

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

@@ -6999,7 +6999,6 @@ FROM
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> QueryVisaByDiId(VisaPriceDto dto)
         {
-            
             Result groupData = await _visaPriceRep.PostVisaByDiId(dto);
             if (groupData.Code != 0)
             {
@@ -7017,19 +7016,12 @@ FROM
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> QueryVisaById(PostVisaByIdDto dto)
         {
-            try
-            {
-                Result groupData = await _visaPriceRep.PostVisaById(dto);
-                if (groupData.Code != 0)
-                {
-                    return Ok(JsonView(false, groupData.Msg));
-                }
-                return Ok(JsonView(true, groupData.Msg, groupData.Data));
-            }
-            catch (Exception ex)
+            Result groupData = await _visaPriceRep.PostVisaById(dto);
+            if (groupData.Code != 0)
             {
-                return Ok(JsonView(false, ex.Message));
+                return Ok(JsonView(false, groupData.Msg));
             }
+            return Ok(JsonView(true, groupData.Msg, groupData.Data));
         }
         /// <summary>
         /// 签证费用删除
@@ -7092,12 +7084,23 @@ FROM
             List<Sys_SetData> BankCard = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 15 && a.IsDel == 0).ToList();
             List<SetDataInfoView> _BankCard = _mapper.Map<List<SetDataInfoView>>(BankCard);
 
+            //代办费类型
+            var agencyFeeTypeData = new List<dynamic>() {
+                new { id = 0 , Text = "未选择" },
+                new { id = 1 , Text = "小公务" },
+                new { id = 2 , Text = "大公务" },
+            };
+
+            //签证费用标准国家Data
+            var visaCountryFeeData = _sqlSugar.Queryable<Res_CountryFeeCost>().Where(x => x.IsDel == 0).Select(x => new { x.Id, Country = x.VisaCountry }).ToList();
             var data = new
             {
                 Payment = _Payment,
                 CurrencyList = _CurrencyList,
                 PassengerType = _PassengerType,
-                BankCard = _BankCard
+                BankCard = _BankCard,
+                AgencyFeeType = agencyFeeTypeData,
+                CountryFeeData = visaCountryFeeData
             };
             return Ok(JsonView(true, "查询成功!", data));
         }

+ 12 - 0
OASystem/OASystem.Domain/Dtos/Groups/VisaPriceDto.cs

@@ -144,5 +144,17 @@ namespace OASystem.Domain.Dtos.Groups
         /// 签证描述
         /// </summary>
         public string VisaDescription { get; set; }
+
+        /// <summary>
+        /// 地区
+        /// </summary>
+        public string Area { get; set; }
+
+        /// <summary>
+        /// 代办费类型
+        /// 0 未选择 1 小公务 2 大公务
+        /// </summary>
+        public int AgencyFeeType { get; set; }
+
     }
 }

+ 13 - 0
OASystem/OASystem.Domain/Entities/Groups/Grp_VisaInfo.cs

@@ -17,7 +17,20 @@ namespace OASystem.Domain.Entities.Groups
         /// </summary>
         [SugarColumn(IsNullable =true,ColumnDataType ="int")]
         public int DIId { get; set; }
+        
         /// <summary>
+        /// 区域
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(100)")]
+        public string Area { get; set; }
+
+        /// <summary>
+        /// 代办费类型
+        /// 0 未选择 1 小公务 2 大公务
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int AgencyFeeType { get; set; }
+
         /// 签证客户
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "varchar(120)")]

+ 48 - 25
OASystem/OASystem.Infrastructure/Repositories/Groups/VisaPriceRepository.cs

@@ -7,6 +7,7 @@ using OASystem.Domain.Dtos.Groups;
 using OASystem.Domain.Entities.Customer;
 using OASystem.Domain.Entities.Financial;
 using OASystem.Domain.Entities.Groups;
+using OASystem.Domain.Entities.Resource;
 using OASystem.Domain.ViewModels.Financial;
 using OASystem.Domain.ViewModels.Groups;
 using OASystem.Infrastructure.Repositories.System;
@@ -297,22 +298,17 @@ Left Join Sys_SetData as sd With(Nolock) On c.PayDId = sd.Id
         /// <returns></returns>
         public async Task<Result> PostVisaById(PostVisaByIdDto dto)
         {
-            Result result = new Result() { Code = -2, Msg = "未知错误" };
-            try
-            {
-                Grp_VisaInfo _VisaInfo = _sqlSugar.Queryable<Grp_VisaInfo>().First(a => a.Id == dto.Id && a.IsDel == 0);
-                Grp_CreditCardPayment _CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == dto.Id && a.IsDel == 0 && a.CTable == 80);
-                var data = new
-                {
-                    VisaInfo = _VisaInfo,
-                    CreditCardPayment = _CreditCardPayment
-                };
-                return result = new Result() { Code = 0, Msg = "暂无数据!", Data = data };
-            }
-            catch (Exception ex)
+            var result = new Result() { Code = -2, Msg = "未知错误" };
+
+            Grp_VisaInfo _VisaInfo = _sqlSugar.Queryable<Grp_VisaInfo>().First(a => a.Id == dto.Id && a.IsDel == 0);
+            Grp_CreditCardPayment _CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == dto.Id && a.IsDel == 0 && a.CTable == 80);
+            var data = new
             {
-                return result = new Result() { Code = -2, Msg = "未知错误" };
-            }
+                VisaInfo = _VisaInfo,
+                CreditCardPayment = _CreditCardPayment
+            };
+            return result = new Result() { Code = 0, Msg = "暂无数据!", Data = data };
+
         }
         /// <summary>
         /// 签证费用录入操作(Status:1.新增,2.修改)
@@ -339,8 +335,32 @@ Left Join Sys_SetData as sd With(Nolock) On c.PayDId = sd.Id
 
             c.RMBPrice = c.PayMoney;
             c.DayRate = 1.0000M;
-            Grp_TeamRate _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == dto.DiId && a.IsDel == 0 && a.CTable == 80);
-            List<CurrencyInfo> currencyInfos = new List<CurrencyInfo>();
+
+            #region 自动审核处理
+            var isAutoAudit = false;
+            if (dto.IsThird == 0)
+            {
+                var visaFeeInfo = _sqlSugar.Queryable<Res_CountryFeeCost>().Where(x => x.IsDel == 0 && x.VisaCountry.Equals(dto.Area)).First();
+                if (visaFeeInfo != null) {
+
+                    var visaFeePrice = visaFeeInfo.VisaPrice;
+                    if (dto.AgencyFeeType == 1) visaFeePrice += visaFeeInfo.PettyBusinessAgencyFee;
+                    else if (dto.AgencyFeeType == 2) visaFeePrice += visaFeeInfo.GrandBusinessAgencyFee;
+                    var visaFeeTotalPrice = visaFeePrice * dto.VisaNumber;
+                    if (dto.VisaPrice <= visaFeeTotalPrice)
+                    {
+                        isAutoAudit = true;
+                        c.IsAuditGM = 3;
+                        c.AuditGMOperate = 4; //系统管理员
+                        c.AuditGMDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+                    }
+                }
+            }
+
+            #endregion
+
+            var _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == dto.DiId && a.IsDel == 0 && a.CTable == 80);
+            var currencyInfos = new List<CurrencyInfo>();
             if (_TeamRate != null)
             {
                 Sys_SetData _SetData = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == c.PaymentCurrency);
@@ -358,13 +378,14 @@ Left Join Sys_SetData as sd With(Nolock) On c.PayDId = sd.Id
 
             if (dto.Status == 1)//添加
             {
-                Grp_VisaInfo grp_Visa = _sqlSugar.Queryable<Grp_VisaInfo>()
-                                                 .First(a => a.IsDel == 0 &&
-                                                             a.VisaDescription.Equals(dto.VisaDescription) &&
-                                                             a.VisaCurrency == dto.VisaCurrency &&
-                                                             a.VisaPrice == dto.VisaPrice &&
-                                                             a.VisaClient == dto.VisaClient
-                                                  );
+                var grp_Visa = _sqlSugar.Queryable<Grp_VisaInfo>()
+                    .First(a => a.IsDel == 0 &&
+                                a.DIId == dto.DiId &&
+                                a.VisaDescription.Equals(dto.VisaDescription) &&
+                                a.VisaCurrency == dto.VisaCurrency &&
+                                a.VisaPrice == dto.VisaPrice &&
+                                a.VisaClient == dto.VisaClient
+                    );
                 if (grp_Visa != null)
                 {
                     return result = new Result() { Code = -1, Msg = "该笔费用已存在,请勿重复添加!" };
@@ -433,8 +454,10 @@ Left Join Sys_SetData as sd With(Nolock) On c.PayDId = sd.Id
                                                     BankNo = c.BankNo,
                                                     CardholderName = c.CardholderName,
                                                     Remark = c.Remark,
-
                                                 })
+                                                .SetColumnsIF(isAutoAudit, x => x.IsAuditGM == 3)
+                                                .SetColumnsIF(isAutoAudit, x => x.AuditGMOperate == 4)
+                                                .SetColumnsIF(isAutoAudit, x => x.AuditGMDate == DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
                                                 .ExecuteCommandAsync();
 
                     var ccp = Query<Grp_CreditCardPayment>(a => a.CId == grp_Visa1.Id && a.CTable == 80).First();