Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cloud-web
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hqzhdj
cloud-web
Commits
3afc38e7
Commit
3afc38e7
authored
Mar 07, 2025
by
阳浪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
试题导出
parent
93193d6a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
4 deletions
+20
-4
cloud-web-manage/src/main/java/com/yizhi/application/exam/controller/ExamExportController.java
+19
-3
cloud-web-manage/src/main/java/com/yizhi/application/exam/controller/LibrarySubjectExport.java
+1
-1
No files found.
cloud-web-manage/src/main/java/com/yizhi/application/exam/controller/ExamExportController.java
View file @
3afc38e7
...
...
@@ -3,13 +3,17 @@ package com.yizhi.application.exam.controller;
import
com.yizhi.core.application.context.ContextHolder
;
import
com.yizhi.core.application.context.RequestContext
;
import
com.yizhi.exam.application.feign.QuestionLibraryClient
;
import
com.yizhi.exam.application.vo.QuestionLibraryVO
;
import
com.yizhi.util.application.domain.Response
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.*
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -23,6 +27,12 @@ public class ExamExportController {
private
LibrarySubjectExport
li
;
@Autowired
private
LibrarySubjectXmlExport
lxml
;
@Autowired
QuestionLibraryClient
questionLibraryClient
;
@Value
(
"${pc.host.url}"
)
String
pcHostUrl
;
private
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
);
@ApiOperation
(
"题库试题导出"
)
@GetMapping
(
"/question/subject/export"
)
...
...
@@ -52,7 +62,10 @@ public class ExamExportController {
map
.
put
(
"pageSize"
,
pageSize
);
}
li
.
execute
(
map
,
true
);
return
Response
.
ok
(
"任务编号:"
+
taskId
+
",请前往系统管理的任务管理进行查看!"
);
String
libraryName
=
questionLibraryClient
.
selectQuestionLibraryById
(
libraryId
).
getName
();
StringBuffer
fileName
=
new
StringBuffer
().
append
(
libraryName
).
append
(
"--"
).
append
(
taskId
).
append
(
".xls"
);
String
fileUril
=
pcHostUrl
+
"/api/v1/buckets/upload/objects/download/?preview=true&prefix="
+
fileName
.
toString
();
return
Response
.
ok
(
fileUril
);
}
@ApiOperation
(
"题库试题导出_xml"
)
...
...
@@ -89,8 +102,11 @@ public class ExamExportController {
map
.
put
(
"pageNo"
,
pageNo
);
map
.
put
(
"pageSize"
,
pageSize
);
lxml
.
execute
(
map
,
true
);
return
Response
.
ok
(
"任务编号:"
+
serialNo
+
"。任务名称:"
+
taskName
+
"请到任务管理中查看!"
);
QuestionLibraryVO
questionLibraryVO
=
questionLibraryClient
.
selectQuestionLibraryById
(
libraryId
);
String
sheetName
=
questionLibraryVO
.
getName
();
String
fileName
=
sheetName
+
"_"
+
simpleDateFormat
.
format
(
submitTime
)
+
".xml"
;
String
fileUril
=
pcHostUrl
+
"/api/v1/buckets/upload/objects/download/?preview=true&prefix="
+
fileName
;
return
Response
.
ok
(
fileUril
);
}
}
cloud-web-manage/src/main/java/com/yizhi/application/exam/controller/LibrarySubjectExport.java
View file @
3afc38e7
...
...
@@ -83,7 +83,7 @@ public class LibrarySubjectExport extends AbstractDefaultTask<String, Map<String
//给excel表取个名称
if
(!
StringUtils
.
isBlank
(
sheetName
))
{
fileName
=
new
StringBuffer
().
append
(
sheetName
).
append
(
"--"
).
append
(
System
.
currentTimeMillis
()
).
append
(
".xls"
);
fileName
=
new
StringBuffer
().
append
(
sheetName
).
append
(
"--"
).
append
(
taskId
).
append
(
".xls"
);
sheet
=
workBook
.
createSheet
(
fileName
.
toString
());
}
//设置标题行 题型 题干 标签 题目解析 正确答案 因为选项个数不固定 所以在下面代码中动态生成
...
...
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