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
90002721
Commit
90002721
authored
Apr 19, 2022
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
245c8818
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
587 additions
and
1 deletion
+587
-1
RB_Sell_Achievements_Emp_ViewModel.cs
...odel/ViewModel/Sell/RB_Sell_Achievements_Emp_ViewModel.cs
+10
-0
SellAchievementsModule.cs
Edu.Module.Course/SellAchievementsModule.cs
+445
-1
RB_Sell_Achievements_EmpRepository.cs
Edu.Repository/Sell/RB_Sell_Achievements_EmpRepository.cs
+18
-0
SellAchievementsController.cs
Edu.WebApi/Controllers/Course/SellAchievementsController.cs
+114
-0
No files found.
Edu.Model/ViewModel/Sell/RB_Sell_Achievements_Emp_ViewModel.cs
View file @
90002721
...
...
@@ -19,5 +19,15 @@ namespace Edu.Model.ViewModel.Sell
/// 订单ids
/// </summary>
public
string
OrderIds
{
get
;
set
;
}
/// <summary>
/// 期数
/// </summary>
public
string
Periods
{
get
;
set
;
}
/// <summary>
/// 返佣总金额
/// </summary>
public
decimal
CommissionMoney
{
get
;
set
;
}
}
}
\ No newline at end of file
Edu.Module.Course/SellAchievementsModule.cs
View file @
90002721
This diff is collapsed.
Click to expand it.
Edu.Repository/Sell/RB_Sell_Achievements_EmpRepository.cs
View file @
90002721
...
...
@@ -161,5 +161,23 @@ GROUP BY g.RenewState";
string
sql
=
$@"SELECT SUM(PushMoney) as PushMoney,SUM(GiveOutMoney) as GiveOutMoney FROM rb_sell_achievements_emp WHERE Group_Id =
{
group_Id
}
and EmpId =
{
empId
}
and IsDept =2"
;
return
Get
<
RB_Sell_Achievements_Emp_ViewModel
>(
sql
).
FirstOrDefault
();
}
/// <summary>
/// 获取业绩排名统计
/// </summary>
/// <param name="monthList"></param>
/// <param name="group_Id"></param>
/// <returns></returns>
public
List
<
RB_Sell_Achievements_Emp_ViewModel
>
GetSellAchievementsRankStat
(
List
<
string
>
monthList
,
int
group_Id
)
{
string
sql
=
$@"SELECT e.Type,e.EmpId,e.Rate,e.IsDept,p.Periods,SUM(e.PushMoney) as PushMoney,Max(e.SaleMoney) as SaleMoney,
SUM(e.OrderSaleMoney) as OrderSaleMoney,SUM(o.PreferPrice - o.DiscountMoney - e.OrderSaleMoney) as CommissionMoney
FROM rb_sell_achievements_emp e
INNER JOIN rb_sell_achievements_periods p on e.PeriodsId = p.Id
INNER JOIN rb_order o on e.OrderId = o.OrderId
WHERE e.Group_Id =
{
group_Id
}
and p.Periods in(
{
string
.
Join
(
","
,
monthList
)}
)
GROUP BY e.Type,e.EmpId,e.Rate,e.IsDept,p.Periods"
;
return
Get
<
RB_Sell_Achievements_Emp_ViewModel
>(
sql
).
ToList
();
}
}
}
Edu.WebApi/Controllers/Course/SellAchievementsController.cs
View file @
90002721
...
...
@@ -661,5 +661,119 @@ namespace Edu.WebApi.Controllers.Course
return
ApiResult
.
Success
(
""
,
pmodel
);
}
#
endregion
#
region
提成统计
/// <summary>
/// 获取业绩排名统计
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetSellAchievementsRankStat
()
{
string
StartMonth
=
ParmJObj
.
GetStringValue
(
"StartMonth"
);
string
EndMonth
=
ParmJObj
.
GetStringValue
(
"EndMonth"
);
if
(
string
.
IsNullOrEmpty
(
StartMonth
)
||
string
.
IsNullOrEmpty
(
EndMonth
))
{
return
ApiResult
.
ParamIsNull
();
}
try
{
StartMonth
=
Convert
.
ToDateTime
(
StartMonth
).
ToString
(
"yyyy-MM"
);
EndMonth
=
Convert
.
ToDateTime
(
EndMonth
).
ToString
(
"yyyy-MM"
);
}
catch
(
Exception
)
{
return
ApiResult
.
Failed
(
"日期格式有误"
);
}
if
(
Convert
.
ToDateTime
(
StartMonth
)
>
Convert
.
ToDateTime
(
EndMonth
))
{
return
ApiResult
.
Failed
(
"开始日期不能大于结束日期"
);
}
var
list
=
sellAchievementsModule
.
GetSellAchievementsRankStat
(
StartMonth
,
EndMonth
,
UserInfo
.
Group_Id
);
return
ApiResult
.
Success
(
""
,
list
);
}
/// <summary>
/// 获取业绩排名统计_V2
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetSellAchievementsRankStat_V2
()
{
string
StartMonth
=
ParmJObj
.
GetStringValue
(
"StartMonth"
);
string
EndMonth
=
ParmJObj
.
GetStringValue
(
"EndMonth"
);
if
(
string
.
IsNullOrEmpty
(
StartMonth
)
||
string
.
IsNullOrEmpty
(
EndMonth
))
{
return
ApiResult
.
ParamIsNull
();
}
try
{
StartMonth
=
Convert
.
ToDateTime
(
StartMonth
).
ToString
(
"yyyy-MM"
);
EndMonth
=
Convert
.
ToDateTime
(
EndMonth
).
ToString
(
"yyyy-MM"
);
}
catch
(
Exception
)
{
return
ApiResult
.
Failed
(
"日期格式有误"
);
}
if
(
Convert
.
ToDateTime
(
StartMonth
)
>
Convert
.
ToDateTime
(
EndMonth
))
{
return
ApiResult
.
Failed
(
"开始日期不能大于结束日期"
);
}
var
list
=
sellAchievementsModule
.
GetSellAchievementsRankStat_V2
(
StartMonth
,
EndMonth
,
UserInfo
.
Group_Id
);
return
ApiResult
.
Success
(
""
,
list
);
}
/// <summary>
/// 导出业绩排名统计 Excel
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
Obsolete
]
public
FileContentResult
GetSellAchievementsRankStatToExcel
()
{
string
ExcelName
=
"业绩排名"
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
)
+
".xls"
;
List
<
ExcelDataSource
>
slist
=
new
List
<
ExcelDataSource
>();
string
StartMonth
=
ParmJObj
.
GetStringValue
(
"StartMonth"
);
string
EndMonth
=
ParmJObj
.
GetStringValue
(
"EndMonth"
);
if
(
string
.
IsNullOrEmpty
(
StartMonth
)
||
string
.
IsNullOrEmpty
(
EndMonth
))
{
var
byteData
=
ExcelTempLateHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData
,
"application/octet-stream"
,
ExcelName
);
}
try
{
StartMonth
=
Convert
.
ToDateTime
(
StartMonth
).
ToString
(
"yyyy-MM"
);
EndMonth
=
Convert
.
ToDateTime
(
EndMonth
).
ToString
(
"yyyy-MM"
);
}
catch
(
Exception
)
{
var
byteData
=
ExcelTempLateHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData
,
"application/octet-stream"
,
ExcelName
);
}
if
(
Convert
.
ToDateTime
(
StartMonth
)
>
Convert
.
ToDateTime
(
EndMonth
))
{
var
byteData
=
ExcelTempLateHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData
,
"application/octet-stream"
,
ExcelName
);
}
try
{
List
<
ExcelDataSource
>
list
=
sellAchievementsModule
.
GetSellAchievementsRankStatToExcel
(
StartMonth
,
EndMonth
,
UserInfo
.
Group_Id
);
slist
.
AddRange
(
list
);
var
byteData
=
ExcelTempLateHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData
,
"application/octet-stream"
,
ExcelName
);
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
string
.
Format
(
"GetTeachingBonusDetailToExcel: {0}"
,
JsonHelper
.
Serialize
(
RequestParm
)));
var
byteData1
=
ExcelTempLateHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData1
,
"application/octet-stream"
,
ExcelName
);
}
}
#
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