部分接口添加非空判断 防止报错

newBigdata
xiaoCJ 11 months ago
parent a93faada9e
commit e5d59f8a61

@ -279,8 +279,10 @@ public class StuIndexController {
}
}
//实战考核完成进度 = 已做答的考试/ 所有发布的考试
if (stuSize != 0 && totalSize != 0) {
int i = stuSize / totalSize;
allModuleProgressDto.setExamProgress(i);
}
//理论考试完成进度 = 完成5次为100%一次为20%
int completedExamCount = theoryExamMapper.selectByUserID(userId);

@ -66,8 +66,6 @@ public class TeaGradeManageController {
@Autowired
private StuTheoryExamMapper stuTheoryExamMapper;
@Autowired
private SysCaseQuestionMapper sysCaseQuestionMapper;
@Autowired
private SysCaseQuestionStepMapper sysCaseQuestionStepMapper;
@Autowired
private SysObjectiveQuestionMapper sysObjectiveQuestionMapper;
@ -81,6 +79,9 @@ public class TeaGradeManageController {
@ApiParam("ManyAnswer为考试时间JudgeAnswer为发布人") @RequestParam String schoolId) {
List<TeaExamManage> teaExamManages = teaExamManageMapper.selectBySchoolId(schoolId);
if (teaExamManages.isEmpty()) {
return null;
}
List<TeaExamManageCountDto> teaExamManageCountDtos = new ArrayList<>();
Map<String, StuUser> userMap = new HashMap<>();

@ -58,10 +58,11 @@ public interface StuUserMapper {
// int selectNumByClass(@Param("s") String s);
@Select("<script>" +
"select userid,name FROM stu_userinfo WHERE userid IN("
"SELECT userid, name FROM stu_userinfo WHERE userid IN ("
+ "<foreach collection='userIds' separator=',' item='id'>"
+ "#{id}"
+ "</foreach>"
+")</script>")
+ ")" +
"</script>")
List<StuUser> selectByPrimaryKeys(@Param("userIds") List<String> userIds);
}

@ -12,7 +12,6 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
import java.util.Map;
/**
* @Author xcj
@ -72,12 +71,14 @@ public class StuIndexServiceImpl implements StuIndexService {
stuTheoryIndexInfoDto.setTaskNum(examSize);
ReceiveDto receiveDto = teaExamManageMapper.getLastExamScore(userId);//拿到最近考试的得分和 老师设置的题目总分
if (receiveDto != null) {
BigDecimal totalScore = receiveDto.getTotalScore();
BigDecimal stuScore = receiveDto.getStuScore();
if (totalScore.intValue() != 0 && stuScore.intValue() != 0) {
BigDecimal bigDecimal = totalScore.divide(stuScore, 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); //学生得分 / 总分 * 100
stuTheoryIndexInfoDto.setLastTaskAccuracy(bigDecimal); //最近一次考核正确率
}
}
int lastRank = studentExamMapper.selectLastExamRank(userId); // 最近一次考核排名

@ -155,7 +155,7 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
teaExaminationDetailsDto.setGoodNumber(goodNum);
teaExaminationDetailsDto.setGeneralNum(generalNum);
teaExaminationDetailsDto.setFailingNumber(failNumber);
teaExaminationDetailsDto.setCaseName(""); //todo 补充 暂时没有
teaExaminationDetailsDto.setCaseName(""); //todo 错误率最高的三个案例名称 补充 暂时没有
// 返回填充好数值的 teaExaminationDetailsDto 对象
}

Loading…
Cancel
Save