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
32d71dbd
Commit
32d71dbd
authored
Sep 12, 2023
by
吴春
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
1e506e3f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
159 additions
and
16 deletions
+159
-16
RB_Student_ViewModel.cs
Edu.Model/ViewModel/User/RB_Student_ViewModel.cs
+4
-1
RB_StudentRepository.cs
Edu.Repository/User/RB_StudentRepository.cs
+2
-2
StudentStatController.cs
Edu.WebApi/Controllers/User/StudentStatController.cs
+153
-13
No files found.
Edu.Model/ViewModel/User/RB_Student_ViewModel.cs
View file @
32d71dbd
...
...
@@ -151,7 +151,10 @@ namespace Edu.Model.ViewModel.User
/// </summary>
public
decimal
OrderIncome
{
get
;
set
;
}
/// <summary>
/// 订单报入类型(1-正常报入,2-插班报入,3-续费订单,4-转班订单,5-分拆订单)
/// </summary>
public
int
JoinType
{
get
;
set
;
}
/// <summary>
/// 订单退款
/// </summary>
...
...
Edu.Repository/User/RB_StudentRepository.cs
View file @
32d71dbd
...
...
@@ -1273,7 +1273,7 @@ WHERE Group_Id ={group_Id} and `Status` =0 and IsSureConsultTime =1 and CreateTi
var
parameters
=
new
DynamicParameters
();
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT t.StuId, t.StuName, t.StuTel, t.StuIcon, t.StuSex, t.StuBirth, t.Group_Id, t.School_Id, t.Status, t.CreateBy, t.IsDisable, t.StuStatus, t.Interest, t.JapanBaseInfo,t. CustomerId,t. StuProfession, t.StuEducation, t.StuPurpose, t.StuSource, t.StuAddress, t.StuContract, t.StuContractMobile, t.StuIDCard, t.StuIDCardAddress,t. CreateType, t.StuStage, t.StuChannel,t. PlatformName, t.StuSourceId,t. QQ, t.WeChatNo, t.StuType,t. StuNeeds, t.StuRealMobile, t.ConsultDate, t.PlanPrice, t.BaseCondition,t. DemandPoint, t.ResistPoint,t. ConsultingResults, t.FirstEnrollDate, t.AdvisorStatus, t.AdvisorWinRate,t. AdvisorExpectDate, t.FileVoucher, t.IsSureConsultTime,g.GroupName,s.SName,IFNULL(a.Account,'') AS StudentAccount ,c.CustomerName,IFNULL(B.Name,'') AS AdvisorStatusName,cou.CourseName,o.PreferPrice as OrderIncome,o.Refund,o.CreateTime
SELECT t.StuId, t.StuName, t.StuTel, t.StuIcon, t.StuSex, t.StuBirth, t.Group_Id, t.School_Id, t.Status, t.CreateBy, t.IsDisable, t.StuStatus, t.Interest, t.JapanBaseInfo,t. CustomerId,t. StuProfession, t.StuEducation, t.StuPurpose, t.StuSource, t.StuAddress, t.StuContract, t.StuContractMobile, t.StuIDCard, t.StuIDCardAddress,t. CreateType, t.StuStage, t.StuChannel,t. PlatformName, t.StuSourceId,t. QQ, t.WeChatNo, t.StuType,t. StuNeeds, t.StuRealMobile, t.ConsultDate, t.PlanPrice, t.BaseCondition,t. DemandPoint, t.ResistPoint,t. ConsultingResults, t.FirstEnrollDate, t.AdvisorStatus, t.AdvisorWinRate,t. AdvisorExpectDate, t.FileVoucher, t.IsSureConsultTime,g.GroupName,s.SName,IFNULL(a.Account,'') AS StudentAccount ,c.CustomerName,IFNULL(B.Name,'') AS AdvisorStatusName,cou.CourseName,o.PreferPrice as OrderIncome,o.Refund,o.CreateTime
,o.JoinType
FROM rb_order as o LEFT JOIN rb_order_guest as og on og.OrderId=o.OrderId
left JOIN rb_student_orderguest as sog on og.Id=sog.GuestId
left JOIN rb_student AS t on t.StuId=sog.Student_Id
...
...
@@ -1323,7 +1323,7 @@ LEFT JOIN rb_group AS g ON t.Group_Id=g.GId
var
parameters
=
new
DynamicParameters
();
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT t.StuId, t.StuName, t.StuTel, t.StuIcon, t.StuSex, t.StuBirth, t.Group_Id, t.School_Id, t.Status, t.CreateBy, t.IsDisable, t.StuStatus, t.Interest, t.JapanBaseInfo,t. CustomerId,t. StuProfession, t.StuEducation, t.StuPurpose, t.StuSource, t.StuAddress, t.StuContract, t.StuContractMobile, t.StuIDCard, t.StuIDCardAddress,t. CreateType, t.StuStage, t.StuChannel,t. PlatformName, t.StuSourceId,t. QQ, t.WeChatNo, t.StuType,t. StuNeeds, t.StuRealMobile, t.ConsultDate, t.PlanPrice, t.BaseCondition,t. DemandPoint, t.ResistPoint,t. ConsultingResults, t.FirstEnrollDate, t.AdvisorStatus, t.AdvisorWinRate,t. AdvisorExpectDate, t.FileVoucher, t.IsSureConsultTime,g.GroupName,s.SName,IFNULL(a.Account,'') AS StudentAccount ,c.CustomerName,IFNULL(B.Name,'') AS AdvisorStatusName,cou.CourseName,o.PreferPrice as OrderIncome,o.Refund,o.CreateTime
SELECT t.StuId, t.StuName, t.StuTel, t.StuIcon, t.StuSex, t.StuBirth, t.Group_Id, t.School_Id, t.Status, t.CreateBy, t.IsDisable, t.StuStatus, t.Interest, t.JapanBaseInfo,t. CustomerId,t. StuProfession, t.StuEducation, t.StuPurpose, t.StuSource, t.StuAddress, t.StuContract, t.StuContractMobile, t.StuIDCard, t.StuIDCardAddress,t. CreateType, t.StuStage, t.StuChannel,t. PlatformName, t.StuSourceId,t. QQ, t.WeChatNo, t.StuType,t. StuNeeds, t.StuRealMobile, t.ConsultDate, t.PlanPrice, t.BaseCondition,t. DemandPoint, t.ResistPoint,t. ConsultingResults, t.FirstEnrollDate, t.AdvisorStatus, t.AdvisorWinRate,t. AdvisorExpectDate, t.FileVoucher, t.IsSureConsultTime,g.GroupName,s.SName,IFNULL(a.Account,'') AS StudentAccount ,c.CustomerName,IFNULL(B.Name,'') AS AdvisorStatusName,cou.CourseName,o.PreferPrice as OrderIncome,o.Refund,o.CreateTime
,o.JoinType
FROM rb_order as o LEFT JOIN rb_order_guest as og on og.OrderId=o.OrderId
left JOIN rb_student_orderguest as sog on og.Id=sog.GuestId
left JOIN rb_student AS t on t.StuId=sog.Student_Id
...
...
Edu.WebApi/Controllers/User/StudentStatController.cs
View file @
32d71dbd
...
...
@@ -2187,11 +2187,16 @@ namespace Edu.WebApi.Controllers.User
public
ApiResult
GetStudentMonthPageList
()
{
var
pageModel
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
Msg
.
ToString
());
string
dataStr
=
base
.
ParmJObj
.
GetStringValue
(
"StartTime"
);
DateTime
dataTime
=
System
.
DateTime
.
Now
;
if
(!
string
.
IsNullOrWhiteSpace
(
dataStr
))
{
dataTime
=
Convert
.
ToDateTime
(
dataStr
+
"-01"
);
}
var
query
=
new
RB_Student_ViewModel
()
{
StartTime
=
base
.
ParmJObj
.
GetStringValue
(
"StartTime"
),
EndTime
=
base
.
ParmJObj
.
GetStringValue
(
"EndTime"
),
StartTime
=
StringHelper
.
FormatDate
(
StringHelper
.
FirstDayOfMonth
(
dataTime
)),
EndTime
=
StringHelper
.
FormatDate
(
StringHelper
.
LastDayOfMonth
(
dataTime
)),
};
query
.
Group_Id
=
base
.
UserInfo
.
Group_Id
;
var
data
=
studentModule
.
GetStudentMonthPageListModule
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
rowsCount
,
query
);
...
...
@@ -2233,9 +2238,11 @@ namespace Edu.WebApi.Controllers.User
item
.
OrderIncome
,
item
.
Refund
,
item
.
CourseName
,
item
.
EnterpriseName
,
item
.
CreateBy
,
item
.
CreateByName
,
//StuSexStr = item.StuSex == 0 ? "男" : "女",
//item.CreateBy,
//item.CreateByName,
//AssistList = item.AssistList.Select(qitem => new
//{
// qitem.Id,
...
...
@@ -2254,7 +2261,7 @@ namespace Edu.WebApi.Controllers.User
//item.StuRealMobile,
//item.OrderCount,
//item.RenewOrderCount,
//
item.EnterpriseName,
//
//item.AdvisorExpectDate,
//
//item.AdvisorList,
...
...
@@ -2277,10 +2284,16 @@ namespace Edu.WebApi.Controllers.User
[
HttpPost
]
public
ApiResult
GetStudentMonthList
()
{
string
dataStr
=
base
.
ParmJObj
.
GetStringValue
(
"StartTime"
);
DateTime
dataTime
=
System
.
DateTime
.
Now
;
if
(!
string
.
IsNullOrWhiteSpace
(
dataStr
))
{
dataTime
=
Convert
.
ToDateTime
(
dataStr
+
"-01"
);
}
var
query
=
new
RB_Student_ViewModel
()
{
StartTime
=
base
.
ParmJObj
.
GetStringValue
(
"StartTime"
),
EndTime
=
base
.
ParmJObj
.
GetStringValue
(
"EndTime"
),
StartTime
=
StringHelper
.
FormatDate
(
StringHelper
.
FirstDayOfMonth
(
dataTime
)
),
EndTime
=
StringHelper
.
FormatDate
(
StringHelper
.
LastDayOfMonth
(
dataTime
)
),
};
query
.
Group_Id
=
base
.
UserInfo
.
Group_Id
;
var
data
=
studentModule
.
GetStudentMonthListModule
(
query
);
...
...
@@ -2321,30 +2334,157 @@ namespace Edu.WebApi.Controllers.User
item
.
OrderIncome
,
item
.
Refund
,
item
.
CourseName
,
item
.
EnterpriseName
,
item
.
CreateBy
,
item
.
CreateByName
,
item
.
JoinType
,
});
}
var
statisticsInfo
=
new
object
();
int
orderNum
=
data
.
Count
();
decimal
totalPrice
=
data
.
Sum
(
x
=>
x
.
OrderIncome
-
x
.
Refund
);
decimal
totalPriceShang
=
data
.
Where
(
x
=>
x
.
CreateTime
.
Day
<=
10
).
Sum
(
x
=>
x
.
OrderIncome
-
x
.
Refund
);
decimal
totalPriceZhong
=
data
.
Where
(
x
=>
x
.
CreateTime
.
Day
>
10
&&
x
.
CreateTime
.
Day
<=
20
).
Sum
(
x
=>
x
.
OrderIncome
-
x
.
Refund
);
decimal
totalPriceXia
=
data
.
Where
(
x
=>
x
.
CreateTime
.
Day
>
20
).
Sum
(
x
=>
x
.
OrderIncome
-
x
.
Refund
);
var
sourceList
=
new
List
<
object
>();
foreach
(
var
item
in
data
.
GroupBy
(
x
=>
new
{
x
.
CreateType
,
x
.
StuSource
}))
{
var
nowData
=
data
.
Where
(
x
=>
x
.
StuSource
==
item
.
Key
.
StuSource
&&
x
.
CreateType
==
item
.
Key
.
CreateType
).
ToList
();
var
nowData
=
data
.
Where
(
x
=>
x
.
JoinType
==
3
).
ToList
();
decimal
nowTotalPrice
=
nowData
.
Sum
(
x
=>
x
.
OrderIncome
-
x
.
Refund
);
sourceList
.
Add
(
new
{
OrderNum
=
nowData
.
Count
(),
TotalPrice
=
nowTotalPrice
,
PriceRate
=
Math
.
Round
((
nowTotalPrice
/
totalPrice
),
2
),
CreateType
=
0
,
CreateTypeStr
=
"内产"
,
StuSourceStr
=
"内产"
,
StuSource
=
0
});
foreach
(
var
item
in
data
.
Where
(
x
=>
x
.
JoinType
!=
3
).
GroupBy
(
x
=>
new
{
x
.
CreateType
,
x
.
StuSource
}))
{
nowData
=
data
.
Where
(
x
=>
x
.
StuSource
==
item
.
Key
.
StuSource
&&
x
.
CreateType
==
item
.
Key
.
CreateType
).
ToList
();
nowTotalPrice
=
nowData
.
Sum
(
x
=>
x
.
OrderIncome
-
x
.
Refund
);
sourceList
.
Add
(
new
{
OrderNum
=
nowData
.
Count
(),
TotalPrice
=
nowTotalPrice
,
PriceRate
=
Math
.
Round
((
nowTotalPrice
/
totalPrice
),
2
),
item
.
Key
.
CreateType
,
CreateTypeStr
=
item
.
Key
.
CreateType
.
ToName
(),
CreateTypeStr
=
item
.
Key
.
CreateType
.
ToName
(),
StuSourceStr
=
item
.
Key
.
StuSource
.
ToName
(),
item
.
Key
.
StuSource
});
}
return
ApiResult
.
Success
(
data
:
new
{
list
,
totalPrice
,
totalPriceShang
,
totalPriceZhong
,
totalPriceXia
,
sourceList
});
return
ApiResult
.
Success
(
data
:
new
{
list
,
orderNum
,
totalPrice
,
totalPriceShang
,
totalPriceZhong
,
totalPriceXia
,
sourceList
});
}
/// <summary>
/// 下载学员跟进信息
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
Obsolete
]
public
FileContentResult
DownLoadStudentMonth
()
{
List
<
ExcelDataSource
>
slist
=
new
List
<
ExcelDataSource
>();
var
userInfo
=
base
.
UserInfo
;
string
dataStr
=
base
.
ParmJObj
.
GetStringValue
(
"StartTime"
);
DateTime
dataTime
=
System
.
DateTime
.
Now
;
if
(!
string
.
IsNullOrWhiteSpace
(
dataStr
))
{
dataTime
=
Convert
.
ToDateTime
(
dataStr
+
"-01"
);
}
var
query
=
new
RB_Student_ViewModel
()
{
StartTime
=
StringHelper
.
FormatDate
(
StringHelper
.
FirstDayOfMonth
(
dataTime
)),
EndTime
=
StringHelper
.
FormatDate
(
StringHelper
.
LastDayOfMonth
(
dataTime
)),
};
query
.
Group_Id
=
base
.
UserInfo
.
Group_Id
;
var
data
=
studentModule
.
GetStudentMonthListModule
(
query
);
List
<
object
>
list
=
new
List
<
object
>();
var
QueryTpye
=
base
.
ParmJObj
.
GetInt
(
"QueryTpye"
);
string
excelName
=
"已报名学员.xls"
;
try
{
ExcelDataSource
header
=
new
ExcelDataSource
{
ExcelRows
=
new
List
<
ExcelColumn
>()
{
new
ExcelColumn
(
"学生"
){
CellWidth
=
15
},
new
ExcelColumn
(
"时间"
){
CellWidth
=
15
},
new
ExcelColumn
(
"类型"
){
CellWidth
=
15
},
new
ExcelColumn
(
"学历"
){
CellWidth
=
10
},
new
ExcelColumn
(
"目的"
){
CellWidth
=
15
},
new
ExcelColumn
(
"是否签合同"
){
CellWidth
=
20
},
new
ExcelColumn
(
"来源"
){
CellWidth
=
20
},
new
ExcelColumn
(
"来源人"
){
CellWidth
=
20
},
new
ExcelColumn
(
"课程"
){
CellWidth
=
100
},
new
ExcelColumn
(
"订单金额"
){
CellWidth
=
50
},
}
};
slist
.
Add
(
header
);
if
(
data
!=
null
&&
data
.
Count
>
0
)
{
int
orderNum
=
data
.
Count
();
decimal
totalPrice
=
data
.
Sum
(
x
=>
x
.
OrderIncome
-
x
.
Refund
);
decimal
totalPriceShang
=
data
.
Where
(
x
=>
x
.
CreateTime
.
Day
<=
10
).
Sum
(
x
=>
x
.
OrderIncome
-
x
.
Refund
);
decimal
totalPriceZhong
=
data
.
Where
(
x
=>
x
.
CreateTime
.
Day
>
10
&&
x
.
CreateTime
.
Day
<=
20
).
Sum
(
x
=>
x
.
OrderIncome
-
x
.
Refund
);
decimal
totalPriceXia
=
data
.
Where
(
x
=>
x
.
CreateTime
.
Day
>
20
).
Sum
(
x
=>
x
.
OrderIncome
-
x
.
Refund
);
foreach
(
var
item
in
data
)
{
var
columns
=
new
List
<
ExcelColumn
>
{
new
ExcelColumn
(
item
.
StuName
),
};
columns
.
Add
(
new
ExcelColumn
(
item
.
CreateTimeStr
));
columns
.
Add
(
new
ExcelColumn
(
item
.
JoinType
==
3
?
"内产"
:
"新生"
));
columns
.
Add
(
new
ExcelColumn
(
item
.
StuEducation
.
ToName
()));
columns
.
Add
(
new
ExcelColumn
(
item
.
StuProfession
));
columns
.
Add
(
new
ExcelColumn
(
item
.
AdvisorStatusName
));
columns
.
Add
(
new
ExcelColumn
(
item
.
CreateType
.
ToName
()));
columns
.
Add
(
new
ExcelColumn
((
item
.
CreateType
==
StuCreateTypeEnum
.
CustomerInput
&&
!
string
.
IsNullOrWhiteSpace
(
item
.
EnterpriseName
))
?
item
.
EnterpriseName
:
(!
string
.
IsNullOrWhiteSpace
(
item
.
StuSourceIdName
)
?
item
.
StuSourceIdName
:
item
.
StuChannelName
)));
columns
.
Add
(
new
ExcelColumn
(
item
.
CourseName
));
columns
.
Add
(
new
ExcelColumn
(
item
.
OrderIncome
+
(
item
.
Refund
>
0
?
",已退款"
+
item
.
Refund
:
""
)));
var
dataRow
=
new
ExcelDataSource
()
{
ExcelRows
=
columns
};
slist
.
Add
(
dataRow
);
}
string
totalInfo
=
"订单总价"
+
totalPrice
+
",总单数"
+
orderNum
+
"单,"
+
"上旬总价:"
+
totalPriceShang
+
",中旬总价:"
+
totalPriceZhong
+
",下旬总价"
+
totalPriceXia
;
var
nowData
=
data
.
Where
(
x
=>
x
.
JoinType
==
3
).
ToList
();
decimal
nowTotalPrice
=
nowData
.
Sum
(
x
=>
x
.
OrderIncome
-
x
.
Refund
);
totalInfo
+=
",内产"
+
nowData
.
Count
()
+
"单"
+
"占比:"
+
(
Math
.
Round
((
nowTotalPrice
/
totalPrice
),
2
)
*
100
)
+
"%"
;
foreach
(
var
item
in
data
.
Where
(
x
=>
x
.
JoinType
!=
3
).
GroupBy
(
x
=>
new
{
x
.
CreateType
,
x
.
StuSource
}))
{
nowData
=
data
.
Where
(
x
=>
x
.
StuSource
==
item
.
Key
.
StuSource
&&
x
.
CreateType
==
item
.
Key
.
CreateType
).
ToList
();
nowTotalPrice
=
nowData
.
Sum
(
x
=>
x
.
OrderIncome
-
x
.
Refund
);
totalInfo
+=
","
+
item
.
Key
.
CreateType
.
ToName
()
+
nowData
.
Count
()
+
"单"
+
"占比:"
+
(
Math
.
Round
((
nowTotalPrice
/
totalPrice
),
2
)
*
100
)
+
"%"
;
}
var
columnsT
=
new
List
<
ExcelColumn
>
{
new
ExcelColumn
(
totalInfo
){
Colspan
=
10
}
};
var
dataRowT
=
new
ExcelDataSource
()
{
ExcelRows
=
columnsT
};
slist
.
Add
(
dataRowT
);
}
var
byteData
=
ExcelTempLateHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData
,
"application/octet-stream"
,
excelName
);
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"OutToExcelOrderStudentClassHoursList"
);
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