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
091a5b1e
Commit
091a5b1e
authored
Nov 17, 2026
by
wujipeng
Browse files
优化项
parent
42f13c03
Changes
4
Hide whitespace changes
Inline
Side-by-side
practical-business/src/main/java/com/platform/business/controller/CourseAdminController.java
View file @
091a5b1e
...
...
@@ -126,7 +126,7 @@ public class CourseAdminController {
return
Result
.
data
(
Boolean
.
TRUE
);
}
@ApiOperation
(
"导出班级课程
CSV
"
)
@ApiOperation
(
"
按标准课程安排表模板
导出班级课程
Word
"
)
@GetMapping
(
"/classes/{classId}/export"
)
public
void
export
(
@PathVariable
(
"classId"
)
Integer
classId
,
...
...
@@ -136,7 +136,7 @@ public class CourseAdminController {
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
Date
endDate
,
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
IOException
{
// 必须在写响应流前完成鉴权,避免鉴权失败时返回半截
CSV
文件。
// 必须在写响应流前完成鉴权,避免鉴权失败时返回半截
Word
文件。
requireAdmin
(
request
);
courseAdminService
.
export
(
classId
,
startDate
,
endDate
,
response
);
}
...
...
practical-business/src/main/java/com/platform/business/service/impl/CourseAdminServiceImpl.java
View file @
091a5b1e
...
...
@@ -23,9 +23,19 @@ import com.platform.business.service.CourseAdminService;
import
com.platform.exception.BusinessException
;
import
org.springframework.http.HttpHeaders
;
import
org.apache.poi.xwpf.usermodel.XWPFDocument
;
import
org.apache.poi.xwpf.usermodel.XWPFParagraph
;
import
org.apache.poi.xwpf.usermodel.XWPFRun
;
import
org.apache.poi.xwpf.usermodel.XWPFTable
;
import
org.apache.poi.xwpf.usermodel.XWPFTableCell
;
import
org.apache.poi.xwpf.usermodel.XWPFTableRow
;
import
org.apache.poi.xwpf.usermodel.ParagraphAlignment
;
import
org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRow
;
import
org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTcPr
;
import
org.openxmlformats.schemas.wordprocessingml.x2006.main.CTVerticalJc
;
import
org.openxmlformats.schemas.wordprocessingml.x2006.main.CTVMerge
;
import
org.openxmlformats.schemas.wordprocessingml.x2006.main.STMerge
;
import
org.openxmlformats.schemas.wordprocessingml.x2006.main.STVerticalJc
;
import
org.apache.xmlbeans.XmlException
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
...
...
@@ -33,8 +43,7 @@ import org.springframework.web.multipart.MultipartFile;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.OutputStreamWriter
;
import
java.io.PrintWriter
;
import
java.io.InputStream
;
import
java.math.BigDecimal
;
import
java.net.URLEncoder
;
import
java.nio.charset.StandardCharsets
;
...
...
@@ -69,6 +78,9 @@ import java.util.regex.Pattern;
@Service
public
class
CourseAdminServiceImpl
implements
CourseAdminService
{
private
static
final
String
COURSE_EXPORT_TEMPLATE
=
"/templates/course-admin/course-schedule-template.docx"
;
/** 兼容前端输入不补零的时间,例如9:00。 */
private
static
final
DateTimeFormatter
FLEXIBLE_TIME_FORMATTER
=
DateTimeFormatter
.
ofPattern
(
"H:mm"
);
...
...
@@ -260,7 +272,12 @@ public class CourseAdminServiceImpl implements CourseAdminService {
for
(
int
rowIndex
=
0
;
rowIndex
<
table
.
getRows
().
size
();
rowIndex
++)
{
String
rowText
=
normalizeCellText
(
table
.
getRow
(
rowIndex
).
getTableCells
().
stream
()
.
map
(
XWPFTableCell:
:
getText
).
collect
(
Collectors
.
joining
(
"|"
)));
if
(
rowText
.
contains
(
"日期"
)
&&
rowText
.
contains
(
"课程"
)
&&
rowText
.
contains
(
"授课教师"
))
{
// 真实Word模板会用多个空格把“课 程”撑开;仅在识别表头时移除空白,
// 后续课程名称仍保留原始词间空格,避免改变实际导入内容。
String
compactHeaderText
=
rowText
.
replaceAll
(
"\\s+"
,
""
);
if
(
compactHeaderText
.
contains
(
"日期"
)
&&
compactHeaderText
.
contains
(
"课程"
)
&&
compactHeaderText
.
contains
(
"授课教师"
))
{
courseTable
=
table
;
headerRowIndex
=
rowIndex
;
break
;
...
...
@@ -729,40 +746,186 @@ public class CourseAdminServiceImpl implements CourseAdminService {
public
void
export
(
Integer
classId
,
Date
startDate
,
Date
endDate
,
HttpServletResponse
response
)
throws
IOException
{
CourseAdminDetailVO
detail
=
detail
(
classId
,
startDate
,
endDate
);
String
fileName
=
"课程表_"
+
detail
.
getClassName
()
+
".
csv
"
;
String
fileName
=
"课程
安排
表_"
+
detail
.
getClassName
()
+
".
docx
"
;
String
encodedName
=
URLEncoder
.
encode
(
fileName
,
StandardCharsets
.
UTF_8
.
name
())
.
replace
(
"+"
,
"%20"
);
response
.
setC
haracterEncoding
(
StandardCharsets
.
UTF_8
.
name
());
response
.
setContentType
(
"text/csv;charset=UTF-8
"
);
response
.
setC
ontentType
(
"application/vnd.openxmlformats-officedocument.wordprocessingml.document
"
);
response
.
setHeader
(
HttpHeaders
.
CONTENT_DISPOSITION
,
"attachment; filename*=UTF-8''"
+
encodedName
);
PrintWriter
writer
=
new
PrintWriter
(
new
OutputStreamWriter
(
response
.
getOutputStream
(),
StandardCharsets
.
UTF_8
));
// Excel识别UTF-8 CSV依赖BOM,否则中文可能按本地ANSI编码打开并出现乱码。
writer
.
write
(
'\ufeff'
);
writeCsvRow
(
writer
,
"序号"
,
"排课组ID"
,
"日期"
,
"星期"
,
"期间"
,
"课次"
,
"时段"
,
"课时"
,
"课程名称"
,
"课程类型"
,
"授课教师"
,
"上课地点"
,
"备注"
);
try
(
InputStream
template
=
CourseAdminServiceImpl
.
class
.
getResourceAsStream
(
COURSE_EXPORT_TEMPLATE
))
{
if
(
template
==
null
)
{
throw
new
BusinessException
(
"课程安排表导出模板不存在"
);
}
try
(
XWPFDocument
document
=
new
XWPFDocument
(
template
))
{
fillExportMetadata
(
document
,
detail
);
fillExportTable
(
document
,
detail
);
document
.
write
(
response
.
getOutputStream
());
// Servlet容器管理响应流;这里只刷新,不主动关闭。
response
.
getOutputStream
().
flush
();
}
}
}
/**
* 模板正文第二段固定承载班级和总课时。标题、图形及底部说明保持模板原样,
* 只重写该可变槽位,避免通用Word生成逻辑破坏原文件版式。
*/
private
void
fillExportMetadata
(
XWPFDocument
document
,
CourseAdminDetailVO
detail
)
{
if
(
document
.
getParagraphs
().
size
()
<
2
)
{
throw
new
BusinessException
(
"课程安排表导出模板缺少班级信息区域"
);
}
XWPFParagraph
paragraph
=
document
.
getParagraphs
().
get
(
1
);
clearParagraphRuns
(
paragraph
);
XWPFRun
run
=
paragraph
.
createRun
();
run
.
setBold
(
true
);
run
.
setFontFamily
(
"宋体"
);
run
.
setFontSize
(
12
);
run
.
setText
(
"班级:"
+
valueOf
(
detail
.
getClassName
())
+
" 总课时:"
+
decimalText
(
detail
.
getTotalHours
())
+
"课时"
);
}
/**
* 以参考文件的首条数据行为样式原型,逐组克隆课程行并替换内容。
* 同一排课组中的独立课程各占一行,共享字段按参考模板纵向合并。
*/
private
void
fillExportTable
(
XWPFDocument
document
,
CourseAdminDetailVO
detail
)
{
if
(
document
.
getTables
().
isEmpty
())
{
throw
new
BusinessException
(
"课程安排表导出模板缺少课程表格"
);
}
XWPFTable
table
=
document
.
getTables
().
get
(
0
);
if
(
table
.
getNumberOfRows
()
<
2
||
table
.
getRow
(
0
).
getTableCells
().
size
()
!=
7
)
{
throw
new
BusinessException
(
"课程安排表导出模板列结构不正确"
);
}
// 保存独立的XML文本快照;删除模板原数据行后,POI原CTRow对象会被断开,不能继续复制。
String
dataRowTemplateXml
=
table
.
getRow
(
1
).
getCtRow
().
xmlText
();
for
(
int
rowIndex
=
table
.
getNumberOfRows
()
-
1
;
rowIndex
>=
1
;
rowIndex
--)
{
table
.
removeRow
(
rowIndex
);
}
int
sequence
=
1
;
for
(
CourseAdminScheduleVO
course
:
detail
.
getCourses
())
{
writeCsvRow
(
writer
,
String
.
valueOf
(
sequence
++),
course
.
getScheduleGroupId
(),
formatDate
(
course
.
getDate
()),
course
.
getWeek
(),
course
.
getPeriod
(),
valueOf
(
course
.
getSubjectTimes
()),
String
.
join
(
" / "
,
course
.
getTimeFrames
()),
valueOf
(
course
.
getSubjectHour
()),
course
.
getSubjectName
(),
course
.
getType
(),
course
.
getTeacherName
(),
course
.
getLocation
(),
course
.
getRemark
());
}
// 不关闭Servlet容器管理的输出流,只刷新本次响应写入的数据。
writer
.
flush
();
List
<
CourseAdminScheduleGroupVO
>
schedules
=
detail
.
getSchedules
()
==
null
?
Collections
.
emptyList
()
:
detail
.
getSchedules
();
for
(
CourseAdminScheduleGroupVO
schedule
:
schedules
)
{
List
<
CourseAdminScheduleVO
>
items
=
schedule
.
getItems
()
==
null
?
Collections
.
emptyList
()
:
schedule
.
getItems
();
if
(
items
.
isEmpty
())
{
continue
;
}
String
date
=
exportDateText
(
schedule
.
getDate
(),
schedule
.
getWeek
());
String
subjectTimes
=
valueOf
(
schedule
.
getSubjectTimes
());
String
timeFrames
=
exportGroupTimeFrames
(
items
);
String
hours
=
decimalText
(
schedule
.
getTotalHours
());
String
sequenceText
=
String
.
valueOf
(
sequence
++);
for
(
int
itemIndex
=
0
;
itemIndex
<
items
.
size
();
itemIndex
++)
{
CourseAdminScheduleVO
course
=
items
.
get
(
itemIndex
);
XWPFTableRow
row
=
createTemplateRow
(
table
,
dataRowTemplateXml
);
boolean
first
=
itemIndex
==
0
;
writeTemplateCell
(
row
.
getCell
(
0
),
first
?
date
:
""
,
12
);
writeTemplateCell
(
row
.
getCell
(
1
),
first
?
subjectTimes
:
""
,
12
);
writeTemplateCell
(
row
.
getCell
(
2
),
first
?
timeFrames
:
""
,
9
);
writeTemplateCell
(
row
.
getCell
(
3
),
first
?
hours
:
""
,
12
);
writeTemplateCell
(
row
.
getCell
(
4
),
valueOf
(
course
.
getSubjectName
()),
12
);
writeTemplateCell
(
row
.
getCell
(
5
),
valueOf
(
course
.
getTeacherName
()),
12
);
writeTemplateCell
(
row
.
getCell
(
6
),
first
?
sequenceText
:
""
,
12
);
if
(
items
.
size
()
>
1
)
{
for
(
int
column
:
new
int
[]{
0
,
1
,
2
,
3
,
6
})
{
setVerticalMerge
(
row
.
getCell
(
column
),
first
);
}
}
// 必须在替换文本后再挂入表格;POI挂入时会复制底层XML,之后修改旧包装对象不会生效。
table
.
addRow
(
row
);
}
}
}
private
XWPFTableRow
createTemplateRow
(
XWPFTable
table
,
String
templateXml
)
{
try
{
CTRow
rowXml
=
CTRow
.
Factory
.
parse
(
templateXml
);
return
new
XWPFTableRow
(
rowXml
,
table
);
}
catch
(
XmlException
e
)
{
throw
new
BusinessException
(
"课程安排表导出模板数据行无法解析"
);
}
}
/** 清除段落旧文本但保留段落级间距、缩进和对齐设置。 */
private
void
clearParagraphRuns
(
XWPFParagraph
paragraph
)
{
for
(
int
index
=
paragraph
.
getRuns
().
size
()
-
1
;
index
>=
0
;
index
--)
{
paragraph
.
removeRun
(
index
);
}
}
/** 按模板的居中排版写入单元格,并将换行时段转换成Word软换行。 */
private
void
writeTemplateCell
(
XWPFTableCell
cell
,
String
text
,
int
fontSize
)
{
// 模板的日期等单元格可能用多个段落排版,必须一并清除,否则旧星期会残留在新值后面。
for
(
int
index
=
cell
.
getParagraphs
().
size
()
-
1
;
index
>=
1
;
index
--)
{
cell
.
removeParagraph
(
index
);
}
XWPFParagraph
paragraph
=
cell
.
getParagraphs
().
get
(
0
);
clearParagraphRuns
(
paragraph
);
paragraph
.
setAlignment
(
ParagraphAlignment
.
CENTER
);
XWPFRun
run
=
paragraph
.
createRun
();
run
.
setFontFamily
(
"宋体"
);
run
.
setFontSize
(
fontSize
);
String
[]
lines
=
valueOf
(
text
).
split
(
"\\n"
,
-
1
);
for
(
int
index
=
0
;
index
<
lines
.
length
;
index
++)
{
if
(
index
>
0
)
run
.
addBreak
();
run
.
setText
(
lines
[
index
]);
}
CTTcPr
properties
=
cell
.
getCTTc
().
isSetTcPr
()
?
cell
.
getCTTc
().
getTcPr
()
:
cell
.
getCTTc
().
addNewTcPr
();
CTVerticalJc
vertical
=
properties
.
isSetVAlign
()
?
properties
.
getVAlign
()
:
properties
.
addNewVAlign
();
vertical
.
setVal
(
STVerticalJc
.
CENTER
);
}
private
void
setVerticalMerge
(
XWPFTableCell
cell
,
boolean
first
)
{
CTTcPr
properties
=
cell
.
getCTTc
().
isSetTcPr
()
?
cell
.
getCTTc
().
getTcPr
()
:
cell
.
getCTTc
().
addNewTcPr
();
CTVMerge
merge
=
properties
.
isSetVMerge
()
?
properties
.
getVMerge
()
:
properties
.
addNewVMerge
();
merge
.
setVal
(
first
?
STMerge
.
RESTART
:
STMerge
.
CONTINUE
);
}
private
String
exportDateText
(
Date
date
,
String
week
)
{
if
(
date
==
null
)
return
""
;
LocalDate
localDate
=
toLocalDate
(
date
);
String
resolvedWeek
=
trimToNull
(
week
)
==
null
?
chineseWeekday
(
date
)
:
week
.
trim
();
return
localDate
.
getMonthValue
()
+
"/"
+
localDate
.
getDayOfMonth
()
+
resolvedWeek
;
}
private
String
exportGroupTimeFrames
(
List
<
CourseAdminScheduleVO
>
courses
)
{
return
courses
.
stream
()
.
flatMap
(
course
->
(
course
.
getTimeFrames
()
==
null
?
Collections
.<
String
>
emptyList
()
:
course
.
getTimeFrames
()).
stream
())
.
filter
(
frame
->
trimToNull
(
frame
)
!=
null
)
.
distinct
()
.
sorted
(
Comparator
.
comparing
(
this
::
timeFrameStart
))
.
map
(
frame
->
frame
.
replace
(
'-'
,
'~'
))
.
collect
(
Collectors
.
joining
(
"\n"
));
}
private
LocalTime
timeFrameStart
(
String
frame
)
{
int
separator
=
frame
.
indexOf
(
'-'
);
if
(
separator
<=
0
)
return
LocalTime
.
MAX
;
try
{
return
LocalTime
.
parse
(
frame
.
substring
(
0
,
separator
),
FLEXIBLE_TIME_FORMATTER
);
}
catch
(
DateTimeParseException
ignored
)
{
return
LocalTime
.
MAX
;
}
}
private
String
decimalText
(
BigDecimal
value
)
{
return
value
==
null
?
"0"
:
value
.
stripTrailingZeros
().
toPlainString
();
}
/**
...
...
@@ -1166,21 +1329,6 @@ public class CourseAdminServiceImpl implements CourseAdminService {
return
result
;
}
private
void
writeCsvRow
(
PrintWriter
writer
,
String
...
values
)
{
for
(
int
index
=
0
;
index
<
values
.
length
;
index
++)
{
if
(
index
>
0
)
writer
.
write
(
','
);
String
value
=
values
[
index
]
==
null
?
""
:
values
[
index
];
writer
.
write
(
'"'
);
writer
.
write
(
value
.
replace
(
"\""
,
"\"\""
));
writer
.
write
(
'"'
);
}
writer
.
write
(
"\r\n"
);
}
private
String
formatDate
(
Date
value
)
{
return
value
==
null
?
""
:
toLocalDate
(
value
).
toString
();
}
private
String
valueOf
(
Object
value
)
{
return
value
==
null
?
""
:
String
.
valueOf
(
value
);
}
...
...
practical-business/src/main/resources/templates/course-admin/course-schedule-template.docx
0 → 100644
View file @
091a5b1e
File added
practical-business/src/test/java/com/platform/business/service/impl/CourseAdminServiceImplTest.java
View file @
091a5b1e
...
...
@@ -24,8 +24,12 @@ import org.mockito.junit.jupiter.MockitoExtension;
import
org.apache.poi.xwpf.usermodel.XWPFDocument
;
import
org.apache.poi.xwpf.usermodel.XWPFTable
;
import
org.apache.poi.xwpf.usermodel.XWPFTableRow
;
import
org.springframework.mock.web.MockHttpServletResponse
;
import
java.io.ByteArrayInputStream
;
import
java.math.BigDecimal
;
import
java.nio.file.Files
;
import
java.nio.file.Paths
;
import
java.sql.Date
;
import
java.time.DayOfWeek
;
import
java.time.LocalDate
;
...
...
@@ -35,6 +39,7 @@ import java.util.Collections;
import
java.util.List
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertThrows
;
import
static
org
.
mockito
.
ArgumentMatchers
.
any
;
import
static
org
.
mockito
.
ArgumentMatchers
.
anyList
;
...
...
@@ -399,7 +404,8 @@ class CourseAdminServiceImplTest {
try
(
XWPFDocument
document
=
new
XWPFDocument
())
{
XWPFTable
table
=
document
.
createTable
(
5
,
7
);
setImportRow
(
table
.
getRow
(
0
),
"日期"
,
"课次"
,
"时段"
,
"课时"
,
"课程"
,
"授课教师"
,
"序号"
);
// 使用真实Word模板的带空格表头,防止测试误用连续“课程”掩盖兼容问题。
setImportRow
(
table
.
getRow
(
0
),
"日期"
,
"课次"
,
"时段"
,
"课时"
,
"课 程"
,
"授课教师"
,
"序号"
);
setImportRow
(
table
.
getRow
(
1
),
"6/03 周三"
,
"4"
,
"09:00~10:20\n10:40~12:00\n13:00~14:20\n14:40~16:00"
,
"8"
,
"污泥干化焚烧运行案例(理论)"
,
"张老师"
,
"16"
);
...
...
@@ -430,6 +436,56 @@ class CourseAdminServiceImplTest {
}
}
@Test
void
exportShouldReuseReferenceWordTemplateAndMergeScheduleGroup
()
throws
Exception
{
CourseAdminDetailVO
classDetail
=
new
CourseAdminDetailVO
();
classDetail
.
setClassId
(
1
);
classDetail
.
setClassName
(
"污泥处理工(四级)2026年1班"
);
when
(
classSubjectMapper
.
selectAdminCourseClass
(
1
)).
thenReturn
(
classDetail
);
CourseAdminScheduleVO
morning
=
exportCourse
(
11
,
"group-1"
,
"09:00-10:20,10:40-12:00"
,
"污泥脱水工艺(实操)"
,
"张三"
);
CourseAdminScheduleVO
afternoon
=
exportCourse
(
12
,
"group-1"
,
"13:00-14:20,14:40-16:00"
,
"污泥处理设备操作(实操)"
,
"李四"
);
when
(
classSubjectMapper
.
selectAdminCourseList
(
1
,
null
,
null
))
.
thenReturn
(
Arrays
.
asList
(
morning
,
afternoon
));
MockHttpServletResponse
response
=
new
MockHttpServletResponse
();
service
.
export
(
1
,
null
,
null
,
response
);
assertEquals
(
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
,
response
.
getContentType
());
assertTrue
(
response
.
getHeader
(
"Content-Disposition"
).
contains
(
".docx"
));
byte
[]
bytes
=
response
.
getContentAsByteArray
();
try
(
XWPFDocument
exported
=
new
XWPFDocument
(
new
ByteArrayInputStream
(
bytes
)))
{
assertTrue
(
exported
.
getParagraphs
().
get
(
0
).
getText
().
contains
(
"课程安排表"
));
assertTrue
(
exported
.
getParagraphs
().
get
(
1
).
getText
()
.
contains
(
"班级:污泥处理工(四级)2026年1班"
));
assertTrue
(
exported
.
getParagraphs
().
get
(
1
).
getText
().
contains
(
"总课时:8课时"
));
XWPFTable
table
=
exported
.
getTables
().
get
(
0
);
assertEquals
(
"课 程"
,
table
.
getRow
(
0
).
getCell
(
4
).
getText
());
assertEquals
(
3
,
table
.
getNumberOfRows
());
assertEquals
(
"4/22周三"
,
table
.
getRow
(
1
).
getCell
(
0
).
getText
());
assertTrue
(
table
.
getRow
(
1
).
getCell
(
2
).
getText
().
contains
(
"09:00~10:20"
));
assertEquals
(
"污泥脱水工艺(实操)"
,
table
.
getRow
(
1
).
getCell
(
4
).
getText
());
assertEquals
(
"污泥处理设备操作(实操)"
,
table
.
getRow
(
2
).
getCell
(
4
).
getText
());
assertEquals
(
"restart"
,
table
.
getRow
(
1
).
getCell
(
0
).
getCTTc
()
.
getTcPr
().
getVMerge
().
getVal
().
toString
());
assertEquals
(
"continue"
,
table
.
getRow
(
2
).
getCell
(
0
).
getCTTc
()
.
getTcPr
().
getVMerge
().
getVal
().
toString
());
}
// 本地视觉核验时显式传入路径;常规CI不产生额外文件。
String
samplePath
=
System
.
getProperty
(
"course.export.sample.path"
);
if
(
samplePath
!=
null
&&
!
samplePath
.
trim
().
isEmpty
())
{
Files
.
write
(
Paths
.
get
(
samplePath
),
bytes
);
}
}
/** 按模板列顺序写入测试表格,确保解析测试与真实Word导入格式一致。 */
private
void
setImportRow
(
XWPFTableRow
row
,
String
...
values
)
{
for
(
int
i
=
0
;
i
<
values
.
length
;
i
++)
{
...
...
@@ -468,6 +524,25 @@ class CourseAdminServiceImplTest {
return
request
;
}
private
CourseAdminScheduleVO
exportCourse
(
Integer
id
,
String
groupId
,
String
timeFrame
,
String
subjectName
,
String
teacherName
)
{
CourseAdminScheduleVO
course
=
new
CourseAdminScheduleVO
();
course
.
setId
(
id
);
course
.
setClassId
(
1
);
course
.
setScheduleGroupId
(
groupId
);
course
.
setDate
(
Date
.
valueOf
(
LocalDate
.
of
(
2026
,
4
,
22
)));
course
.
setWeek
(
"周三"
);
course
.
setSubjectTimes
(
2
);
course
.
setTimeFrame
(
timeFrame
);
course
.
setSubjectHour
(
new
BigDecimal
(
"4.0"
));
course
.
setSubjectName
(
subjectName
);
course
.
setTeacherId
(
"teacher-"
+
id
);
course
.
setTeacherName
(
teacherName
);
course
.
setType
(
"实训"
);
return
course
;
}
private
ClassSubjectEntity
existingCourse
(
Integer
id
,
String
groupId
,
String
timeFrame
)
{
ClassSubjectEntity
entity
=
new
ClassSubjectEntity
();
entity
.
setId
(
id
);
...
...
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