Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
邬吉朋
practical_train
Commits
ee1e563c
Commit
ee1e563c
authored
Nov 20, 2026
by
wujipeng
Browse files
优化项
parent
97d0574e
Changes
2
Show whitespace changes
Inline
Side-by-side
practical-business/src/main/java/com/platform/business/service/impl/CourseAdminServiceImpl.java
View file @
ee1e563c
...
@@ -1621,9 +1621,8 @@ public class CourseAdminServiceImpl implements CourseAdminService {
...
@@ -1621,9 +1621,8 @@ public class CourseAdminServiceImpl implements CourseAdminService {
validateCourseDate
(
course
.
entity
.
getDate
(),
managedClass
);
validateCourseDate
(
course
.
entity
.
getDate
(),
managedClass
);
LocalDate
courseDate
=
toLocalDate
(
course
.
entity
.
getDate
());
LocalDate
courseDate
=
toLocalDate
(
course
.
entity
.
getDate
());
LocalDate
today
=
LocalDate
.
now
(
ClassAdminConstants
.
BUSINESS_ZONE
);
LocalDate
today
=
LocalDate
.
now
(
ClassAdminConstants
.
BUSINESS_ZONE
);
if
(
courseDate
.
isBefore
(
today
))
{
// 允许补录班级培训周期内的历史课程。日期边界仍由 validateCourseDate 校验,
throw
new
BusinessException
(
"课程日期不能早于当前日期"
);
// 因而放开“不得早于今天”不会允许课程超出班级的培训开始、结束日期。
}
if
(
courseDate
.
equals
(
today
))
{
if
(
courseDate
.
equals
(
today
))
{
LocalTime
now
=
LocalTime
.
now
(
ClassAdminConstants
.
BUSINESS_ZONE
);
LocalTime
now
=
LocalTime
.
now
(
ClassAdminConstants
.
BUSINESS_ZONE
);
boolean
started
=
course
.
timeRanges
.
stream
()
boolean
started
=
course
.
timeRanges
.
stream
()
...
...
practical-business/src/test/java/com/platform/business/service/impl/CourseAdminServiceImplTest.java
View file @
ee1e563c
...
@@ -161,6 +161,31 @@ class CourseAdminServiceImplTest {
...
@@ -161,6 +161,31 @@ class CourseAdminServiceImplTest {
assertEquals
(
"11:00-13:00"
,
captor
.
getValue
().
getTimeFrame
());
assertEquals
(
"11:00-13:00"
,
captor
.
getValue
().
getTimeFrame
());
}
}
@Test
void
createBatchShouldAllowHistoricalCourseWithinClassTrainingPeriod
()
{
LocalDate
historicalDate
=
LocalDate
.
now
(
ClassAdminConstants
.
BUSINESS_ZONE
).
minusDays
(
1
);
mockWritableClassFor
(
historicalDate
);
when
(
classSubjectMapper
.
countAdminActiveTeacher
(
"teacher-1"
)).
thenReturn
(
1
);
when
(
classSubjectMapper
.
selectAdminConflictCandidates
(
any
(),
eq
(
1
),
eq
(
"teacher-1"
),
anyList
())).
thenReturn
(
Collections
.
emptyList
());
when
(
classSubjectMapper
.
insert
(
any
(
ClassSubjectEntity
.
class
))).
thenReturn
(
1
);
mockEmptyDetail
();
CourseAdminSaveDTO
item
=
validCourse
();
item
.
setDate
(
Date
.
valueOf
(
historicalDate
));
CourseAdminBatchSaveDTO
request
=
new
CourseAdminBatchSaveDTO
();
request
.
setClassId
(
1
);
request
.
setCourses
(
Collections
.
singletonList
(
item
));
// 历史课程用于补录真实教学记录,只要仍处于班级培训周期内就应允许保存。
service
.
createBatch
(
request
);
ArgumentCaptor
<
ClassSubjectEntity
>
captor
=
ArgumentCaptor
.
forClass
(
ClassSubjectEntity
.
class
);
verify
(
classSubjectMapper
).
insert
(
captor
.
capture
());
assertEquals
(
Date
.
valueOf
(
historicalDate
),
captor
.
getValue
().
getDate
());
}
@Test
@Test
void
createBatchShouldRejectOverlappingCoursesInSameRequest
()
{
void
createBatchShouldRejectOverlappingCoursesInSameRequest
()
{
mockWritableClass
();
mockWritableClass
();
...
...
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