Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Education
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
Education
Commits
9e2a9560
Commit
9e2a9560
authored
Mar 22, 2023
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1 甲鹤市场提成调整
parent
6a23e57b
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
390 additions
and
39 deletions
+390
-39
StudentLogTypeEnum.cs
Edu.Common/Enum/Log/StudentLogTypeEnum.cs
+1
-1
RB_Sell_Achievements_Rule.cs
Edu.Model/Entity/Sell/RB_Sell_Achievements_Rule.cs
+15
-0
RB_Student.cs
Edu.Model/Entity/User/RB_Student.cs
+10
-0
RB_Student_Assist_Extend.cs
Edu.Model/ViewModel/Customer/RB_Student_Assist_Extend.cs
+5
-0
SellAchievementsModule.cs
Edu.Module.Course/SellAchievementsModule.cs
+183
-24
CustomerStudentModule.cs
Edu.Module.Customer/CustomerStudentModule.cs
+81
-1
RB_Student_AssistRepository.cs
Edu.Repository/Customer/RB_Student_AssistRepository.cs
+14
-0
RB_OrderRepository.cs
Edu.Repository/Sell/RB_OrderRepository.cs
+14
-1
RB_StudentRepository.cs
Edu.Repository/User/RB_StudentRepository.cs
+4
-0
SellAchievementsController.cs
Edu.WebApi/Controllers/Course/SellAchievementsController.cs
+25
-12
CustomerStudentController.cs
Edu.WebApi/Controllers/Customer/CustomerStudentController.cs
+32
-0
UserController.cs
Edu.WebApi/Controllers/User/UserController.cs
+5
-0
Startup.cs
Edu.WebApi/Startup.cs
+1
-0
No files found.
Edu.Common/Enum/Log/StudentLogTypeEnum.cs
View file @
9e2a9560
...
...
@@ -36,7 +36,7 @@ namespace Edu.Common.Enum.Log
/// <summary>
///
试听
///
基础资料
/// </summary>
[
EnumField
(
"基础资料"
)]
BasicInfo
=
5
,
...
...
Edu.Model/Entity/Sell/RB_Sell_Achievements_Rule.cs
View file @
9e2a9560
...
...
@@ -97,5 +97,20 @@ namespace Edu.Model.Entity.Sell
/// </summary>
public
string
SchoolIds
{
get
;
set
;
}
/// <summary>
/// 提成类型 1业绩百分比 2人数固定金额
/// </summary>
public
int
SendType
{
get
;
set
;
}
/// <summary>
/// 人头奖励金额
/// </summary>
public
decimal
PeopleMoney
{
get
;
set
;
}
/// <summary>
/// 额外奖励金额 根据确认邀约咨询30分钟以上 发放
/// </summary>
public
decimal
ExtraMoney
{
get
;
set
;
}
}
}
Edu.Model/Entity/User/RB_Student.cs
View file @
9e2a9560
...
...
@@ -266,5 +266,15 @@ namespace Edu.Model.Entity.User
/// 课程顾问期望达成协议日期
/// </summary>
public
string
AdvisorExpectDate
{
get
;
set
;
}
/// <summary>
/// 学员填表文件路径
/// </summary>
public
string
FileVoucher
{
get
;
set
;
}
/// <summary>
/// 确认邀约咨询30分钟以上 1是
/// </summary>
public
int
IsSureConsultTime
{
get
;
set
;
}
}
}
Edu.Model/ViewModel/Customer/RB_Student_Assist_Extend.cs
View file @
9e2a9560
...
...
@@ -19,5 +19,10 @@ namespace Edu.Model.ViewModel.Customer
/// 协助人员名称
/// </summary>
public
string
AssistName
{
get
;
set
;
}
/// <summary>
/// 订单Id
/// </summary>
public
int
OrderId
{
get
;
set
;
}
}
}
Edu.Module.Course/SellAchievementsModule.cs
View file @
9e2a9560
...
...
@@ -72,6 +72,10 @@ namespace Edu.Module.Course
/// 订单学生
/// </summary>
private
readonly
RB_Order_GuestRepository
order_GuestRepository
=
new
RB_Order_GuestRepository
();
/// <summary>
/// 学员协助人员仓储层对象
/// </summary>
private
readonly
RB_Student_AssistRepository
student_AssistRepository
=
new
RB_Student_AssistRepository
();
/// <summary>
/// 签到
...
...
@@ -734,6 +738,9 @@ namespace Edu.Module.Course
string
orderIds
=
string
.
Join
(
","
,
orderList
.
Select
(
x
=>
x
.
OrderId
));
var
bdList
=
order_ReturnComissionRepository
.
GetOrderReturnComissionListRepositpry
(
new
RB_Order_ReturnComission_ViewModel
()
{
GroupId
=
userInfo
.
Group_Id
,
QOrderIds
=
orderIds
});
//获取订单的学生 是否邀约到访30分钟以上
var
surList
=
orderRepository
.
GetStuSureConsultTimeForOrder
(
orderIds
);
#
region
验证订单是否已生成返佣
(必须有返佣数据
才能参与业绩提成)
var
cbdOrderlist
=
bdList
.
Where
(
x
=>
x
.
Status
>=
0
).
Select
(
x
=>
x
.
OrderId
).
ToList
();
orderList
=
orderList
.
Where
(
x
=>
cbdOrderlist
.
Contains
(
x
.
OrderId
)).
ToList
();
//都是已返佣的
...
...
@@ -759,6 +766,21 @@ namespace Edu.Module.Course
#
endregion
#
region
老师订单
5.10
日需求
//ld2023-03-21 转介绍学生的老师 有2%提成 留学订单200
//查询非续费订单的 转介绍学生类型的 老师
if
(
orderList
.
Where
(
x
=>
x
.
JoinType
==
Common
.
Enum
.
Sale
.
OrderJoinTypeEnum
.
Normal
).
Any
())
{
//再次查询学生
string
OrderIds
=
string
.
Join
(
","
,
orderList
.
Where
(
x
=>
x
.
JoinType
==
Common
.
Enum
.
Sale
.
OrderJoinTypeEnum
.
Normal
).
Select
(
x
=>
x
.
OrderId
));
var
saList
=
student_AssistRepository
.
GetAssistTeacherForOrder
(
OrderIds
);
//重新关联一下订单的 转介绍老师
foreach
(
var
item
in
orderList
.
Where
(
x
=>
x
.
JoinType
==
Common
.
Enum
.
Sale
.
OrderJoinTypeEnum
.
Normal
))
{
//if (item.HelpEnterId > 0) { continue; }
item
.
HelpEnterId
=
saList
.
Where
(
x
=>
x
.
OrderId
==
item
.
OrderId
).
FirstOrDefault
()?.
AssistId
??
0
;
//
}
}
if
(
orderList
.
Where
(
x
=>
x
.
HelpEnterId
>
0
).
Any
())
{
//查询字典表 老师提成规则
...
...
@@ -784,7 +806,11 @@ namespace Edu.Module.Course
TRate
=
Convert
.
ToDecimal
(
TeacherRuleList
.
Where
(
x
=>
x
.
SNO
==
1
).
FirstOrDefault
()?.
Content
??
"0"
);
Remark
=
"教师试听订单提成:订单b2b返佣:"
+
bdCommission
+
";订单业绩:"
+
(
qitem
.
PreferPrice
-
qitem
.
DiscountMoney
-
bdCommission
);
}
if
(
qitem
.
JoinType
==
Common
.
Enum
.
Sale
.
OrderJoinTypeEnum
.
Normal
&&
qitem
.
OrderType
==
Common
.
Enum
.
Sale
.
OrderTypeEnum
.
StudyabroadOrder
)
{
//留学订单
decimal
lxMoney
=
Convert
.
ToDecimal
(
TeacherRuleList
.
Where
(
x
=>
x
.
SNO
==
3
).
FirstOrDefault
()?.
Content
??
"0"
);
Remark
=
"教师留学订单奖励:订单b2b返佣:"
+
bdCommission
+
";订单业绩:"
+
(
qitem
.
PreferPrice
-
qitem
.
DiscountMoney
-
bdCommission
)
+
";留学奖励"
+
lxMoney
;
}
decimal
PushMoney
=
Math
.
Round
((
qitem
.
PreferPrice
-
qitem
.
DiscountMoney
-
bdCommission
)
*
TRate
/
100
,
2
,
MidpointRounding
.
AwayFromZero
);
AchEmpList
.
Add
(
new
RB_Sell_Achievements_Emp_ViewModel
()
{
...
...
@@ -870,6 +896,7 @@ namespace Edu.Module.Course
if
(
item
.
Type
==
1
)
{
var
sellOrderList
=
orderList
.
Where
(
x
=>
x
.
EnterID
>
0
&&
(
","
+
item
.
EmpIds
+
","
).
Contains
(
","
+
x
.
EnterID
+
","
)
&&
(
","
+
item
.
SchoolIds
+
","
).
Contains
(
","
+
x
.
ClassSchoolId
+
","
)).
ToList
();
sellOrderList
=
sellOrderList
.
Where
(
x
=>
x
.
JoinType
!=
Common
.
Enum
.
Sale
.
OrderJoinTypeEnum
.
RenewOrder
).
ToList
();
//市场排除续费订单
if
(!
string
.
IsNullOrEmpty
(
item
.
CourseIds
))
{
if
(
item
.
CourseType
==
1
)
...
...
@@ -893,16 +920,48 @@ namespace Edu.Module.Course
//查询老师的提成
decimal
teacherMoney
=
AchEmpList
.
Where
(
x
=>
x
.
Type
==
3
&&
orderChildList
.
Select
(
y
=>
y
.
OrderId
).
Contains
(
x
.
OrderId
)).
Sum
(
x
=>
x
.
PushMoney
);
decimal
YjMoney
=
TotalYj
-
teacherMoney
;
//排除老师的提成
//根据业绩所在区间 查询比例
var
rateModel
=
item
.
RateList
.
Where
(
x
=>
x
.
StartValue
<
YjMoney
&&
(
x
.
EndValue
>=
YjMoney
||
x
.
EndValue
==
-
1
)).
FirstOrDefault
();
if
(
rateModel
!=
null
)
if
(
item
.
SendType
==
1
)
{
//根据业绩所在区间 查询比例
var
rateModel
=
item
.
RateList
.
Where
(
x
=>
x
.
StartValue
<
YjMoney
&&
(
x
.
EndValue
>=
YjMoney
||
x
.
EndValue
==
-
1
)).
FirstOrDefault
();
if
(
rateModel
!=
null
)
{
foreach
(
var
qitem
in
orderChildList
)
{
//当前订单的业绩
decimal
bdCommission
=
bdList
.
Where
(
x
=>
x
.
OrderId
==
qitem
.
OrderId
).
Sum
(
x
=>
x
.
CommissionMoeny
);
decimal
tCommission
=
AchEmpList
.
Where
(
x
=>
x
.
Type
==
3
&&
x
.
OrderId
==
qitem
.
OrderId
).
Sum
(
x
=>
x
.
PushMoney
);
decimal
orderYj
=
qitem
.
PreferPrice
-
qitem
.
DiscountMoney
-
bdCommission
-
tCommission
;
AchEmpList
.
Add
(
new
RB_Sell_Achievements_Emp_ViewModel
()
{
EmpId
=
qitem
.
EnterID
,
GiveOutMoney
=
0
,
GiveOutState
=
2
,
Group_Id
=
userInfo
.
Group_Id
,
Id
=
0
,
IsDept
=
2
,
OrderId
=
qitem
.
OrderId
,
PeriodsId
=
0
,
Rate
=
rateModel
.
Rate
,
PushMoney
=
Math
.
Round
(
orderYj
*
rateModel
.
Rate
/
100
,
2
,
MidpointRounding
.
AwayFromZero
),
RuleId
=
item
.
Id
,
SaleMoney
=
YjMoney
,
OrderSaleMoney
=
orderYj
,
Type
=
1
,
Remark
=
"当月业绩:"
+
TotalYj
+
";当月老师提成:"
+
teacherMoney
+
";订单b2b返佣:"
+
bdCommission
+
";订单老师提成:"
+
tCommission
+
";订单业绩:"
+
orderYj
});
}
}
}
else
{
//根据人数发放奖励
foreach
(
var
qitem
in
orderChildList
)
{
//当前订单的业绩
decimal
bdCommission
=
bdList
.
Where
(
x
=>
x
.
OrderId
==
qitem
.
OrderId
).
Sum
(
x
=>
x
.
CommissionMoeny
);
decimal
tCommission
=
AchEmpList
.
Where
(
x
=>
x
.
Type
==
3
&&
x
.
OrderId
==
qitem
.
OrderId
).
Sum
(
x
=>
x
.
PushMoney
);
decimal
orderYj
=
qitem
.
PreferPrice
-
qitem
.
DiscountMoney
-
bdCommission
-
tCommission
;
int
IsSureConsultTime
=
surList
.
Where
(
x
=>
x
.
OrderId
==
qitem
.
OrderId
).
FirstOrDefault
()?.
OrderCount
??
0
;
AchEmpList
.
Add
(
new
RB_Sell_Achievements_Emp_ViewModel
()
{
EmpId
=
qitem
.
EnterID
,
...
...
@@ -913,13 +972,13 @@ namespace Edu.Module.Course
IsDept
=
2
,
OrderId
=
qitem
.
OrderId
,
PeriodsId
=
0
,
Rate
=
rateModel
.
Rate
,
PushMoney
=
Math
.
Round
(
orderYj
*
rateModel
.
Rate
/
100
,
2
,
MidpointRounding
.
AwayFromZero
),
Rate
=
0
,
PushMoney
=
item
.
PeopleMoney
+
(
IsSureConsultTime
==
1
?
item
.
ExtraMoney
:
0
),
RuleId
=
item
.
Id
,
SaleMoney
=
YjMoney
,
OrderSaleMoney
=
orderYj
,
Type
=
1
,
Remark
=
"当月业绩:"
+
TotalYj
+
";当月老师提成:"
+
teacherMoney
+
";订单b2b返佣:"
+
bdCommission
+
";订单老师提成:"
+
tCommission
+
";订单业绩:"
+
orderYj
Remark
=
"当月业绩:"
+
TotalYj
+
";当月老师提成:"
+
teacherMoney
+
";订单b2b返佣:"
+
bdCommission
+
";订单老师提成:"
+
tCommission
+
";订单业绩:"
+
orderYj
+
";市场根据人数发放提成:"
+
item
.
PeopleMoney
+
"/人"
+
(
IsSureConsultTime
==
1
?
";满足邀约咨询30分钟以上奖励"
+
item
.
ExtraMoney
:
""
)
});
}
}
...
...
@@ -954,16 +1013,47 @@ namespace Edu.Module.Course
//查询老师的提成
decimal
teacherMoney
=
AchEmpList
.
Where
(
x
=>
x
.
Type
==
3
&&
orderChildList
.
Select
(
y
=>
y
.
OrderId
).
Contains
(
x
.
OrderId
)).
Sum
(
x
=>
x
.
PushMoney
);
decimal
YjMoney
=
TotalYj
-
teacherMoney
;
//排除老师的提成
//根据业绩所在区间 查询比例
var
rateModel
=
item
.
RateList
.
Where
(
x
=>
x
.
StartValue
<
YjMoney
&&
(
x
.
EndValue
>=
YjMoney
||
x
.
EndValue
==
-
1
)).
FirstOrDefault
();
if
(
rateModel
!=
null
)
if
(
item
.
SendType
==
1
)
{
//根据业绩所在区间 查询比例
var
rateModel
=
item
.
RateList
.
Where
(
x
=>
x
.
StartValue
<
YjMoney
&&
(
x
.
EndValue
>=
YjMoney
||
x
.
EndValue
==
-
1
)).
FirstOrDefault
();
if
(
rateModel
!=
null
)
{
foreach
(
var
qitem
in
orderChildList
)
{
//当前订单的业绩
decimal
bdCommission
=
bdList
.
Where
(
x
=>
x
.
OrderId
==
qitem
.
OrderId
).
Sum
(
x
=>
x
.
CommissionMoeny
);
decimal
tCommission
=
AchEmpList
.
Where
(
x
=>
x
.
Type
==
3
&&
x
.
OrderId
==
qitem
.
OrderId
).
Sum
(
x
=>
x
.
PushMoney
);
decimal
orderYj
=
qitem
.
PreferPrice
-
qitem
.
DiscountMoney
-
bdCommission
-
tCommission
;
AchEmpList
.
Add
(
new
RB_Sell_Achievements_Emp_ViewModel
()
{
EmpId
=
qitem
.
CourseConsultantId
,
GiveOutMoney
=
0
,
GiveOutState
=
2
,
Group_Id
=
userInfo
.
Group_Id
,
Id
=
0
,
IsDept
=
2
,
OrderId
=
qitem
.
OrderId
,
PeriodsId
=
0
,
Rate
=
rateModel
.
Rate
,
PushMoney
=
Math
.
Round
(
orderYj
*
rateModel
.
Rate
/
100
,
2
,
MidpointRounding
.
AwayFromZero
),
RuleId
=
item
.
Id
,
SaleMoney
=
YjMoney
,
OrderSaleMoney
=
orderYj
,
Type
=
2
,
Remark
=
"当月业绩:"
+
TotalYj
+
";当月老师提成:"
+
teacherMoney
+
";订单b2b返佣:"
+
bdCommission
+
";订单老师提成:"
+
tCommission
+
";订单业绩:"
+
orderYj
});
}
}
}
else
{
foreach
(
var
qitem
in
orderChildList
)
{
//当前订单的业绩
decimal
bdCommission
=
bdList
.
Where
(
x
=>
x
.
OrderId
==
qitem
.
OrderId
).
Sum
(
x
=>
x
.
CommissionMoeny
);
decimal
tCommission
=
AchEmpList
.
Where
(
x
=>
x
.
Type
==
3
&&
x
.
OrderId
==
qitem
.
OrderId
).
Sum
(
x
=>
x
.
PushMoney
);
decimal
orderYj
=
qitem
.
PreferPrice
-
qitem
.
DiscountMoney
-
bdCommission
-
tCommission
;
int
IsSureConsultTime
=
surList
.
Where
(
x
=>
x
.
OrderId
==
qitem
.
OrderId
).
FirstOrDefault
()?.
OrderCount
??
0
;
AchEmpList
.
Add
(
new
RB_Sell_Achievements_Emp_ViewModel
()
{
EmpId
=
qitem
.
CourseConsultantId
,
...
...
@@ -974,13 +1064,13 @@ namespace Edu.Module.Course
IsDept
=
2
,
OrderId
=
qitem
.
OrderId
,
PeriodsId
=
0
,
Rate
=
rateModel
.
Rate
,
PushMoney
=
Math
.
Round
(
orderYj
*
rateModel
.
Rate
/
100
,
2
,
MidpointRounding
.
AwayFromZero
),
Rate
=
0
,
PushMoney
=
item
.
PeopleMoney
+
(
IsSureConsultTime
==
1
?
item
.
ExtraMoney
:
0
),
RuleId
=
item
.
Id
,
SaleMoney
=
YjMoney
,
OrderSaleMoney
=
orderYj
,
Type
=
2
,
Remark
=
"当月业绩:"
+
TotalYj
+
";当月老师提成:"
+
teacherMoney
+
";订单b2b返佣:"
+
bdCommission
+
";订单老师提成:"
+
tCommission
+
";订单业绩:"
+
orderYj
Remark
=
"当月业绩:"
+
TotalYj
+
";当月老师提成:"
+
teacherMoney
+
";订单b2b返佣:"
+
bdCommission
+
";订单老师提成:"
+
tCommission
+
";订单业绩:"
+
orderYj
+
";根据人数发放提成:"
+
item
.
PeopleMoney
+
"/人"
+
(
IsSureConsultTime
==
1
?
";满足邀约咨询30分钟以上奖励"
+
item
.
ExtraMoney
:
""
)
});
}
}
...
...
@@ -995,6 +1085,7 @@ namespace Edu.Module.Course
if
(
item
.
Type
==
1
)
{
var
sellOrderList
=
orderList
.
Where
(
x
=>
x
.
EnterID
>
0
&&
(
","
+
item
.
ChildEmpIds
+
","
).
Contains
(
","
+
x
.
EnterID
+
","
)
&&
(
","
+
item
.
SchoolIds
+
","
).
Contains
(
","
+
x
.
ClassSchoolId
+
","
)).
ToList
();
sellOrderList
=
sellOrderList
.
Where
(
x
=>
x
.
JoinType
!=
Common
.
Enum
.
Sale
.
OrderJoinTypeEnum
.
RenewOrder
).
ToList
();
//市场排除续费订单
if
(!
string
.
IsNullOrEmpty
(
item
.
CourseIds
))
{
if
(
item
.
CourseType
==
1
)
...
...
@@ -1014,15 +1105,49 @@ namespace Edu.Module.Course
decimal
teacherMoney
=
AchEmpList
.
Where
(
x
=>
x
.
Type
==
3
&&
sellOrderList
.
Select
(
y
=>
y
.
OrderId
).
Contains
(
x
.
OrderId
)).
Sum
(
x
=>
x
.
PushMoney
);
decimal
YjMoney
=
TotalYj
-
teacherMoney
;
//排除 老师的提成
//根据业绩所在区间 查询比例
var
rateModel
=
item
.
RateList
.
Where
(
x
=>
x
.
StartValue
<
YjMoney
&&
(
x
.
EndValue
>=
YjMoney
||
x
.
EndValue
==
-
1
)).
FirstOrDefault
();
if
(
rateModel
!=
null
)
if
(
item
.
SendType
==
1
)
{
var
rateModel
=
item
.
RateList
.
Where
(
x
=>
x
.
StartValue
<
YjMoney
&&
(
x
.
EndValue
>=
YjMoney
||
x
.
EndValue
==
-
1
)).
FirstOrDefault
();
if
(
rateModel
!=
null
)
{
foreach
(
var
qitem
in
sellOrderList
)
{
//当前订单的业绩
decimal
bdCommission
=
bdList
.
Where
(
x
=>
x
.
OrderId
==
qitem
.
OrderId
).
Sum
(
x
=>
x
.
CommissionMoeny
);
decimal
tCommission
=
AchEmpList
.
Where
(
x
=>
x
.
Type
==
3
&&
x
.
OrderId
==
qitem
.
OrderId
).
Sum
(
x
=>
x
.
PushMoney
);
decimal
orderYj
=
qitem
.
PreferPrice
-
qitem
.
DiscountMoney
-
bdCommission
-
tCommission
;
foreach
(
var
emp
in
EmpList
)
{
AchEmpList
.
Add
(
new
RB_Sell_Achievements_Emp_ViewModel
()
{
EmpId
=
emp
,
GiveOutMoney
=
0
,
GiveOutState
=
2
,
Group_Id
=
userInfo
.
Group_Id
,
Id
=
0
,
IsDept
=
1
,
OrderId
=
qitem
.
OrderId
,
PeriodsId
=
0
,
Rate
=
rateModel
.
Rate
,
PushMoney
=
Math
.
Round
(
orderYj
*
rateModel
.
Rate
/
100
,
2
,
MidpointRounding
.
AwayFromZero
),
RuleId
=
item
.
Id
,
SaleMoney
=
YjMoney
,
OrderSaleMoney
=
orderYj
,
Type
=
1
,
Remark
=
"当月业绩:"
+
TotalYj
+
";当月老师提成:"
+
teacherMoney
+
";订单b2b返佣:"
+
bdCommission
+
";订单老师提成:"
+
tCommission
+
";订单业绩:"
+
orderYj
});
}
}
}
}
else
{
foreach
(
var
qitem
in
sellOrderList
)
{
//当前订单的业绩
decimal
bdCommission
=
bdList
.
Where
(
x
=>
x
.
OrderId
==
qitem
.
OrderId
).
Sum
(
x
=>
x
.
CommissionMoeny
);
decimal
tCommission
=
AchEmpList
.
Where
(
x
=>
x
.
Type
==
3
&&
x
.
OrderId
==
qitem
.
OrderId
).
Sum
(
x
=>
x
.
PushMoney
);
decimal
orderYj
=
qitem
.
PreferPrice
-
qitem
.
DiscountMoney
-
bdCommission
-
tCommission
;
int
IsSureConsultTime
=
surList
.
Where
(
x
=>
x
.
OrderId
==
qitem
.
OrderId
).
FirstOrDefault
()?.
OrderCount
??
0
;
foreach
(
var
emp
in
EmpList
)
{
AchEmpList
.
Add
(
new
RB_Sell_Achievements_Emp_ViewModel
()
...
...
@@ -1035,13 +1160,13 @@ namespace Edu.Module.Course
IsDept
=
1
,
OrderId
=
qitem
.
OrderId
,
PeriodsId
=
0
,
Rate
=
rateModel
.
Rate
,
PushMoney
=
Math
.
Round
(
orderYj
*
rateModel
.
Rate
/
100
,
2
,
MidpointRounding
.
AwayFromZero
),
Rate
=
0
,
PushMoney
=
item
.
PeopleMoney
+
(
IsSureConsultTime
==
1
?
item
.
ExtraMoney
:
0
),
RuleId
=
item
.
Id
,
SaleMoney
=
YjMoney
,
OrderSaleMoney
=
orderYj
,
Type
=
1
,
Remark
=
"当月业绩:"
+
TotalYj
+
";当月老师提成:"
+
teacherMoney
+
";订单b2b返佣:"
+
bdCommission
+
";订单老师提成:"
+
tCommission
+
";订单业绩:"
+
orderYj
Remark
=
"当月业绩:"
+
TotalYj
+
";当月老师提成:"
+
teacherMoney
+
";订单b2b返佣:"
+
bdCommission
+
";订单老师提成:"
+
tCommission
+
";订单业绩:"
+
orderYj
+
";市场根据人数发放提成:"
+
item
.
PeopleMoney
+
"/人"
+
(
IsSureConsultTime
==
1
?
";满足邀约咨询30分钟以上奖励"
+
item
.
ExtraMoney
:
""
)
});
}
}
...
...
@@ -1069,16 +1194,50 @@ namespace Edu.Module.Course
//查询老师的提成
decimal
teacherMoney
=
AchEmpList
.
Where
(
x
=>
x
.
Type
==
3
&&
consultantOrderList
.
Select
(
y
=>
y
.
OrderId
).
Contains
(
x
.
OrderId
)).
Sum
(
x
=>
x
.
PushMoney
);
decimal
YjMoney
=
TotalYj
-
teacherMoney
;
//排除老师的提成
//根据业绩所在区间 查询比例
var
rateModel
=
item
.
RateList
.
Where
(
x
=>
x
.
StartValue
<
YjMoney
&&
(
x
.
EndValue
>=
YjMoney
||
x
.
EndValue
==
-
1
)).
FirstOrDefault
();
if
(
rateModel
!=
null
)
if
(
item
.
SendType
==
1
)
{
//根据业绩所在区间 查询比例
var
rateModel
=
item
.
RateList
.
Where
(
x
=>
x
.
StartValue
<
YjMoney
&&
(
x
.
EndValue
>=
YjMoney
||
x
.
EndValue
==
-
1
)).
FirstOrDefault
();
if
(
rateModel
!=
null
)
{
foreach
(
var
qitem
in
consultantOrderList
)
{
//当前订单的业绩
decimal
bdCommission
=
bdList
.
Where
(
x
=>
x
.
OrderId
==
qitem
.
OrderId
).
Sum
(
x
=>
x
.
CommissionMoeny
);
decimal
tCommission
=
AchEmpList
.
Where
(
x
=>
x
.
Type
==
3
&&
x
.
OrderId
==
qitem
.
OrderId
).
Sum
(
x
=>
x
.
PushMoney
);
decimal
orderYj
=
qitem
.
PreferPrice
-
qitem
.
DiscountMoney
-
bdCommission
-
tCommission
;
foreach
(
var
emp
in
EmpList
)
{
AchEmpList
.
Add
(
new
RB_Sell_Achievements_Emp_ViewModel
()
{
EmpId
=
emp
,
GiveOutMoney
=
0
,
GiveOutState
=
2
,
Group_Id
=
userInfo
.
Group_Id
,
Id
=
0
,
IsDept
=
1
,
OrderId
=
qitem
.
OrderId
,
PeriodsId
=
0
,
Rate
=
rateModel
.
Rate
,
PushMoney
=
Math
.
Round
(
orderYj
*
rateModel
.
Rate
/
100
,
2
,
MidpointRounding
.
AwayFromZero
),
RuleId
=
item
.
Id
,
SaleMoney
=
YjMoney
,
OrderSaleMoney
=
orderYj
,
Type
=
2
,
Remark
=
"当月业绩:"
+
TotalYj
+
";当月老师提成:"
+
teacherMoney
+
";订单b2b返佣:"
+
bdCommission
+
";订单老师提成:"
+
tCommission
+
";订单业绩:"
+
orderYj
});
}
}
}
}
else
{
foreach
(
var
qitem
in
consultantOrderList
)
{
//当前订单的业绩
decimal
bdCommission
=
bdList
.
Where
(
x
=>
x
.
OrderId
==
qitem
.
OrderId
).
Sum
(
x
=>
x
.
CommissionMoeny
);
decimal
tCommission
=
AchEmpList
.
Where
(
x
=>
x
.
Type
==
3
&&
x
.
OrderId
==
qitem
.
OrderId
).
Sum
(
x
=>
x
.
PushMoney
);
decimal
orderYj
=
qitem
.
PreferPrice
-
qitem
.
DiscountMoney
-
bdCommission
-
tCommission
;
int
IsSureConsultTime
=
surList
.
Where
(
x
=>
x
.
OrderId
==
qitem
.
OrderId
).
FirstOrDefault
()?.
OrderCount
??
0
;
foreach
(
var
emp
in
EmpList
)
{
AchEmpList
.
Add
(
new
RB_Sell_Achievements_Emp_ViewModel
()
...
...
@@ -1091,13 +1250,13 @@ namespace Edu.Module.Course
IsDept
=
1
,
OrderId
=
qitem
.
OrderId
,
PeriodsId
=
0
,
Rate
=
rateModel
.
Rate
,
PushMoney
=
Math
.
Round
(
orderYj
*
rateModel
.
Rate
/
100
,
2
,
MidpointRounding
.
AwayFromZero
),
Rate
=
0
,
PushMoney
=
item
.
PeopleMoney
+
(
IsSureConsultTime
==
1
?
item
.
ExtraMoney
:
0
),
RuleId
=
item
.
Id
,
SaleMoney
=
YjMoney
,
OrderSaleMoney
=
orderYj
,
Type
=
2
,
Remark
=
"当月业绩:"
+
TotalYj
+
";当月老师提成:"
+
teacherMoney
+
";订单b2b返佣:"
+
bdCommission
+
";订单老师提成:"
+
tCommission
+
";订单业绩:"
+
orderYj
Remark
=
"当月业绩:"
+
TotalYj
+
";当月老师提成:"
+
teacherMoney
+
";订单b2b返佣:"
+
bdCommission
+
";订单老师提成:"
+
tCommission
+
";订单业绩:"
+
orderYj
+
";根据人数发放提成:"
+
item
.
PeopleMoney
+
"/人"
+
(
IsSureConsultTime
==
1
?
";满足邀约咨询30分钟以上奖励"
+
item
.
ExtraMoney
:
""
)
});
}
}
...
...
Edu.Module.Customer/CustomerStudentModule.cs
View file @
9e2a9560
...
...
@@ -17,6 +17,7 @@ using Edu.Repository.StudyAbroad;
using
Edu.Model.ViewModel.StudyAbroad
;
using
Edu.Common.Enum.System
;
using
Newtonsoft.Json.Linq
;
using
Edu.Model.CacheModel
;
namespace
Edu.Module.Customer
{
...
...
@@ -825,7 +826,7 @@ namespace Edu.Module.Customer
});
}
return
student_AssistRepository
.
Exists
(
list
);
}
}
/// <summary>
/// 推送课程顾问
...
...
@@ -1351,5 +1352,84 @@ namespace Edu.Module.Customer
return
flag
;
}
#
endregion
#
region
学员填报上传
+
顾问给市场提成确认
/// <summary>
/// 学员填表上传
/// </summary>
/// <param name="stuId"></param>
/// <param name="voucher"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public
bool
SetStudentVoucher
(
int
stuId
,
string
voucher
,
UserInfo
userInfo
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Student_ViewModel
.
FileVoucher
),
voucher
},
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Student_ViewModel
.
StuId
),
FiledValue
=
stuId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag
=
studentRepository
.
Update
(
keyValues
,
wheres
);
if
(
flag
)
{
student_LogRepository
.
Insert
(
new
Model
.
Entity
.
Customer
.
RB_Student_Log
()
{
LogId
=
0
,
CreateBy
=
userInfo
.
Id
,
CreateTime
=
DateTime
.
Now
,
CreateType
=
1
,
Group_Id
=
userInfo
.
Group_Id
,
LogContent
=
"上传学员填表附件"
,
LogTitle
=
"上传资料"
,
LogType
=
Common
.
Enum
.
Log
.
StudentLogTypeEnum
.
BasicInfo
,
StuId
=
stuId
});
}
return
flag
;
}
/// <summary>
/// 确认邀约咨询30分钟以上 1是
/// </summary>
/// <param name="stuId"></param>
/// <param name="isSureConsultTime"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public
bool
SetStudentSureConsult
(
int
stuId
,
int
isSureConsultTime
,
UserInfo
userInfo
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Student_ViewModel
.
IsSureConsultTime
),
isSureConsultTime
},
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Student_ViewModel
.
StuId
),
FiledValue
=
stuId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag
=
studentRepository
.
Update
(
keyValues
,
wheres
);
if
(
flag
)
{
student_LogRepository
.
Insert
(
new
Model
.
Entity
.
Customer
.
RB_Student_Log
()
{
LogId
=
0
,
CreateBy
=
userInfo
.
Id
,
CreateTime
=
DateTime
.
Now
,
CreateType
=
1
,
Group_Id
=
userInfo
.
Group_Id
,
LogContent
=
$"修改学生是否邀约咨询30分钟以上【
{(
isSureConsultTime
==
1
?
"是"
:
"否"
)}
】"
,
LogTitle
=
"修改咨询状态"
,
LogType
=
Common
.
Enum
.
Log
.
StudentLogTypeEnum
.
BasicInfo
,
StuId
=
stuId
});
}
return
flag
;
}
#
endregion
}
}
Edu.Repository/Customer/RB_Student_AssistRepository.cs
View file @
9e2a9560
...
...
@@ -66,5 +66,19 @@ inner join rb_student s on s.StuId = a.StuId
WHERE a.`Status`=0 and s.Group_Id =
{
group_Id
}
and s.`Status`=0 and a.AssistId =
{
userId
}
"
;
return
Get
<
RB_Student_Assist_Extend
>(
sql
).
ToList
();
}
/// <summary>
/// 根据订单获取 转介绍学生的老师
/// </summary>
/// <param name="orderIds"></param>
/// <returns></returns>
public
List
<
RB_Student_Assist_Extend
>
GetAssistTeacherForOrder
(
string
orderIds
)
{
string
sql
=
$@"SELECT og.OrderId,a.AssistId FROM rb_student_orderguest og
INNER JOIN rb_student_assist a on og.Student_Id =a.StuId
INNER JOIN rb_student s on og.Student_Id =s.StuId
INNER JOIN rb_account ac on a.AssistId = ac.Id
WHERE og.`Status` =0 and a.`Status` =0 and og.OrderId in(
{
orderIds
}
) and a.AssistType =4 and s.CreateType =4 and ac.AccountType =2"
;
return
Get
<
RB_Student_Assist_Extend
>(
sql
).
ToList
();
}
}
}
Edu.Repository/Sell/RB_OrderRepository.cs
View file @
9e2a9560
...
...
@@ -1289,7 +1289,7 @@ WHERE 1=1
//市场人员
if
(
PlanType
==
1
)
{
builder
.
AppendFormat
(
" AND (EnterID={0})
"
,
SaleId
);
builder
.
AppendFormat
(
" AND (EnterID={0})
and o.JoinType <>3 "
,
SaleId
);
//ld 2023-03-22 徐总要求 续费订单 市场不参加,续费跟课程顾问 + 老师相关
}
//课程顾问
else
...
...
@@ -1437,5 +1437,18 @@ FROM rb_order o WHERE o.Group_Id ={group_Id} and o.OrderState <>3 and o.CreateTi
GROUP BY o.CourseConsultantId"
;
return
Get
<
RB_Order_ViewModel
>(
sql
).
ToList
();
}
/// <summary>
/// 获取学生确认咨询时间
/// </summary>
/// <param name="orderIds"></param>
/// <returns></returns>
public
List
<
RB_Order_ViewModel
>
GetStuSureConsultTimeForOrder
(
string
orderIds
)
{
string
sql
=
$@"SELECT og.OrderId,s.IsSureConsultTime as OrderCount FROM rb_student_orderguest og
INNER JOIN rb_student s on og.Student_Id =s.StuId
WHERE og.`Status` =0 and og.OrderId in(
{
orderIds
}
)"
;
return
Get
<
RB_Order_ViewModel
>(
sql
).
ToList
();
}
}
}
Edu.Repository/User/RB_StudentRepository.cs
View file @
9e2a9560
...
...
@@ -724,6 +724,10 @@ GROUP BY GuestId";
{
nameof
(
RB_Student_ViewModel
.
StuType
),
model
.
StuType
},
{
nameof
(
RB_Student_ViewModel
.
StuRealMobile
),
model
.
StuRealMobile
},
};
if
(!
string
.
IsNullOrEmpty
(
model
.
FileVoucher
))
{
fileds
.
Add
(
nameof
(
RB_Student_ViewModel
.
FileVoucher
),
model
.
FileVoucher
);
}
//教育后台操作
if
(
model
.
OperateType
==
1
)
{
...
...
Edu.WebApi/Controllers/Course/SellAchievementsController.cs
View file @
9e2a9560
...
...
@@ -67,6 +67,9 @@ namespace Edu.WebApi.Controllers.Course
x
.
RateList
,
x
.
SchoolIds
,
x
.
SchoolName
,
x
.
SendType
,
x
.
PeopleMoney
,
x
.
ExtraMoney
,
CreateTime
=
x
.
CreateTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
}));
}
...
...
@@ -107,22 +110,32 @@ namespace Edu.WebApi.Controllers.Course
return
ApiResult
.
ParamIsNull
(
"请传递首次发放比例"
);
}
if
(
demodel
.
RateList
==
null
||
!
demodel
.
RateList
.
Any
()
)
if
(
demodel
.
SendType
==
1
)
{
return
ApiResult
.
ParamIsNull
(
"请传递业绩提成比例"
);
}
int
length
=
demodel
.
RateList
.
Count
();
for
(
var
i
=
0
;
i
<
length
;
i
++)
{
if
(
i
<
length
-
1
)
{
if
(
demodel
.
RateList
[
i
].
EndValue
>
demodel
.
RateList
[
i
+
1
].
StartValue
)
{
return
ApiResult
.
ParamIsNull
(
"业绩金额有误,请核实后再试"
);
}
if
(
demodel
.
RateList
==
null
||
!
demodel
.
RateList
.
Any
())
{
return
ApiResult
.
ParamIsNull
(
"请传递业绩提成比例"
);
}
if
(
demodel
.
RateList
[
i
].
Rate
<
0
)
{
return
ApiResult
.
ParamIsNull
(
"业绩提成比例有误"
);
int
length
=
demodel
.
RateList
.
Count
();
for
(
var
i
=
0
;
i
<
length
;
i
++)
{
if
(
i
<
length
-
1
)
{
if
(
demodel
.
RateList
[
i
].
EndValue
>
demodel
.
RateList
[
i
+
1
].
StartValue
)
{
return
ApiResult
.
ParamIsNull
(
"业绩金额有误,请核实后再试"
);
}
}
if
(
demodel
.
RateList
[
i
].
Rate
<
0
)
{
return
ApiResult
.
ParamIsNull
(
"业绩提成比例有误"
);
}
}
demodel
.
Content
=
JsonHelper
.
Serialize
(
demodel
.
RateList
);
}
else
{
demodel
.
Content
=
""
;
}
demodel
.
Content
=
JsonHelper
.
Serialize
(
demodel
.
RateList
);
demodel
.
Status
=
0
;
demodel
.
Group_Id
=
userInfo
.
Group_Id
;
...
...
Edu.WebApi/Controllers/Customer/CustomerStudentController.cs
View file @
9e2a9560
...
...
@@ -989,5 +989,37 @@ namespace Edu.WebApi.Controllers.Customer
bool
flag
=
customerStudentModule
.
RemoveNeedsModule
(
Id
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
#
region
学员填报上传
+
顾问给市场提成确认
/// <summary>
/// 保存学员填表文件
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetStudentVoucher
()
{
int
StuId
=
base
.
ParmJObj
.
GetInt
(
"StuId"
);
string
Voucher
=
base
.
ParmJObj
.
GetStringValue
(
"Voucher"
);
bool
flag
=
customerStudentModule
.
SetStudentVoucher
(
StuId
,
Voucher
,
base
.
UserInfo
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
/// 确认邀约咨询30分钟以上
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetStudentSureConsult
()
{
int
StuId
=
base
.
ParmJObj
.
GetInt
(
"StuId"
);
int
IsSureConsultTime
=
base
.
ParmJObj
.
GetInt
(
"IsSureConsultTime"
);
bool
flag
=
customerStudentModule
.
SetStudentSureConsult
(
StuId
,
IsSureConsultTime
,
base
.
UserInfo
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
#
endregion
}
}
Edu.WebApi/Controllers/User/UserController.cs
View file @
9e2a9560
...
...
@@ -806,6 +806,8 @@ namespace Edu.WebApi.Controllers.User
item
.
AdvisorStatusName
,
item
.
AdvisorList
,
item
.
AdvisorWinRate
,
item
.
FileVoucher
,
item
.
IsSureConsultTime
});
}
pageModel
.
Count
=
rowsCount
;
...
...
@@ -1059,6 +1061,7 @@ namespace Edu.WebApi.Controllers.User
StuType
=
base
.
ParmJObj
.
GetInt
(
"StuType"
),
StuNeeds
=
base
.
ParmJObj
.
GetInt
(
"StuNeeds"
),
StuRealMobile
=
base
.
ParmJObj
.
GetStringValue
(
"StuRealMobile"
),
FileVoucher
=
base
.
ParmJObj
.
GetStringValue
(
"FileVoucher"
),
};
if
(
string
.
IsNullOrEmpty
(
extModel
.
StuRealMobile
)
&&
string
.
IsNullOrEmpty
(
extModel
.
QQ
)
&&
string
.
IsNullOrEmpty
(
extModel
.
WeChatNo
))
{
...
...
@@ -1493,6 +1496,8 @@ namespace Edu.WebApi.Controllers.User
extModel
.
ConsultingResults
,
ConsultDate
=
extModel
.
ConsultDate
.
HasValue
?
extModel
.
ConsultDate
.
Value
.
ToString
(
"yyyy-MM-dd"
)
:
""
,
extModel
.
OrderCount
,
extModel
.
IsSureConsultTime
,
extModel
.
FileVoucher
};
return
ApiResult
.
Success
(
data
:
obj
);
}
...
...
Edu.WebApi/Startup.cs
View file @
9e2a9560
...
...
@@ -76,6 +76,7 @@ namespace Edu.WebApi
"http://mobile.kookaku.com"
,
"http://m.kookaku.com"
,
"http://lm.oytour.com"
,
"http://192.168.10.9:8068"
,
};
services
.
AddCors
(
options
=>
options
.
AddPolicy
(
"AllowCors"
,
policy
=>
policy
.
AllowAnyHeader
().
AllowAnyMethod
().
AllowCredentials
().
WithOrigins
(
corsArray
.
ToArray
())));
services
.
Configure
<
IISServerOptions
>(
options
=>
options
.
AllowSynchronousIO
=
true
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment