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
eca651ce
Commit
eca651ce
authored
Aug 19, 2026
by
wujipeng
Browse files
学员-考试中心/我的成绩-拆分
parent
ffe84393
Changes
36
Show whitespace changes
Inline
Side-by-side
practical-api/practical-business-api/src/main/java/com/platform/business/model/dto/StudentExamAnswerDTO.java
0 → 100644
View file @
eca651ce
package
com.platform.business.model.dto
;
import
lombok.Data
;
/**
* 在线理论考试答案保存请求。
*
* <p>只开放实际答案字段,避免旧接口直接接收题目实体后被客户端篡改分值、正确答案、
* 考试ID或学员ID。</p>
*/
@Data
public
class
StudentExamAnswerDTO
{
private
String
actualChoice
;
}
practical-api/practical-business-api/src/main/java/com/platform/business/model/dto/StudentExamCenterQueryDTO.java
0 → 100644
View file @
eca651ce
package
com.platform.business.model.dto
;
import
lombok.Data
;
/**
* 学员端考试中心分页查询条件。
*
* <p>本对象不包含studentId。学员身份必须由服务端从JWT解析,禁止客户端通过查询条件
* 指定其他学员。</p>
*/
@Data
public
class
StudentExamCenterQueryDTO
{
private
int
pageNum
;
private
int
pageSize
;
/** 考试名称关键字。 */
private
String
keyword
;
/** ALL、PENDING或COMPLETED。 */
private
String
status
;
}
practical-api/practical-business-api/src/main/java/com/platform/business/model/dto/StudentScoreQueryDTO.java
0 → 100644
View file @
eca651ce
package
com.platform.business.model.dto
;
import
lombok.Data
;
/** 学员端“我的成绩”分页查询条件。 */
@Data
public
class
StudentScoreQueryDTO
{
private
int
pageNum
;
private
int
pageSize
;
/** 考试名称关键字。 */
private
String
keyword
;
/** THEORY/PRACTICE,也兼容数据库中的“理论/实训”。 */
private
String
type
;
}
practical-api/practical-business-api/src/main/java/com/platform/business/model/vo/StudentExamCenterVO.java
0 → 100644
View file @
eca651ce
package
com.platform.business.model.vo
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.platform.business.model.entity.ExamStudentEntity
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
/** 学员端考试中心的页面级响应模型。 */
public
final
class
StudentExamCenterVO
{
private
StudentExamCenterVO
()
{
}
/** 考试中心列表行。 */
@Data
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
static
class
ListItem
{
private
Integer
examStudentId
;
private
Integer
examId
;
private
String
examName
;
private
String
type
;
@JsonFormat
(
pattern
=
"MM-dd HH:mm"
,
timezone
=
"GMT+8"
)
private
Date
examTime
;
private
Integer
duration
;
private
String
location
;
private
BigDecimal
totalScore
;
private
BigDecimal
passScore
;
private
Long
startTime
;
private
Long
endTime
;
private
Boolean
submit
;
private
Boolean
studentMarkFlag
;
private
Boolean
examMarkFlag
;
private
Double
score
;
/** WAITING、IN_PROGRESS、SUBMITTED或PUBLISHED。 */
private
String
workflowStatus
;
/** WAIT、START、RESUME、VIEW_INSTRUCTIONS或VIEW_SCORE。 */
private
String
action
;
}
/** 进入考试前展示的考试说明。 */
@Data
public
static
class
Instructions
{
private
Integer
examStudentId
;
private
Integer
examId
;
private
String
examName
;
private
String
type
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm"
,
timezone
=
"GMT+8"
)
private
Date
examTime
;
private
Integer
duration
;
private
Integer
forbidMinutes
;
private
String
location
;
private
BigDecimal
totalScore
;
private
BigDecimal
passScore
;
private
List
<
String
>
notices
;
}
/**
* Mapper内部使用的应考记录聚合模型。
*
* <p>继承应考实体便于复用关系字段,新增字段均来自exam表,不直接用于持久化更新。</p>
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
public
static
class
Attempt
extends
ExamStudentEntity
{
private
String
examName
;
private
String
examType
;
private
Date
examTime
;
private
Integer
examDuration
;
private
Integer
forbidMinutes
;
private
String
location
;
private
String
paperId
;
private
BigDecimal
totalScore
;
private
BigDecimal
passScore
;
private
Boolean
examMarkFlag
;
}
/** 在线试卷及恢复作答所需的完整进度,但不包含正确答案。 */
@Data
public
static
class
Paper
{
private
Integer
examStudentId
;
private
Integer
examId
;
private
String
examName
;
private
Long
startTime
;
private
Long
endTime
;
private
Integer
totalCount
;
private
Integer
answeredCount
;
private
List
<
Question
>
questions
;
}
/** 在线考试题目。正确答案只会出现在成绩模块,不会由本模型返回。 */
@Data
public
static
class
Question
{
private
String
id
;
private
String
sequence
;
private
String
type
;
private
String
problem
;
private
String
optionA
;
private
String
optionB
;
private
String
optionC
;
private
String
optionD
;
private
String
optionE
;
private
Double
score
;
private
String
actualChoice
;
}
/** 交卷前校验结果。 */
@Data
public
static
class
SubmitCheck
{
private
Integer
totalCount
;
private
Integer
answeredCount
;
private
Integer
unansweredCount
;
private
Boolean
submitAllowed
;
private
Long
allowedAt
;
private
String
message
;
}
/** 交卷结果不包含未发布的分数。 */
@Data
public
static
class
SubmitResult
{
private
Integer
examStudentId
;
private
String
status
;
private
Integer
totalCount
;
private
Integer
answeredCount
;
private
Integer
unansweredCount
;
private
String
duration
;
}
}
practical-api/practical-business-api/src/main/java/com/platform/business/model/vo/StudentScoreVO.java
0 → 100644
View file @
eca651ce
package
com.platform.business.model.vo
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
/** 学员端“我的成绩”的聚合响应模型。 */
public
final
class
StudentScoreVO
{
private
StudentScoreVO
()
{
}
/** 页面顶部四项统计。 */
@Data
public
static
class
Overview
{
private
Double
averageScore
;
private
Double
highestScore
;
private
Integer
examCount
;
private
Integer
classRank
;
private
Integer
classId
;
}
/** 成绩明细列表行。 */
@Data
public
static
class
ListItem
{
private
Integer
examStudentId
;
private
Integer
examId
;
private
String
examName
;
private
String
type
;
private
Double
score
;
private
Double
averageScore
;
private
Integer
rank
;
private
Integer
classCount
;
@JsonFormat
(
pattern
=
"MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
examTime
;
}
/** 单场成绩聚合详情;理论和实训明细只会返回其中一种。 */
@Data
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
static
class
Detail
{
private
Integer
examStudentId
;
private
Integer
examId
;
/** 应考记录所属班级,用于限定班级均分、排名和题型分析的数据范围。 */
private
Integer
classId
;
private
String
examName
;
private
String
type
;
private
String
className
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm"
,
timezone
=
"GMT+8"
)
private
Date
examTime
;
private
Double
score
;
private
BigDecimal
totalScore
;
private
BigDecimal
passScore
;
private
String
grade
;
private
Boolean
passed
;
private
Double
classAverageScore
;
private
Double
scoreDifference
;
private
Integer
rank
;
private
Integer
classCount
;
private
String
duration
;
private
Integer
totalQuestionCount
;
private
Integer
rightCount
;
private
Integer
wrongCount
;
private
Integer
partiallyRightCount
;
private
Double
correctRate
;
private
List
<
TheoryQuestion
>
theoryQuestions
;
private
List
<
TypeAnalysis
>
typeAnalysis
;
private
List
<
PracticeItem
>
practiceItems
;
private
PracticeSummary
practiceSummary
;
}
/** 理论题成绩明细。 */
@Data
public
static
class
TheoryQuestion
{
private
String
id
;
private
String
sequence
;
private
String
type
;
private
String
problem
;
private
String
optionA
;
private
String
optionB
;
private
String
optionC
;
private
String
optionD
;
private
String
optionE
;
private
String
actualChoice
;
private
String
answer
;
private
Double
score
;
private
Double
actualScore
;
private
Boolean
result
;
private
Boolean
partiallyRight
;
private
String
resultDescription
;
}
/** 理论题型个人得分率与班级平均得分率。 */
@Data
public
static
class
TypeAnalysis
{
private
String
type
;
private
Double
personalRate
;
private
Double
classAverageRate
;
}
/** fz_grades当前协议能够稳定提供的实训步骤字段。 */
@Data
public
static
class
PracticeItem
{
private
String
id
;
private
String
code
;
private
String
level
;
private
String
title
;
private
String
type
;
private
String
options
;
private
String
text
;
private
String
result
;
private
String
file
;
private
Double
score
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
startTime
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
submissionTime
;
/** PASS、PARTIAL或FAIL,由现有result文本归一化得到。 */
private
String
normalizedStatus
;
}
/** 基于现有实训结果文本计算的步骤数量汇总。 */
@Data
public
static
class
PracticeSummary
{
private
Integer
totalCount
;
private
Integer
passedCount
;
private
Integer
partiallyPassedCount
;
private
Integer
failedCount
;
private
Double
weightedPassRate
;
}
}
practical-business/src/main/java/com/platform/business/controller/ExamController.java
View file @
eca651ce
package
com.platform.business.controller
;
import
com.platform.business.model.dto.ExamDTO
;
import
com.platform.business.model.dto.TheoreticalPaperStudentDetailDTO
;
import
com.platform.business.model.vo.ExamStudentVO
;
import
com.platform.business.model.vo.ExamVO
;
import
com.platform.business.model.vo.TheoreticalPaperStudentDetailVO
;
import
com.platform.business.service.ExamService
;
import
com.platform.controller.BaseController
;
import
com.platform.model.resp.Result
;
import
com.platform.page.TableDataInfo
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.Map
;
@RestController
@RequestMapping
(
"/exam"
)
public
class
ExamController
extends
BaseController
{
...
...
@@ -59,94 +53,4 @@ public class ExamController extends BaseController {
return
getDataTable
(
examService
.
classExamScore
(
examDTO
));
}
@ApiOperation
(
value
=
"学员端-考试中心-列表"
)
@PostMapping
(
"/student/list"
)
public
Result
<
List
<
ExamVO
>>
unfinished
(
@RequestBody
ExamDTO
examDTO
)
{
startPage
(
examDTO
.
getPageNum
(),
examDTO
.
getPageSize
());
return
Result
.
data
(
examService
.
unfinished
(
examDTO
));
}
@ApiOperation
(
value
=
"开始考试"
)
@PostMapping
(
"/start"
)
public
Result
<
Integer
>
startExam
(
@RequestBody
ExamDTO
examDTO
)
{
return
examService
.
startExam
(
examDTO
);
}
@ApiOperation
(
value
=
"试卷总览"
)
@GetMapping
(
"/paper/overview/{id}"
)
public
Result
<
List
<
TheoreticalPaperStudentDetailVO
>>
paperOverview
(
@PathVariable
(
name
=
"id"
)
Integer
id
)
{
return
Result
.
data
(
examService
.
paperOverview
(
id
));
}
@ApiOperation
(
value
=
"考卷详情"
)
@GetMapping
(
"/paper/detail/{id}"
)
public
Result
<
ExamStudentVO
>
paperDetail
(
@PathVariable
(
name
=
"id"
)
Integer
id
)
{
return
Result
.
data
(
examService
.
paperDetail
(
id
));
}
@ApiModelProperty
(
value
=
"考题详情"
)
@GetMapping
(
"/question/detail/{id}"
)
public
Result
<
TheoreticalPaperStudentDetailVO
>
questionDetail
(
@PathVariable
(
name
=
"id"
)
String
id
)
{
return
Result
.
data
(
examService
.
questionDetail
(
id
));
}
@ApiOperation
(
value
=
"考题编辑"
)
@PutMapping
(
"/question/edit"
)
public
Result
<
Boolean
>
questionEdit
(
@RequestBody
TheoreticalPaperStudentDetailDTO
theoreticalPaperStudentDetailDTO
)
{
return
Result
.
data
(
examService
.
questionEdit
(
theoreticalPaperStudentDetailDTO
));
}
@ApiOperation
(
value
=
"交卷校验"
)
@GetMapping
(
"/submit/check/{id}"
)
public
Result
<
Map
<
String
,
String
>>
submitCheck
(
@PathVariable
(
name
=
"id"
)
String
id
)
{
return
Result
.
data
(
examService
.
submitCheck
(
id
));
}
@ApiOperation
(
value
=
"交卷"
)
@GetMapping
(
"/submit/{id}"
)
public
Result
<
Boolean
>
submit
(
@PathVariable
(
name
=
"id"
)
String
id
)
{
return
examService
.
submit
(
id
);
}
@ApiModelProperty
(
value
=
"成绩-考题详情"
)
@GetMapping
(
"/grades/question/detail/{id}"
)
public
Result
<
TheoreticalPaperStudentDetailVO
>
gradesQuestionDetail
(
@PathVariable
(
name
=
"id"
)
String
id
)
{
return
Result
.
data
(
examService
.
gradesQuestionDetail
(
id
));
}
@ApiOperation
(
value
=
"成绩详情"
)
@GetMapping
(
"/grades/detail/{id}"
)
public
Result
<
ExamStudentVO
>
gradesDetail
(
@PathVariable
(
name
=
"id"
)
String
id
)
{
return
Result
.
data
(
examService
.
gradesDetail
(
id
));
}
@ApiOperation
(
value
=
"学生端-学习中心-我的成绩-详情-汇总"
)
@GetMapping
(
"/grades/summary/{id}"
)
public
Result
<
ExamStudentVO
>
gradesSummary
(
@PathVariable
(
name
=
"id"
)
String
id
)
{
return
Result
.
data
(
examService
.
gradesSummary
(
id
));
}
@ApiOperation
(
value
=
"学生端-学习中心-我的成绩-详情-成绩分析"
)
@GetMapping
(
"/grades/analysis/{id}"
)
public
Result
<
Map
<
String
,
ExamStudentVO
>>
gradesAnalysis
(
@PathVariable
(
name
=
"id"
)
String
id
)
{
return
Result
.
data
(
examService
.
gradesAnalysis
(
id
));
}
@ApiOperation
(
value
=
"学生端-学习中心-我的成绩-详情-考试统计"
)
@GetMapping
(
"/grades/statistics/{id}"
)
public
Result
<
ExamStudentVO
>
gradesStatistics
(
@PathVariable
(
name
=
"id"
)
String
id
)
{
return
Result
.
data
(
examService
.
gradesStatistics
(
id
));
}
@ApiOperation
(
value
=
"学生端-学习中心-我的成绩-详情-题目导航"
)
@GetMapping
(
"/grades/navigation/{id}"
)
public
Result
<
List
<
TheoreticalPaperStudentDetailVO
>>
gradesNavigation
(
@PathVariable
(
name
=
"id"
)
String
id
)
{
return
Result
.
data
(
examService
.
gradesNavigation
(
id
));
}
@ApiOperation
(
value
=
"学生端-学习中心-我的成绩-详情-列表"
)
@GetMapping
(
"/grades/list/{id}"
)
public
Result
<
List
<
TheoreticalPaperStudentDetailVO
>>
gradesList
(
@PathVariable
(
name
=
"id"
)
String
id
)
{
return
Result
.
data
(
examService
.
gradesList
(
id
));
}
}
practical-business/src/main/java/com/platform/business/controller/ExamDetailController.java
deleted
100644 → 0
View file @
ffe84393
package
com.platform.business.controller
;
import
com.platform.business.model.dto.ExamDetailDTO
;
import
com.platform.business.model.vo.ExamScoreDetailVO
;
import
com.platform.business.service.ExamDetailService
;
import
com.platform.controller.BaseController
;
import
com.platform.model.resp.Result
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
@RestController
@RequestMapping
(
"/score"
)
public
class
ExamDetailController
extends
BaseController
{
@Resource
private
ExamDetailService
examDetailService
;
@ApiOperation
(
value
=
"学生成绩详情"
)
@PostMapping
(
"/detail"
)
public
Result
<
ExamScoreDetailVO
>
queryDetail
(
@RequestBody
ExamDetailDTO
examDetailDTO
){
return
Result
.
data
(
examDetailService
.
queryQuestionList
(
examDetailDTO
));
}
}
practical-business/src/main/java/com/platform/business/controller/ExamStudentController.java
deleted
100644 → 0
View file @
ffe84393
package
com.platform.business.controller
;
import
com.platform.business.model.dto.ExamStudentDTO
;
import
com.platform.business.model.vo.ExamStudentVO
;
import
com.platform.business.service.ExamStudentService
;
import
com.platform.controller.BaseController
;
import
com.platform.model.resp.Result
;
import
com.platform.page.TableDataInfo
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.util.Map
;
@RestController
@RequestMapping
(
"/exam/student"
)
public
class
ExamStudentController
extends
BaseController
{
@Resource
private
ExamStudentService
examStudentService
;
@ApiOperation
(
value
=
"学生端-学习中心-我的成绩-成绩明细"
)
@PostMapping
(
"/page"
)
public
TableDataInfo
page
(
@RequestBody
ExamStudentDTO
examStudentDTO
)
{
startPage
(
examStudentDTO
.
getPageNum
(),
examStudentDTO
.
getPageSize
());
return
getDataTable
(
examStudentService
.
page
(
examStudentDTO
));
}
@ApiOperation
(
value
=
"学生端-学习中心-我的成绩-汇总"
)
@GetMapping
(
"/summary/{studentId}"
)
public
Result
<
Map
<
String
,
String
>>
summary
(
@PathVariable
String
studentId
)
{
return
Result
.
data
(
examStudentService
.
summary
(
studentId
));
}
@ApiOperation
(
value
=
"根据学生id查询最近的一场考试"
)
@GetMapping
(
"/recent/{studentId}"
)
public
Result
<
ExamStudentVO
>
recent
(
@PathVariable
String
studentId
)
{
return
Result
.
data
(
examStudentService
.
recent
(
studentId
));
}
}
practical-business/src/main/java/com/platform/business/controller/StudentExamCenterController.java
0 → 100644
View file @
eca651ce
package
com.platform.business.controller
;
import
com.platform.business.model.dto.StudentExamAnswerDTO
;
import
com.platform.business.model.dto.StudentExamCenterQueryDTO
;
import
com.platform.business.model.entity.UserEntity
;
import
com.platform.business.model.vo.StudentExamCenterVO
;
import
com.platform.business.service.AuthenticatedUserService
;
import
com.platform.business.service.StudentExamCenterService
;
import
com.platform.controller.BaseController
;
import
com.platform.model.resp.Result
;
import
com.platform.page.TableDataInfo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
/**
* 学员端“学习中心-考试中心”控制器。
*
* <p>本控制器只处理考试安排和在线作答流程;正式成绩展示由StudentScoreController负责。
* 所有入口都使用JWT中的当前学员,不接受客户端传入的userId/studentId。</p>
*/
@Api
(
tags
=
"学员端-考试中心"
)
@RestController
@RequestMapping
(
"/exam/student/center"
)
public
class
StudentExamCenterController
extends
BaseController
{
@Resource
private
StudentExamCenterService
studentExamCenterService
;
@Resource
private
AuthenticatedUserService
authenticatedUserService
;
@ApiOperation
(
"考试中心分页列表"
)
@PostMapping
(
"/page"
)
public
TableDataInfo
page
(
@RequestBody
(
required
=
false
)
StudentExamCenterQueryDTO
query
,
HttpServletRequest
request
)
{
StudentExamCenterQueryDTO
safeQuery
=
query
==
null
?
new
StudentExamCenterQueryDTO
()
:
query
;
normalizePage
(
safeQuery
);
String
studentId
=
currentStudentId
(
request
);
startPage
(
safeQuery
.
getPageNum
(),
safeQuery
.
getPageSize
());
return
getDataTable
(
studentExamCenterService
.
page
(
safeQuery
,
studentId
));
}
@ApiOperation
(
"进入考试前的考试说明"
)
@GetMapping
(
"/{examStudentId}/instructions"
)
public
Result
<
StudentExamCenterVO
.
Instructions
>
instructions
(
@PathVariable
Integer
examStudentId
,
HttpServletRequest
request
)
{
return
Result
.
data
(
studentExamCenterService
.
instructions
(
examStudentId
,
currentStudentId
(
request
)));
}
@ApiOperation
(
"开始或恢复在线理论考试"
)
@PostMapping
(
"/{examStudentId}/start"
)
public
Result
<
Integer
>
start
(
@PathVariable
Integer
examStudentId
,
HttpServletRequest
request
)
{
return
Result
.
data
(
studentExamCenterService
.
start
(
examStudentId
,
currentStudentId
(
request
)));
}
@ApiOperation
(
"在线理论考试试卷及作答进度"
)
@GetMapping
(
"/attempts/{examStudentId}/paper"
)
public
Result
<
StudentExamCenterVO
.
Paper
>
paper
(
@PathVariable
Integer
examStudentId
,
HttpServletRequest
request
)
{
return
Result
.
data
(
studentExamCenterService
.
paper
(
examStudentId
,
currentStudentId
(
request
)));
}
@ApiOperation
(
"保存单题答案"
)
@PutMapping
(
"/attempts/{examStudentId}/questions/{questionId}/answer"
)
public
Result
<
Boolean
>
saveAnswer
(
@PathVariable
Integer
examStudentId
,
@PathVariable
String
questionId
,
@RequestBody
StudentExamAnswerDTO
answer
,
HttpServletRequest
request
)
{
return
Result
.
data
(
studentExamCenterService
.
saveAnswer
(
examStudentId
,
questionId
,
answer
,
currentStudentId
(
request
)));
}
@ApiOperation
(
"交卷前校验"
)
@GetMapping
(
"/attempts/{examStudentId}/submit-check"
)
public
Result
<
StudentExamCenterVO
.
SubmitCheck
>
submitCheck
(
@PathVariable
Integer
examStudentId
,
HttpServletRequest
request
)
{
return
Result
.
data
(
studentExamCenterService
.
submitCheck
(
examStudentId
,
currentStudentId
(
request
)));
}
@ApiOperation
(
"确认交卷"
)
@PostMapping
(
"/attempts/{examStudentId}/submit"
)
public
Result
<
StudentExamCenterVO
.
SubmitResult
>
submit
(
@PathVariable
Integer
examStudentId
,
HttpServletRequest
request
)
{
return
Result
.
data
(
studentExamCenterService
.
submit
(
examStudentId
,
currentStudentId
(
request
)));
}
/** 统一完成JWT解析和学员角色校验,只向业务层传递可信学员ID。 */
private
String
currentStudentId
(
HttpServletRequest
request
)
{
UserEntity
student
=
authenticatedUserService
.
current
(
request
);
authenticatedUserService
.
requireStudent
(
student
);
return
student
.
getId
();
}
private
void
normalizePage
(
StudentExamCenterQueryDTO
query
)
{
query
.
setPageNum
(
query
.
getPageNum
()
<=
0
?
1
:
query
.
getPageNum
());
query
.
setPageSize
(
query
.
getPageSize
()
<=
0
?
10
:
Math
.
min
(
query
.
getPageSize
(),
100
));
}
}
practical-business/src/main/java/com/platform/business/controller/StudentScoreController.java
0 → 100644
View file @
eca651ce
package
com.platform.business.controller
;
import
com.platform.business.model.dto.StudentScoreQueryDTO
;
import
com.platform.business.model.entity.UserEntity
;
import
com.platform.business.model.vo.StudentScoreVO
;
import
com.platform.business.service.AuthenticatedUserService
;
import
com.platform.business.service.StudentScoreService
;
import
com.platform.controller.BaseController
;
import
com.platform.model.resp.Result
;
import
com.platform.page.TableDataInfo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
/**
* 学员端“学习中心-我的成绩”控制器。
*
* <p>本模块只查询已经正式发布的成绩,与在线考试作答流程、后台成绩管理完全隔离。</p>
*/
@Api
(
tags
=
"学员端-我的成绩"
)
@RestController
@RequestMapping
(
"/exam/student/scores"
)
public
class
StudentScoreController
extends
BaseController
{
@Resource
private
StudentScoreService
studentScoreService
;
@Resource
private
AuthenticatedUserService
authenticatedUserService
;
@ApiOperation
(
"个人正式成绩总览"
)
@GetMapping
(
"/overview"
)
public
Result
<
StudentScoreVO
.
Overview
>
overview
(
HttpServletRequest
request
)
{
return
Result
.
data
(
studentScoreService
.
overview
(
currentStudentId
(
request
)));
}
@ApiOperation
(
"正式成绩分页列表"
)
@PostMapping
(
"/page"
)
public
TableDataInfo
page
(
@RequestBody
(
required
=
false
)
StudentScoreQueryDTO
query
,
HttpServletRequest
request
)
{
StudentScoreQueryDTO
safeQuery
=
query
==
null
?
new
StudentScoreQueryDTO
()
:
query
;
normalizePage
(
safeQuery
);
String
studentId
=
currentStudentId
(
request
);
startPage
(
safeQuery
.
getPageNum
(),
safeQuery
.
getPageSize
());
return
getDataTable
(
studentScoreService
.
page
(
safeQuery
,
studentId
));
}
@ApiOperation
(
"单场理论或实训成绩聚合详情"
)
@GetMapping
(
"/{examStudentId}"
)
public
Result
<
StudentScoreVO
.
Detail
>
detail
(
@PathVariable
Integer
examStudentId
,
HttpServletRequest
request
)
{
return
Result
.
data
(
studentScoreService
.
detail
(
examStudentId
,
currentStudentId
(
request
)));
}
@ApiOperation
(
"导出本人单场正式成绩CSV"
)
@GetMapping
(
"/{examStudentId}/export"
)
public
void
export
(
@PathVariable
Integer
examStudentId
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
studentScoreService
.
export
(
examStudentId
,
currentStudentId
(
request
),
response
);
}
/** 每个入口都执行JWT解析与学员角色校验,避免通过路径参数查询其他学员成绩。 */
private
String
currentStudentId
(
HttpServletRequest
request
)
{
UserEntity
student
=
authenticatedUserService
.
current
(
request
);
authenticatedUserService
.
requireStudent
(
student
);
return
student
.
getId
();
}
private
void
normalizePage
(
StudentScoreQueryDTO
query
)
{
query
.
setPageNum
(
query
.
getPageNum
()
<=
0
?
1
:
query
.
getPageNum
());
query
.
setPageSize
(
query
.
getPageSize
()
<=
0
?
10
:
Math
.
min
(
query
.
getPageSize
(),
100
));
}
}
practical-business/src/main/java/com/platform/business/mapper/ExamMapper.java
View file @
eca651ce
...
...
@@ -9,7 +9,6 @@ import com.platform.business.model.vo.ExamAdminDetailVO;
import
com.platform.business.model.vo.ExamAdminStudentOptionVO
;
import
com.platform.business.model.vo.ExamStudentVO
;
import
com.platform.business.model.vo.ExamVO
;
import
com.platform.business.model.vo.TheoreticalPaperStudentDetailVO
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -27,22 +26,6 @@ public interface ExamMapper extends BaseMapper<ExamEntity> {
List
<
ExamVO
>
queryByClassId
(
Integer
classId
);
List
<
ExamVO
>
unfinished
(
ExamDTO
examDTO
);
List
<
TheoreticalPaperStudentDetailVO
>
paperOverview
(
@Param
(
"studentId"
)
String
studentId
,
@Param
(
"examId"
)
Integer
examId
,
@Param
(
"type"
)
String
type
);
List
<
TheoreticalPaperStudentDetailVO
>
numberAndScore
(
@Param
(
"studentId"
)
String
studentId
,
@Param
(
"examId"
)
Integer
examId
);
ExamStudentVO
gradesDetail
(
@Param
(
"id"
)
String
id
);
TheoreticalPaperStudentDetailVO
same
(
@Param
(
"examId"
)
Integer
examId
,
@Param
(
"studentId"
)
String
studentId
,
@Param
(
"type"
)
String
type
);
ExamStudentVO
gradesSummary
(
@Param
(
"id"
)
String
id
);
ExamStudentVO
gradesStatistics
(
@Param
(
"id"
)
String
id
);
List
<
ExamStudentVO
>
gradesAnalysis
(
@Param
(
"examId"
)
int
examId
,
@Param
(
"studentId"
)
String
studentId
);
/* ==================== 管理员端考试管理 ==================== */
/** 锁定班级行,使同一班级并发创建、编辑考试时串行完成冲突校验。 */
...
...
practical-business/src/main/java/com/platform/business/mapper/ExamStudentMapper.java
View file @
eca651ce
...
...
@@ -3,12 +3,10 @@ package com.platform.business.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.platform.business.model.entity.ExamStudentEntity
;
import
com.platform.business.model.vo.ExamStudentVO
;
import
io.swagger.models.auth.In
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
@Mapper
public
interface
ExamStudentMapper
extends
BaseMapper
<
ExamStudentEntity
>
{
...
...
@@ -17,17 +15,8 @@ public interface ExamStudentMapper extends BaseMapper<ExamStudentEntity> {
List
<
ExamStudentVO
>
queryByClassIdAndExamId
(
@Param
(
"classId"
)
Integer
classId
,
@Param
(
"examId"
)
Integer
examId
);
List
<
ExamStudentVO
>
page
(
@Param
(
"studentId"
)
String
studentId
);
ExamStudentVO
paperDetail
(
@Param
(
"id"
)
Integer
id
);
List
<
ExamStudentVO
>
queryOneself
(
@Param
(
"userId"
)
String
userId
);
List
<
ExamStudentVO
>
queryOneselfTeacher
(
@Param
(
"userId"
)
String
userId
);
Map
<
String
,
String
>
summary
(
@Param
(
"studentId"
)
String
studentId
);
ExamStudentVO
recent
(
@Param
(
"studentId"
)
String
studentId
);
List
<
ExamStudentVO
>
theSameEvent
(
@Param
(
"examId"
)
Integer
examId
);
}
practical-business/src/main/java/com/platform/business/mapper/StudentExamCenterMapper.java
0 → 100644
View file @
eca651ce
package
com.platform.business.mapper
;
import
com.platform.business.model.dto.StudentExamCenterQueryDTO
;
import
com.platform.business.model.entity.TheoreticalPaperStudentDetailEntity
;
import
com.platform.business.model.vo.StudentExamCenterVO
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/** 学员考试中心专用Mapper,所有详情查询均包含当前学员ID作为归属条件。 */
@Mapper
public
interface
StudentExamCenterMapper
{
List
<
StudentExamCenterVO
.
ListItem
>
selectPage
(
@Param
(
"query"
)
StudentExamCenterQueryDTO
query
,
@Param
(
"studentId"
)
String
studentId
);
StudentExamCenterVO
.
Attempt
selectAttempt
(
@Param
(
"examStudentId"
)
Integer
examStudentId
,
@Param
(
"studentId"
)
String
studentId
);
StudentExamCenterVO
.
Attempt
selectAttemptForUpdate
(
@Param
(
"examStudentId"
)
Integer
examStudentId
,
@Param
(
"studentId"
)
String
studentId
);
int
countGeneratedQuestions
(
@Param
(
"examId"
)
Integer
examId
,
@Param
(
"studentId"
)
String
studentId
);
int
updateAttemptStarted
(
@Param
(
"examStudentId"
)
Integer
examStudentId
,
@Param
(
"startTime"
)
Long
startTime
,
@Param
(
"endTime"
)
Long
endTime
,
@Param
(
"answerTime"
)
String
answerTime
);
List
<
StudentExamCenterVO
.
Question
>
selectPaperQuestions
(
@Param
(
"examId"
)
Integer
examId
,
@Param
(
"studentId"
)
String
studentId
);
TheoreticalPaperStudentDetailEntity
selectQuestionForUpdate
(
@Param
(
"questionId"
)
String
questionId
,
@Param
(
"examId"
)
Integer
examId
,
@Param
(
"studentId"
)
String
studentId
);
int
updateAnswer
(
@Param
(
"questionId"
)
String
questionId
,
@Param
(
"actualChoice"
)
String
actualChoice
);
List
<
TheoreticalPaperStudentDetailEntity
>
selectQuestionsForSubmit
(
@Param
(
"examId"
)
Integer
examId
,
@Param
(
"studentId"
)
String
studentId
);
int
updateQuestionResult
(
@Param
(
"id"
)
String
id
,
@Param
(
"result"
)
Boolean
result
,
@Param
(
"actualScore"
)
Double
actualScore
);
int
updateAttemptSubmitted
(
@Param
(
"examStudentId"
)
Integer
examStudentId
,
@Param
(
"score"
)
Double
score
,
@Param
(
"duration"
)
String
duration
,
@Param
(
"answerTime"
)
String
answerTime
);
}
practical-business/src/main/java/com/platform/business/mapper/StudentScoreMapper.java
0 → 100644
View file @
eca651ce
package
com.platform.business.mapper
;
import
com.platform.business.model.dto.StudentScoreQueryDTO
;
import
com.platform.business.model.vo.StudentScoreVO
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Date
;
import
java.util.List
;
/** 学员成绩专用Mapper,统一实现正式发布口径和MySQL 5.7兼容统计。 */
@Mapper
public
interface
StudentScoreMapper
{
StudentScoreVO
.
Overview
selectOverview
(
@Param
(
"studentId"
)
String
studentId
);
Integer
selectCurrentClassId
(
@Param
(
"studentId"
)
String
studentId
,
@Param
(
"today"
)
Date
today
);
Integer
selectClassRank
(
@Param
(
"classId"
)
Integer
classId
,
@Param
(
"studentId"
)
String
studentId
);
List
<
StudentScoreVO
.
ListItem
>
selectPage
(
@Param
(
"query"
)
StudentScoreQueryDTO
query
,
@Param
(
"studentId"
)
String
studentId
);
StudentScoreVO
.
Detail
selectDetail
(
@Param
(
"examStudentId"
)
Integer
examStudentId
,
@Param
(
"studentId"
)
String
studentId
);
List
<
StudentScoreVO
.
TheoryQuestion
>
selectTheoryQuestions
(
@Param
(
"examId"
)
Integer
examId
,
@Param
(
"studentId"
)
String
studentId
);
List
<
StudentScoreVO
.
TypeAnalysis
>
selectTheoryPersonalAnalysis
(
@Param
(
"examId"
)
Integer
examId
,
@Param
(
"studentId"
)
String
studentId
);
List
<
StudentScoreVO
.
TypeAnalysis
>
selectTheoryClassAnalysis
(
@Param
(
"examId"
)
Integer
examId
,
@Param
(
"classId"
)
Integer
classId
);
List
<
StudentScoreVO
.
PracticeItem
>
selectPracticeItems
(
@Param
(
"examId"
)
Integer
examId
,
@Param
(
"studentId"
)
String
studentId
);
}
practical-business/src/main/java/com/platform/business/service/ExamService.java
View file @
eca651ce
...
...
@@ -2,15 +2,11 @@ package com.platform.business.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.platform.business.model.dto.ExamDTO
;
import
com.platform.business.model.dto.TheoreticalPaperStudentDetailDTO
;
import
com.platform.business.model.entity.ExamEntity
;
import
com.platform.business.model.vo.ExamStudentVO
;
import
com.platform.business.model.vo.ExamVO
;
import
com.platform.business.model.vo.TheoreticalPaperStudentDetailVO
;
import
com.platform.model.resp.Result
;
import
java.util.List
;
import
java.util.Map
;
public
interface
ExamService
extends
IService
<
ExamEntity
>
{
List
<
ExamVO
>
queryList
(
ExamDTO
examDTO
);
...
...
@@ -27,34 +23,4 @@ public interface ExamService extends IService<ExamEntity> {
List
<
ExamVO
>
queryByClassId
(
Integer
classId
);
List
<
ExamVO
>
unfinished
(
ExamDTO
examDTO
);
Result
<
Integer
>
startExam
(
ExamDTO
examDTO
);
List
<
TheoreticalPaperStudentDetailVO
>
paperOverview
(
Integer
id
);
ExamStudentVO
paperDetail
(
Integer
id
);
TheoreticalPaperStudentDetailVO
questionDetail
(
String
id
);
Boolean
questionEdit
(
TheoreticalPaperStudentDetailDTO
theoreticalPaperStudentDetailDTO
);
Map
<
String
,
String
>
submitCheck
(
String
id
);
Result
<
Boolean
>
submit
(
String
id
);
TheoreticalPaperStudentDetailVO
gradesQuestionDetail
(
String
id
);
ExamStudentVO
gradesDetail
(
String
id
);
ExamStudentVO
gradesSummary
(
String
id
);
Map
<
String
,
ExamStudentVO
>
gradesAnalysis
(
String
id
);
ExamStudentVO
gradesStatistics
(
String
id
);
List
<
TheoreticalPaperStudentDetailVO
>
gradesNavigation
(
String
id
);
List
<
TheoreticalPaperStudentDetailVO
>
gradesList
(
String
id
);
}
practical-business/src/main/java/com/platform/business/service/ExamStudentService.java
View file @
eca651ce
package
com.platform.business.service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.platform.business.model.dto.ExamStudentDTO
;
import
com.platform.business.model.entity.ExamStudentEntity
;
import
com.platform.business.model.vo.ExamStudentVO
;
import
java.util.List
;
import
java.util.Map
;
public
interface
ExamStudentService
extends
IService
<
ExamStudentEntity
>
{
...
...
@@ -20,16 +18,8 @@ public interface ExamStudentService extends IService<ExamStudentEntity> {
List
<
ExamStudentVO
>
queryByClassIdAndExamId
(
Integer
classId
,
Integer
examId
);
List
<
ExamStudentVO
>
page
(
ExamStudentDTO
examStudentDTO
);
ExamStudentVO
paperDetail
(
Integer
id
);
List
<
ExamStudentVO
>
queryOneself
(
String
userId
);
List
<
ExamStudentVO
>
queryOneselfTeacher
(
String
userId
);
Map
<
String
,
String
>
summary
(
String
studentId
);
ExamStudentVO
recent
(
String
studentId
);
}
practical-business/src/main/java/com/platform/business/service/StudentExamCenterService.java
0 → 100644
View file @
eca651ce
package
com.platform.business.service
;
import
com.platform.business.model.dto.StudentExamAnswerDTO
;
import
com.platform.business.model.dto.StudentExamCenterQueryDTO
;
import
com.platform.business.model.vo.StudentExamCenterVO
;
import
java.util.List
;
/** 学员端考试中心业务服务,与后台考试管理及学生成绩查询完全分离。 */
public
interface
StudentExamCenterService
{
List
<
StudentExamCenterVO
.
ListItem
>
page
(
StudentExamCenterQueryDTO
query
,
String
studentId
);
StudentExamCenterVO
.
Instructions
instructions
(
Integer
examStudentId
,
String
studentId
);
Integer
start
(
Integer
examStudentId
,
String
studentId
);
StudentExamCenterVO
.
Paper
paper
(
Integer
examStudentId
,
String
studentId
);
Boolean
saveAnswer
(
Integer
examStudentId
,
String
questionId
,
StudentExamAnswerDTO
answer
,
String
studentId
);
StudentExamCenterVO
.
SubmitCheck
submitCheck
(
Integer
examStudentId
,
String
studentId
);
StudentExamCenterVO
.
SubmitResult
submit
(
Integer
examStudentId
,
String
studentId
);
}
practical-business/src/main/java/com/platform/business/service/StudentScoreService.java
0 → 100644
View file @
eca651ce
package
com.platform.business.service
;
import
com.platform.business.model.dto.StudentScoreQueryDTO
;
import
com.platform.business.model.vo.StudentScoreVO
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/** 学员端“我的成绩”只读查询与单场导出服务。 */
public
interface
StudentScoreService
{
StudentScoreVO
.
Overview
overview
(
String
studentId
);
List
<
StudentScoreVO
.
ListItem
>
page
(
StudentScoreQueryDTO
query
,
String
studentId
);
StudentScoreVO
.
Detail
detail
(
Integer
examStudentId
,
String
studentId
);
void
export
(
Integer
examStudentId
,
String
studentId
,
HttpServletResponse
response
);
}
practical-business/src/main/java/com/platform/business/service/impl/ExamServiceImpl.java
View file @
eca651ce
package
com.platform.business.service.impl
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.google.common.collect.Lists
;
import
com.platform.business.mapper.ExamMapper
;
import
com.platform.business.model.dto.ExamDTO
;
import
com.platform.business.model.dto.TheoreticalPaperStudentDetailDTO
;
import
com.platform.business.model.entity.*
;
import
com.platform.business.model.entity.ExamEntity
;
import
com.platform.business.model.entity.ExamStudentEntity
;
import
com.platform.business.model.entity.SysLevelEntity
;
import
com.platform.business.model.entity.UserEntity
;
import
com.platform.business.model.vo.ExamStudentVO
;
import
com.platform.business.model.vo.ExamVO
;
import
com.platform.business.model.vo.TheoreticalPaperStudentDetailVO
;
import
com.platform.business.service.*
;
import
com.platform.model.resp.Result
;
import
com.platform.business.service.ExamService
;
import
com.platform.business.service.ExamStudentService
;
import
com.platform.business.service.SysLevelService
;
import
com.platform.business.service.UserService
;
import
com.platform.utils.DozerUtils
;
import
com.platform.utils.StringUtils
;
import
org.springframework.stereotype.Service
;
...
...
@@ -21,29 +23,26 @@ import org.springframework.transaction.annotation.Transactional;
import
org.springframework.util.ObjectUtils
;
import
javax.annotation.Resource
;
import
java.time.Instant
;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.List
;
import
java.util.StringJoiner
;
/**
* 通用及历史后台考试服务。
*
* <p>学员考试中心和“我的成绩”逻辑已经分别迁移到StudentExamCenterService与
* StudentScoreService,本服务不再承载学生端作答或成绩详情。</p>
*/
@Service
public
class
ExamServiceImpl
extends
ServiceImpl
<
ExamMapper
,
ExamEntity
>
implements
ExamService
{
@Resource
private
ExamStudentService
examStudentService
;
@Resource
private
SysLevelService
sysLevelService
;
@Resource
private
TheoreticalPaperService
theoreticalPaperService
;
@Resource
private
TheoreticalPaperDetailService
theoreticalPaperDetailService
;
@Resource
private
UserService
userService
;
@Resource
private
TheoreticalPaperStudentDetailService
theoreticalPaperStudentDetailService
;
@Override
public
List
<
ExamVO
>
queryList
(
ExamDTO
examDTO
)
{
...
...
@@ -51,22 +50,21 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, ExamEntity> impleme
}
@Override
@Transactional
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
saveOrUpdateExam
(
ExamDTO
examDTO
)
{
//保存考试
ExamEntity
examEntity
=
DozerUtils
.
convertBean
(
examDTO
,
ExamEntity
.
class
);
saveOrUpdate
(
examEntity
);
List
<
String
>
studentList
=
examDTO
.
getExamStudentList
();
if
(
CollUtil
.
isNotEmpty
(
studentList
))
{
//删除旧数据
examStudentService
.
remove
(
new
LambdaQueryWrapper
<
ExamStudentEntity
>()
.
eq
(
ExamStudentEntity:
:
getExamId
,
examEntity
.
getId
()));
//保存学生,初始化学生集合
List
<
ExamStudentEntity
>
examStudentEntityList
=
Lists
.
newArrayList
()
;
studentList
.
forEach
(
studentId
->
examStudentEntityList
.
add
(
ExamStudentEntity
.
builder
()
.
studentId
(
studentId
)
examStudentService
.
remove
(
new
LambdaQueryWrapper
<
ExamStudentEntity
>()
.
eq
(
ExamStudentEntity:
:
getExamId
,
examEntity
.
getId
()));
List
<
ExamStudentEntity
>
candidates
=
Lists
.
newArrayList
();
studentList
.
forEach
(
studentId
->
candidates
.
add
(
ExamStudentEntity
.
builder
()
.
studentId
(
studentId
)
.
examId
(
examEntity
.
getId
())
.
classId
(
examEntity
.
getClassId
())
.
build
()));
examStudentService
.
saveBatch
(
examStudentEntityList
);
examStudentService
.
saveBatch
(
candidates
);
}
return
true
;
}
...
...
@@ -74,24 +72,25 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, ExamEntity> impleme
@Override
public
ExamVO
detail
(
int
id
)
{
ExamVO
examVO
=
baseMapper
.
getInfoById
(
id
);
//拼接监考教师信息
if
(
examVO
==
null
)
{
return
null
;
}
String
invigilationId
=
examVO
.
getInvigilationId
();
if
(
StringUtils
.
isNotEmpty
(
invigilationId
))
{
StringJoiner
invigilationName
=
new
StringJoiner
(
","
);
String
[]
split
=
invigilationId
.
split
(
","
);
for
(
String
s
:
split
)
{
UserEntity
user
=
userService
.
getById
(
s
);
invigilationName
.
add
(
user
.
getNickName
());
StringJoiner
names
=
new
StringJoiner
(
","
);
for
(
String
teacherId
:
invigilationId
.
split
(
","
))
{
UserEntity
user
=
userService
.
getById
(
teacherId
);
if
(
user
!=
null
)
{
names
.
add
(
user
.
getNickName
());
}
}
examVO
.
setInvigilationName
(
invigilationN
ame
.
toString
());
examVO
.
setInvigilationName
(
n
ame
s
.
toString
());
}
SysLevelEntity
sysL
evel
=
sysLevelService
.
getById
(
examVO
.
getLevel
());
if
(!
ObjectUtils
.
isEmpty
(
sysL
evel
))
{
examVO
.
setLevel
(
sysL
evel
.
getName
());
SysLevelEntity
l
evel
=
sysLevelService
.
getById
(
examVO
.
getLevel
());
if
(!
ObjectUtils
.
isEmpty
(
l
evel
))
{
examVO
.
setLevel
(
l
evel
.
getName
());
}
//查看考试关联的学员
List
<
ExamStudentVO
>
examStudentVOList
=
examStudentService
.
queryByExamId
(
id
);
examVO
.
setExamStudentList
(
examStudentVOList
);
examVO
.
setExamStudentList
(
examStudentService
.
queryByExamId
(
id
));
return
examVO
;
}
...
...
@@ -114,386 +113,4 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, ExamEntity> impleme
public
List
<
ExamVO
>
queryByClassId
(
Integer
classId
)
{
return
baseMapper
.
queryByClassId
(
classId
);
}
@Override
public
List
<
ExamVO
>
unfinished
(
ExamDTO
examDTO
)
{
return
baseMapper
.
unfinished
(
examDTO
);
}
@Override
@Transactional
public
Result
<
Integer
>
startExam
(
ExamDTO
examDTO
)
{
//查询考试详情
ExamEntity
exam
=
this
.
getById
(
examDTO
.
getId
());
//判断有没有到考试时间
long
currentTimeMillis
=
System
.
currentTimeMillis
();
if
(
currentTimeMillis
<
exam
.
getExamTime
().
getTime
())
{
return
Result
.
fail
(
"考试未开始"
);
}
//检查是否已经开始考试
ExamStudentEntity
examStudent
=
examStudentService
.
getOne
(
new
LambdaQueryWrapper
<
ExamStudentEntity
>()
.
eq
(
ExamStudentEntity:
:
getExamId
,
examDTO
.
getId
())
.
eq
(
ExamStudentEntity:
:
getStudentId
,
examDTO
.
getUserId
())
// 与管理员考试编辑/删除使用同一行锁,避免临近开考时应考关系被并发移除。
.
last
(
"for update"
));
if
(
ObjectUtils
.
isEmpty
(
examStudent
))
{
return
Result
.
fail
(
"您不在本场考试名单中,或考试计划已取消"
);
}
if
(!
ObjectUtils
.
isEmpty
(
examStudent
.
getEndTime
()))
{
return
Result
.
fail
(
"考试已开始"
);
}
//检查是否已经考完试
if
(
examStudent
.
getSubmit
())
{
return
Result
.
fail
(
"考试已结束"
);
}
//检查试卷是否已经生成
long
count
=
theoreticalPaperStudentDetailService
.
count
(
new
LambdaQueryWrapper
<
TheoreticalPaperStudentDetailEntity
>()
.
eq
(
TheoreticalPaperStudentDetailEntity:
:
getExamId
,
examStudent
.
getExamId
()).
eq
(
TheoreticalPaperStudentDetailEntity:
:
getStudentId
,
examStudent
.
getId
()));
if
(
count
>
0
)
{
return
Result
.
fail
(
"考试试卷已生成"
);
}
//设置考试开始和结束时间
examStudent
.
setAnswerTime
(
format
(
currentTimeMillis
,
"yyyy.MM.dd HH:mm:ss"
));
examStudent
.
setStartTime
(
currentTimeMillis
);
long
endTime
=
currentTimeMillis
+
exam
.
getDuration
()
*
60
*
1000
;
examStudent
.
setEndTime
(
endTime
);
examStudentService
.
updateById
(
examStudent
);
//创建实际考试试卷详情
//查询理论试卷
TheoreticalPaperEntity
theoreticalPaper
=
theoreticalPaperService
.
getById
(
exam
.
getPaperId
());
List
<
TheoreticalPaperStudentDetailEntity
>
paperStudentDetailList
=
new
ArrayList
<>();
//判断是否需要乱序
List
<
TheoreticalPaperDetailEntity
>
theoreticalPaperDetailList
;
if
(
"乱序"
.
equals
(
theoreticalPaper
.
getSequence
()))
{
theoreticalPaperDetailList
=
theoreticalPaperDetailService
.
selectDisorderly
(
exam
.
getPaperId
());
}
else
{
theoreticalPaperDetailList
=
theoreticalPaperDetailService
.
list
(
new
LambdaQueryWrapper
<
TheoreticalPaperDetailEntity
>()
.
eq
(
TheoreticalPaperDetailEntity:
:
getPaperId
,
exam
.
getPaperId
()));
}
//考生个人试卷详情入库
for
(
TheoreticalPaperDetailEntity
theoreticalPaperDetail
:
theoreticalPaperDetailList
)
{
TheoreticalPaperStudentDetailEntity
theoreticalPaperStudentDetail
=
BeanUtil
.
copyProperties
(
theoreticalPaperDetail
,
TheoreticalPaperStudentDetailEntity
.
class
);
theoreticalPaperStudentDetail
.
setId
(
null
);
theoreticalPaperStudentDetail
.
setStudentId
(
examDTO
.
getUserId
());
theoreticalPaperStudentDetail
.
setExamId
(
examDTO
.
getId
());
paperStudentDetailList
.
add
(
theoreticalPaperStudentDetail
);
}
theoreticalPaperStudentDetailService
.
saveBatch
(
paperStudentDetailList
);
//设置用户信息标识
UserEntity
user
=
userService
.
getById
(
examDTO
.
getUserId
());
user
.
setExamFlag
(
true
);
user
.
setExamOneselfId
(
examStudent
.
getId
());
userService
.
updateById
(
user
);
return
Result
.
data
(
examStudent
.
getId
());
}
/**
* 将 yyyy.MM.dd HH:mm:ss 格式字符串转换为时间戳
*
* @param dateString 日期字符串,格式如 "2023.10.25 14:30:45"
* @return 时间戳(毫秒)
*/
public
static
long
convertToTimestamp
(
String
dateString
)
{
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy.MM.dd HH:mm:ss"
);
LocalDateTime
localDateTime
=
LocalDateTime
.
parse
(
dateString
,
formatter
);
return
localDateTime
.
atZone
(
java
.
time
.
ZoneId
.
systemDefault
()).
toInstant
().
toEpochMilli
();
}
/**
* 将时间戳转换为指定格式的字符串
*
* @param timestamp 时间戳(毫秒)
* @param pattern 日期时间格式
* @return 格式化后的时间字符串
*/
public
static
String
format
(
long
timestamp
,
String
pattern
)
{
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
pattern
);
LocalDateTime
dateTime
=
LocalDateTime
.
ofInstant
(
Instant
.
ofEpochMilli
(
timestamp
),
ZoneId
.
systemDefault
());
return
dateTime
.
format
(
formatter
);
}
@Override
public
List
<
TheoreticalPaperStudentDetailVO
>
paperOverview
(
Integer
id
)
{
//查询考生个人信息
ExamStudentEntity
examStudent
=
examStudentService
.
getById
(
id
);
//查询试题数量和分值
List
<
TheoreticalPaperStudentDetailVO
>
result
=
baseMapper
.
numberAndScore
(
examStudent
.
getStudentId
(),
examStudent
.
getExamId
());
for
(
TheoreticalPaperStudentDetailVO
theoreticalPaperStudentDetailVO
:
result
)
{
if
(
StringUtils
.
isNotEmpty
(
theoreticalPaperStudentDetailVO
.
getType
()))
{
List
<
TheoreticalPaperStudentDetailVO
>
data
=
baseMapper
.
paperOverview
(
examStudent
.
getStudentId
(),
examStudent
.
getExamId
(),
theoreticalPaperStudentDetailVO
.
getType
());
theoreticalPaperStudentDetailVO
.
setData
(
data
);
}
}
return
result
;
}
@Override
public
ExamStudentVO
paperDetail
(
Integer
id
)
{
int
finishNum
=
0
;
ExamStudentVO
examStudentVO
=
examStudentService
.
paperDetail
(
id
);
//查询进度
List
<
TheoreticalPaperStudentDetailVO
>
processList
=
theoreticalPaperStudentDetailService
.
process
(
examStudentVO
.
getExamId
(),
examStudentVO
.
getStudentId
());
examStudentVO
.
setTotalNum
(
processList
.
size
());
for
(
TheoreticalPaperStudentDetailVO
process
:
processList
)
{
if
(
StringUtils
.
isNotEmpty
(
process
.
getActualChoice
()))
{
finishNum
++;
}
}
examStudentVO
.
setFinishNum
(
finishNum
);
return
examStudentVO
;
}
@Override
public
TheoreticalPaperStudentDetailVO
questionDetail
(
String
id
)
{
TheoreticalPaperStudentDetailVO
result
=
theoreticalPaperStudentDetailService
.
questionDetail
(
id
);
//查询题数
long
count
=
theoreticalPaperStudentDetailService
.
count
(
new
LambdaQueryWrapper
<
TheoreticalPaperStudentDetailEntity
>()
.
eq
(
TheoreticalPaperStudentDetailEntity:
:
getExamId
,
result
.
getExamId
())
.
eq
(
TheoreticalPaperStudentDetailEntity:
:
getStudentId
,
result
.
getStudentId
())
.
eq
(
TheoreticalPaperStudentDetailEntity:
:
getType
,
result
.
getType
()));
result
.
setNum
((
int
)
count
);
return
result
;
}
@Override
public
Boolean
questionEdit
(
TheoreticalPaperStudentDetailDTO
theoreticalPaperStudentDetailDTO
)
{
if
(
StringUtils
.
isEmpty
(
theoreticalPaperStudentDetailDTO
.
getActualChoice
()))
{
return
theoreticalPaperStudentDetailService
.
leaveBlank
(
theoreticalPaperStudentDetailDTO
);
}
else
{
return
theoreticalPaperStudentDetailService
.
updateById
(
theoreticalPaperStudentDetailDTO
);
}
}
@Override
public
Map
<
String
,
String
>
submitCheck
(
String
id
)
{
Map
<
String
,
String
>
result
=
new
HashMap
<>();
//查询考生个人信息
ExamStudentEntity
examStudent
=
examStudentService
.
getById
(
id
);
//查询考试信息
ExamEntity
exam
=
this
.
getById
(
examStudent
.
getExamId
());
//判断是否在禁止交卷时间内
if
(
examStudent
.
getStartTime
()
+
exam
.
getForbid
()
*
60
*
1000
>
System
.
currentTimeMillis
())
{
result
.
put
(
"first"
,
"暂不支持交卷,请继续作答"
);
result
.
put
(
"second"
,
"考试开始"
+
exam
.
getForbid
()
+
"分钟内,禁止交卷。"
);
return
result
;
}
//判断题目是否都做完
long
count
=
theoreticalPaperStudentDetailService
.
count
(
new
LambdaQueryWrapper
<
TheoreticalPaperStudentDetailEntity
>()
.
eq
(
TheoreticalPaperStudentDetailEntity:
:
getExamId
,
examStudent
.
getExamId
())
.
eq
(
TheoreticalPaperStudentDetailEntity:
:
getStudentId
,
examStudent
.
getStudentId
())
.
isNull
(
TheoreticalPaperStudentDetailEntity:
:
getActualChoice
));
if
(
count
>
0
)
{
result
.
put
(
"first"
,
"您还有"
+
count
+
"道题目未答,是否交卷?"
);
result
.
put
(
"second"
,
"提示:倒计时结束后会自动保存答案并交卷"
);
}
else
{
result
.
put
(
"first"
,
"您已完成作答,是否交卷?"
);
result
.
put
(
"second"
,
"提示:倒计时结束后会自动保存答案并交卷"
);
}
return
result
;
}
@Override
@Transactional
public
Result
<
Boolean
>
submit
(
String
id
)
{
//总分
double
score
=
0
;
//查询考生个人信息
ExamStudentEntity
examStudent
=
examStudentService
.
getById
(
id
);
//检查是否重复交卷
if
(
examStudent
.
getSubmit
())
{
return
Result
.
fail
(
"请勿重复交卷"
);
}
//修改登陆信息
userService
.
closeExam
(
examStudent
.
getStudentId
());
//判题
List
<
TheoreticalPaperStudentDetailEntity
>
theoreticalPaperStudentDetailList
=
theoreticalPaperStudentDetailService
.
list
(
new
LambdaQueryWrapper
<
TheoreticalPaperStudentDetailEntity
>()
.
eq
(
TheoreticalPaperStudentDetailEntity:
:
getExamId
,
examStudent
.
getExamId
())
.
eq
(
TheoreticalPaperStudentDetailEntity:
:
getStudentId
,
examStudent
.
getStudentId
()));
for
(
TheoreticalPaperStudentDetailEntity
theoreticalPaperStudentDetail
:
theoreticalPaperStudentDetailList
)
{
if
(
StringUtils
.
isNotEmpty
(
theoreticalPaperStudentDetail
.
getActualChoice
()))
{
if
(
theoreticalPaperStudentDetail
.
getActualChoice
().
equals
(
theoreticalPaperStudentDetail
.
getAnswer
()))
{
theoreticalPaperStudentDetail
.
setResult
(
true
);
score
+=
theoreticalPaperStudentDetail
.
getScore
();
}
else
{
theoreticalPaperStudentDetail
.
setResult
(
false
);
}
}
}
theoreticalPaperStudentDetailService
.
updateBatchById
(
theoreticalPaperStudentDetailList
);
examStudent
.
setSubmit
(
true
);
examStudent
.
setScore
(
score
);
//计算答题时长
long
time
=
System
.
currentTimeMillis
()
-
examStudent
.
getStartTime
();
examStudent
.
setDuration
(
convertWithTimeUnit
(
time
));
examStudent
.
setAnswerTime
(
examStudent
.
getAnswerTime
()
+
"-"
+
format
(
System
.
currentTimeMillis
(),
"yyyy.MM.dd HH:mm:ss"
));
return
Result
.
data
(
examStudentService
.
updateById
(
examStudent
));
}
public
String
convertWithTimeUnit
(
long
milliseconds
)
{
if
(
milliseconds
<
0
)
{
return
"00:00:00"
;
}
long
hours
=
TimeUnit
.
MILLISECONDS
.
toHours
(
milliseconds
);
long
minutes
=
TimeUnit
.
MILLISECONDS
.
toMinutes
(
milliseconds
)
-
TimeUnit
.
HOURS
.
toMinutes
(
hours
);
long
seconds
=
TimeUnit
.
MILLISECONDS
.
toSeconds
(
milliseconds
)
-
TimeUnit
.
MINUTES
.
toSeconds
(
TimeUnit
.
MILLISECONDS
.
toMinutes
(
milliseconds
));
return
String
.
format
(
"%02d:%02d:%02d"
,
hours
,
minutes
,
seconds
);
}
@Override
public
TheoreticalPaperStudentDetailVO
gradesQuestionDetail
(
String
id
)
{
TheoreticalPaperStudentDetailVO
result
=
theoreticalPaperStudentDetailService
.
gradesQuestionDetail
(
id
);
//查询题数
long
count
=
theoreticalPaperStudentDetailService
.
count
(
new
LambdaQueryWrapper
<
TheoreticalPaperStudentDetailEntity
>()
.
eq
(
TheoreticalPaperStudentDetailEntity:
:
getExamId
,
result
.
getExamId
())
.
eq
(
TheoreticalPaperStudentDetailEntity:
:
getStudentId
,
result
.
getStudentId
())
.
eq
(
TheoreticalPaperStudentDetailEntity:
:
getType
,
result
.
getType
()));
result
.
setNum
((
int
)
count
);
//查询同类型答对数量和得分
TheoreticalPaperStudentDetailVO
same
=
baseMapper
.
same
(
result
.
getExamId
(),
result
.
getStudentId
(),
result
.
getType
());
result
.
setSameRightNum
(
same
.
getSameRightNum
());
result
.
setSameScore
(
same
.
getSameScore
());
return
result
;
}
@Override
public
ExamStudentVO
gradesDetail
(
String
id
)
{
return
baseMapper
.
gradesDetail
(
id
);
}
@Override
public
ExamStudentVO
gradesSummary
(
String
id
)
{
//考试名称,考试类型,考试时间,班级名称,本次成绩,班级排名
ExamStudentVO
result
=
baseMapper
.
gradesSummary
(
id
);
//成绩标签
Double
score
=
judgeExamResult
(
result
);
//班级均分
List
<
ExamStudentEntity
>
examStudentList
=
examStudentService
.
list
(
new
LambdaQueryWrapper
<
ExamStudentEntity
>()
.
eq
(
ExamStudentEntity:
:
getExamId
,
result
.
getExamId
()));
double
totalScore
=
0
;
for
(
ExamStudentEntity
examStudentEntity
:
examStudentList
)
{
if
(
examStudentEntity
.
getScore
()
!=
null
)
{
totalScore
+=
examStudentEntity
.
getScore
();
}
}
result
.
setAvgScore
(
totalScore
/
examStudentList
.
size
());
//和班级均分比较
if
(
result
.
getAvgScore
()
!=
null
&&
score
!=
null
)
{
if
(
result
.
getScore
()
>
result
.
getAvgScore
())
{
result
.
setScoreLabel
(
"高于均分"
+
(
result
.
getScore
()
-
result
.
getAvgScore
()));
}
else
if
(
result
.
getScore
().
equals
(
result
.
getAvgScore
()))
{
result
.
setScoreLabel
(
"等于均分"
);
}
else
{
result
.
setScoreLabel
(
"低于均分"
+
(
result
.
getAvgScore
()
-
result
.
getScore
()));
}
}
//班级人数
result
.
setClassNum
(
examStudentList
.
size
());
int
rightNum
=
0
;
int
wrongNum
=
0
;
int
partiallyRightNum
=
0
;
int
totalNum
=
0
;
List
<
TheoreticalPaperStudentDetailEntity
>
list
=
theoreticalPaperStudentDetailService
.
list
(
new
LambdaQueryWrapper
<
TheoreticalPaperStudentDetailEntity
>()
.
eq
(
TheoreticalPaperStudentDetailEntity:
:
getExamId
,
result
.
getExamId
())
.
eq
(
TheoreticalPaperStudentDetailEntity:
:
getStudentId
,
result
.
getStudentId
()));
for
(
TheoreticalPaperStudentDetailEntity
theoreticalPaperStudentDetail
:
list
)
{
if
(!
"主观题"
.
equals
(
theoreticalPaperStudentDetail
.
getType
())){
if
(
theoreticalPaperStudentDetail
.
getIsPartiallyRight
())
{
partiallyRightNum
++;
}
else
{
if
(
theoreticalPaperStudentDetail
.
getResult
()){
rightNum
++;
}
else
{
wrongNum
++;
}
}
totalNum
++;
}
}
//答对题数
result
.
setRightNum
(
rightNum
);
//部分对题数
result
.
setPartiallyRightNum
(
partiallyRightNum
);
//答错题数
result
.
setWrongNum
(
wrongNum
);
//正确率
result
.
setCorrectRate
(
String
.
format
(
"%.2f%%"
,
(
double
)
rightNum
/
totalNum
*
100
));
return
result
;
}
@Override
public
Map
<
String
,
ExamStudentVO
>
gradesAnalysis
(
String
id
)
{
//获取考试基础信息
ExamStudentEntity
examStudent
=
examStudentService
.
getById
(
id
);
//个人
List
<
ExamStudentVO
>
personal
=
baseMapper
.
gradesAnalysis
(
examStudent
.
getExamId
(),
examStudent
.
getStudentId
());
//班级
List
<
ExamStudentVO
>
classList
=
baseMapper
.
gradesAnalysis
(
examStudent
.
getExamId
(),
null
);
Map
<
String
,
ExamStudentVO
>
result
=
new
HashMap
<>();
result
.
put
(
"个人"
,
personal
.
get
(
0
));
result
.
put
(
"班级"
,
classList
.
get
(
0
));
return
result
;
}
@Override
public
ExamStudentVO
gradesStatistics
(
String
id
)
{
ExamStudentVO
result
=
baseMapper
.
gradesStatistics
(
id
);
//考试结果
judgeExamResult
(
result
);
return
result
;
}
@Override
public
List
<
TheoreticalPaperStudentDetailVO
>
gradesNavigation
(
String
id
)
{
//获取考试基础信息
ExamStudentEntity
examStudent
=
examStudentService
.
getById
(
id
);
List
<
TheoreticalPaperStudentDetailVO
>
result
=
theoreticalPaperStudentDetailService
.
gradesNavigation
(
examStudent
.
getExamId
(),
examStudent
.
getStudentId
());
//判断答题结果
judgeAnswerResult
(
result
);
return
result
;
}
@Override
public
List
<
TheoreticalPaperStudentDetailVO
>
gradesList
(
String
id
)
{
//获取考试基础信息
ExamStudentEntity
examStudent
=
examStudentService
.
getById
(
id
);
List
<
TheoreticalPaperStudentDetailVO
>
result
=
theoreticalPaperStudentDetailService
.
gradesList
(
examStudent
.
getExamId
(),
examStudent
.
getStudentId
());
//判断答题结果
judgeAnswerResult
(
result
);
return
result
;
}
private
static
void
judgeAnswerResult
(
List
<
TheoreticalPaperStudentDetailVO
>
result
)
{
for
(
TheoreticalPaperStudentDetailVO
theoreticalPaperStudentDetailVO
:
result
)
{
if
(
theoreticalPaperStudentDetailVO
.
getIsPartiallyRight
())
{
theoreticalPaperStudentDetailVO
.
setResultDesc
(
"部分对"
);
}
else
{
if
(
theoreticalPaperStudentDetailVO
.
getResult
()){
theoreticalPaperStudentDetailVO
.
setResultDesc
(
"答对"
);
}
else
{
theoreticalPaperStudentDetailVO
.
setResultDesc
(
"答错"
);
}
}
}
}
private
static
Double
judgeExamResult
(
ExamStudentVO
result
)
{
Double
score
=
result
.
getScore
();
if
(
score
!=
null
)
{
if
(
score
>=
90
)
{
result
.
setScoreLabel
(
"优秀"
);
}
else
if
(
score
>=
80
)
{
result
.
setScoreLabel
(
"良好"
);
}
else
if
(
score
>=
60
)
{
result
.
setScoreLabel
(
"及格"
);
}
else
{
result
.
setScoreLabel
(
"不合格"
);
}
}
return
score
;
}
}
practical-business/src/main/java/com/platform/business/service/impl/ExamStaudentServiceImpl.java
View file @
eca651ce
...
...
@@ -2,24 +2,16 @@ package com.platform.business.service.impl;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.platform.business.mapper.ExamStudentMapper
;
import
com.platform.business.model.dto.ExamStudentDTO
;
import
com.platform.business.model.entity.ExamStudentEntity
;
import
com.platform.business.model.vo.ExamStudentVO
;
import
com.platform.business.service.ExamStudentService
;
import
com.platform.business.service.UserService
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Service
public
class
ExamStaudentServiceImpl
extends
ServiceImpl
<
ExamStudentMapper
,
ExamStudentEntity
>
implements
ExamStudentService
{
@Resource
private
UserService
userService
;
@Override
public
List
<
ExamStudentVO
>
queryByExamId
(
int
id
)
{
return
baseMapper
.
queryByExamId
(
id
);
...
...
@@ -31,16 +23,6 @@ public class ExamStaudentServiceImpl extends ServiceImpl<ExamStudentMapper, Exam
return
baseMapper
.
queryByClassIdAndExamId
(
classId
,
examId
);
}
@Override
public
List
<
ExamStudentVO
>
page
(
ExamStudentDTO
examStudentDTO
)
{
return
baseMapper
.
page
(
examStudentDTO
.
getStudentId
());
}
@Override
public
ExamStudentVO
paperDetail
(
Integer
id
)
{
return
baseMapper
.
paperDetail
(
id
);
}
@Override
public
List
<
ExamStudentVO
>
queryOneself
(
String
userId
)
{
return
baseMapper
.
queryOneself
(
userId
);
...
...
@@ -51,25 +33,4 @@ public class ExamStaudentServiceImpl extends ServiceImpl<ExamStudentMapper, Exam
return
baseMapper
.
queryOneselfTeacher
(
userId
);
}
@Override
public
Map
<
String
,
String
>
summary
(
String
studentId
)
{
Map
<
String
,
String
>
result
=
new
HashMap
<>();
Map
<
String
,
String
>
summary
=
baseMapper
.
summary
(
studentId
);
if
(
summary
!=
null
&&
!
summary
.
isEmpty
())
{
result
.
put
(
"平均成绩"
,
summary
.
get
(
"overallAvgScore"
));
result
.
put
(
"班级排名"
,
summary
.
get
(
"classRank"
));
result
.
put
(
"最高分"
,
summary
.
get
(
"highestScore"
));
result
.
put
(
"考试次数"
,
summary
.
get
(
"examCount"
));
}
return
result
;
}
@Override
public
ExamStudentVO
recent
(
String
studentId
)
{
ExamStudentVO
examStudentVO
=
baseMapper
.
recent
(
studentId
);
//获取同一场考试的学生
List
<
ExamStudentVO
>
data
=
baseMapper
.
theSameEvent
(
examStudentVO
.
getExamId
());
examStudentVO
.
setData
(
data
);
return
examStudentVO
;
}
}
Prev
1
2
Next
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