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
790c1541
Commit
790c1541
authored
Dec 27, 2021
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
047504a5
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
813 additions
and
4 deletions
+813
-4
RB_Order_ReturnComission.cs
Edu.Model/Entity/Sell/RB_Order_ReturnComission.cs
+3
-2
RB_User_ReturnCommission.cs
Edu.Model/Entity/User/RB_User_ReturnCommission.cs
+3
-2
RB_Order_ReturnComission_ViewModel.cs
...odel/ViewModel/Sell/RB_Order_ReturnComission_ViewModel.cs
+45
-0
RB_ReturnMoney_Batch_ViewModel.cs
Edu.Model/ViewModel/Sell/RB_ReturnMoney_Batch_ViewModel.cs
+5
-0
CustomerCommissionModule.cs
Edu.Module.Customer/CustomerCommissionModule.cs
+268
-0
RB_Order_ReturnComissionRepository.cs
Edu.Repository/Sell/RB_Order_ReturnComissionRepository.cs
+179
-0
RB_ReturnMoney_BatchRepository.cs
Edu.Repository/Sell/RB_ReturnMoney_BatchRepository.cs
+22
-0
RB_User_ReturnComissionRepository.cs
Edu.Repository/User/RB_User_ReturnComissionRepository.cs
+16
-0
CustomerCommissionController.cs
...bApi/Controllers/Customer/CustomerCommissionController.cs
+272
-0
No files found.
Edu.Model/Entity/Sell/RB_Order_ReturnComission.cs
View file @
790c1541
using
System
;
using
Edu.Common.Enum.User
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
VT.FW.DB
;
...
...
@@ -31,7 +32,7 @@ namespace Edu.Model.Entity.Sell
/// <summary>
/// 学员来源
/// </summary>
public
int
OrderSourceType
{
get
;
set
;
}
public
StuCreateTypeEnum
OrderSourceType
{
get
;
set
;
}
/// <summary>
/// 关联来源编号
...
...
Edu.Model/Entity/User/RB_User_ReturnCommission.cs
View file @
790c1541
using
System
;
using
Edu.Common.Enum.User
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
VT.FW.DB
;
...
...
@@ -20,7 +21,7 @@ namespace Edu.Model.Entity.User
/// <summary>
/// 用户类型
/// </summary>
public
int
UserType
{
get
;
set
;
}
public
StuCreateTypeEnum
UserType
{
get
;
set
;
}
/// <summary>
/// 未结算佣金
...
...
Edu.Model/ViewModel/Sell/RB_Order_ReturnComission_ViewModel.cs
View file @
790c1541
...
...
@@ -8,5 +8,50 @@ namespace Edu.Model.ViewModel.Sell
public
class
RB_Order_ReturnComission_ViewModel
:
RB_Order_ReturnComission
{
public
string
StuSourceName
{
get
;
set
;
}
/// <summary>
/// 查询正常返佣 1正常 2已返佣
/// </summary>
public
int
Q_SelectNormal
{
get
;
set
;
}
/// <summary>
/// 学生数量
/// </summary>
public
int
StudentCount
{
get
;
set
;
}
/// <summary>
/// 校区名称
/// </summary>
public
string
SchoolName
{
get
;
set
;
}
/// <summary>
/// 用户名称
/// </summary>
public
string
UserName
{
get
;
set
;
}
/// <summary>
/// 返佣期数
/// </summary>
public
string
BatchName
{
get
;
set
;
}
/// <summary>
/// 班级
/// </summary>
public
string
ClassName
{
get
;
set
;
}
/// <summary>
/// 班号
/// </summary>
public
string
ClassNo
{
get
;
set
;
}
/// <summary>
/// 班级ID
/// </summary>
public
int
ClassId
{
get
;
set
;
}
/// <summary>
/// 学生
/// </summary>
public
string
StuName
{
get
;
set
;
}
}
}
Edu.Model/ViewModel/Sell/RB_ReturnMoney_Batch_ViewModel.cs
View file @
790c1541
...
...
@@ -10,5 +10,10 @@ namespace Edu.Model.ViewModel.Sell
public
string
CreateByName
{
get
;
set
;
}
public
string
CreateDateStr
{
get
;
set
;
}
/// <summary>
/// 月份
/// </summary>
public
string
Month
{
get
;
set
;
}
}
}
Edu.Module.Customer/CustomerCommissionModule.cs
0 → 100644
View file @
790c1541
using
Edu.AOP.CustomerAttribute
;
using
Edu.Cache.User
;
using
Edu.Common
;
using
Edu.Common.API
;
using
Edu.Common.Enum
;
using
Edu.Common.Enum.Course
;
using
Edu.Common.Plugin
;
using
Edu.Model.CacheModel
;
using
Edu.Model.Entity.Sell
;
using
Edu.Model.ViewModel.Course
;
using
Edu.Model.ViewModel.Customer
;
using
Edu.Model.ViewModel.Finance
;
using
Edu.Model.ViewModel.Grade
;
using
Edu.Model.ViewModel.Log
;
using
Edu.Model.ViewModel.Sell
;
using
Edu.Model.ViewModel.User
;
using
Edu.Repository.Course
;
using
Edu.Repository.Customer
;
using
Edu.Repository.Finance
;
using
Edu.Repository.Grade
;
using
Edu.Repository.Log
;
using
Edu.Repository.Sell
;
using
Edu.Repository.StudyAbroad
;
using
Edu.Repository.User
;
using
Newtonsoft.Json.Linq
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
VT.FW.DB
;
namespace
Edu.Module.Course
{
/// <summary>
/// 返佣存折处理类
/// </summary>
public
class
CustomerCommissionModule
{
/// <summary>
/// 返佣周期
/// </summary>
private
readonly
RB_ReturnMoney_BatchRepository
returnMoney_BatchRepository
=
new
RB_ReturnMoney_BatchRepository
();
/// <summary>
/// 返佣明细
/// </summary>
private
readonly
RB_Order_ReturnComissionRepository
order_ReturnComissionRepository
=
new
RB_Order_ReturnComissionRepository
();
/// <summary>
/// 用户返佣
/// </summary>
private
readonly
RB_User_ReturnComissionRepository
user_ReturnComissionRepository
=
new
RB_User_ReturnComissionRepository
();
/// <summary>
/// 同行
/// </summary>
private
readonly
RB_CustomerRepository
customerRepository
=
new
RB_CustomerRepository
();
/// <summary>
/// 学生
/// </summary>
private
readonly
RB_StudentRepository
studentRepository
=
new
RB_StudentRepository
();
/// <summary>
/// 订单
/// </summary>
private
readonly
RB_OrderRepository
orderRepository
=
new
RB_OrderRepository
();
/// <summary>
/// 订单学生
/// </summary>
private
readonly
RB_Order_GuestRepository
order_GuestRepository
=
new
RB_Order_GuestRepository
();
/// <summary>
/// 签到
/// </summary>
private
readonly
RB_Class_CheckRepository
class_CheckRepository
=
new
RB_Class_CheckRepository
();
/// <summary>
/// 班级
/// </summary>
private
readonly
RB_ClassRepository
classRepository
=
new
RB_ClassRepository
();
/// <summary>
/// 课程
/// </summary>
private
readonly
RB_CourseRepository
courseRepository
=
new
RB_CourseRepository
();
/// <summary>
/// 班级类型
/// </summary>
private
readonly
RB_Class_TypeRepository
class_TypeRepository
=
new
RB_Class_TypeRepository
();
/// <summary>
/// 账户
/// </summary>
private
readonly
RB_AccountRepository
accountRepository
=
new
RB_AccountRepository
();
/// <summary>
/// 部门
/// </summary>
private
readonly
RB_DepartmentRepository
departmentRepository
=
new
RB_DepartmentRepository
();
/// <summary>
/// 校区
/// </summary>
private
readonly
RB_SchoolRepository
schoolRepository
=
new
RB_SchoolRepository
();
/// <summary>
/// 财务单据
/// </summary>
private
readonly
RB_FinanceRepository
financeRepository
=
new
RB_FinanceRepository
();
#
region
首页返佣
/// <summary>
/// 获取首页返佣同级
/// </summary>
/// <param name="userInfo"></param>
/// <returns></returns>
public
object
GetCenterCommissionStatistics
(
UserInfo
userInfo
)
{
var
model
=
user_ReturnComissionRepository
.
GetCenterCommissionStatistics
(
userInfo
.
Group_Id
,
userInfo
.
Id
);
return
new
{
model
?.
UnSettlementMoney
,
model
?.
SttlementMoney
,
model
?.
CashOutMoney
,
model
?.
CanCashOutMoney
};
}
#
endregion
#
region
返佣存折列表
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_ReturnMoney_Batch_ViewModel
>
GetCommissionPeriodsList
(
RB_ReturnMoney_Batch_ViewModel
dmodel
)
{
return
returnMoney_BatchRepository
.
GetList
(
dmodel
);
}
/// <summary>
/// 获取佣金期数分页类别
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_ReturnMoney_Batch_ViewModel
>
GetCommissionPeriodsPageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_ReturnMoney_Batch_ViewModel
dmodel
)
{
var
list
=
returnMoney_BatchRepository
.
GetPageList
(
pageIndex
,
pageSize
,
out
count
,
dmodel
.
CommissionType
,
dmodel
.
Month
,
dmodel
.
GroupId
);
return
list
;
}
/// <summary>
/// 获取用户提成列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_Order_ReturnComission_ViewModel
>
GetCommissionUserList
(
RB_Order_ReturnComission_ViewModel
dmodel
)
{
var
list
=
order_ReturnComissionRepository
.
GetCommissionUserList
(
dmodel
);
if
(
list
.
Any
())
{
//分成三个部门 内部人员 同行 学员
//查询用户 部门 校区
string
userIds
=
string
.
Join
(
","
,
list
.
Where
(
x
=>
x
.
OrderSourceType
==
Common
.
Enum
.
User
.
StuCreateTypeEnum
.
EmployeeInput
||
x
.
OrderSourceType
==
Common
.
Enum
.
User
.
StuCreateTypeEnum
.
InternalIntroduction
).
Select
(
x
=>
x
.
OrderSourceId
).
Distinct
());
string
customerIds
=
string
.
Join
(
","
,
list
.
Where
(
x
=>
x
.
OrderSourceType
==
Common
.
Enum
.
User
.
StuCreateTypeEnum
.
CustomerInput
).
Select
(
x
=>
x
.
OrderSourceId
).
Distinct
());
string
stuIds
=
string
.
Join
(
","
,
list
.
Where
(
x
=>
x
.
OrderSourceType
==
Common
.
Enum
.
User
.
StuCreateTypeEnum
.
TransIntroduction
).
Select
(
x
=>
x
.
OrderSourceId
).
Distinct
());
string
schoolIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
SchoolId
).
Distinct
());
var
slist
=
schoolRepository
.
GetSchoolListRepository
(
new
RB_School_ViewModel
()
{
Group_Id
=
dmodel
.
GroupId
,
QSIds
=
schoolIds
});
List
<
Employee_ViewModel
>
ulist
=
new
List
<
Employee_ViewModel
>();
if
(!
string
.
IsNullOrEmpty
(
userIds
))
{
ulist
=
accountRepository
.
GetEmployeeListRepository
(
new
Employee_ViewModel
()
{
Group_Id
=
dmodel
.
GroupId
,
QIds
=
userIds
});
}
List
<
RB_Customer_Extend
>
clist
=
new
List
<
RB_Customer_Extend
>();
if
(!
string
.
IsNullOrEmpty
(
customerIds
))
{
clist
=
customerRepository
.
GetCustomerListRepository
(
new
RB_Customer_Extend
()
{
Group_Id
=
dmodel
.
GroupId
,
CustomerIds
=
customerIds
});
}
List
<
RB_Student_ViewModel
>
stulist
=
new
List
<
RB_Student_ViewModel
>();
if
(!
string
.
IsNullOrEmpty
(
stuIds
))
{
stulist
=
studentRepository
.
GetStudentListRepository
(
new
RB_Student_ViewModel
()
{
Group_Id
=
dmodel
.
GroupId
,
StuIds
=
stuIds
});
}
foreach
(
var
item
in
list
)
{
item
.
SchoolName
=
slist
.
Where
(
x
=>
x
.
SId
==
item
.
SchoolId
).
FirstOrDefault
()?.
SName
??
""
;
if
(
item
.
OrderSourceType
==
Common
.
Enum
.
User
.
StuCreateTypeEnum
.
EmployeeInput
||
item
.
OrderSourceType
==
Common
.
Enum
.
User
.
StuCreateTypeEnum
.
InternalIntroduction
)
{
var
umodel
=
ulist
.
Where
(
x
=>
x
.
Id
==
item
.
OrderSourceId
).
FirstOrDefault
();
item
.
UserName
=
umodel
.
EmployeeName
+
(
umodel
.
LeaveStatus
==
Common
.
Enum
.
User
.
LeaveStatusEnum
.
Departure
?
"离职"
:
""
);
}
else
if
(
item
.
OrderSourceType
==
Common
.
Enum
.
User
.
StuCreateTypeEnum
.
CustomerInput
)
{
item
.
UserName
=
clist
.
Where
(
x
=>
x
.
CustomerId
==
item
.
OrderSourceId
).
FirstOrDefault
()?.
CustomerName
??
""
;
}
else
if
(
item
.
OrderSourceType
==
Common
.
Enum
.
User
.
StuCreateTypeEnum
.
TransIntroduction
)
{
item
.
UserName
=
stulist
.
Where
(
x
=>
x
.
StuId
==
item
.
OrderSourceId
).
FirstOrDefault
()?.
StuName
??
""
;
}
}
}
return
list
;
}
/// <summary>
/// 获取返佣统计
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_Order_ReturnComission_ViewModel
>
GetCommissionStatisticsPageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_Order_ReturnComission_ViewModel
dmodel
)
{
var
list
=
order_ReturnComissionRepository
.
GetPageList
(
pageIndex
,
pageSize
,
out
count
,
dmodel
);
if
(
list
.
Any
())
{
//查询用户 部门 校区
string
userIds
=
string
.
Join
(
","
,
list
.
Where
(
x
=>
x
.
OrderSourceType
==
Common
.
Enum
.
User
.
StuCreateTypeEnum
.
EmployeeInput
||
x
.
OrderSourceType
==
Common
.
Enum
.
User
.
StuCreateTypeEnum
.
InternalIntroduction
).
Select
(
x
=>
x
.
OrderSourceId
).
Distinct
());
string
customerIds
=
string
.
Join
(
","
,
list
.
Where
(
x
=>
x
.
OrderSourceType
==
Common
.
Enum
.
User
.
StuCreateTypeEnum
.
CustomerInput
).
Select
(
x
=>
x
.
OrderSourceId
).
Distinct
());
string
stuIds
=
string
.
Join
(
","
,
list
.
Where
(
x
=>
x
.
OrderSourceType
==
Common
.
Enum
.
User
.
StuCreateTypeEnum
.
TransIntroduction
).
Select
(
x
=>
x
.
OrderSourceId
).
Distinct
());
string
schoolIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
SchoolId
).
Distinct
());
var
slist
=
schoolRepository
.
GetSchoolListRepository
(
new
RB_School_ViewModel
()
{
Group_Id
=
dmodel
.
GroupId
,
QSIds
=
schoolIds
});
List
<
Employee_ViewModel
>
ulist
=
new
List
<
Employee_ViewModel
>();
if
(!
string
.
IsNullOrEmpty
(
userIds
))
{
ulist
=
accountRepository
.
GetEmployeeListRepository
(
new
Employee_ViewModel
()
{
Group_Id
=
dmodel
.
GroupId
,
QIds
=
userIds
});
}
List
<
RB_Customer_Extend
>
clist
=
new
List
<
RB_Customer_Extend
>();
if
(!
string
.
IsNullOrEmpty
(
customerIds
))
{
clist
=
customerRepository
.
GetCustomerListRepository
(
new
RB_Customer_Extend
()
{
Group_Id
=
dmodel
.
GroupId
,
CustomerIds
=
customerIds
});
}
List
<
RB_Student_ViewModel
>
stulist
=
new
List
<
RB_Student_ViewModel
>();
if
(!
string
.
IsNullOrEmpty
(
stuIds
))
{
stulist
=
studentRepository
.
GetStudentListRepository
(
new
RB_Student_ViewModel
()
{
Group_Id
=
dmodel
.
GroupId
,
StuIds
=
stuIds
});
}
foreach
(
var
item
in
list
)
{
item
.
SchoolName
=
slist
.
Where
(
x
=>
x
.
SId
==
item
.
SchoolId
).
FirstOrDefault
()?.
SName
??
""
;
if
(
item
.
OrderSourceType
==
Common
.
Enum
.
User
.
StuCreateTypeEnum
.
EmployeeInput
||
item
.
OrderSourceType
==
Common
.
Enum
.
User
.
StuCreateTypeEnum
.
InternalIntroduction
)
{
var
umodel
=
ulist
.
Where
(
x
=>
x
.
Id
==
item
.
OrderSourceId
).
FirstOrDefault
();
item
.
UserName
=
umodel
.
EmployeeName
+
(
umodel
.
LeaveStatus
==
Common
.
Enum
.
User
.
LeaveStatusEnum
.
Departure
?
"离职"
:
""
);
}
else
if
(
item
.
OrderSourceType
==
Common
.
Enum
.
User
.
StuCreateTypeEnum
.
CustomerInput
)
{
item
.
UserName
=
clist
.
Where
(
x
=>
x
.
CustomerId
==
item
.
OrderSourceId
).
FirstOrDefault
()?.
CustomerName
??
""
;
}
else
if
(
item
.
OrderSourceType
==
Common
.
Enum
.
User
.
StuCreateTypeEnum
.
TransIntroduction
)
{
item
.
UserName
=
stulist
.
Where
(
x
=>
x
.
StuId
==
item
.
OrderSourceId
).
FirstOrDefault
()?.
StuName
??
""
;
}
}
}
return
list
;
}
/// <summary>
/// 累计佣金金额统计
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public
decimal
GetCommissionStatistics
(
RB_Order_ReturnComission_ViewModel
dmodel
)
{
return
order_ReturnComissionRepository
.
GetCommissionStatistics
(
dmodel
);
}
#
endregion
#
region
返佣存折查询
#
endregion
}
}
Edu.Repository/Sell/RB_Order_ReturnComissionRepository.cs
View file @
790c1541
...
...
@@ -58,5 +58,184 @@ namespace Edu.Repository.Sell
return
Execute
(
sql
,
null
)
>
0
;
}
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Order_ReturnComission_ViewModel
>
GetPageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_Order_ReturnComission_ViewModel
demodel
)
{
string
where
=
$@" 1=1"
;
if
(
demodel
.
GroupId
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
GroupId
)}
=
{
demodel
.
GroupId
}
"
;
}
if
(
demodel
.
SchoolId
>=
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
SchoolId
)}
=
{
demodel
.
SchoolId
}
"
;
}
if
(
demodel
.
BatchId
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
BatchId
)}
=
{
demodel
.
BatchId
}
"
;
}
if
(
demodel
.
CommissionType
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
CommissionType
)}
=
{
demodel
.
CommissionType
}
"
;
}
if
(
demodel
.
Status
>
-
2
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
Status
)}
=
{
demodel
.
Status
}
"
;
}
if
(
demodel
.
OrderId
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
OrderId
)}
=
{
demodel
.
OrderId
}
"
;
}
if
(
demodel
.
ClassId
>
0
)
{
where
+=
$@" and o.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
ClassId
)}
=
{
demodel
.
ClassId
}
"
;
}
if
(
demodel
.
OrderSourceType
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
OrderSourceType
)}
=
{
demodel
.
OrderSourceType
}
"
;
}
if
(
demodel
.
OrderSourceId
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
OrderSourceId
)}
=
{
demodel
.
OrderSourceId
}
"
;
}
if
(
demodel
.
Q_SelectNormal
==
1
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
Status
)}
in(0,1,2)"
;
}
else
if
(
demodel
.
Q_SelectNormal
==
2
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
Status
)}
in(1,2)"
;
}
string
sql
=
$@" select r.*,b.BatchName,o.ClassId,c.ClassName,c.ClassNo,s.StuName from RB_Order_ReturnComission r
left join rb_returnmoney_batch b on r.BatchId = b.Id
left join rb_order o on r.OrderId = o.OrderId
left join rb_class c on o.ClassId = c.ClassId
left join rb_student s on s.StuId = r.StuId
where
{
where
}
order by r.Id desc"
;
return
GetPage
<
RB_Order_ReturnComission_ViewModel
>(
pageIndex
,
pageSize
,
out
count
,
sql
).
ToList
();
}
/// <summary>
/// 获取用户返佣列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_Order_ReturnComission_ViewModel
>
GetCommissionUserList
(
RB_Order_ReturnComission_ViewModel
demodel
)
{
string
where
=
$@" 1=1"
;
if
(
demodel
.
GroupId
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
GroupId
)}
=
{
demodel
.
GroupId
}
"
;
}
if
(
demodel
.
SchoolId
>=
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
SchoolId
)}
=
{
demodel
.
SchoolId
}
"
;
}
if
(
demodel
.
BatchId
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
BatchId
)}
=
{
demodel
.
BatchId
}
"
;
}
if
(
demodel
.
CommissionType
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
CommissionType
)}
=
{
demodel
.
CommissionType
}
"
;
}
if
(
demodel
.
Status
>
-
2
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
Status
)}
=
{
demodel
.
Status
}
"
;
}
if
(
demodel
.
OrderId
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
OrderId
)}
=
{
demodel
.
OrderId
}
"
;
}
if
(
demodel
.
OrderSourceType
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
OrderSourceType
)}
=
{
demodel
.
OrderSourceType
}
"
;
}
if
(
demodel
.
OrderSourceId
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
OrderSourceId
)}
=
{
demodel
.
OrderSourceId
}
"
;
}
if
(
demodel
.
Q_SelectNormal
==
1
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
Status
)}
in(0,1,2)"
;
}
string
sql
=
$@" select r.OrderSourceType,r.OrderSourceId,r.SchoolId,count(0) as StudentCount,sum(r.CommissionMoeny) as CommissionMoeny
from RB_Order_ReturnComission r where
{
where
}
group by r.OrderSourceType,r.OrderSourceId,r.SchoolId"
;
return
Get
<
RB_Order_ReturnComission_ViewModel
>(
sql
).
ToList
();
}
/// <summary>
/// 获取累积佣金金额
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public
decimal
GetCommissionStatistics
(
RB_Order_ReturnComission_ViewModel
demodel
)
{
string
where
=
$@" 1=1"
;
if
(
demodel
.
GroupId
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
GroupId
)}
=
{
demodel
.
GroupId
}
"
;
}
if
(
demodel
.
SchoolId
>=
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
SchoolId
)}
=
{
demodel
.
SchoolId
}
"
;
}
if
(
demodel
.
BatchId
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
BatchId
)}
=
{
demodel
.
BatchId
}
"
;
}
if
(
demodel
.
CommissionType
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
CommissionType
)}
=
{
demodel
.
CommissionType
}
"
;
}
if
(
demodel
.
Status
>
-
2
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
Status
)}
=
{
demodel
.
Status
}
"
;
}
if
(
demodel
.
OrderId
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
OrderId
)}
=
{
demodel
.
OrderId
}
"
;
}
if
(
demodel
.
ClassId
>
0
)
{
where
+=
$@" and o.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
ClassId
)}
=
{
demodel
.
ClassId
}
"
;
}
if
(
demodel
.
OrderSourceType
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
OrderSourceType
)}
=
{
demodel
.
OrderSourceType
}
"
;
}
if
(
demodel
.
OrderSourceId
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
OrderSourceId
)}
=
{
demodel
.
OrderSourceId
}
"
;
}
if
(
demodel
.
Q_SelectNormal
==
1
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
Status
)}
in(0,1,2)"
;
}
else
if
(
demodel
.
Q_SelectNormal
==
2
)
{
where
+=
$@" and r.
{
nameof
(
RB_Order_ReturnComission_ViewModel
.
Status
)}
in(1,2)"
;
}
string
sql
=
$@" select sum(r.CommissionMoeny) from RB_Order_ReturnComission r
left join rb_order o on r.OrderId = o.OrderId
where
{
where
}
"
;
var
obj
=
ExecuteScalar
(
sql
);
return
obj
==
null
?
0
:
Convert
.
ToDecimal
(
obj
);
}
}
}
Edu.Repository/Sell/RB_ReturnMoney_BatchRepository.cs
View file @
790c1541
...
...
@@ -46,6 +46,28 @@ namespace Edu.Repository.Sell
return
GetPage
<
RB_ReturnMoney_Batch_ViewModel
>(
pageIndex
,
pageSize
,
out
count
,
sql
,
parameters
).
ToList
();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_ReturnMoney_Batch_ViewModel
>
GetList
(
RB_ReturnMoney_Batch_ViewModel
demodel
)
{
string
where
=
$@" 1=1"
;
if
(
demodel
.
GroupId
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_ReturnMoney_Batch_ViewModel
.
GroupId
)}
=
{
demodel
.
GroupId
}
"
;
}
if
(
demodel
.
CommissionType
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_ReturnMoney_Batch_ViewModel
.
CommissionType
)}
=
{
demodel
.
CommissionType
}
"
;
}
string
sql
=
$@" select r.* from RB_ReturnMoney_Batch r where
{
where
}
order by r.CreateDate desc"
;
return
Get
<
RB_ReturnMoney_Batch_ViewModel
>(
sql
).
ToList
();
}
/// <summary>
/// 查询当月份是否存在提成
/// </summary>
...
...
Edu.Repository/User/RB_User_ReturnComissionRepository.cs
View file @
790c1541
...
...
@@ -27,5 +27,21 @@ namespace Edu.Repository.User
return
Get
<
RB_User_ReturnComission_ViewModel
>(
sql
,
parameters
).
ToList
().
FirstOrDefault
();
}
/// <summary>
/// 获取个人返佣情况
/// </summary>
/// <param name="group_Id"></param>
/// <param name="id"></param>
/// <returns></returns>
public
RB_User_ReturnComission_ViewModel
GetCenterCommissionStatistics
(
int
group_Id
,
int
id
)
{
string
sql
=
$@"select sum(UnSettlementMoney)as UnSettlementMoney,
sum(SttlementMoney)as SttlementMoney,
sum(CashOutMoney)as CashOutMoney,
sum(CanCashOutMoney)as CanCashOutMoney
from RB_User_ReturnCommission where GroupId =
{
group_Id
}
and UserId=
{
id
}
and UserType in(1,3)"
;
return
Get
<
RB_User_ReturnComission_ViewModel
>(
sql
).
FirstOrDefault
();
}
}
}
Edu.WebApi/Controllers/Customer/CustomerCommissionController.cs
0 → 100644
View file @
790c1541
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
Edu.Cache.User
;
using
Edu.Common.API
;
using
Edu.Common.Enum.Course
;
using
Edu.Common.Plugin
;
using
Edu.Model.ViewModel.Course
;
using
Edu.Model.ViewModel.Log
;
using
Edu.Model.ViewModel.Sell
;
using
Edu.Module.Course
;
using
Edu.WebApi.Filter
;
using
Microsoft.AspNetCore.Cors
;
using
Microsoft.AspNetCore.Mvc
;
using
Newtonsoft.Json.Linq
;
namespace
Edu.WebApi.Controllers.Course
{
[
Route
(
"api/[controller]/[action]"
)]
[
ApiExceptionFilter
]
[
ApiController
]
[
EnableCors
(
"AllowCors"
)]
public
class
CustomerCommissionController
:
BaseController
{
/// <summary>
/// 返佣存折
/// </summary>
private
readonly
CustomerCommissionModule
customerCommissionModule
=
new
CustomerCommissionModule
();
#
region
获取首页返佣
/// <summary>
/// 获取首页返佣统计
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetCenterCommissionStatistics
()
{
var
userInfo
=
base
.
UserInfo
;
var
Robj
=
customerCommissionModule
.
GetCenterCommissionStatistics
(
userInfo
);
return
ApiResult
.
Success
(
""
,
Robj
);
}
#
endregion
#
region
返佣列表
/// <summary>
/// 获取佣金期数分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetCommissionPeriodsPageList
()
{
var
userInfo
=
base
.
UserInfo
;
var
pageModel
=
JsonHelper
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
Msg
.
ToString
());
var
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_ReturnMoney_Batch_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
dmodel
.
GroupId
=
userInfo
.
Group_Id
;
var
list
=
customerCommissionModule
.
GetCommissionPeriodsPageList
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
count
,
dmodel
);
pageModel
.
Count
=
Convert
.
ToInt32
(
count
);
pageModel
.
PageData
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
BatchName
,
x
.
TotalMoney
,
x
.
CreateBy
,
CreateByName
=
UserReidsCache
.
GetUserLoginInfo
(
x
.
CreateBy
)?.
AccountName
??
""
,
CreateDate
=
x
.
CreateDate
.
ToString
(
"yyyy-MM-dd"
),
x
.
CommissionType
});
return
ApiResult
.
Success
(
""
,
pageModel
);
}
/// <summary>
/// 获取期数列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetCommissionPeriodsList
()
{
var
userInfo
=
base
.
UserInfo
;
var
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_ReturnMoney_Batch_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
dmodel
.
GroupId
=
userInfo
.
Group_Id
;
var
list
=
customerCommissionModule
.
GetCommissionPeriodsList
(
dmodel
);
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
BatchName
,
x
.
CommissionType
}));
}
/// <summary>
/// 获取返佣用户列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetCommissionUserList
()
{
var
userInfo
=
base
.
UserInfo
;
var
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_Order_ReturnComission_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
dmodel
.
GroupId
=
userInfo
.
Group_Id
;
if
(
dmodel
.
BatchId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递期数id"
);
}
var
list
=
customerCommissionModule
.
GetCommissionUserList
(
dmodel
);
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
{
x
.
SchoolId
,
x
.
SchoolName
,
x
.
UserName
,
x
.
OrderSourceType
,
x
.
OrderSourceId
,
x
.
StudentCount
,
x
.
CommissionMoeny
}));
}
/// <summary>
/// 返佣统计
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetCommissionStatistics
()
{
var
userInfo
=
base
.
UserInfo
;
var
pageModel
=
JsonHelper
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
Msg
.
ToString
());
var
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_Order_ReturnComission_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
dmodel
.
GroupId
=
userInfo
.
Group_Id
;
var
list
=
customerCommissionModule
.
GetCommissionStatisticsPageList
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
count
,
dmodel
);
decimal
TotalMoney
=
customerCommissionModule
.
GetCommissionStatistics
(
dmodel
);
pageModel
.
Count
=
Convert
.
ToInt32
(
count
);
pageModel
.
PageData
=
new
{
TotalCommission
=
TotalMoney
,
List
=
list
.
Select
(
x
=>
new
{
x
.
SchoolId
,
x
.
SchoolName
,
x
.
UserName
,
x
.
OrderSourceType
,
x
.
OrderSourceId
,
x
.
ClassId
,
x
.
ClassName
,
x
.
ClassNo
,
x
.
OrderId
,
x
.
Remark
,
x
.
Status
,
x
.
CommissionMoeny
,
x
.
BatchId
,
x
.
BatchName
,
x
.
StuId
,
x
.
StuName
})
};
return
ApiResult
.
Success
(
""
,
pageModel
);
}
/// <summary>
/// 导出fanyong 统计 Excel
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
Obsolete
]
public
FileContentResult
GetCommissionStatisticsToExcel
()
{
var
userInfo
=
base
.
UserInfo
;
var
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_Order_ReturnComission_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
dmodel
.
GroupId
=
userInfo
.
Group_Id
;
string
ExcelName
=
"返佣存折"
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
)
+
".xls"
;
List
<
ExcelDataSource
>
slist
=
new
List
<
ExcelDataSource
>();
ExcelDataSource
header
=
new
ExcelDataSource
()
{
ExcelRows
=
new
List
<
ExcelColumn
>(
30
)
{
new
ExcelColumn
(
value
:
"校区"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"来源"
)
{
CellWidth
=
25
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"人员"
)
{
CellWidth
=
25
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"班号"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"班级"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"订单号"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"学生"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"类型"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"金额"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"状态"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"期数"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"备注"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
}
}
};
slist
.
Add
(
header
);
try
{
var
list
=
customerCommissionModule
.
GetCommissionStatisticsPageList
(
1
,
1000000
,
out
long
count
,
dmodel
);
decimal
TotalMoney
=
customerCommissionModule
.
GetCommissionStatistics
(
dmodel
);
#
region
组装数据
foreach
(
var
item
in
list
)
{
ExcelDataSource
datarow
=
new
ExcelDataSource
()
{
ExcelRows
=
new
List
<
ExcelColumn
>(
30
)
{
new
ExcelColumn
(
value
:
item
.
SchoolName
){
},
new
ExcelColumn
(
value
:
item
.
OrderSourceType
.
ToName
()){
},
new
ExcelColumn
(
value
:
item
.
UserName
){
},
new
ExcelColumn
(
value
:
item
.
ClassNo
){
},
new
ExcelColumn
(
value
:
item
.
ClassName
){
},
new
ExcelColumn
(
value
:
item
.
OrderId
.
ToString
()){
},
new
ExcelColumn
(
value
:
item
.
StuName
){
},
new
ExcelColumn
(
value
:
item
.
CommissionType
==
1
?
"返佣"
:
"幸福存折"
){
},
new
ExcelColumn
(
value
:
(
item
.
CommissionMoeny
).
ToString
(
"#0.00"
)){
},
new
ExcelColumn
(
value
:
item
.
Status
==-
1
?
"不返佣"
:
item
.
Status
==
0
?
"待返佣"
:
item
.
Status
==
1
?
"已返佣"
:
"已提现"
){
},
new
ExcelColumn
(
value
:
item
.
BatchName
){
},
new
ExcelColumn
(
value
:
item
.
Remark
){
},
},
ColumnHight
=
30
};
slist
.
Add
(
datarow
);
}
//统计
ExcelDataSource
datarows
=
new
ExcelDataSource
()
{
ExcelRows
=
new
List
<
ExcelColumn
>(
30
)
{
new
ExcelColumn
(
value
:
"汇总"
){
},
new
ExcelColumn
(
value
:
""
){
},
new
ExcelColumn
(
value
:
""
){
},
new
ExcelColumn
(
value
:
""
){
},
new
ExcelColumn
(
value
:
""
){
},
new
ExcelColumn
(
value
:
""
){
},
new
ExcelColumn
(
value
:
""
){
},
new
ExcelColumn
(
value
:
TotalMoney
.
ToString
(
"#0.00"
)){
},
new
ExcelColumn
(
value
:
""
){
},
new
ExcelColumn
(
value
:
""
){
},
new
ExcelColumn
(
value
:
""
){
},
new
ExcelColumn
(
value
:
""
){
},
},
ColumnHight
=
30
};
slist
.
Add
(
datarows
);
#
endregion
var
byteData
=
ExcelTempLateHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData
,
"application/octet-stream"
,
ExcelName
);
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
string
.
Format
(
"GetCommissionStatisticsToExcel: {0}"
,
JsonHelper
.
Serialize
(
RequestParm
)));
var
byteData1
=
ExcelTempLateHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData1
,
"application/octet-stream"
,
ExcelName
);
}
}
#
endregion
#
region
同业返佣
/// <summary>
/// 获取同业详情 返佣同级
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetCustomerCommissionStat
()
{
return
ApiResult
.
Success
();
}
#
endregion
}
}
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