|
@@ -2,6 +2,7 @@
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
using OASystem.Domain;
|
|
|
using OASystem.Domain.Entities.Groups;
|
|
|
+using OASystem.Domain.Entities.Resource;
|
|
|
using OASystem.Domain.ViewModels.Groups;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
@@ -460,6 +461,20 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
{
|
|
|
#region 保险费用录入自动审核
|
|
|
var currModule = 82;
|
|
|
+ var groupDetails = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(x => x.IsDel == 0 && x.Id == diId).First();
|
|
|
+ if (groupDetails == null)
|
|
|
+ {
|
|
|
+ _view.Msg = $"团组信息为空,不可自动审核!";
|
|
|
+ return _view;
|
|
|
+ }
|
|
|
+
|
|
|
+ var insuranceCountryCostData = _sqlSugar.Queryable<Res_BasicInsuranceCost>().Where(x => x.IsDel == 0).ToList();
|
|
|
+ if (!insuranceCountryCostData.Any())
|
|
|
+ {
|
|
|
+ _view.Msg = $"保险国家费用信息为空,不可自动审核!";
|
|
|
+ return _view;
|
|
|
+ }
|
|
|
+
|
|
|
var insuranceType = _sqlSugar.Queryable<Grp_InsuranceCost>().Where(x => x.IsDel == 0 && x.Id != 2).Select(x => x.Id).ToList();
|
|
|
var insuranceCostData1 = _sqlSugar.Queryable<Grp_Customers>()
|
|
|
.LeftJoin<Grp_CreditCardPayment>((c, ccp) => c.Id == ccp.CId && ccp.CTable == 82)
|
|
@@ -510,7 +525,24 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
return _view;
|
|
|
}
|
|
|
|
|
|
- var groupBudgetCost = groupInfo.BXCB * groupInfo.BXRS;
|
|
|
+ var groupPeopleNum = groupDetails.VisitPNumber;
|
|
|
+ var visitCountrys = groupDetails.VisitCountry.Split("|").ToList();
|
|
|
+
|
|
|
+ if (!visitCountrys.Any())
|
|
|
+ {
|
|
|
+ _view.Msg = $"出访国家为空,不可自动审核!";
|
|
|
+ return _view;
|
|
|
+ }
|
|
|
+
|
|
|
+ var basicCountrys = insuranceCountryCostData.Select(x => x.CountryName).ToList();
|
|
|
+ var schengenCountry = visitCountrys.Intersect(basicCountrys); //申根国
|
|
|
+ var unSchengenCountry = visitCountrys.Except(basicCountrys); //非申根国
|
|
|
+
|
|
|
+ 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);
|
|
|
|
|
|
if (groupActialCost > groupBudgetCost)
|