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
cfc1e3bb
Commit
cfc1e3bb
authored
Jul 05, 2021
by
liudong1993
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/Kui2/education
parents
23a09c18
8e62b868
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
98 additions
and
22 deletions
+98
-22
RB_Course_Chapter.cs
Edu.Model/Entity/Course/RB_Course_Chapter.cs
+1
-1
RB_Course_Chapter_ViewModel.cs
Edu.Model/ViewModel/Course/RB_Course_Chapter_ViewModel.cs
+2
-10
CourseModule.cs
Edu.Module.Course/CourseModule.cs
+55
-1
RB_Course_ChapterRepository.cs
Edu.Repository/Course/RB_Course_ChapterRepository.cs
+10
-6
CourseController.cs
Edu.WebApi/Controllers/Course/CourseController.cs
+18
-2
UserInfoController.cs
Edu.WebApi/Controllers/User/UserInfoController.cs
+12
-2
No files found.
Edu.Model/Entity/Course/RB_Course_Chapter.cs
View file @
cfc1e3bb
...
@@ -100,7 +100,7 @@ namespace Edu.Model.Entity.Course
...
@@ -100,7 +100,7 @@ namespace Edu.Model.Entity.Course
/// <summary>
/// <summary>
/// 排序
/// 排序
/// </summary>
/// </summary>
public
int
SortNum
{
get
;
set
;
}
public
double
SortNum
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 学习课时
/// 学习课时
...
...
Edu.Model/ViewModel/Course/RB_Course_Chapter_ViewModel.cs
View file @
cfc1e3bb
...
@@ -14,16 +14,8 @@ namespace Edu.Model.ViewModel.Course
...
@@ -14,16 +14,8 @@ namespace Edu.Model.ViewModel.Course
public
string
CourseIds
{
get
;
set
;
}
public
string
CourseIds
{
get
;
set
;
}
/// <summary>
/// <summary>
///
排序
///
序列号
/// </summary>
/// </summary>
public
decimal
OrderFileds
public
int
SerialNumber
{
get
;
set
;
}
{
get
{
decimal
.
TryParse
(
this
.
ChapterNo
,
out
decimal
Num
);
return
Num
;
}
}
}
}
}
}
Edu.Module.Course/CourseModule.cs
View file @
cfc1e3bb
...
@@ -485,7 +485,7 @@ namespace Edu.Module.Course
...
@@ -485,7 +485,7 @@ namespace Edu.Module.Course
{
{
List
<
ChapterTree_ViewModel
>
resultList
=
new
List
<
ChapterTree_ViewModel
>();
List
<
ChapterTree_ViewModel
>
resultList
=
new
List
<
ChapterTree_ViewModel
>();
//获取下级节点
//获取下级节点
var
subList
=
sourceList
?.
Where
(
qItem
=>
qItem
.
ParentId
==
parentId
).
OrderBy
(
qitem
=>
qitem
.
OrderFileds
).
ToList
();
var
subList
=
sourceList
?.
Where
(
qItem
=>
qItem
.
ParentId
==
parentId
).
OrderBy
(
qitem
=>
qitem
.
SortNum
).
ToList
();
//如果存在下级节点
//如果存在下级节点
if
(
subList
!=
null
&&
subList
.
Count
>
0
)
if
(
subList
!=
null
&&
subList
.
Count
>
0
)
{
{
...
@@ -553,6 +553,60 @@ namespace Edu.Module.Course
...
@@ -553,6 +553,60 @@ namespace Edu.Module.Course
return
flag
;
return
flag
;
}
}
/// <summary>
/// 批量更新当前课时
/// </summary>
/// <param name="courseId"></param>
/// <returns></returns>
public
virtual
List
<
RB_Course_Chapter_ViewModel
>
BatchUpdateChapterCurrentHoursModule
(
int
courseId
)
{
List
<
RB_Course_Chapter_ViewModel
>
chapterList
=
new
List
<
RB_Course_Chapter_ViewModel
>();
List
<
ChapterTree_ViewModel
>
treeList
=
GetChapterTreeListModule
(
new
RB_Course_Chapter_ViewModel
()
{
CourseId
=
courseId
});
CalcChapterClassHours
(
treeList
,
chapterList
);
var
resultList
=
chapterList
;
if
(
resultList
!=
null
&&
resultList
.
Count
>
0
)
{
for
(
var
i
=
0
;
i
<
resultList
.
Count
;
i
++)
{
resultList
[
i
].
CurrentHours
=
resultList
.
Where
(
qitem
=>
qitem
.
SerialNumber
<=
(
i
+
1
)).
Sum
(
qitem
=>
qitem
.
StudyHours
);
}
}
return
resultList
;
}
/// <summary>
/// 计算
/// </summary>
/// <param name="treeList"></param>
/// <param name="chapterList"></param>
public
void
CalcChapterClassHours
(
List
<
ChapterTree_ViewModel
>
treeList
,
List
<
RB_Course_Chapter_ViewModel
>
chapterList
)
{
foreach
(
var
item
in
treeList
)
{
RB_Course_Chapter_ViewModel
model
=
new
RB_Course_Chapter_ViewModel
()
{
ChapterId
=
item
.
ChapterId
,
ChapterNo
=
item
.
ChapterNo
,
ChapterName
=
item
.
ChapterName
,
SerialNumber
=
chapterList
.
Count
()+
1
,
};
if
(
item
.
ChildList
!=
null
&&
item
.
ChildList
.
Count
>
0
)
{
model
.
StudyHours
=
0
;
}
else
{
model
.
StudyHours
=
item
.
StudyHours
;
}
chapterList
.
Add
(
model
);
if
(
item
.
ChildList
!=
null
&&
item
.
ChildList
.
Count
>
0
)
{
CalcChapterClassHours
(
item
.
ChildList
,
chapterList
);
}
}
}
/// <summary>
/// <summary>
/// 获取章节实体类
/// 获取章节实体类
/// </summary>
/// </summary>
...
...
Edu.Repository/Course/RB_Course_ChapterRepository.cs
View file @
cfc1e3bb
...
@@ -29,10 +29,12 @@ namespace Edu.Repository.Course
...
@@ -29,10 +29,12 @@ namespace Edu.Repository.Course
WHERE 1=1
WHERE 1=1
"
);
"
);
builder
.
AppendFormat
(
" AND {0}={1}"
,
nameof
(
RB_Course_Chapter_ViewModel
.
Status
),
EnumHelper
.
ToInt
(
DateStateEnum
.
Normal
));
builder
.
AppendFormat
(
" AND {0}={1}"
,
nameof
(
RB_Course_Chapter_ViewModel
.
Status
),
EnumHelper
.
ToInt
(
DateStateEnum
.
Normal
));
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Course_Chapter_ViewModel
.
Group_Id
),
query
.
Group_Id
);
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Course_Chapter_ViewModel
.
School_Id
),
query
.
School_Id
);
if
(
query
!=
null
)
if
(
query
!=
null
)
{
{
if
(
query
.
Group_Id
>
0
)
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Course_Chapter_ViewModel
.
Group_Id
),
query
.
Group_Id
);
}
if
(
query
.
CourseId
>
0
)
if
(
query
.
CourseId
>
0
)
{
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Course_Chapter_ViewModel
.
CourseId
),
query
.
CourseId
);
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Course_Chapter_ViewModel
.
CourseId
),
query
.
CourseId
);
...
@@ -42,7 +44,7 @@ namespace Edu.Repository.Course
...
@@ -42,7 +44,7 @@ namespace Edu.Repository.Course
builder
.
AppendFormat
(
" AND {0} IN({1}) "
,
nameof
(
RB_Course_Chapter_ViewModel
.
CourseId
),
query
.
CourseIds
);
builder
.
AppendFormat
(
" AND {0} IN({1}) "
,
nameof
(
RB_Course_Chapter_ViewModel
.
CourseId
),
query
.
CourseIds
);
}
}
}
}
builder
.
AppendFormat
(
" ORDER BY {0}"
,
nameof
(
RB_Course_Chapter_ViewModel
.
ChapterNo
));
builder
.
AppendFormat
(
" ORDER BY {0}
"
,
nameof
(
RB_Course_Chapter_ViewModel
.
ChapterNo
));
return
Get
<
RB_Course_Chapter_ViewModel
>(
builder
.
ToString
(),
parameters
).
ToList
();
return
Get
<
RB_Course_Chapter_ViewModel
>(
builder
.
ToString
(),
parameters
).
ToList
();
}
}
...
@@ -54,12 +56,14 @@ namespace Edu.Repository.Course
...
@@ -54,12 +56,14 @@ namespace Edu.Repository.Course
public
bool
SetBatchUpdateChapterNoRepository
(
List
<
RB_Course_Chapter_ViewModel
>
param
)
public
bool
SetBatchUpdateChapterNoRepository
(
List
<
RB_Course_Chapter_ViewModel
>
param
)
{
{
StringBuilder
builder
=
new
StringBuilder
();
StringBuilder
builder
=
new
StringBuilder
();
builder
.
Append
(
"INSERT INTO rb_course_chapter (ChapterId, ChapterNo, ParentId) VALUES"
);
builder
.
Append
(
"INSERT INTO rb_course_chapter (ChapterId, ChapterNo, ParentId
,SortNum
) VALUES"
);
param
.
ForEach
(
x
=>
{
param
.
ForEach
(
x
=>
{
builder
.
Append
(
$"(
{
x
.
ChapterId
}
,'
{
x
.
ChapterNo
}
',
{
x
.
ParentId
}
),"
);
var
newChapterNo
=
x
.
ChapterNo
.
Replace
(
"."
,
""
);
double
.
TryParse
(
newChapterNo
,
out
double
SortNum
);
builder
.
Append
(
$"(
{
x
.
ChapterId
}
,'
{
x
.
ChapterNo
}
',
{
x
.
ParentId
}
,
{
SortNum
}
),"
);
});
});
builder
=
builder
.
Remove
(
builder
.
Length
-
1
,
1
);
builder
=
builder
.
Remove
(
builder
.
Length
-
1
,
1
);
builder
.
Append
(
"ON DUPLICATE KEY UPDATE ChapterNo=VALUES(ChapterNo),
ParentId=VALUES(ParentId
);"
);
builder
.
Append
(
"ON DUPLICATE KEY UPDATE ChapterNo=VALUES(ChapterNo),
ParentId=VALUES(ParentId),SortNum=VALUES(SortNum
);"
);
return
Execute
(
builder
.
ToString
())
>
0
;
return
Execute
(
builder
.
ToString
())
>
0
;
}
}
...
...
Edu.WebApi/Controllers/Course/CourseController.cs
View file @
cfc1e3bb
...
@@ -430,7 +430,6 @@ namespace Edu.WebApi.Controllers.Course
...
@@ -430,7 +430,6 @@ namespace Edu.WebApi.Controllers.Course
ParentId
=
base
.
ParmJObj
.
GetInt
(
"ParentId"
),
ParentId
=
base
.
ParmJObj
.
GetInt
(
"ParentId"
),
OpenStatus
=
base
.
ParmJObj
.
GetInt
(
"OpenStatus"
),
OpenStatus
=
base
.
ParmJObj
.
GetInt
(
"OpenStatus"
),
Progress
=
base
.
ParmJObj
.
GetInt
(
"Progress"
),
Progress
=
base
.
ParmJObj
.
GetInt
(
"Progress"
),
SortNum
=
base
.
ParmJObj
.
GetInt
(
"SortNum"
),
StudyHours
=
base
.
ParmJObj
.
GetInt
(
"StudyHours"
),
StudyHours
=
base
.
ParmJObj
.
GetInt
(
"StudyHours"
),
StudyMinutes
=
base
.
ParmJObj
.
GetInt
(
"StudyMinutes"
),
StudyMinutes
=
base
.
ParmJObj
.
GetInt
(
"StudyMinutes"
),
Objectives
=
base
.
ParmJObj
.
GetStringValue
(
"Objectives"
),
Objectives
=
base
.
ParmJObj
.
GetStringValue
(
"Objectives"
),
...
@@ -446,7 +445,6 @@ namespace Edu.WebApi.Controllers.Course
...
@@ -446,7 +445,6 @@ namespace Edu.WebApi.Controllers.Course
extModel
.
UpdateTime
=
DateTime
.
Now
;
extModel
.
UpdateTime
=
DateTime
.
Now
;
extModel
.
Group_Id
=
this
.
UserInfo
.
Group_Id
;
extModel
.
Group_Id
=
this
.
UserInfo
.
Group_Id
;
extModel
.
School_Id
=
this
.
UserInfo
.
School_Id
;
extModel
.
School_Id
=
this
.
UserInfo
.
School_Id
;
bool
flag
=
courseModule
.
SetChapterModule
(
extModel
);
bool
flag
=
courseModule
.
SetChapterModule
(
extModel
);
return
flag
?
ApiResult
.
Success
(
data
:
extModel
)
:
ApiResult
.
Failed
();
return
flag
?
ApiResult
.
Success
(
data
:
extModel
)
:
ApiResult
.
Failed
();
}
}
...
@@ -465,6 +463,24 @@ namespace Edu.WebApi.Controllers.Course
...
@@ -465,6 +463,24 @@ namespace Edu.WebApi.Controllers.Course
return
ApiResult
.
Success
(
data
:
list
);
return
ApiResult
.
Success
(
data
:
list
);
}
}
/// <summary>
/// 计算当前课时数
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
BatchUpdateChapterCurrentHours
()
{
var
CourseId
=
base
.
ParmJObj
.
GetInt
(
"CourseId"
,
0
);
var
list
=
courseModule
.
BatchUpdateChapterCurrentHoursModule
(
CourseId
);
return
ApiResult
.
Success
(
data
:
list
.
Select
(
qitem
=>
new
{
qitem
.
ChapterId
,
qitem
.
ChapterNo
,
qitem
.
ChapterName
,
qitem
.
CurrentHours
,
}));
}
/// <summary>
/// <summary>
/// 获取章节树形列表
/// 获取章节树形列表
/// </summary>
/// </summary>
...
...
Edu.WebApi/Controllers/User/UserInfoController.cs
View file @
cfc1e3bb
...
@@ -66,6 +66,10 @@ namespace Edu.WebApi.Controllers.User
...
@@ -66,6 +66,10 @@ namespace Edu.WebApi.Controllers.User
var
OldPassWord
=
base
.
ParmJObj
.
GetStringValue
(
"OldPassWord"
);
var
OldPassWord
=
base
.
ParmJObj
.
GetStringValue
(
"OldPassWord"
);
var
NewPassWord
=
base
.
ParmJObj
.
GetStringValue
(
"NewPassWord"
);
var
NewPassWord
=
base
.
ParmJObj
.
GetStringValue
(
"NewPassWord"
);
var
NewSurePassWord
=
base
.
ParmJObj
.
GetStringValue
(
"NewSurePassWord"
);
var
NewSurePassWord
=
base
.
ParmJObj
.
GetStringValue
(
"NewSurePassWord"
);
if
(
string
.
IsNullOrWhiteSpace
(
OldPassWord
)
||
string
.
IsNullOrWhiteSpace
(
NewPassWord
)
||
string
.
IsNullOrWhiteSpace
(
NewSurePassWord
))
{
return
ApiResult
.
Failed
(
message
:
"请输入密码"
);
}
if
(
OldPassWord
.
Equals
(
NewPassWord
))
if
(
OldPassWord
.
Equals
(
NewPassWord
))
{
{
return
ApiResult
.
Failed
(
message
:
"新密码与旧密码不能一致"
);
return
ApiResult
.
Failed
(
message
:
"新密码与旧密码不能一致"
);
...
@@ -77,6 +81,10 @@ namespace Edu.WebApi.Controllers.User
...
@@ -77,6 +81,10 @@ namespace Edu.WebApi.Controllers.User
{
{
return
ApiResult
.
Failed
(
message
:
"员工信息不存在"
);
return
ApiResult
.
Failed
(
message
:
"员工信息不存在"
);
}
}
if
(
extModel
.
Password
!=
Common
.
DES
.
Encrypt
(
OldPassWord
))
{
return
ApiResult
.
Failed
(
message
:
"旧密码输入错误"
);
}
if
(
extModel
.
Password
==
Common
.
DES
.
Encrypt
(
NewSurePassWord
))
if
(
extModel
.
Password
==
Common
.
DES
.
Encrypt
(
NewSurePassWord
))
{
{
return
ApiResult
.
Failed
(
message
:
"新密码与旧密码不能一致"
);
return
ApiResult
.
Failed
(
message
:
"新密码与旧密码不能一致"
);
...
@@ -99,7 +107,7 @@ namespace Edu.WebApi.Controllers.User
...
@@ -99,7 +107,7 @@ namespace Edu.WebApi.Controllers.User
bool
result
=
accountModule
.
SetBatchResetPassword
(
list
,
NewPassWord
);
bool
result
=
accountModule
.
SetBatchResetPassword
(
list
,
NewPassWord
);
if
(
result
)
if
(
result
)
{
{
return
ApiResult
.
Failed
(
message
:
"更新密码成功"
);
return
ApiResult
.
Success
(
message
:
"更新密码成功"
);
}
}
else
else
{
{
...
@@ -245,7 +253,9 @@ namespace Edu.WebApi.Controllers.User
...
@@ -245,7 +253,9 @@ namespace Edu.WebApi.Controllers.User
#
endregion
#
endregion
#
endregion
#
endregion
return
ApiResult
.
Success
(
""
,
new
{
EmployeeListResult
=
employeeListResult
,
return
ApiResult
.
Success
(
""
,
new
{
EmployeeListResult
=
employeeListResult
,
OrderNoCompleteNum
=
orderList
.
Count
(),
OrderNoCompleteNum
=
orderList
.
Count
(),
CourseNum
=
guestList
.
Count
(),
CourseNum
=
guestList
.
Count
(),
TotalCommiommission
=
totalCommiommission
,
TotalCommiommission
=
totalCommiommission
,
...
...
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