|
|
|
@ -5,8 +5,8 @@ import com.blockchain.common.base.constant.YyyfConstant; |
|
|
|
|
import com.blockchain.server.train.dto.ExamPaperDto; |
|
|
|
|
import com.blockchain.server.train.dto.TrainCaseTargetDto; |
|
|
|
|
import com.blockchain.server.yyyf.dto.PractiseProDto; |
|
|
|
|
import com.blockchain.server.yyyf.dto.StudentTargetErrorStatisticsDto; |
|
|
|
|
import com.blockchain.server.yyyf.entity.AssessUser; |
|
|
|
|
import com.blockchain.server.yyyf.entity.AssessUserTarget; |
|
|
|
|
import com.blockchain.server.yyyf.service.AssessUserService; |
|
|
|
|
import com.blockchain.server.yyyf.service.AssessUserTargetService; |
|
|
|
|
import com.blockchain.server.yyyf.utils.ResponseUtils; |
|
|
|
@ -87,16 +87,15 @@ public class TeachingGradeController { |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
int answerCount= assessUserService.selectCountByByIssueId(issueId); |
|
|
|
|
|
|
|
|
|
Map<String, Object> wrongStatistics = null;//错误信息
|
|
|
|
|
//无人考试 时封装错误率
|
|
|
|
|
if (answerCount==0) { |
|
|
|
|
|
|
|
|
|
//获取案例信息
|
|
|
|
|
HashOperations<String, String, ExamPaperDto> examPaperOpsForHash = redisTemplate.opsForHash(); |
|
|
|
|
ExamPaperDto examPaperDto = examPaperOpsForHash.get(YyyfConstant.EXAM_PAPER_KEY, projectId); |
|
|
|
|
List<TrainCaseTargetDto> trainCaseTargeList = examPaperDto.getTrainCaseTargeList(); |
|
|
|
|
|
|
|
|
|
Map<String, Object> wrongStatistics = null;//错误信息
|
|
|
|
|
//无人考试 时封装错误率
|
|
|
|
|
if (answerCount==0) { |
|
|
|
|
|
|
|
|
|
wrongStatistics = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
Map<String, Object> maxErrorRateInfo = new HashMap<>();//最大错误率信息记录
|
|
|
|
@ -129,7 +128,7 @@ public class TeachingGradeController { |
|
|
|
|
wrongStatistics.put("errorRates", errorRates); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
wrongStatistics = getWrongStatistics(issueId, totalNum - answerCount); |
|
|
|
|
wrongStatistics = getWrongStatistics(issueId, totalNum, trainCaseTargeList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -151,43 +150,43 @@ public class TeachingGradeController { |
|
|
|
|
* @author huan.xu |
|
|
|
|
* @date 2019-11-08 18:27:22 |
|
|
|
|
**/ |
|
|
|
|
private Map<String, Object> getWrongStatistics(String issueId, Integer notExamNum) { |
|
|
|
|
private Map<String, Object> getWrongStatistics(String issueId, Integer totalNum,List<TrainCaseTargetDto> trainCaseTargeList) { |
|
|
|
|
Map<String, Object> wrongStatistics = new HashMap<String, Object>(); |
|
|
|
|
List<AssessUserTarget> list = this.assessUserTargetService.selectAllStudentAssessUserTargetByIssueId(issueId); |
|
|
|
|
List<StudentTargetErrorStatisticsDto> studentTargetErrorStatisticsDtoLis = this.assessUserTargetService.getStudentTargetErrorStatisticsDtoListByIssueId(issueId); |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
Map<String, Object> maxErrorRateInfo = null;//最大错误率信息记录
|
|
|
|
|
Map<String, Object> minErrorRateInfo = null;//最小错误率信息记录
|
|
|
|
|
//记录考核点名称
|
|
|
|
|
String[] taskNames = new String[taskList.size()]; |
|
|
|
|
String[] taskNames = new String[trainCaseTargeList.size()]; |
|
|
|
|
//记录错误率
|
|
|
|
|
double[] errorRates = new double[taskList.size()]; |
|
|
|
|
for (int i = 0; i < taskList.size(); i++) { |
|
|
|
|
Map<String, Object> task = taskList.get(i); |
|
|
|
|
taskNames[i] = task.get("taskName").toString(); |
|
|
|
|
*//*Map<String,Object> con = new HashMap<String,Object>();
|
|
|
|
|
con.put("issueId", issueId); |
|
|
|
|
con.put("classId", classId); |
|
|
|
|
con.put("appTaskId", task.get("appTaskId"));*//*
|
|
|
|
|
double[] errorRates = new double[trainCaseTargeList.size()]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int i=0; |
|
|
|
|
for (TrainCaseTargetDto trainCaseTargetDto:trainCaseTargeList) { |
|
|
|
|
String targetName = trainCaseTargetDto.getName(); |
|
|
|
|
taskNames[i]=targetName ; |
|
|
|
|
|
|
|
|
|
//获取该考核点用户的答题情况
|
|
|
|
|
List<Map<String, Object>> userTasks = new ArrayList<Map<String, Object>>(); |
|
|
|
|
userTasks = userTasksMap.get(task.get("appTaskId")); |
|
|
|
|
int errorCount = notExamNum;//错误人数
|
|
|
|
|
for (Map<String, Object> userTask : userTasks) { |
|
|
|
|
int errorCount = 0;//错误人数
|
|
|
|
|
for (StudentTargetErrorStatisticsDto studentTargetErrorStatisticsDto:studentTargetErrorStatisticsDtoLis) { |
|
|
|
|
//答题错误记录人数
|
|
|
|
|
if (Integer.valueOf(userTask.get("answer").toString()) == 1) { |
|
|
|
|
if(studentTargetErrorStatisticsDto.getTargetId().equals(trainCaseTargetDto.getId())){ |
|
|
|
|
errorCount++; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
int totalNum = userTasks.size() + notExamNum; |
|
|
|
|
|
|
|
|
|
double errorRate = (double) (errorCount) / (double) (totalNum) * 100;//计算错误率
|
|
|
|
|
errorRate = Double.valueOf(String.format("%.2f", errorRate));//四舍五入保留两位小数
|
|
|
|
|
errorRates[i] = errorRate; |
|
|
|
|
//处理最大和最小错误率信息
|
|
|
|
|
if (maxErrorRateInfo == null) { |
|
|
|
|
maxErrorRateInfo = new HashMap<String, Object>(); |
|
|
|
|
maxErrorRateInfo.put("projectName", task.get("projectName").toString()); |
|
|
|
|
maxErrorRateInfo.put("taskName", task.get("taskName").toString()); |
|
|
|
|
maxErrorRateInfo.put("projectName", targetName); |
|
|
|
|
maxErrorRateInfo.put("taskName", targetName); |
|
|
|
|
maxErrorRateInfo.put("headCount", totalNum); |
|
|
|
|
maxErrorRateInfo.put("errorCount", errorCount); |
|
|
|
|
maxErrorRateInfo.put("errorRate", errorRate); |
|
|
|
@ -196,8 +195,8 @@ public class TeachingGradeController { |
|
|
|
|
double prevMaxErrorRate = Double.valueOf(maxErrorRateInfo.get("errorRate").toString()); |
|
|
|
|
if (errorRate > prevMaxErrorRate) { |
|
|
|
|
//本次错误率大于上次,则记录本次信息
|
|
|
|
|
maxErrorRateInfo.put("projectName", task.get("projectName").toString()); |
|
|
|
|
maxErrorRateInfo.put("taskName", task.get("taskName").toString()); |
|
|
|
|
maxErrorRateInfo.put("projectName", targetName); |
|
|
|
|
maxErrorRateInfo.put("taskName",targetName); |
|
|
|
|
maxErrorRateInfo.put("headCount", totalNum); |
|
|
|
|
maxErrorRateInfo.put("errorCount", errorCount); |
|
|
|
|
maxErrorRateInfo.put("errorRate", errorRate); |
|
|
|
@ -205,8 +204,8 @@ public class TeachingGradeController { |
|
|
|
|
} |
|
|
|
|
if (minErrorRateInfo == null) { |
|
|
|
|
minErrorRateInfo = new HashMap<String, Object>(); |
|
|
|
|
minErrorRateInfo.put("projectName", task.get("projectName").toString()); |
|
|
|
|
minErrorRateInfo.put("taskName", task.get("taskName").toString()); |
|
|
|
|
minErrorRateInfo.put("projectName", targetName); |
|
|
|
|
minErrorRateInfo.put("taskName",targetName); |
|
|
|
|
minErrorRateInfo.put("headCount", totalNum); |
|
|
|
|
minErrorRateInfo.put("errorCount", errorCount); |
|
|
|
|
minErrorRateInfo.put("errorRate", errorRate); |
|
|
|
@ -215,8 +214,8 @@ public class TeachingGradeController { |
|
|
|
|
double prevMinErrorRate = Double.valueOf(minErrorRateInfo.get("errorRate").toString()); |
|
|
|
|
if (prevMinErrorRate > errorRate) { |
|
|
|
|
//本次错误率小于上次最小错误率,则记录本次信息
|
|
|
|
|
minErrorRateInfo.put("projectName", task.get("projectName").toString()); |
|
|
|
|
minErrorRateInfo.put("taskName", task.get("taskName").toString()); |
|
|
|
|
minErrorRateInfo.put("projectName",targetName); |
|
|
|
|
minErrorRateInfo.put("taskName", targetName); |
|
|
|
|
minErrorRateInfo.put("headCount", totalNum); |
|
|
|
|
minErrorRateInfo.put("errorCount", errorCount); |
|
|
|
|
minErrorRateInfo.put("errorRate", errorRate); |
|
|
|
@ -226,7 +225,7 @@ public class TeachingGradeController { |
|
|
|
|
wrongStatistics.put("maxErrorRateInfo", maxErrorRateInfo); |
|
|
|
|
wrongStatistics.put("minErrorRateInfo", minErrorRateInfo); |
|
|
|
|
wrongStatistics.put("taskNames", taskNames); |
|
|
|
|
wrongStatistics.put("errorRates", errorRates);*/ |
|
|
|
|
wrongStatistics.put("errorRates", errorRates); |
|
|
|
|
return wrongStatistics; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|