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
c286dfbc
Commit
c286dfbc
authored
Jul 06, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
下载修改
parent
57fd65a2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
158 additions
and
29 deletions
+158
-29
AsposeCellHelper.cs
Edu.Common/Plugin/AsposeCellHelper.cs
+35
-19
ExcelTempLateHelper.cs
Edu.Common/Plugin/ExcelTempLateHelper.cs
+5
-0
LeaveStudentController.cs
Edu.WebApi/Controllers/Applet/LeaveStudentController.cs
+11
-9
PlanAppoimentController.cs
Edu.WebApi/Controllers/Course/PlanAppoimentController.cs
+107
-0
ScrollController.cs
Edu.WebApi/Controllers/Course/ScrollController.cs
+0
-1
No files found.
Edu.Common/Plugin/AsposeCellHelper.cs
View file @
c286dfbc
...
...
@@ -18,7 +18,7 @@ namespace Edu.Common.Plugin
/// <param name="list">模板数据</param>
/// <param name="isTempLate">是否模板导出</param>
/// <param name="tempLatePath">模板文件路劲</param>
public
static
byte
[]
ToExcelExtend
(
List
<
ExcelDataSource
>
list
,
bool
isTempLate
=
false
,
string
tempLatePath
=
""
)
{
Workbook
workbook
=
null
;
...
...
@@ -35,7 +35,7 @@ namespace Edu.Common.Plugin
else
{
workbook
=
new
Workbook
();
sheet
=
workbook
.
Worksheets
[
0
];
sheet
=
workbook
.
Worksheets
[
0
];
}
int
rowIndex
=
0
;
Cells
cells
=
sheet
.
Cells
;
...
...
@@ -44,7 +44,7 @@ namespace Edu.Common.Plugin
foreach
(
var
item
in
list
)
{
int
columnsIndex
=
0
;
//设置行高
//设置行高
if
(
item
.
ColumnHight
>
0
)
{
cells
.
SetRowHeight
(
rowIndex
,
item
.
ColumnHight
);
...
...
@@ -66,32 +66,34 @@ namespace Edu.Common.Plugin
cells
.
SetColumnWidth
(
columnsIndex
,
subItem
.
CellWidth
);
}
string
cellValue
=
subItem
.
Value
??
""
;
//设置单元格背景颜色
switch
(
subItem
.
BgColorEnum
)
{
case
ColorEnum
.
BrightGreen
:
style
.
ForegroundColor
=
Color
.
DodgerBlue
;
//fCellStyle.FillPattern = FillPattern.SolidForegroun
d;
style
.
Pattern
=
BackgroundType
.
Soli
d
;
break
;
case
ColorEnum
.
DarkBlue
:
style
.
ForegroundColor
=
Color
.
DarkBlue
;
//fCellStyle.FillPattern = FillPattern.SolidForegroun
d;
style
.
Pattern
=
BackgroundType
.
Soli
d
;
break
;
//红色
case
ColorEnum
.
Red
:
style
.
ForegroundColor
=
Color
.
Red
;
//fCellStyle.FillPattern = FillPattern.SolidForeground;
style
.
Pattern
=
BackgroundType
.
Solid
;
break
;
//灰色
case
ColorEnum
.
Grey
:
style
.
ForegroundColor
=
Color
.
FromArgb
(
242
,
244
,
247
);
style
.
Pattern
=
BackgroundType
.
Solid
;
break
;
default
:
style
.
ForegroundColor
=
Color
.
Transparent
;
style
.
Pattern
=
BackgroundType
.
Solid
;
break
;
}
////字体大小
//if (subItem.FontHeight > 0)
//{
// style.Font.Size = subItem.FontHeight * 20;
//}
//else
//{
// style.Font.Size = 11 * 20;
//}
//字体
if
(!
string
.
IsNullOrWhiteSpace
(
subItem
.
FontName
))
{
...
...
@@ -160,9 +162,23 @@ namespace Edu.Common.Plugin
style
.
SetBorder
(
BorderType
.
RightBorder
,
CellBorderType
.
None
,
Color
.
Black
);
style
.
SetBorder
(
BorderType
.
TopBorder
,
CellBorderType
.
None
,
Color
.
Black
);
}
cells
[
rowIndex
,
columnsIndex
].
SetStyle
(
style
);
cells
[
rowIndex
,
columnsIndex
].
PutValue
(
cellValue
);
columnsIndex
++;
//合并单元格
if
(
subItem
.
Colspan
>
1
||
subItem
.
Rowspan
>
1
)
{
cells
.
Merge
(
rowIndex
,
columnsIndex
,
subItem
.
Rowspan
,
subItem
.
Colspan
);
cells
[
rowIndex
,
columnsIndex
].
SetStyle
(
style
);
cells
[
rowIndex
,
columnsIndex
].
PutValue
(
cellValue
);
columnsIndex
+=
subItem
.
Colspan
;
}
else
{
cells
[
rowIndex
,
columnsIndex
].
SetStyle
(
style
);
cells
[
rowIndex
,
columnsIndex
].
PutValue
(
cellValue
);
columnsIndex
++;
}
}
rowIndex
++;
}
...
...
Edu.Common/Plugin/ExcelTempLateHelper.cs
View file @
c286dfbc
...
...
@@ -344,6 +344,11 @@ namespace Edu.Common.Plugin
/// Yellow
/// </summary>
Yellow
=
5
,
/// <summary>
/// 灰色
/// </summary>
Grey
=
6
,
}
/// <summary>
...
...
Edu.WebApi/Controllers/Applet/LeaveStudentController.cs
View file @
c286dfbc
...
...
@@ -180,16 +180,18 @@ namespace Edu.WebApi.Controllers.Applet
Group_Id
=
base
.
AppletUserInfo
.
Group_Id
,
CreateTime
=
DateTime
.
Now
};
model
.
DetailsList
=
new
List
<
RB_Plan_Appointment_Details_ViewModel
>();
model
.
DetailsList
.
Add
(
new
RB_Plan_Appointment_Details_ViewModel
()
model
.
DetailsList
=
new
List
<
RB_Plan_Appointment_Details_ViewModel
>
{
DetailsId
=
base
.
ParmJObj
.
GetInt
(
"DetailsId"
),
PlanAppointmentId
=
0
,
StuId
=
base
.
AppletUserInfo
.
AccountId
,
Account_Id
=
base
.
AppletUserInfo
.
Id
,
Status
=
0
,
CreateTime
=
DateTime
.
Now
});
new
RB_Plan_Appointment_Details_ViewModel
()
{
DetailsId
=
base
.
ParmJObj
.
GetInt
(
"DetailsId"
),
PlanAppointmentId
=
0
,
StuId
=
base
.
AppletUserInfo
.
AccountId
,
Account_Id
=
base
.
AppletUserInfo
.
Id
,
Status
=
0
,
CreateTime
=
DateTime
.
Now
}
};
bool
flag
=
planAppoiment
.
SetPlanAppointmentModule
(
model
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
...
...
Edu.WebApi/Controllers/Course/PlanAppoimentController.cs
View file @
c286dfbc
...
...
@@ -5,6 +5,7 @@ using Edu.Module.Course;
using
Edu.WebApi.Filter
;
using
Microsoft.AspNetCore.Cors
;
using
Microsoft.AspNetCore.Mvc
;
using
Newtonsoft.Json.Linq
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
@@ -90,6 +91,112 @@ namespace Edu.WebApi.Controllers.Course
return
ApiResult
.
Success
(
data
:
data
);
}
/// <summary>
/// 下载学员预约统计信息
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
FileContentResult
DownLoadPlanAppointmentStatic
()
{
string
startDate
=
base
.
ParmJObj
.
GetStringValue
(
"StartTime"
);
string
endDate
=
base
.
ParmJObj
.
GetStringValue
(
"EndTime"
);
if
(
string
.
IsNullOrEmpty
(
startDate
))
{
startDate
=
Common
.
ConvertHelper
.
FormatDate
(
DateTime
.
Now
);
}
if
(
string
.
IsNullOrEmpty
(
endDate
))
{
endDate
=
Common
.
ConvertHelper
.
FormatDate
(
Convert
.
ToDateTime
(
startDate
).
AddMonths
(
1
));
}
var
dataList
=
planAppoiment
.
GetPlanAppointmentStaticModule
(
startDate
,
endDate
,
base
.
UserInfo
.
Group_Id
);
string
excelName
=
"学员预约统计.xls"
;
List
<
ExcelDataSource
>
slist
=
new
List
<
ExcelDataSource
>();
try
{
foreach
(
var
item
in
dataList
)
{
var
dataObj
=
JObject
.
Parse
(
JsonHelper
.
Serialize
(
item
));
string
DateStr
=
dataObj
.
GetStringValue
(
"DateStr"
);
string
WeekStr
=
dataObj
.
GetStringValue
(
"WeekStr"
);
string
timeListStr
=
dataObj
.
GetStringValue
(
"TimeList"
);
if
(!
string
.
IsNullOrEmpty
(
timeListStr
))
{
JArray
itemArray
=
JArray
.
Parse
(
timeListStr
);
if
(
itemArray
!=
null
&&
itemArray
.
Count
>
0
)
{
int
SubIndex
=
0
;
foreach
(
var
subItem
in
itemArray
)
{
JObject
subObj
=
JObject
.
Parse
(
JsonHelper
.
Serialize
(
subItem
));
var
dataRow
=
new
ExcelDataSource
()
{
ExcelRows
=
new
List
<
ExcelColumn
>()
};
if
(
SubIndex
==
0
)
{
dataRow
.
ExcelRows
.
Add
(
new
ExcelColumn
()
{
Value
=
DateStr
+
"\r\n"
+
WeekStr
,
CellWidth
=
20
,
Rowspan
=
itemArray
.
Count
});
}
else
{
dataRow
.
ExcelRows
.
Add
(
new
ExcelColumn
()
{
Value
=
""
,
CellWidth
=
20
,
});
}
dataRow
.
ExcelRows
.
Add
(
new
ExcelColumn
()
{
Value
=
string
.
Format
(
"第{0}节课"
,
SubIndex
+
1
),
CellWidth
=
30
,
BgColorEnum
=
ColorEnum
.
Grey
});
string
stuNames
=
""
;
var
subStr
=
subObj
.
GetStringValue
(
"StuList"
);
if
(!
string
.
IsNullOrEmpty
(
subStr
))
{
JArray
subArray
=
JArray
.
Parse
(
subStr
);
if
(
subArray
!=
null
&&
subArray
.
Count
>
0
)
{
foreach
(
var
stuItem
in
subArray
)
{
JObject
stuObj
=
JObject
.
Parse
(
JsonHelper
.
Serialize
(
stuItem
));
stuNames
+=
stuObj
.
GetStringValue
(
"StuName"
)+
"、"
;
}
}
}
dataRow
.
ExcelRows
.
Add
(
new
ExcelColumn
()
{
Value
=
stuNames
.
TrimStart
(
'、'
).
TrimEnd
(
'、'
),
CellWidth
=
25
,
});
slist
.
Add
(
dataRow
);
SubIndex
++;
}
}
}
}
var
byteData
=
AsposeCellHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData
,
"application/octet-stream"
,
excelName
);
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"DownLoadPlanAppointmentStatic"
);
var
byteData1
=
ExcelTempLateHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData1
,
"application/octet-stream"
,
excelName
);
}
}
/// <summary>
/// 获取预约详情
/// </summary>
...
...
Edu.WebApi/Controllers/Course/ScrollController.cs
View file @
c286dfbc
...
...
@@ -1154,7 +1154,6 @@ namespace Edu.WebApi.Controllers.Course
/// <returns></returns>
[
HttpPost
]
[
Obsolete
]
public
FileContentResult
DownLoadStuLearnChapterStatic
()
{
var
userInfo
=
base
.
UserInfo
;
...
...
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