|
|
@ -1,22 +1,26 @@ |
|
|
|
package com.blockchain.server.yyyf.controller; |
|
|
|
package com.blockchain.server.yyyf.controller; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
|
|
|
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.PractiseProDto; |
|
|
|
import com.blockchain.server.yyyf.dto.PractiseTaskDto; |
|
|
|
|
|
|
|
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.AssessUserTaskService; |
|
|
|
import com.blockchain.server.yyyf.service.AssessUserTargetService; |
|
|
|
import com.blockchain.server.yyyf.utils.MSExcelUtil; |
|
|
|
|
|
|
|
import com.blockchain.server.yyyf.utils.ResponseUtils; |
|
|
|
import com.blockchain.server.yyyf.utils.ResponseUtils; |
|
|
|
|
|
|
|
|
|
|
|
import io.swagger.annotations.ApiParam; |
|
|
|
import io.swagger.annotations.ApiParam; |
|
|
|
import org.apache.poi.hssf.usermodel.*; |
|
|
|
import org.apache.poi.hssf.usermodel.HSSFCell; |
|
|
|
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFFont; |
|
|
|
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFRichTextString; |
|
|
|
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
|
|
|
import org.apache.poi.hssf.util.HSSFColor; |
|
|
|
import org.apache.poi.hssf.util.HSSFColor; |
|
|
|
import org.apache.poi.ss.util.CellRangeAddress; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
|
|
|
import org.springframework.data.redis.core.HashOperations; |
|
|
|
|
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
import org.springframework.ui.Model; |
|
|
|
import org.springframework.ui.Model; |
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
@ -24,17 +28,14 @@ import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestParam; |
|
|
|
import org.springframework.web.bind.annotation.RequestParam; |
|
|
|
import org.springframework.web.bind.annotation.ResponseBody; |
|
|
|
import org.springframework.web.bind.annotation.ResponseBody; |
|
|
|
import springfox.documentation.annotations.ApiIgnore; |
|
|
|
import springfox.documentation.annotations.ApiIgnore; |
|
|
|
import sun.misc.BASE64Decoder; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.ServletOutputStream; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
|
|
|
import java.net.URLEncoder; |
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author huan.xu |
|
|
|
* @author huan.xu |
|
|
@ -48,12 +49,17 @@ import java.util.*; |
|
|
|
public class TeachingGradeController { |
|
|
|
public class TeachingGradeController { |
|
|
|
protected Logger logger = LoggerFactory.getLogger(TeachingGradeController.class); |
|
|
|
protected Logger logger = LoggerFactory.getLogger(TeachingGradeController.class); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private RedisTemplate redisTemplate; |
|
|
|
|
|
|
|
|
|
|
|
private static final String SYS_CODE = "102"; |
|
|
|
private static final String SYS_CODE = "102"; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private AssessUserService assessUserService; |
|
|
|
private AssessUserService assessUserService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private AssessUserTaskService assessUserTaskService; |
|
|
|
private AssessUserTargetService assessUserTargetService; |
|
|
|
|
|
|
|
|
|
|
|
// @Autowired
|
|
|
|
// @Autowired
|
|
|
|
// private ScoreSynchroService scoreSynchroService;
|
|
|
|
// private ScoreSynchroService scoreSynchroService;
|
|
|
|
|
|
|
|
|
|
|
@ -67,7 +73,7 @@ public class TeachingGradeController { |
|
|
|
* @author huan.xu |
|
|
|
* @author huan.xu |
|
|
|
* @date 2019-11-08 18:03:39 |
|
|
|
* @date 2019-11-08 18:03:39 |
|
|
|
**/ |
|
|
|
**/ |
|
|
|
@GetMapping(value = "/getGradeData"/*,produces = {"application/text;charset=UTF-8"}*/) |
|
|
|
@GetMapping(value = "/getGradeData",produces = {"application/text;charset=UTF-8"}) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@SuppressWarnings("all") |
|
|
|
@SuppressWarnings("all") |
|
|
|
public void getGradeData(HttpServletRequest request, HttpServletResponse response) { |
|
|
|
public void getGradeData(HttpServletRequest request, HttpServletResponse response) { |
|
|
@ -78,16 +84,18 @@ public class TeachingGradeController { |
|
|
|
Integer totalNum = Integer.valueOf(totalNumStr); |
|
|
|
Integer totalNum = Integer.valueOf(totalNumStr); |
|
|
|
|
|
|
|
|
|
|
|
JSONObject json = new JSONObject(); |
|
|
|
JSONObject json = new JSONObject(); |
|
|
|
try {/* |
|
|
|
try { |
|
|
|
//根据考核id 查询所有的有成绩的学生考核概览信息
|
|
|
|
|
|
|
|
List<AssessUser> assessUserList = this.assessUserService.selectAssessUserListByIssueId(issueId); |
|
|
|
int answerCount= assessUserService.selectCountByByIssueId(issueId); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> wrongStatistics = null;//错误信息
|
|
|
|
Map<String, Object> wrongStatistics = null;//错误信息
|
|
|
|
//无人考试 时封装错误率
|
|
|
|
//无人考试 时封装错误率
|
|
|
|
if (assessUserList == null || (assessUserList != null && assessUserList.size() == 0)) { |
|
|
|
if (answerCount==0) { |
|
|
|
|
|
|
|
|
|
|
|
//String projectName = JedisUtil.getMapValue(JedisUtil.bulidKey(Const.TIFPRO_KEY), projectId, TifPro.class).getProjectName();
|
|
|
|
//获取案例信息
|
|
|
|
//获取所有交易关联信息
|
|
|
|
HashOperations<String, String, ExamPaperDto> examPaperOpsForHash = redisTemplate.opsForHash(); |
|
|
|
List<TiftrnDto> tiftrnDtoList = JedisUtil.getMapValueForList(JedisUtil.bulidKey(Const.TIFTRN_KEY), projectId, TiftrnDto.class); |
|
|
|
ExamPaperDto examPaperDto = examPaperOpsForHash.get(YyyfConstant.EXAM_PAPER_KEY, projectId); |
|
|
|
|
|
|
|
List<TrainCaseTargetDto> trainCaseTargeList = examPaperDto.getTrainCaseTargeList(); |
|
|
|
|
|
|
|
|
|
|
|
wrongStatistics = new HashMap<>(); |
|
|
|
wrongStatistics = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
@ -95,49 +103,24 @@ public class TeachingGradeController { |
|
|
|
Map<String, Object> minErrorRateInfo = new HashMap<>();//最小错误率信息记录
|
|
|
|
Map<String, Object> minErrorRateInfo = new HashMap<>();//最小错误率信息记录
|
|
|
|
List<String> taskNames = new ArrayList<>(); |
|
|
|
List<String> taskNames = new ArrayList<>(); |
|
|
|
List<Double> errorRates = new ArrayList<>(); |
|
|
|
List<Double> errorRates = new ArrayList<>(); |
|
|
|
for (TiftrnDto tifDtotrn : tiftrnDtoList) { |
|
|
|
for (TrainCaseTargetDto trainCaseTargetDto : trainCaseTargeList) { |
|
|
|
List<TestPointDto> testPoints = tifDtotrn.getTestPoints(); |
|
|
|
taskNames.add(trainCaseTargetDto.getName()); |
|
|
|
if (testPoints != null && testPoints.size() != 0) { |
|
|
|
errorRates.add(Double.valueOf(100)); |
|
|
|
for (TestPointDto testPointDto : testPoints) { |
|
|
|
if (maxErrorRateInfo.size() == 0) { |
|
|
|
taskNames.add(testPointDto.getPointName()); |
|
|
|
maxErrorRateInfo.put("headCount", totalNum); |
|
|
|
errorRates.add(Double.valueOf(100)); |
|
|
|
maxErrorRateInfo.put("taskName", trainCaseTargetDto.getName()); |
|
|
|
if (maxErrorRateInfo.size() == 0) { |
|
|
|
maxErrorRateInfo.put("errorRate", Double.valueOf(100)); |
|
|
|
maxErrorRateInfo.put("headCount", totalNum); |
|
|
|
maxErrorRateInfo.put("projectName",trainCaseTargetDto.getName()); |
|
|
|
maxErrorRateInfo.put("taskName", testPointDto.getPointName()); |
|
|
|
maxErrorRateInfo.put("errorCount", totalNum); |
|
|
|
maxErrorRateInfo.put("errorRate", Double.valueOf(100)); |
|
|
|
continue; |
|
|
|
maxErrorRateInfo.put("projectName", tifDtotrn.getTrxName()); |
|
|
|
} |
|
|
|
maxErrorRateInfo.put("errorCount", totalNum); |
|
|
|
if (minErrorRateInfo.size() == 0) { |
|
|
|
continue; |
|
|
|
minErrorRateInfo.put("headCount", totalNum); |
|
|
|
} |
|
|
|
minErrorRateInfo.put("taskName", trainCaseTargetDto.getName()); |
|
|
|
if (minErrorRateInfo.size() == 0) { |
|
|
|
minErrorRateInfo.put("errorRate", Double.valueOf(100)); |
|
|
|
minErrorRateInfo.put("headCount", totalNum); |
|
|
|
minErrorRateInfo.put("projectName", trainCaseTargetDto.getName()); |
|
|
|
minErrorRateInfo.put("taskName", testPointDto.getPointName()); |
|
|
|
minErrorRateInfo.put("errorCount", totalNum); |
|
|
|
minErrorRateInfo.put("errorRate", Double.valueOf(100)); |
|
|
|
continue; |
|
|
|
minErrorRateInfo.put("projectName", tifDtotrn.getTrxName()); |
|
|
|
|
|
|
|
minErrorRateInfo.put("errorCount", totalNum); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
taskNames.add(tifDtotrn.getTrxName()); |
|
|
|
|
|
|
|
errorRates.add(Double.valueOf(100)); |
|
|
|
|
|
|
|
if (maxErrorRateInfo.size() == 0) { |
|
|
|
|
|
|
|
maxErrorRateInfo.put("headCount", totalNum); |
|
|
|
|
|
|
|
maxErrorRateInfo.put("taskName", tifDtotrn.getTrxName()); |
|
|
|
|
|
|
|
maxErrorRateInfo.put("errorRate", Double.valueOf(100)); |
|
|
|
|
|
|
|
maxErrorRateInfo.put("projectName", tifDtotrn.getTrxName()); |
|
|
|
|
|
|
|
maxErrorRateInfo.put("errorCount", totalNum); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (minErrorRateInfo.size() == 0) { |
|
|
|
|
|
|
|
minErrorRateInfo.put("headCount", totalNum); |
|
|
|
|
|
|
|
minErrorRateInfo.put("taskName", tifDtotrn.getTrxName()); |
|
|
|
|
|
|
|
minErrorRateInfo.put("errorRate", Double.valueOf(100)); |
|
|
|
|
|
|
|
minErrorRateInfo.put("projectName", tifDtotrn.getTrxName()); |
|
|
|
|
|
|
|
minErrorRateInfo.put("errorCount", totalNum); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
wrongStatistics.put("maxErrorRateInfo", maxErrorRateInfo); |
|
|
|
wrongStatistics.put("maxErrorRateInfo", maxErrorRateInfo); |
|
|
@ -146,12 +129,12 @@ public class TeachingGradeController { |
|
|
|
wrongStatistics.put("errorRates", errorRates); |
|
|
|
wrongStatistics.put("errorRates", errorRates); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
wrongStatistics = getWrongStatistics(issueId, totalNum - assessUserList.size()); |
|
|
|
wrongStatistics = getWrongStatistics(issueId, totalNum - answerCount); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
json.put("result", true); |
|
|
|
json.put("result", true); |
|
|
|
json.put("wrongStatistics", wrongStatistics);*/ |
|
|
|
json.put("wrongStatistics", wrongStatistics); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
json.put("result", false); |
|
|
|
json.put("result", false); |
|
|
|
json.put("msg", "获取成绩报表数据失败"); |
|
|
|
json.put("msg", "获取成绩报表数据失败"); |
|
|
@ -170,30 +153,9 @@ public class TeachingGradeController { |
|
|
|
**/ |
|
|
|
**/ |
|
|
|
private Map<String, Object> getWrongStatistics(String issueId, Integer notExamNum) { |
|
|
|
private Map<String, Object> getWrongStatistics(String issueId, Integer notExamNum) { |
|
|
|
Map<String, Object> wrongStatistics = new HashMap<String, Object>(); |
|
|
|
Map<String, Object> wrongStatistics = new HashMap<String, Object>(); |
|
|
|
//根据考核发布id,获取考核点信息
|
|
|
|
List<AssessUserTarget> list = this.assessUserTargetService.selectAllStudentAssessUserTargetByIssueId(issueId); |
|
|
|
List<Map<String, Object>> taskListDb = assessUserTaskService.selectYHTaskInfoByIssueId(issueId); |
|
|
|
|
|
|
|
List<Map<String, Object>> taskList = new ArrayList<>(); |
|
|
|
|
|
|
|
String appTaskIdStrs = ","; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//key 考核点id(无考核点则是交易的id),value为答题情况集合
|
|
|
|
|
|
|
|
Map<String, List<Map<String, Object>>> userTasksMap = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Map map : taskListDb) { |
|
|
|
|
|
|
|
String appTaskId = (String) map.get("appTaskId"); |
|
|
|
|
|
|
|
List<Map<String, Object>> mapList = userTasksMap.get(appTaskId); |
|
|
|
|
|
|
|
if (mapList == null) { |
|
|
|
|
|
|
|
mapList = new ArrayList<>(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
mapList.add(map); |
|
|
|
|
|
|
|
userTasksMap.put(appTaskId, mapList); |
|
|
|
|
|
|
|
String s = appTaskId + ","; |
|
|
|
|
|
|
|
if (!appTaskIdStrs.contains("," + s)) { |
|
|
|
|
|
|
|
taskList.add(map); |
|
|
|
|
|
|
|
appTaskIdStrs += s; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
Map<String, Object> maxErrorRateInfo = null;//最大错误率信息记录
|
|
|
|
Map<String, Object> maxErrorRateInfo = null;//最大错误率信息记录
|
|
|
|
Map<String, Object> minErrorRateInfo = null;//最小错误率信息记录
|
|
|
|
Map<String, Object> minErrorRateInfo = null;//最小错误率信息记录
|
|
|
|
//记录考核点名称
|
|
|
|
//记录考核点名称
|
|
|
@ -203,10 +165,10 @@ public class TeachingGradeController { |
|
|
|
for (int i = 0; i < taskList.size(); i++) { |
|
|
|
for (int i = 0; i < taskList.size(); i++) { |
|
|
|
Map<String, Object> task = taskList.get(i); |
|
|
|
Map<String, Object> task = taskList.get(i); |
|
|
|
taskNames[i] = task.get("taskName").toString(); |
|
|
|
taskNames[i] = task.get("taskName").toString(); |
|
|
|
/*Map<String,Object> con = new HashMap<String,Object>(); |
|
|
|
*//*Map<String,Object> con = new HashMap<String,Object>();
|
|
|
|
con.put("issueId", issueId); |
|
|
|
con.put("issueId", issueId); |
|
|
|
con.put("classId", classId); |
|
|
|
con.put("classId", classId); |
|
|
|
con.put("appTaskId", task.get("appTaskId"));*/ |
|
|
|
con.put("appTaskId", task.get("appTaskId"));*//*
|
|
|
|
//获取该考核点用户的答题情况
|
|
|
|
//获取该考核点用户的答题情况
|
|
|
|
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")); |
|
|
|
userTasks = userTasksMap.get(task.get("appTaskId")); |
|
|
@ -264,7 +226,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; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -368,7 +330,7 @@ public class TeachingGradeController { |
|
|
|
* @date 2019-11-08 18:38:41 |
|
|
|
* @date 2019-11-08 18:38:41 |
|
|
|
**/ |
|
|
|
**/ |
|
|
|
public void cratePractiseProDtosForNotNull(AssessUser assessUser, Model model) { |
|
|
|
public void cratePractiseProDtosForNotNull(AssessUser assessUser, Model model) { |
|
|
|
List<PractiseProDto> practiseProDtos = this.assessUserService.selectPractiseProList(assessUser.getId()); |
|
|
|
List<PractiseProDto> practiseProDtos = null;//this.assessUserService.selectPractiseProList(assessUser.getId());
|
|
|
|
double duration = assessUser.getEndTime().getTime() - assessUser.getStartTime().getTime(); |
|
|
|
double duration = assessUser.getEndTime().getTime() - assessUser.getStartTime().getTime(); |
|
|
|
String h = String.format("%02d", (int) Math.floor(duration / 1000 / 60 / 60)); |
|
|
|
String h = String.format("%02d", (int) Math.floor(duration / 1000 / 60 / 60)); |
|
|
|
String m = String.format("%02d", (int) Math.floor(duration / 1000 / 60 % 60)); |
|
|
|
String m = String.format("%02d", (int) Math.floor(duration / 1000 / 60 % 60)); |
|
|
|