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
c96176e0
Commit
c96176e0
authored
Jan 29, 2023
by
吴卿华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
手机端题目增加多选功能 手机端题目增加题库功能
parent
86c4568f
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
372 additions
and
155 deletions
+372
-155
TContractorTrainCourseTopicController.java
.../contractTrain/TContractorTrainCourseTopicController.java
+12
-0
TContractorTrainResultController.java
...b/controller/system/TContractorTrainResultController.java
+5
-0
TTrainCourseBankController.java
...ong/web/controller/system/TTrainCourseBankController.java
+0
-1
TContractorTrainCourse.java
...java/com/zehong/system/domain/TContractorTrainCourse.java
+70
-32
TContractorTrainCourseTopic.java
...com/zehong/system/domain/TContractorTrainCourseTopic.java
+42
-28
TContractorTrainResult.java
...java/com/zehong/system/domain/TContractorTrainResult.java
+12
-0
TContractorTrainResultDetail.java
...om/zehong/system/domain/TContractorTrainResultDetail.java
+29
-26
TContractorTrainCourseTopicMapper.java
...hong/system/mapper/TContractorTrainCourseTopicMapper.java
+32
-8
ITContractorTrainCourseTopicService.java
...g/system/service/ITContractorTrainCourseTopicService.java
+16
-8
TContractorTrainCourseTopicServiceImpl.java
.../service/impl/TContractorTrainCourseTopicServiceImpl.java
+58
-10
TContractorTrainResultServiceImpl.java
...ystem/service/impl/TContractorTrainResultServiceImpl.java
+40
-17
TTrainCourseServiceImpl.java
...m/zehong/system/service/impl/TTrainCourseServiceImpl.java
+2
-9
TContractorTrainCourseMapper.xml
.../resources/mapper/system/TContractorTrainCourseMapper.xml
+13
-1
TContractorTrainCourseTopicMapper.xml
...urces/mapper/system/TContractorTrainCourseTopicMapper.xml
+35
-7
TContractorTrainResultDetailMapper.xml
...rces/mapper/system/TContractorTrainResultDetailMapper.xml
+6
-8
No files found.
danger-manage-admin/src/main/java/com/zehong/web/controller/contractTrain/TContractorTrainCourseTopicController.java
View file @
c96176e0
package
com
.
zehong
.
web
.
controller
.
contractTrain
;
import
java.util.List
;
import
com.zehong.system.domain.vo.BatchTopicVo
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -79,6 +81,16 @@ public class TContractorTrainCourseTopicController extends BaseController
return
toAjax
(
tContractorTrainCourseTopicService
.
insertTContractorTrainCourseTopic
(
tContractorTrainCourseTopic
));
}
/**
* 题库批量导入试题
* @param batchTopicVo 试题实体
* @return AjaxResult
*/
@PostMapping
(
"/bachAddTopic"
)
public
AjaxResult
bachAddTopic
(
@RequestBody
BatchTopicVo
batchTopicVo
){
return
toAjax
(
tContractorTrainCourseTopicService
.
bachAddTopic
(
batchTopicVo
));
}
/**
* 修改承包商及访客培训题库
*/
...
...
danger-manage-admin/src/main/java/com/zehong/web/controller/system/TContractorTrainResultController.java
View file @
c96176e0
...
...
@@ -4,6 +4,7 @@ import java.util.Date;
import
java.util.List
;
import
java.util.Map
;
import
com.alibaba.fastjson.JSON
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -81,6 +82,10 @@ public class TContractorTrainResultController extends BaseController
@GetMapping
(
"/examination"
)
public
AjaxResult
examination
(
TContractorTrainResult
tContractorTrainResult
){
String
n
=
"["
+
tContractorTrainResult
.
getAnswers
()+
']'
;
//字符串转换成二维数组
Integer
[][]
integers
=
JSON
.
parseObject
(
n
,
Integer
[][].
class
);
tContractorTrainResult
.
setIntegers
(
integers
);
//结束时间
tContractorTrainResult
.
setTestEndTime
(
new
Date
());
Map
<
String
,
Object
>
examination
=
tContractorTrainResultService
.
examination
(
tContractorTrainResult
);
...
...
danger-manage-admin/src/main/java/com/zehong/web/controller/system/TTrainCourseBankController.java
View file @
c96176e0
...
...
@@ -41,7 +41,6 @@ public class TTrainCourseBankController extends BaseController
public
TableDataInfo
list
(
TTrainCourseBank
tTrainCourseBank
)
{
startPage
();
System
.
out
.
println
(
tTrainCourseBank
);
List
<
TTrainCourseBank
>
list
=
tTrainCourseBankService
.
selectTTrainCourseBankList
(
tTrainCourseBank
);
return
getDataTable
(
list
);
}
...
...
danger-manage-system/src/main/java/com/zehong/system/domain/TContractorTrainCourse.java
View file @
c96176e0
...
...
@@ -50,6 +50,43 @@ public class TContractorTrainCourse extends BaseEntity
@Excel
(
name
=
"是否删除(0正常,1删除)"
)
private
String
isDel
;
/** 多选题分数*/
private
Integer
multipleChoiceScore
;
/**单选题分数*/
private
Integer
singleChoiceScore
;
/**判断题分数*/
private
Integer
judgmentScore
;
public
static
long
getSerialVersionUID
()
{
return
serialVersionUID
;
}
public
Integer
getMultipleChoiceScore
()
{
return
multipleChoiceScore
;
}
public
void
setMultipleChoiceScore
(
Integer
multipleChoiceScore
)
{
this
.
multipleChoiceScore
=
multipleChoiceScore
;
}
public
Integer
getSingleChoiceScore
()
{
return
singleChoiceScore
;
}
public
void
setSingleChoiceScore
(
Integer
singleChoiceScore
)
{
this
.
singleChoiceScore
=
singleChoiceScore
;
}
public
Integer
getJudgmentScore
()
{
return
judgmentScore
;
}
public
void
setJudgmentScore
(
Integer
judgmentScore
)
{
this
.
judgmentScore
=
judgmentScore
;
}
public
void
setContractorCourseId
(
Long
contractorCourseId
)
{
this
.
contractorCourseId
=
contractorCourseId
;
...
...
@@ -134,18 +171,19 @@ public class TContractorTrainCourse extends BaseEntity
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"contractorCourseId"
,
getContractorCourseId
())
.
append
(
"courseName"
,
getCourseName
())
.
append
(
"courseConent"
,
getCourseConent
())
.
append
(
"enclosure"
,
getEnclosure
())
.
append
(
"video"
,
getVideo
())
.
append
(
"qualifiedNum"
,
getQualifiedNum
())
.
append
(
"topicNum"
,
getTopicNum
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"createUser"
,
getCreateUser
())
.
append
(
"isDel"
,
getIsDel
())
.
append
(
"remark"
,
getRemark
())
.
toString
();
return
"TContractorTrainCourse{"
+
"contractorCourseId="
+
contractorCourseId
+
", courseName='"
+
courseName
+
'\''
+
", courseConent='"
+
courseConent
+
'\''
+
", enclosure='"
+
enclosure
+
'\''
+
", video='"
+
video
+
'\''
+
", qualifiedNum="
+
qualifiedNum
+
", topicNum="
+
topicNum
+
", createUser='"
+
createUser
+
'\''
+
", isDel='"
+
isDel
+
'\''
+
", multipleChoiceScore="
+
multipleChoiceScore
+
", singleChoiceScore="
+
singleChoiceScore
+
", judgmentScore="
+
judgmentScore
+
'}'
;
}
}
danger-manage-system/src/main/java/com/zehong/system/domain/TContractorTrainCourseTopic.java
View file @
c96176e0
...
...
@@ -32,12 +32,31 @@ public class TContractorTrainCourseTopic extends BaseEntity
/** 答案 */
@Excel
(
name
=
"答案"
)
private
Integer
answer
;
private
String
answer
;
/** 是否删除(0正常,1删除) */
@Excel
(
name
=
"是否删除(0正常,1删除)"
)
private
String
isDel
;
/**题目类型*/
private
Integer
topicType
;
public
static
long
getSerialVersionUID
()
{
return
serialVersionUID
;
}
public
void
setAnswer
(
String
answer
)
{
this
.
answer
=
answer
;
}
public
Integer
getTopicType
()
{
return
topicType
;
}
public
void
setTopicType
(
Integer
topicType
)
{
this
.
topicType
=
topicType
;
}
public
void
setTopicId
(
Long
topicId
)
{
this
.
topicId
=
topicId
;
...
...
@@ -74,15 +93,11 @@ public class TContractorTrainCourseTopic extends BaseEntity
{
return
topicOption
;
}
public
void
setAnswer
(
Integer
answer
)
{
this
.
answer
=
answer
;
}
public
Integer
getAnswer
()
{
public
String
getAnswer
()
{
return
answer
;
}
public
void
setIsDel
(
String
isDel
)
{
this
.
isDel
=
isDel
;
...
...
@@ -95,15 +110,14 @@ public class TContractorTrainCourseTopic extends BaseEntity
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"topicId"
,
getTopicId
())
.
append
(
"contractorCourseId"
,
getContractorCourseId
())
.
append
(
"topicTitle"
,
getTopicTitle
())
.
append
(
"topicOption"
,
getTopicOption
())
.
append
(
"answer"
,
getAnswer
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"isDel"
,
getIsDel
())
.
append
(
"remark"
,
getRemark
())
.
toString
();
return
"TContractorTrainCourseTopic{"
+
"topicId="
+
topicId
+
", contractorCourseId="
+
contractorCourseId
+
", topicTitle='"
+
topicTitle
+
'\''
+
", topicOption='"
+
topicOption
+
'\''
+
", answer='"
+
answer
+
'\''
+
", isDel='"
+
isDel
+
'\''
+
", topicType="
+
topicType
+
'}'
;
}
}
danger-manage-system/src/main/java/com/zehong/system/domain/TContractorTrainResult.java
View file @
c96176e0
...
...
@@ -55,8 +55,20 @@ public class TContractorTrainResult extends BaseEntity
/** 是否删除(0正常,1删除) */
private
String
isDel
;
/** 答案*/
private
String
answers
;
/** 转换成二维数组答案*/
private
Integer
[][]
integers
;
public
Integer
[][]
getIntegers
()
{
return
integers
;
}
public
void
setIntegers
(
Integer
[][]
integers
)
{
this
.
integers
=
integers
;
}
public
static
long
getSerialVersionUID
()
{
return
serialVersionUID
;
}
...
...
danger-manage-system/src/main/java/com/zehong/system/domain/TContractorTrainResultDetail.java
View file @
c96176e0
...
...
@@ -32,11 +32,11 @@ public class TContractorTrainResultDetail extends BaseEntity
/** 答案 */
@Excel
(
name
=
"答案"
)
private
Integer
answer
;
private
String
answer
;
/** 所选答案 */
@Excel
(
name
=
"所选答案"
)
private
Integer
answerChoice
;
private
String
answerChoice
;
/** 答题结果:0 对,1 错 */
@Excel
(
name
=
"答题结果:0 对,1 错"
)
...
...
@@ -82,24 +82,27 @@ public class TContractorTrainResultDetail extends BaseEntity
{
return
topicOption
;
}
public
void
setAnswer
(
Integer
answer
)
{
this
.
answer
=
answer
;
}
public
Integer
getAnswer
()
{
public
String
getAnswer
()
{
return
answer
;
}
public
void
setAnswerChoice
(
Integer
answerChoice
)
{
this
.
answer
Choice
=
answerChoice
;
public
void
setAnswer
(
String
answer
)
{
this
.
answer
=
answer
;
}
public
Integer
getAnswerChoice
()
{
public
static
long
getSerialVersionUID
()
{
return
serialVersionUID
;
}
public
String
getAnswerChoice
()
{
return
answerChoice
;
}
public
void
setAnswerChoice
(
String
answerChoice
)
{
this
.
answerChoice
=
answerChoice
;
}
public
void
setResult
(
String
result
)
{
this
.
result
=
result
;
...
...
danger-manage-system/src/main/java/com/zehong/system/mapper/TContractorTrainCourseTopicMapper.java
View file @
c96176e0
package
com
.
zehong
.
system
.
mapper
;
import
java.util.List
;
import
com.zehong.system.domain.TContractorTrainCourse
;
import
com.zehong.system.domain.TContractorTrainCourseTopic
;
import
com.zehong.system.domain.TTrainCourse
;
import
com.zehong.system.domain.TTrainCourseTopic
;
/**
* 承包商及访客培训题库Mapper接口
...
...
@@ -58,4 +62,24 @@ public interface TContractorTrainCourseTopicMapper
* @return 结果
*/
public
int
deleteTContractorTrainCourseTopicByIds
(
Long
[]
topicIds
);
/**
* 批量新增试题
* @param topics
*/
void
batchInsertTTrainCourseTopic
(
List
<
TContractorTrainCourseTopic
>
topics
);
/**
* 更新试题数量
* @param courseId
* @return
*/
TContractorTrainCourse
selectTTrainCourseById
(
Long
courseId
);
/**
* 更新试题数量
* @param course
* @return
*/
int
updateTTrainCourse
(
TContractorTrainCourse
course
);
}
danger-manage-system/src/main/java/com/zehong/system/service/ITContractorTrainCourseTopicService.java
View file @
c96176e0
...
...
@@ -2,6 +2,7 @@ package com.zehong.system.service;
import
java.util.List
;
import
com.zehong.system.domain.TContractorTrainCourseTopic
;
import
com.zehong.system.domain.vo.BatchTopicVo
;
/**
* 承包商及访客培训题库Service接口
...
...
@@ -58,4 +59,11 @@ public interface ITContractorTrainCourseTopicService
* @return 结果
*/
public
int
deleteTContractorTrainCourseTopicById
(
Long
topicId
);
/**
* 题库批量导入试题
* @param batchTopicVo
* @return
*/
int
bachAddTopic
(
BatchTopicVo
batchTopicVo
);
}
danger-manage-system/src/main/java/com/zehong/system/service/impl/TContractorTrainCourseTopicServiceImpl.java
View file @
c96176e0
package
com
.
zehong
.
system
.
service
.
impl
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.zehong.common.utils.DateUtils
;
import
com.zehong.system.domain.TContractorTrainCourse
;
import
com.zehong.system.domain.TContractorTrainCourseTopic
;
import
com.zehong.common.utils.StringUtils
;
import
com.zehong.system.domain.*
;
import
com.zehong.system.domain.vo.BatchTopicVo
;
import
com.zehong.system.mapper.TBankSubjectMapper
;
import
com.zehong.system.mapper.TContractorTrainCourseMapper
;
import
com.zehong.system.mapper.TContractorTrainCourseTopicMapper
;
import
com.zehong.system.service.ITContractorTrainCourseTopicService
;
...
...
@@ -11,6 +14,9 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
/**
...
...
@@ -26,6 +32,8 @@ public class TContractorTrainCourseTopicServiceImpl implements ITContractorTrain
private
TContractorTrainCourseTopicMapper
tContractorTrainCourseTopicMapper
;
@Resource
private
TContractorTrainCourseMapper
tContractorTrainCourseMapper
;
@Resource
private
TBankSubjectMapper
tBankSubjectMapper
;
/**
* 查询承包商及访客培训题库
...
...
@@ -115,4 +123,44 @@ public class TContractorTrainCourseTopicServiceImpl implements ITContractorTrain
{
return
tContractorTrainCourseTopicMapper
.
deleteTContractorTrainCourseTopicById
(
topicId
);
}
/**
* 题库批量导入试题
* @param batchTopicVo
* @return
*/
@Override
public
int
bachAddTopic
(
BatchTopicVo
batchTopicVo
)
{
if
(
CollectionUtil
.
isEmpty
(
batchTopicVo
.
getTopicInfos
())
||
StringUtils
.
isEmpty
(
String
.
valueOf
(
batchTopicVo
.
getCourseId
()))){
return
0
;
}
List
<
TContractorTrainCourseTopic
>
topics
=
new
ArrayList
<>();
int
count
=
0
;
for
(
BatchTopicVo
.
TopicInfos
topic
:
batchTopicVo
.
getTopicInfos
()){
//获取题库试题
TBankSubject
tBankSubject
=
new
TBankSubject
();
tBankSubject
.
setBankId
(
topic
.
getBankId
());
List
<
TBankSubject
>
bankSubjects
=
tBankSubjectMapper
.
selectTBankSubjectList
(
tBankSubject
);
//获取随机试题
Collections
.
shuffle
(
bankSubjects
);
for
(
int
i
=
0
;
i
<
topic
.
getQuan
();
i
++){
TContractorTrainCourseTopic
courseTopic
=
new
TContractorTrainCourseTopic
();
courseTopic
.
setContractorCourseId
(
batchTopicVo
.
getCourseId
());
courseTopic
.
setTopicTitle
(
bankSubjects
.
get
(
i
).
getTopicTitle
());
courseTopic
.
setTopicOption
(
bankSubjects
.
get
(
i
).
getTopicOption
());
courseTopic
.
setAnswer
(
String
.
valueOf
(
bankSubjects
.
get
(
i
).
getAnswer
()));
courseTopic
.
setCreateTime
(
new
Date
());
courseTopic
.
setTopicType
(
bankSubjects
.
get
(
i
).
getTopicType
());
topics
.
add
(
courseTopic
);
}
count
+=
topic
.
getQuan
();
}
//批量新增试题
tContractorTrainCourseTopicMapper
.
batchInsertTTrainCourseTopic
(
topics
);
//更新试题数量
TContractorTrainCourse
course
=
tContractorTrainCourseTopicMapper
.
selectTTrainCourseById
(
batchTopicVo
.
getCourseId
());
course
.
setTopicNum
(
course
.
getTopicNum
()
+
count
);
tContractorTrainCourseTopicMapper
.
updateTTrainCourse
(
course
);
return
1
;
}
}
danger-manage-system/src/main/java/com/zehong/system/service/impl/TContractorTrainResultServiceImpl.java
View file @
c96176e0
...
...
@@ -5,6 +5,7 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
com.alibaba.fastjson.JSON
;
import
com.zehong.common.utils.DateUtils
;
import
com.zehong.system.domain.*
;
import
com.zehong.system.mapper.*
;
...
...
@@ -112,21 +113,43 @@ public class TContractorTrainResultServiceImpl implements ITContractorTrainResul
@Override
public
Map
<
String
,
Object
>
examination
(
TContractorTrainResult
tContractorTrainResult
)
{
TContractorTrainCourseTopic
tContractorTrainCourseTopic
=
new
TContractorTrainCourseTopic
();
String
answers
=
tContractorTrainResult
.
getAnswers
();
//交卷答题
String
[]
split
=
answers
.
split
(
","
);
TContractorTrainCourse
tContractorTrainCourse
=
new
TContractorTrainCourse
();
//查询考试题和答案
List
<
TContractorTrainCourseTopic
>
tContractorTrainCourseTopics
=
tContractorTrainCourseTopicMapper
.
selectTContractorTrainCourseTopicList
(
tContractorTrainCourseTopic
);
//正确答案数量
//查询需要正确几道题算通过
TContractorTrainCourse
itContractorTrainCourse
=
tContractorTrainCourseMapper
.
getITContractorTrainCourse
(
tContractorTrainCourse
);
//已获得分数
int
num
=
0
;
for
(
Integer
i
=
0
;
i
<
split
.
length
;
i
++){
if
(
Integer
.
parseInt
(
split
[
i
])==
tContractorTrainCourseTopics
.
get
(
i
).
getAnswer
()){
num
++;
/**
* 大循环 共有多少答案 此循环最后只算出 得了多少分
*/
for
(
int
i
=
0
;
i
<
tContractorTrainResult
.
getIntegers
().
length
;
i
++){
/*题目答案*/
String
answer
=
tContractorTrainCourseTopics
.
get
(
i
).
getAnswer
();
//答案转换成数组
Integer
[]
integers
=
JSON
.
parseObject
(
answer
,
Integer
[].
class
);
/**判断所选答案是否与正确答案长度相等*/
if
(
integers
.
length
==
tContractorTrainResult
.
getIntegers
()[
i
].
length
){
boolean
adopt
=
true
;
for
(
int
n
=
0
;
n
<
integers
.
length
;
n
++){
if
(
integers
[
n
]!=
tContractorTrainResult
.
getIntegers
()[
i
][
n
]){
adopt
=
false
;
break
;
}
}
TContractorTrainCourse
tContractorTrainCourse
=
new
TContractorTrainCourse
();
//查询需要正确几道题算通过
TContractorTrainCourse
itContractorTrainCourse
=
tContractorTrainCourseMapper
.
getITContractorTrainCourse
(
tContractorTrainCourse
);
if
(
adopt
){
/** 1单选 2多选 3判断*/
if
(
tContractorTrainCourseTopics
.
get
(
i
).
getTopicType
()==
1
){
num
=
num
+
itContractorTrainCourse
.
getSingleChoiceScore
();
}
else
if
(
tContractorTrainCourseTopics
.
get
(
i
).
getTopicType
()==
2
){
num
=
num
+
itContractorTrainCourse
.
getMultipleChoiceScore
();
}
else
if
(
tContractorTrainCourseTopics
.
get
(
i
).
getTopicType
()==
3
){
num
=
num
+
itContractorTrainCourse
.
getJudgmentScore
();
}
}
}
}
//判断答题是否合格
if
(
num
>=
itContractorTrainCourse
.
getQualifiedNum
()){
tContractorTrainResult
.
setIsQualified
(
"0"
);
...
...
@@ -139,7 +162,7 @@ public class TContractorTrainResultServiceImpl implements ITContractorTrainResul
//承包商及访客培训考试结果 添加方法
tContractorTrainResultMapper
.
insertTContractorTrainResult
(
tContractorTrainResult
);
/**添加承包商及访客培训考试结果详情*/
for
(
int
n
=
0
;
n
<
split
.
length
;
n
++){
for
(
int
n
=
0
;
n
<
tContractorTrainResult
.
getIntegers
()
.
length
;
n
++){
TContractorTrainResultDetail
tContractorTrainResultDetail
=
new
TContractorTrainResultDetail
();
//设置结果管理id
tContractorTrainResultDetail
.
setResult
(
String
.
valueOf
(
tContractorTrainResult
.
getResultId
()));
...
...
@@ -150,13 +173,13 @@ public class TContractorTrainResultServiceImpl implements ITContractorTrainResul
//答案
tContractorTrainResultDetail
.
setAnswer
(
tContractorTrainCourseTopics
.
get
(
n
).
getAnswer
());
//所选答案
tContractorTrainResultDetail
.
setAnswerChoice
(
Integer
.
valueOf
(
split
[
n
]
));
tContractorTrainResultDetail
.
setAnswerChoice
(
tContractorTrainResult
.
getAnswers
(
));
//答案结果
if
(
Integer
.
valueOf
(
split
[
n
])==
tContractorTrainCourseTopics
.
get
(
n
).
getAnswer
()){
tContractorTrainResultDetail
.
setResult
(
"0"
);
}
else
{
tContractorTrainResultDetail
.
setResult
(
"1"
);
}
//
if (Integer.valueOf(split[n])==tContractorTrainCourseTopics.get(n).getAnswer()){
//
tContractorTrainResultDetail.setResult("0");
//
}else {
//
tContractorTrainResultDetail.setResult("1");
//
}
tContractorTrainResultDetail
.
setCreateTime
(
new
Date
());
tContractorTrainResultDetail
.
setResultId
(
tContractorTrainResult
.
getResultId
());
tContractorTrainResultDetailMapper
.
insertTContractorTrainResultDetail
(
tContractorTrainResultDetail
);
...
...
danger-manage-system/src/main/java/com/zehong/system/service/impl/TTrainCourseServiceImpl.java
View file @
c96176e0
...
...
@@ -205,7 +205,6 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Map
<
String
,
Object
>
examination
(
Long
userCourseId
,
Integer
[][]
answers
){
//查询用户课程信息
TTrainUserCourse
userCourse
=
tTrainUserCourseMapper
.
selectTTrainUserCourseById
(
userCourseId
);
TTrainCourseTopic
topic
=
new
TTrainCourseTopic
();
...
...
@@ -226,7 +225,6 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
Integer
qualifiedNum
=
c
.
getQualifiedNum
();
//已获得分数
int
num
=
0
;
/**
* 大循环 共有多少答案 此循环最后只算出 得了多少分
*/
...
...
@@ -235,10 +233,8 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
int
PassedNot
=
0
;
/*题目答案*/
String
answer
=
list
.
get
(
i
).
getAnswer
();
System
.
out
.
println
(
"答案:"
+
answer
);
//答案转换成数组
Integer
[]
integers
=
JSON
.
parseObject
(
answer
,
Integer
[].
class
);
/**判断所选答案是否与正确答案长度相等*/
if
(
integers
.
length
==
answers
[
i
].
length
){
boolean
adopt
=
true
;
...
...
@@ -251,13 +247,10 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
if
(
adopt
){
/** 1单选 2多选 3判断*/
if
(
list
.
get
(
i
).
getTopicType
()==
1
){
System
.
out
.
println
(
num
);
num
=
num
+
singleChoiceScore
;
}
else
if
(
list
.
get
(
i
).
getTopicType
()==
2
){
System
.
out
.
println
(
num
);
num
=
num
+
multipleChoiceScore
;
}
else
if
(
list
.
get
(
i
).
getTopicType
()==
3
){
System
.
out
.
println
(
num
);
num
=
num
+
judgmentScore
;
}
}
...
...
@@ -273,12 +266,12 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
}
for
(
Integer
i
=
0
;
i
<
answers
.
length
;
i
++){
//
for(Integer i=0;i<answers.length;i++){
// String demosub = list.get(i).getAnswer().substring(1,list.get(i).getAnswer().length()-1);
// if(Integer.parseInt(answers[i])==demosub){
// num++;
// }
}
//
}
/**已获得分数*/
userCourse
.
setExaminationResult
(
num
);
/**生成日期*/
...
...
danger-manage-system/src/main/resources/mapper/system/TContractorTrainCourseMapper.xml
View file @
c96176e0
...
...
@@ -16,10 +16,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"createUser"
column=
"create_user"
/>
<result
property=
"isDel"
column=
"is_del"
/>
<result
property=
"remark"
column=
"remark"
/>
<result
property=
"singleChoiceScore"
column=
"single_choice_score"
/>
<result
property=
"multipleChoiceScore"
column=
"multiple_choice_score"
/>
<result
property=
"judgmentScore"
column=
"judgment_score"
/>
</resultMap>
<sql
id=
"selectTContractorTrainCourseVo"
>
select contractor_course_id, course_name, course_conent, enclosure, video, qualified_num, topic_num, create_time, create_user, is_del, remark from t_contractor_train_course
select
single_choice_score,multiple_choice_score,judgment_score,
contractor_course_id, course_name, course_conent, enclosure, video, qualified_num, topic_num, create_time, create_user, is_del, remark from t_contractor_train_course
</sql>
<select
id=
"selectTContractorTrainCourseList"
parameterType=
"TContractorTrainCourse"
resultMap=
"TContractorTrainCourseResult"
>
...
...
@@ -54,6 +57,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"createUser != null"
>
create_user,
</if>
<if
test=
"isDel != null"
>
is_del,
</if>
<if
test=
"remark != null"
>
remark,
</if>
<if
test=
"singleChoiceScore != null"
>
single_choice_score,
</if>
<if
test=
"multipleChoiceScore != null"
>
multiple_choice_score,
</if>
<if
test=
"judgmentScore != null"
>
judgment_score,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"courseName != null"
>
#{courseName},
</if>
...
...
@@ -66,6 +72,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"createUser != null"
>
#{createUser},
</if>
<if
test=
"isDel != null"
>
#{isDel},
</if>
<if
test=
"remark != null"
>
#{remark},
</if>
<if
test=
"singleChoiceScore != null"
>
#{singleChoiceScore},
</if>
<if
test=
"multipleChoiceScore != null"
>
#{multipleChoiceScore},
</if>
<if
test=
"judgmentScore != null"
>
#{judgmentScore},
</if>
</trim>
</insert>
...
...
@@ -82,6 +91,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"createUser != null"
>
create_user = #{createUser},
</if>
<if
test=
"isDel != null"
>
is_del = #{isDel},
</if>
<if
test=
"remark != null"
>
remark = #{remark},
</if>
<if
test=
"singleChoiceScore != null"
>
single_choice_score = #{singleChoiceScore},
</if>
<if
test=
"multipleChoiceScore != null"
>
multiple_choice_score = #{multipleChoiceScore},
</if>
<if
test=
"judgmentScore != null"
>
judgment_score = #{judgmentScore},
</if>
</trim>
where contractor_course_id = #{contractorCourseId}
</update>
...
...
danger-manage-system/src/main/resources/mapper/system/TContractorTrainCourseTopicMapper.xml
View file @
c96176e0
...
...
@@ -13,10 +13,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"isDel"
column=
"is_del"
/>
<result
property=
"remark"
column=
"remark"
/>
<result
property=
"topicType"
column=
"topic_type"
/>
</resultMap>
<resultMap
type=
"TContractorTrainCourse"
id=
"TContractorTrainCourseResult"
>
<result
property=
"contractor_course_id"
column=
"contractorCourseId"
/>
</resultMap>
<sql
id=
"selectTContractorTrainCourseTopicVo"
>
select topic_id, contractor_course_id, topic_title, topic_option, answer, create_time, is_del, remark from t_contractor_train_course_topic
select topic_id, contractor_course_id, topic_title, topic_option, answer, create_time, is_del, remark
,topic_type
from t_contractor_train_course_topic
</sql>
<select
id=
"selectTContractorTrainCourseTopicList"
parameterType=
"TContractorTrainCourseTopic"
resultMap=
"TContractorTrainCourseTopicResult"
>
...
...
@@ -45,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"isDel != null"
>
is_del,
</if>
<if
test=
"remark != null"
>
remark,
</if>
<if
test=
"topicType != null"
>
topic_type,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"contractorCourseId != null"
>
#{contractorCourseId},
</if>
...
...
@@ -54,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"isDel != null"
>
#{isDel},
</if>
<if
test=
"remark != null"
>
#{remark},
</if>
<if
test=
"topicType != null"
>
#{topicType},
</if>
</trim>
</insert>
...
...
@@ -67,6 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"isDel != null"
>
is_del = #{isDel},
</if>
<if
test=
"remark != null"
>
remark = #{remark},
</if>
<if
test=
"topicType != null"
>
topic_type = #{topicType},
</if>
</trim>
where topic_id = #{topicId}
</update>
...
...
@@ -81,4 +91,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{topicId}
</foreach>
</delete>
<insert
id=
"batchInsertTTrainCourseTopic"
parameterType=
"java.util.List"
>
insert into t_contractor_train_course_topic(contractor_course_id,topic_title,topic_option,answer,create_time,topic_type) values
<foreach
collection=
"list"
item=
"topic"
index=
"index"
separator=
","
>
(#{topic.contractorCourseId},#{topic.topicTitle},#{topic.topicOption},#{topic.answer},#{topic.createTime},#{topic.topicType})
</foreach>
</insert>
<select
id=
"selectTTrainCourseById"
resultType=
"com.zehong.system.domain.TContractorTrainCourse"
>
select topic_num topicNum from t_contractor_train_course
where contractor_course_id = #{courseId}
</select>
<update
id=
"updateTTrainCourse"
parameterType=
"TContractorTrainCourse"
>
update t_contractor_train_course set topic_num=#{topicNum}
where contractor_course_id = #{contractorCourseId}
</update>
</mapper>
danger-manage-system/src/main/resources/mapper/system/TContractorTrainResultDetailMapper.xml
View file @
c96176e0
...
...
@@ -47,7 +47,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"topicOption != null"
>
topic_option,
</if>
<if
test=
"answer != null"
>
answer,
</if>
<if
test=
"answerChoice != null"
>
answer_choice,
</if>
<if
test=
"result != null"
>
result,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"isDel != null"
>
is_del,
</if>
<if
test=
"remark != null"
>
remark,
</if>
...
...
@@ -58,7 +57,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"topicOption != null"
>
#{topicOption},
</if>
<if
test=
"answer != null"
>
#{answer},
</if>
<if
test=
"answerChoice != null"
>
#{answerChoice},
</if>
<if
test=
"result != null"
>
#{result},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"isDel != null"
>
#{isDel},
</if>
<if
test=
"remark != null"
>
#{remark},
</if>
...
...
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