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
21567372
Commit
21567372
authored
Dec 21, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
cbbf226a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
216 additions
and
4 deletions
+216
-4
EmployeeBonusModule.cs
Edu.Module.Course/EmployeeBonusModule.cs
+184
-0
RB_Bonus_PlanRepository.cs
Edu.Repository/Sell/RB_Bonus_PlanRepository.cs
+21
-2
RB_OrderRepository.cs
Edu.Repository/Sell/RB_OrderRepository.cs
+5
-1
LoginController.cs
Edu.WebApi/Controllers/User/LoginController.cs
+6
-1
No files found.
Edu.Module.Course/EmployeeBonusModule.cs
0 → 100644
View file @
21567372
using
Edu.Model.ViewModel.Sell
;
using
Edu.Repository.Bonus
;
using
Edu.Repository.Sell
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Linq
;
using
Edu.Model.Entity.Bonus
;
namespace
Edu.Module.Course
{
/// <summary>
/// 员工月度人头奖金处理类
/// </summary>
public
class
EmployeeBonusModule
{
/// <summary>
/// 课程顾问、市场达标奖金配置仓储层对象
/// </summary>
private
readonly
RB_Bonus_PlanRepository
bonus_PlanRepository
=
new
RB_Bonus_PlanRepository
();
/// <summary>
/// 员工人头奖励仓储层对象
/// </summary>
private
readonly
RB_Personnel_BonusRepository
personnel_BonusRepository
=
new
RB_Personnel_BonusRepository
();
/// <summary>
/// 员工人头奖励抵扣详情仓储层对象
/// </summary>
private
readonly
RB_Personnel_DeductionRepository
personnel_DeductionRepository
=
new
RB_Personnel_DeductionRepository
();
/// <summary>
/// 员工人头奖励详情仓储层对象
/// </summary>
private
readonly
RB_Personnel_BonusDetailRepository
personnel_BonusDetailRepository
=
new
RB_Personnel_BonusDetailRepository
();
/// <summary>
/// 订单仓储层对象
/// </summary>
private
readonly
RB_OrderRepository
orderRepository
=
new
RB_OrderRepository
();
/// <summary>
/// 生成业绩
/// </summary>
public
void
CreateEmployeeBonusModule
(
int
GroupId
)
{
string
endDate
=
"2021-11-30"
;
int
CurrentYear
=
2021
;
int
CurrentMonth
=
11
;
//人头配置列表
var
planList
=
bonus_PlanRepository
.
GetBounsPlanListRepository
(
new
RB_Bonus_PlanExtend
()
{
Group_Id
=
GroupId
},
isGetDetail
:
true
);
foreach
(
var
item
in
planList
)
{
var
saleList
=
Common
.
ConvertHelper
.
StringToList
(
item
.
SaleIds
);
foreach
(
var
saleId
in
saleList
)
{
var
orderList
=
GetSaleOrderList
(
item
,
GroupId
,
endDate
,
saleId
);
var
curNum
=
orderList
?.
Where
(
qitem
=>
qitem
.
Year
==
CurrentYear
&&
qitem
.
Month
==
CurrentMonth
)?.
Sum
(
qitem
=>
qitem
.
GuestNum
)
??
0
;
var
curOrderMoney
=
orderList
?.
Where
(
qitem
=>
qitem
.
Year
==
CurrentYear
&&
qitem
.
Month
==
CurrentMonth
)?.
Sum
(
qitem
=>
qitem
.
OrderMoney
)
??
0
;
var
pModel
=
new
RB_Personnel_Bonus
()
{
Id
=
0
,
RewardType
=
item
.
PlanType
,
YearNum
=
CurrentYear
,
MonthNum
=
CurrentMonth
,
EmployeeId
=
saleId
,
CurGuestNum
=
curNum
,
CurOrderMoney
=
curOrderMoney
,
Group_Id
=
GroupId
,
CurRewardMoney
=
GetStepAwardAmount
(
item
,
curNum
)
};
var
newId
=
personnel_BonusRepository
.
Insert
(
pModel
);
pModel
.
Id
=
newId
;
foreach
(
var
oItem
in
orderList
)
{
}
}
}
}
/// <summary>
/// 获取梯度奖励金额
/// </summary>
/// <param name="item"></param>
/// <param name="GuestNum"></param>
/// <returns></returns>
private
decimal
GetStepAwardAmount
(
RB_Bonus_PlanExtend
item
,
int
GuestNum
)
{
decimal
awardAmount
=
0
;
if
(
item
!=
null
&&
item
.
DetailList
!=
null
&&
item
.
DetailList
.
Count
>
0
)
{
for
(
var
i
=
0
;
i
<
item
.
DetailList
.
Count
;
i
++)
{
var
tempNum
=
item
.
DetailList
[
i
];
if
(
tempNum
.
StartNum
<=
GuestNum
&&
GuestNum
<=
tempNum
.
EndNum
)
{
awardAmount
=
tempNum
.
Money
;
}
}
}
return
awardAmount
;
}
/// <summary>
/// 获取当前人员订单列表
/// </summary>
/// <param name="item"></param>
/// <param name="GroupId"></param>
/// <param name="endDate"></param>
/// <param name="SaleId"></param>
/// <returns></returns>
private
List
<
PersionOrderItem
>
GetSaleOrderList
(
RB_Bonus_PlanExtend
item
,
int
GroupId
,
string
endDate
,
int
SaleId
)
{
List
<
PersionOrderItem
>
list
=
new
List
<
PersionOrderItem
>();
//所有当前人员订单列表
var
orderList
=
orderRepository
.
GetAllBonusOrderListRepository
(
GroupId
,
endDate
,
SaleId
);
//适用课程
if
(!
string
.
IsNullOrEmpty
(
item
.
UseCourseIds
))
{
orderList
=
orderList
?.
Where
(
qitem
=>
item
.
UseCourseIds
.
Contains
(
qitem
.
CourseId
.
ToString
()))?.
ToList
();
}
//不适用课程
if
(!
string
.
IsNullOrEmpty
(
item
.
NotUseCourseIds
))
{
orderList
=
orderList
?.
Where
(
qitem
=>
!
item
.
NotUseCourseIds
.
Contains
(
qitem
.
CourseId
.
ToString
()))?.
ToList
();
}
//按照年份、月份统计订单人数和金额
var
groupList
=
orderList
.
GroupBy
(
qitem
=>
new
{
qitem
.
CreateTime
.
Year
,
qitem
.
CreateTime
.
Month
})
.
Select
(
qitem
=>
new
{
qitem
.
Key
.
Year
,
qitem
.
Key
.
Month
,
GuestNum
=
qitem
.
Sum
(
s
=>
s
.
GuestNum
),
OrderMoney
=
qitem
.
Sum
(
s
=>
s
.
Income
-
s
.
Refund
+
s
.
PlatformTax
)
});
foreach
(
var
gItem
in
groupList
)
{
list
.
Add
(
new
PersionOrderItem
()
{
Year
=
gItem
.
Year
,
Month
=
gItem
.
Month
,
GuestNum
=
gItem
.
GuestNum
,
OrderMoney
=
gItem
.
OrderMoney
});
}
return
list
;
}
}
/// <summary>
/// 人员销售
/// </summary>
public
class
PersionOrderItem
{
/// <summary>
/// 年份
/// </summary>
public
int
Year
{
get
;
set
;
}
/// <summary>
/// 月份
/// </summary>
public
int
Month
{
get
;
set
;
}
/// <summary>
/// 人数
/// </summary>
public
int
GuestNum
{
get
;
set
;
}
/// <summary>
/// 订单金额
/// </summary>
public
decimal
OrderMoney
{
get
;
set
;
}
}
}
Edu.Repository/Sell/RB_Bonus_PlanRepository.cs
View file @
21567372
...
@@ -14,6 +14,12 @@ namespace Edu.Repository.Sell
...
@@ -14,6 +14,12 @@ namespace Edu.Repository.Sell
/// </summary>
/// </summary>
public
class
RB_Bonus_PlanRepository
:
BaseRepository
<
RB_Bonus_Plan
>
public
class
RB_Bonus_PlanRepository
:
BaseRepository
<
RB_Bonus_Plan
>
{
{
/// <summary>
/// 课程顾问、市场达标奖金配置阶梯仓储层对象
/// </summary>
private
readonly
RB_Bouns_PlanDetailRepository
bouns_PlanDetailRepository
=
new
RB_Bouns_PlanDetailRepository
();
/// <summary>
/// <summary>
/// 获取课程顾问、市场达标奖金配置分页列表
/// 获取课程顾问、市场达标奖金配置分页列表
/// </summary>
/// </summary>
...
@@ -56,7 +62,7 @@ WHERE 1=1
...
@@ -56,7 +62,7 @@ WHERE 1=1
/// </summary>
/// </summary>
/// <param name="query"></param>
/// <param name="query"></param>
/// <returns></returns>
/// <returns></returns>
public
List
<
RB_Bonus_PlanExtend
>
GetBounsPlanListRepository
(
RB_Bonus_PlanExtend
query
)
public
List
<
RB_Bonus_PlanExtend
>
GetBounsPlanListRepository
(
RB_Bonus_PlanExtend
query
,
bool
isGetDetail
=
false
)
{
{
StringBuilder
builder
=
new
StringBuilder
();
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
builder
.
AppendFormat
(
@"
...
@@ -76,7 +82,20 @@ WHERE 1=1
...
@@ -76,7 +82,20 @@ WHERE 1=1
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Bonus_PlanExtend
.
PlanType
),
query
.
PlanType
);
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Bonus_PlanExtend
.
PlanType
),
query
.
PlanType
);
}
}
}
}
return
Get
<
RB_Bonus_PlanExtend
>(
builder
.
ToString
()).
ToList
();
var
list
=
Get
<
RB_Bonus_PlanExtend
>(
builder
.
ToString
()).
ToList
();
if
(
list
!=
null
&&
list
.
Count
>
0
&&
isGetDetail
)
{
string
planIds
=
string
.
Join
(
","
,
list
.
Select
(
qitem
=>
qitem
.
Id
));
List
<
RB_Bouns_PlanDetail_Extend
>
detailList
=
bouns_PlanDetailRepository
.
GetBounsPlanDetailListRepository
(
new
RB_Bouns_PlanDetail_Extend
()
{
QPlanIds
=
planIds
});
foreach
(
var
item
in
list
)
{
item
.
DetailList
=
detailList
?.
Where
(
qitem
=>
qitem
.
PlanId
==
item
.
Id
)?.
ToList
();
}
}
return
list
;
}
}
}
}
}
}
Edu.Repository/Sell/RB_OrderRepository.cs
View file @
21567372
...
@@ -1176,7 +1176,7 @@ group by o.OrderId
...
@@ -1176,7 +1176,7 @@ group by o.OrderId
/// <param name="group_Id">集团编号</param>
/// <param name="group_Id">集团编号</param>
/// <param name="eDate">结束日期</param>
/// <param name="eDate">结束日期</param>
/// <returns></returns>
/// <returns></returns>
public
List
<
RB_Order_ViewModel
>
GetAllBonusOrderListRepository
(
int
group_Id
,
string
eDate
)
public
List
<
RB_Order_ViewModel
>
GetAllBonusOrderListRepository
(
int
group_Id
,
string
eDate
,
int
SaleId
)
{
{
StringBuilder
builder
=
new
StringBuilder
();
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
builder
.
AppendFormat
(
@"
...
@@ -1197,6 +1197,10 @@ WHERE 1=1
...
@@ -1197,6 +1197,10 @@ WHERE 1=1
{
{
builder
.
AppendFormat
(
" AND o.CreateTime <= '{0} 23:59:59' "
,
eDate
);
builder
.
AppendFormat
(
" AND o.CreateTime <= '{0} 23:59:59' "
,
eDate
);
}
}
if
(
SaleId
>
0
)
{
builder
.
AppendFormat
(
" AND ( EnterID={0} OR CreateBy={0} ) "
,
SaleId
);
}
builder
.
AppendFormat
(
" GROUP BY o.OrderId "
);
builder
.
AppendFormat
(
" GROUP BY o.OrderId "
);
return
Get
<
RB_Order_ViewModel
>(
builder
.
ToString
()).
ToList
();
return
Get
<
RB_Order_ViewModel
>(
builder
.
ToString
()).
ToList
();
}
}
...
...
Edu.WebApi/Controllers/User/LoginController.cs
View file @
21567372
...
@@ -10,6 +10,7 @@ using Edu.Common.Plugin;
...
@@ -10,6 +10,7 @@ using Edu.Common.Plugin;
using
Edu.Model.CacheModel
;
using
Edu.Model.CacheModel
;
using
Edu.Model.ViewModel.System
;
using
Edu.Model.ViewModel.System
;
using
Edu.Model.ViewModel.User
;
using
Edu.Model.ViewModel.User
;
using
Edu.Module.Course
;
using
Edu.Module.Duty
;
using
Edu.Module.Duty
;
using
Edu.Module.Public
;
using
Edu.Module.Public
;
using
Edu.Module.System
;
using
Edu.Module.System
;
...
@@ -49,12 +50,16 @@ namespace Edu.WebApi.Controllers.User
...
@@ -49,12 +50,16 @@ namespace Edu.WebApi.Controllers.User
/// </summary>
/// </summary>
private
readonly
TeacherModule
teacherModule
=
new
TeacherModule
();
private
readonly
TeacherModule
teacherModule
=
new
TeacherModule
();
private
readonly
EmployeeBonusModule
employeeBonusModule
=
new
EmployeeBonusModule
();
[
HttpGet
]
[
HttpGet
]
[
HttpPost
]
[
HttpPost
]
[
AllowAnonymous
]
[
AllowAnonymous
]
public
ApiResult
Test
()
public
ApiResult
Test
()
{
{
new
DutyPlanModule
().
TransVisitorToStu
();
//new DutyPlanModule().TransVisitorToStu();
var
userInfo
=
base
.
UserInfo
;
employeeBonusModule
.
CreateEmployeeBonusModule
(
userInfo
.
Group_Id
);
return
ApiResult
.
Success
();
return
ApiResult
.
Success
();
}
}
...
...
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