Browse Source

保险费用审核调试

LEIYI 4 days ago
parent
commit
57447915cf

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

@@ -19863,7 +19863,38 @@ ORDER BY
             if (!SharingStaticData.PortTypes.Contains(portType)) return Ok(JsonView(false, MsgTips.Port));
             if (groupId < 1) return Ok(JsonView(false, MsgTips.DiId));
 
-            return Ok(await _restaurantRep.ItemAsync(portType, groupId));
+            var sql = string.Format(@" SELECT
+  ri.Id,
+  ri.GroupId,
+  ri.Date,
+  ri.StartTime,
+  ri.EndTime,
+  CASE WHEN ri.Type = 1 THEN '早餐'
+  WHEN ri.Type = 2 THEN '午餐'
+  WHEN ri.Type = 3 THEN '晚餐'
+  ELSE '其他'
+  END AS 'Type',
+  ri.Name,
+  ri.Address,
+  ri.Tel,
+  ri.Remark,
+  ri.CreateTime,
+  u.CnName AS CreateUserName
+FROM
+  Grp_RestaurantInfo ri
+  LEFT JOIN Sys_Users u ON ri.CreateUserId = u.Id
+WHERE
+  ri.IsDel = 0
+  AND ri.GroupId = {0}
+ORDER BY
+  ri.Date ASC
+", groupId);
+
+            var infos = await _sqlSugar.SqlQueryable<RestaurantItemView>(sql).ToListAsync();
+
+            if (!infos.Any()) Ok(JsonView(false, "数据未填写!"));
+
+            return Ok(JsonView(infos));
         }
 
         /// <summary>

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

@@ -379,7 +379,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
             c.PayPercentage = 100;
             c.CTable = 82;
             c.CId = id;
-            c.IsAuditGM = 3;
+            c.IsAuditGM = 0;
             c.PayMoney = cus.InsuranceCosts;
             c.PaymentCurrency = cus.Currency;
 

+ 41 - 34
OASystem/OASystem.Infrastructure/Repositories/Groups/FeeAuditRepository.cs

@@ -43,27 +43,42 @@ namespace OASystem.Infrastructure.Repositories.Groups
             var stids = new List<int>() { 17, 66, 91 };
             var setData = _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0 && stids.Contains(x.STid)).ToList();
             string _teamCurrency = string.Empty;
-           
-            var groupInfo = _sqlSugar.Queryable<Grp_GroupCostParameter>().Where(x => x.IsDel == 0 && x.DiId == diId).First();
-            if (groupInfo == null) { _view.Msg = $"团组成本信息未填写!"; return _view; }
-            _teamCurrency = groupInfo.Currency;
-            decimal _teamRate = groupInfo.Rate;
-            //币种验证  统一为currencycode三字码
-            if (int.TryParse(_teamCurrency,out int currency)) _teamCurrency = setData.Find(x => x.Id == currency)?.Name ?? "";
 
-            string costContentSql = $"Select * From Grp_GroupCost";
-            var costContents =  _sqlSugar.SqlQueryable<GroupCostAuditView>(costContentSql).Where(x => x.IsDel == 0 && x.Diid == diId).ToList();
-            if (costContents.Count < 1) { _view.Msg = $"团组成本信息未填写!"; return _view; }
-
-            //处理 成本详细信息 日期为空
-            for (int i = 0; i < costContents.Count; i++)
+            decimal _teamRate = 0.00M;
+            var costContents = new List<GroupCostAuditView>();
+            if (feeType != 4)
             {
-                if (string.IsNullOrEmpty( costContents[i].Date))
+                var groupInfo = _sqlSugar.Queryable<Grp_GroupCostParameter>().Where(x => x.IsDel == 0 && x.DiId == diId).First();
+                if (groupInfo == null) { _view.Msg = $"团组成本信息未填写!"; return _view; }
+                _teamCurrency = groupInfo.Currency;
+                _teamRate = groupInfo.Rate;
+
+                //币种验证  统一为currencycode三字码
+                if (int.TryParse(_teamCurrency, out int currency)) _teamCurrency = setData.Find(x => x.Id == currency)?.Name ?? "";
+
+                string costContentSql = $"Select * From Grp_GroupCost";
+                costContents = _sqlSugar.SqlQueryable<GroupCostAuditView>(costContentSql).Where(x => x.IsDel == 0 && x.Diid == diId).ToList();
+
+                if (costContents.Count < 1) { _view.Msg = $"团组成本信息未填写!"; return _view; }
+
+                //处理 成本详细信息 日期为空
+                for (int i = 0; i < costContents.Count; i++)
                 {
-                    int index = i - 1;
-                    if (index >= 0)
+                    if (string.IsNullOrEmpty(costContents[i].Date))
+                    {
+                        int index = i - 1;
+                        if (index >= 0)
+                        {
+                            costContents[i].Date = costContents[index].Date;
+                            var dtBool = DateTime.TryParse(costContents[i].Date, out DateTime _dateTime);
+                            if (dtBool)
+                            {
+                                costContents[i].CurrTime = _dateTime;
+                            }
+                        }
+                    }
+                    else
                     {
-                        costContents[i].Date = costContents[index].Date;
                         var dtBool = DateTime.TryParse(costContents[i].Date, out DateTime _dateTime);
                         if (dtBool)
                         {
@@ -71,16 +86,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         }
                     }
                 }
-                else
-                {
-                    var dtBool = DateTime.TryParse(costContents[i].Date, out DateTime _dateTime);
-                    if (dtBool)
-                    {
-                        costContents[i].CurrTime = _dateTime;
-                    }
-                }
             }
-
+            
             if (feeType == 1)
             {
                 //1089	对冲账或其他 不在审核范围
@@ -374,7 +381,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 var currModule = 98; //其他款项
                 int groupSize = 0; // 团组人数
                 var groupDetails = await _sqlSugar.Queryable<Grp_DelegationInfo>().Where(x => x.IsDel == 0 && x.Id == diId).FirstAsync();
-                if (groupInfo != null) groupSize = groupDetails.VisitPNumber;
+                if (groupDetails != null) groupSize = groupDetails.VisitPNumber;
 
                 decimal groupCostCNYTotal = costContents.Sum(x => x.TeFee) * _teamRate * groupSize; //团组成本出行物资总金额
                 if (groupCostCNYTotal <= 0.00M)
@@ -512,17 +519,18 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     if (auditCcpIds.Any())
                     {
                         var ccpUpd = _sqlSugar.Updateable<Grp_CreditCardPayment>()
-                       .SetColumns(it => it.IsAuditGM == 0)
-                       .SetColumns(it => it.AuditGMOperate == 0)
-                       .SetColumns(it => it.AuditGMDate == "")
-                       .Where(s => auditCcpIds.Contains(s.Id))
-                       .ExecuteCommand();
+                           .SetColumns(it => it.IsAuditGM == 0)
+                           .SetColumns(it => it.AuditGMOperate == 0)
+                           .SetColumns(it => it.AuditGMDate == string.Empty)
+                           .Where(s => auditCcpIds.Contains(s.Id))
+                           .ExecuteCommand();
                     }
                 }
 
                 #endregion
 
-                var insuranceCostData = insuranceCostData1.Where(x => insuranceType.Contains(x.Iid)).ToList();
+                //var insuranceCostData = insuranceCostData1.Where(x => insuranceType.Contains(x.Iid)).ToList();
+                var insuranceCostData = insuranceCostData1.ToList();
                 var currInsuranceInfo = insuranceCostData.Where(x => x.Id == dataId).FirstOrDefault();
                 if (!insuranceCostData.Any() && currInsuranceInfo == null)
                 {
@@ -553,7 +561,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 var schengenCost = insuranceCountryCostData.Where(x => schengenCountry.Contains(x.CountryName)).Sum(x => x.Cost); // 申根国费用
                 var unSchengenCost = unSchengenCountry.Count() * 35; // 非申根国费用
 
-
                 var groupBudgetCost = (schengenCost + unSchengenCost) * groupPeopleNum;
                 var groupActialCost = insuranceCostData.Sum(x => x.CNYPrice);