loading添加

pull/1/head
huan.xu 5 years ago
parent c20fd31bba
commit 4de1e30a99
  1. 69
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/TeachingGradeController.java
  2. 3
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserTargetService.java
  3. 6
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserTargetServiceImpl.java

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

@ -1,5 +1,6 @@
package com.blockchain.server.yyyf.service; package com.blockchain.server.yyyf.service;
import com.blockchain.server.yyyf.dto.StudentTargetErrorStatisticsDto;
import com.blockchain.server.yyyf.entity.AssessUserTarget; import com.blockchain.server.yyyf.entity.AssessUserTarget;
import java.util.List; import java.util.List;
@ -29,4 +30,6 @@ public interface AssessUserTargetService{
List<AssessUserTarget> selectAllStudentAssessUserTargetByIssueId(String issueId); List<AssessUserTarget> selectAllStudentAssessUserTargetByIssueId(String issueId);
List<StudentTargetErrorStatisticsDto> getStudentTargetErrorStatisticsDtoListByIssueId(String issueId);
} }

@ -1,5 +1,6 @@
package com.blockchain.server.yyyf.service.impl; package com.blockchain.server.yyyf.service.impl;
import com.blockchain.server.yyyf.dto.StudentTargetErrorStatisticsDto;
import com.blockchain.server.yyyf.entity.AssessUserTarget; import com.blockchain.server.yyyf.entity.AssessUserTarget;
import com.blockchain.server.yyyf.mapper.AssessUserTargetMapper; import com.blockchain.server.yyyf.mapper.AssessUserTargetMapper;
import com.blockchain.server.yyyf.service.AssessUserTargetService; import com.blockchain.server.yyyf.service.AssessUserTargetService;
@ -48,4 +49,9 @@ public class AssessUserTargetServiceImpl implements AssessUserTargetService {
return this.assessUserTargetMapper.selectAllStudentAssessUserTargetByIssueId(issueId); return this.assessUserTargetMapper.selectAllStudentAssessUserTargetByIssueId(issueId);
} }
@Override
public List<StudentTargetErrorStatisticsDto> getStudentTargetErrorStatisticsDtoListByIssueId(String issueId) {
return this.assessUserTargetMapper.getStudentTargetErrorStatisticsDtoListByIssueId(issueId);
}
} }
Loading…
Cancel
Save