Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zhengyuan-danger-chemistry-manage
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
耿迪迪
zhengyuan-danger-chemistry-manage
Commits
830bd15e
Commit
830bd15e
authored
Dec 25, 2022
by
吴卿华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导入修改
parent
aa08a383
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
29 deletions
+23
-29
TBankSubjectController.java
.../zehong/web/controller/system/TBankSubjectController.java
+17
-24
QuestionList.vue
...ducationPlanExam/questionBank/components/QuestionList.vue
+6
-5
No files found.
danger-manage-admin/src/main/java/com/zehong/web/controller/system/TBankSubjectController.java
View file @
830bd15e
package
com
.
zehong
.
web
.
controller
.
system
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zehong.common.exception.CustomException
;
import
com.zehong.common.utils.StringUtils
;
import
com.zehong.system.domain.Answer
;
import
com.zehong.system.domain.TBankSubject
;
import
com.zehong.system.domain.TDeviceInfo
;
import
com.zehong.system.service.ITBankSubjectService
;
import
org.apache.poi.ss.usermodel.Row
;
import
org.apache.poi.ss.usermodel.Sheet
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.apache.poi.xssf.streaming.SXSSFWorkbook
;
import
org.apache.poi.xssf.usermodel.XSSFRow
;
import
org.apache.poi.xssf.usermodel.XSSFSheet
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
...
...
@@ -39,8 +30,6 @@ import com.zehong.common.utils.poi.ExcelUtil;
import
com.zehong.common.core.page.TableDataInfo
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.xml.crypto.Data
;
/**
* 题目Controller
*
...
...
@@ -149,7 +138,7 @@ public class TBankSubjectController extends BaseController
int
lastRowNum
=
sheet
.
getLastRowNum
();
// 通过循环,逐行取出表中每行数据
for
(
int
i
=
0
;
i
<=
lastRowNum
;
i
++){
//跳过第一行和第二行
if
(
i
<=
2
){
if
(
i
<=
1
){
continue
;
}
// 获取行
...
...
@@ -167,26 +156,28 @@ public class TBankSubjectController extends BaseController
/**选项*/
for
(
int
s
=
1
;
s
<=
8
;
s
++){
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"value"
,
row
.
getCell
(
s
).
toString
());
jsonArray
.
add
(
jsonObject
);
if
(!
StringUtils
.
isEmpty
(
row
.
getCell
(
s
).
toString
()))
{
jsonObject
.
put
(
"value"
,
row
.
getCell
(
s
).
toString
());
jsonArray
.
add
(
jsonObject
);
}
}
/**答案*/
if
(
"A"
.
equals
(
row
.
getCell
(
9
).
toString
())){
excelEntity
.
setAnswer
(
0
);
}
else
if
(
"B"
.
equals
(
row
.
getCell
(
9
).
toString
())){
excelEntity
.
setAnswer
(
1
);
}
else
if
(
"b"
.
equals
(
row
.
getCell
(
9
).
toString
())){
excelEntity
.
setAnswer
(
2
);
}
else
if
(
"C"
.
equals
(
row
.
getCell
(
9
).
toString
())){
excelEntity
.
setAnswer
(
3
);
excelEntity
.
setAnswer
(
2
);
}
else
if
(
"D"
.
equals
(
row
.
getCell
(
9
).
toString
())){
excelEntity
.
setAnswer
(
4
);
excelEntity
.
setAnswer
(
3
);
}
else
if
(
"E"
.
equals
(
row
.
getCell
(
9
).
toString
())){
excelEntity
.
setAnswer
(
5
);
excelEntity
.
setAnswer
(
4
);
}
else
if
(
"F"
.
equals
(
row
.
getCell
(
9
).
toString
())){
excelEntity
.
setAnswer
(
6
);
excelEntity
.
setAnswer
(
5
);
}
else
if
(
"G"
.
equals
(
row
.
getCell
(
9
).
toString
())){
excelEntity
.
setAnswer
(
7
);
excelEntity
.
setAnswer
(
6
);
}
else
if
(
"H"
.
equals
(
row
.
getCell
(
9
).
toString
())){
excelEntity
.
setAnswer
(
8
);
excelEntity
.
setAnswer
(
7
);
}
excelEntity
.
setTopicOption
(
String
.
valueOf
(
jsonArray
));
excelEntity
.
setDatetime
(
new
Date
());
...
...
@@ -213,8 +204,10 @@ public class TBankSubjectController extends BaseController
{
successMsg
.
insert
(
0
,
"数据已全部导入成功!共 "
+
successNum
+
" 条"
);
}
/**数据添加方法*/
tBankSubjectService
.
insertBank
(
list
);
if
(
list
.
size
()!=
0
){
/**数据添加方法*/
tBankSubjectService
.
insertBank
(
list
);
}
// String message = tBankSubjectService.importDevice(file, updateSupport);
return
AjaxResult
.
success
(
successMsg
.
toString
());
}
...
...
danger-manage-web/src/views/educationPlanExam/questionBank/components/QuestionList.vue
View file @
830bd15e
...
...
@@ -174,6 +174,9 @@ export default {
// 上传的地址
url
:
process
.
env
.
VUE_APP_BASE_API
+
"/system/subject/import"
},
queryParams
:
{
bankId
:
0
},
};
},
// watch: {
...
...
@@ -198,9 +201,9 @@ export default {
// 文件下载处理
handleDownload
(
row
)
{
const
a
=
document
.
createElement
(
'a'
)
a
.
setAttribute
(
'download'
,
'
考试宝
'
)
a
.
setAttribute
(
'download'
,
'
试题导入模板
'
)
a
.
setAttribute
(
'target'
,
'_blank'
)
a
.
setAttribute
(
'href'
,
'http://36.138.181.113:8091/dangerManage/profile/upload/2022/kaoshi/
kaoshibao
.xlsx'
)
a
.
setAttribute
(
'href'
,
'http://36.138.181.113:8091/dangerManage/profile/upload/2022/kaoshi/
shitimoban
.xlsx'
)
a
.
click
()
},
...
...
@@ -219,7 +222,7 @@ export default {
this
.
upload
.
isUploading
=
false
;
this
.
$refs
.
upload
.
clearFiles
();
this
.
$alert
(
response
.
msg
,
"导入结果"
,
{
dangerouslyUseHTMLString
:
true
});
this
.
get
List
(
);
this
.
get
Question
({
bankId
:
this
.
bankId
}
);
},
/** 下载模板操作 */
importTemplate
()
{
...
...
@@ -243,9 +246,7 @@ export default {
this
.
$parent
.
$parent
.
componentsNumChange
(
3
);
},
getQuestion
(
bankId
)
{
console
.
log
(
bankId
);
return
listSubject
(
bankId
).
then
((
res
)
=>
{
console
.
log
(
"题库res"
,
res
);
this
.
questionList
=
res
.
rows
.
map
((
item
)
=>
{
return
{
...
...
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