【修改】 1、教师分配科目权限之后BUG修改;2、判分,默认记录所有选择题

This commit is contained in:
DESKTOP-932OMT8\REN
2025-06-05 13:53:42 +08:00
parent 5d84d16b78
commit 905133b810
4 changed files with 47 additions and 15 deletions

View File

@@ -25,6 +25,13 @@ public interface ExamSpecialtyMapper extends BaseMapperX<ExamSpecialty>
* @return 数据信息
*/
public ExamSpecialty selectExamSpecialtyBySpId(Long spId);
/**
* 查询数据parentId
*
* @param parentId 父ID
* @return 数据信息
*/
List<SpecialtyQueryVo> selectExamSpecialtyByParentId(Long parentId);
/**
* 修改数据信息

View File

@@ -34,7 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectExamSpecialtyByids" resultType="pc.exam.pp.module.exam.controller.admin.specialty.vo.SpecialtyQueryVo">
SELECT sp_id AS id, sp_name AS name, parent_id, status, create_time from exam_specialty
SELECT sp_id AS id, sp_name AS name, ancestors, parent_id, status, create_time from exam_specialty
WHERE sp_id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
@@ -91,6 +91,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectExamSpecialtyVo"/>
where sp_id = #{spId}
</select>
<select id="selectExamSpecialtyByParentId" resultType="pc.exam.pp.module.exam.controller.admin.specialty.vo.SpecialtyQueryVo">
SELECT sp_id AS id, sp_name AS name, ancestors, parent_id, status, create_time from exam_specialty
where parent_id = #{parentId}
</select>
<select id="getRoleById" resultType="java.lang.String">
select roles
from exam_specialty where sp_id =#{id};

View File

@@ -180,6 +180,8 @@ public class AutoToolsServiceImpl implements AutoToolsService{
*/
@Override
public CommonResult<BigDecimal> judgementScore(Long stuId, String paperId) throws Exception {
// 先删除考试明细
stuPaperScoreService.deleteStuPaperScore(stuId, paperId);
// 监控管理 生成选择题文件路径
endStuMonitorUtils.endStuMonitor(String.valueOf(stuId), paperId);
// 获取平台文件参数
@@ -224,9 +226,10 @@ public class AutoToolsServiceImpl implements AutoToolsService{
// 1-1-3、进行选择题判分
for (ExamQuestion examQuestion : quList) {
if ("选择题".equals(examQuestion.getSubjectName())) {
for (String key : stu.getQuestionResultMap().keySet()) {
Optional<ExamQuestion> result = quList.stream().filter(quLists -> quLists.getQuId().equals(key)).findFirst();
ExamQuestion examQuestions = result.get();
Optional<String> result = stu.getQuestionResultMap().keySet().stream().filter(strs -> strs.equals(examQuestion.getQuId())).findFirst();
if (!result.isEmpty()) {
String key = result.get();
String value = stu.getQuestionResultMap().get(key);
// 查询该题的成绩
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuId, paperId, key);
// 判断是否做过该题
@@ -238,15 +241,22 @@ public class AutoToolsServiceImpl implements AutoToolsService{
stuPaperScoreDO.setPaperId(paperId);
isNull = true;
}
if (examQuestions != null) {
String value = stu.getQuestionResultMap().get(key);
double selectScore = judgementChoiceService.programmingChoice(Double.parseDouble(examQuestion.getQuScores()), key, value, stuPaperScoreDO, isNull);
score += selectScore;
} else {
// 说明学生没有答题,直接给零分
double selectScore = judgementChoiceService.programmingChoice(Double.parseDouble(examQuestion.getQuScores()), key, "", stuPaperScoreDO, isNull);
score += selectScore;
double selectScore = judgementChoiceService.programmingChoice(Double.parseDouble(examQuestion.getQuScores()), key, value, stuPaperScoreDO, isNull);
score += selectScore;
} else {
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuId, paperId, examQuestion.getQuId());
// 判断是否做过该题
boolean isNull = false;
if (stuPaperScoreDO == null) {
stuPaperScoreDO = new StuPaperScoreDO();
stuPaperScoreDO.setStuId(stuId);
stuPaperScoreDO.setQuId(examQuestion.getQuId());
stuPaperScoreDO.setPaperId(paperId);
isNull = true;
}
// 说明学生没有答题,直接给零分
double selectScore = judgementChoiceService.programmingChoice(Double.parseDouble(examQuestion.getQuScores()), examQuestion.getQuId(), "", stuPaperScoreDO, isNull);
score += selectScore;
}
}
}

View File

@@ -17,6 +17,7 @@ import pc.exam.pp.module.exam.controller.admin.classs.vo.ClassSaveReqVO;
import pc.exam.pp.module.exam.controller.admin.specialty.vo.SpecialtListByUserReqVo;
import pc.exam.pp.module.exam.controller.admin.specialty.vo.SpecialtyQueryVo;
import pc.exam.pp.module.exam.dal.dataobject.classs.ClassDO;
import pc.exam.pp.module.exam.dal.dataobject.specialty.ExamSpecialty;
import pc.exam.pp.module.exam.dal.mysql.classs.ClassMapper;
import pc.exam.pp.module.exam.dal.mysql.specialty.ExamSpecialtyMapper;
import pc.exam.pp.module.exam.service.classs.ClassService;
@@ -829,14 +830,23 @@ public class AdminUserServiceImpl implements AdminUserService {
// 查询所有专业数据
specialtyQueryVos = examSpecialtyMapper.selectExamSpecialtyAll();
} else {
// 判断专业是否为空,为空的话查询所有
if (adminUserDO.getClassIds() != null) {
if (adminUserDO.getSpecialtyIds() == null) {
// 查询所有数据
specialtyQueryVos = examSpecialtyMapper.selectExamSpecialtyAll();
} else {
// 查询部分数据
specialtyQueryVos = examSpecialtyMapper.selectExamSpecialtyByids(adminUserDO.getClassIds());
List<SpecialtyQueryVo> specialtyList = examSpecialtyMapper.selectExamSpecialtyByids(adminUserDO.getSpecialtyIds());
for (SpecialtyQueryVo specialtyQueryVo : specialtyList) {
specialtyQueryVos.add(specialtyQueryVo);
// 查询题型
if (specialtyQueryVo.getAncestors().contains(",")) {
List<SpecialtyQueryVo> specialtyLists = examSpecialtyMapper.selectExamSpecialtyByParentId(specialtyQueryVo.getId());
for (SpecialtyQueryVo specialtyQueryVosInfo : specialtyLists) {
specialtyQueryVos.add(specialtyQueryVosInfo);
}
}
}
}
}
return specialtyQueryVos;