|
@@ -47,6 +47,11 @@ using Org.BouncyCastle.Asn1.Crmf;
|
|
|
using EyeSoft.Extensions;
|
|
|
using System.Collections;
|
|
|
using SqlSugar.Extensions;
|
|
|
+using System.Linq.Expressions;
|
|
|
+using MathNet.Numerics.Distributions;
|
|
|
+using System.Diagnostics.Metrics;
|
|
|
+using EyeSoft.Collections.Generic;
|
|
|
+using Microsoft.Extensions.Hosting;
|
|
|
|
|
|
namespace OASystem.API.Controllers
|
|
|
{
|
|
@@ -4774,6 +4779,133 @@ Group by PriceType ", dto.diId);
|
|
|
{
|
|
|
|
|
|
|
|
|
+ }
|
|
|
+ else if (Invitation.Contains(userId))
|
|
|
+ {
|
|
|
+ // 2)付费公务活动部分:¥50 / 团;
|
|
|
+ //4)不付费公务活动部分(自己联络)额外奖励:¥200 / 团(若公务活动方与邀请方为同一机构,奖励金额为¥100 / 团);
|
|
|
+ //5)只发邀请的团组不付费邀请额外奖励:¥100 / 团;
|
|
|
+ //邀请方已授权我司签发的邀请仍按照:¥100 / 团,无额外奖励。
|
|
|
+ var officialList = _sqlSugar.Queryable<Res_OfficialActivities, Grp_DelegationInfo>((x,a)=>
|
|
|
+ new JoinQueryInfos(JoinType.Left,a.Id == x.DiId)
|
|
|
+ ).Where((x,a) => x.IsSubmitApproval == 0 && x.IsDel == 0 && a.IsDel == 0
|
|
|
+ && a.VisitDate > StartDateTime && a.VisitDate < EndDateTime
|
|
|
+ )
|
|
|
+ .Select((x, a) => new
|
|
|
+ {
|
|
|
+ a.Id,
|
|
|
+ a.TeamName,
|
|
|
+ a.VisitDate,
|
|
|
+ x.CreateUserId,
|
|
|
+ x.Type
|
|
|
+ })
|
|
|
+ .ToList();
|
|
|
+
|
|
|
+ var groups = officialList.GroupBy(x => x.Id);
|
|
|
+
|
|
|
+ foreach (var group in groups)
|
|
|
+ {
|
|
|
+ var officialGroupList = group.GroupBy(d => d.CreateUserId);
|
|
|
+ int operUserMax = 0, operMaxCount = 0;
|
|
|
+
|
|
|
+ foreach (var item in officialGroupList)
|
|
|
+ {
|
|
|
+ if (item.Count() > operMaxCount)
|
|
|
+ {
|
|
|
+ operUserMax = item.Key;
|
|
|
+ operMaxCount = item.Count();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ string temp = string.Empty;
|
|
|
+ bool isBasics = operUserMax == userId;
|
|
|
+ var comMoney = 0;
|
|
|
+
|
|
|
+ foreach (var item in group)
|
|
|
+ {
|
|
|
+ if (item.Type == 0)
|
|
|
+ {
|
|
|
+ comMoney += (100 + 300);
|
|
|
+ }
|
|
|
+ else if (item.Type == 1)
|
|
|
+ {
|
|
|
+ comMoney += 300;
|
|
|
+ }
|
|
|
+ else if (item.Type == 2)
|
|
|
+ {
|
|
|
+ comMoney += 200;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (Visa.Contains(userId)) //签证
|
|
|
+ {
|
|
|
+ // 1)办理英国、加拿大、美国签证¥50元 / 人 / 团;
|
|
|
+ // 申根国家及其他所有国家¥30元 / 人 / 团;
|
|
|
+ var existsCountry = new string[] { "英国", "加拿大", "美国" };
|
|
|
+ var whereExpression = Expressionable.Create<Grp_VisaInfo, Grp_DelegationInfo, Grp_CreditCardPayment>()
|
|
|
+ .Or(
|
|
|
+ (x, a, b) => x.IsDel == 0 && x.CreateUserId == userId && (b.IsAuditGM == 1 || b.IsAuditGM == 3)
|
|
|
+ && a.IsDel == 0 && a.VisitDate > StartDateTime && a.VisitDate < EndDateTime && b.IsDel == 0 && x.IsThird == 0 && x.PassengerType == 974
|
|
|
+ );
|
|
|
+ var listVisa = _sqlSugar.Queryable<Grp_VisaInfo, Grp_DelegationInfo, Grp_CreditCardPayment>((x, a, b) => new
|
|
|
+ JoinQueryInfos(
|
|
|
+ JoinType.Left, a.Id == x.DIId,
|
|
|
+ JoinType.Left, b.CTable == 80 && b.CId == x.Id)
|
|
|
+ )
|
|
|
+ .Where(whereExpression.ToExpression())
|
|
|
+ .Select((x, a, b) => new
|
|
|
+ {
|
|
|
+ a.Id,
|
|
|
+ a.TeamName,
|
|
|
+ a.VisitDate,
|
|
|
+ a.TeamLevSId,
|
|
|
+ a.VisitPNumber,
|
|
|
+ a.VisitCountry,
|
|
|
+ x.VisaDescription,
|
|
|
+ x.VisaFreeNumber,
|
|
|
+ x.VisaNumber,
|
|
|
+ x.VisaPrice
|
|
|
+ })
|
|
|
+ .ToList();
|
|
|
+
|
|
|
+ var groupByid = listVisa.GroupBy(x => x.Id);
|
|
|
+ foreach (var visaArr in groupByid)
|
|
|
+ {
|
|
|
+ var groupinfo = listVisa.First(x => x.Id == visaArr.Key);
|
|
|
+ var singlePrice = existsCountry.Where(x => groupinfo.VisitCountry.Contains(x)).Count() > 0 ? 50 : 30;
|
|
|
+ int count = 0, money = 0;
|
|
|
+ var arr = new ArrayList();
|
|
|
+ foreach (var visa in visaArr)
|
|
|
+ {
|
|
|
+ if (visa.VisaPrice > 0)
|
|
|
+ {
|
|
|
+ count += visa.VisaFreeNumber + visa.VisaNumber;
|
|
|
+ money += singlePrice * (visa.VisaFreeNumber + visa.VisaNumber);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ count -= visa.VisaFreeNumber + visa.VisaNumber;
|
|
|
+ money -= singlePrice * (visa.VisaFreeNumber + visa.VisaNumber);
|
|
|
+ }
|
|
|
+ string info = $"签证 {visa.VisaDescription} {(visa.VisaPrice > 0 ? "" : "此笔为退费!")} 人数为{visa.VisaFreeNumber + visa.VisaNumber} 单价为{singlePrice} 金额为{singlePrice * (visa.VisaFreeNumber + visa.VisaNumber)}";
|
|
|
+ arr.Add(info);
|
|
|
+ }
|
|
|
+
|
|
|
+ string temp = "本团人数" + groupinfo.VisitPNumber + ",该人员" + user.CnName + "共办理英国、加拿大、美国签证" + (singlePrice == 50 ? count : 0).ToString() + "本护照(包含免签人员),申根国家及其他所有国家" + (singlePrice == 30 ? count : 0).ToString() + "本。" + user.CnName + "提成共" + money.ToString("#0.00") + "元";
|
|
|
+
|
|
|
+ resultArr.Add(new
|
|
|
+ {
|
|
|
+ groupinfo.TeamName,
|
|
|
+ groupinfo.Id,
|
|
|
+ chiArr = arr,
|
|
|
+ teamLvStr = teamLv.Find(x => x.Id == groupinfo.TeamLevSId)?.Name,
|
|
|
+ groupinfo.VisitDate,
|
|
|
+ temp,
|
|
|
+ price = money,
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
jw.Data = resultArr;
|