查看详情

pull/1/head
huan.xu 5 years ago
parent 73d71eb491
commit 32e3f3b9db
  1. 266
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/TeachingGradeController.java
  2. 20
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/TeachingGradeApi.java
  3. 32
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ExamDetailsDto.java
  4. 39
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/OverviewDto.java
  5. 26
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/PractiseProDto.java
  6. 26
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/PractiseTaskDto.java
  7. 22
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/PractiseTipDto.java
  8. 35
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ReExamOverviewDto.java
  9. 41
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/StudentAnswerDto.java
  10. 23
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/StudentScoreDto.java
  11. 19
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/StudentTrainCaseTargetDto.java
  12. 6
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserService.java
  13. 27
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserServiceImpl.java

@ -2,14 +2,21 @@ 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.common.base.constant.YyyfConstant;
import com.blockchain.common.base.dto.ResultDTO;
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.controller.api.StudentAnswerApi;
import com.blockchain.server.yyyf.controller.api.TeachingGradeApi;
import com.blockchain.server.yyyf.dto.ExamDetailsDto;
import com.blockchain.server.yyyf.dto.OverviewDto;
import com.blockchain.server.yyyf.dto.ReExamOverviewDto;
import com.blockchain.server.yyyf.dto.StudentTargetErrorStatisticsDto; 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.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;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFFont; import org.apache.poi.hssf.usermodel.HSSFFont;
@ -21,13 +28,9 @@ 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.HashOperations;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import sun.misc.BASE64Decoder;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -44,7 +47,8 @@ import java.util.Map;
* @description 练习考核成绩Controller * @description 练习考核成绩Controller
* @date 2019-11-05 16:23 * @date 2019-11-05 16:23
*/ */
@Controller @RestController
@Api(TeachingGradeApi.CONTROLLER_API)
@RequestMapping("/teachingGrade") @RequestMapping("/teachingGrade")
public class TeachingGradeController { public class TeachingGradeController {
protected Logger logger = LoggerFactory.getLogger(TeachingGradeController.class); protected Logger logger = LoggerFactory.getLogger(TeachingGradeController.class);
@ -65,25 +69,26 @@ public class TeachingGradeController {
/** /**
* http://10.10.17.93:8080/BankTrain/teachingGrade/getGradeData?issueId=7e027a96764b4749b2a2d65cdc4a5c92&totalNum=10&caseId=38 * @description 教师获取考核概况
*
* @param [request, response]
* @return void
* @description 教师端获取错误率 issueId考核id即reqId;totalNum:班级总人数;caseId:项目id
* @author huan.xu * @author huan.xu
* @date 2019-11-08 18:03:39 * @date 2020-05-19 10:47:29
* @param [issueId, totalNum, caseId, response]
* @return void
**/ **/
@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( String issueId,Integer totalNum, String caseId, HttpServletResponse response) { @ApiOperation(value = TeachingGradeApi.GetGradeData.METHOD_NAME,
notes = TeachingGradeApi.GetGradeData.METHOD_NOTE)
public void getGradeData(@ApiParam(TeachingGradeApi.GetGradeData.METHOD_ISSUE_ID) @RequestParam(name = "issueId") String issueId,
@ApiParam(TeachingGradeApi.GetGradeData.METHOD_TOTAL_NUM) @RequestParam(name = "totalNum") Integer totalNum,
@ApiParam(TeachingGradeApi.GetGradeData.METHOD_CASE_ID) @RequestParam(name = "caseId") String caseId,
HttpServletResponse response) {
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
try { try {
int answerCount= assessUserService.selectCountByByIssueId(issueId); int answerCount = assessUserService.selectCountByByIssueId(issueId);
//获取案例信息 //获取案例信息
HashOperations<String, String, ExamPaperDto> examPaperOpsForHash = redisTemplate.opsForHash(); HashOperations<String, String, ExamPaperDto> examPaperOpsForHash = redisTemplate.opsForHash();
ExamPaperDto examPaperDto = examPaperOpsForHash.get(YyyfConstant.EXAM_PAPER_KEY, caseId); ExamPaperDto examPaperDto = examPaperOpsForHash.get(YyyfConstant.EXAM_PAPER_KEY, caseId);
@ -91,7 +96,7 @@ public class TeachingGradeController {
Map<String, Object> wrongStatistics = null;//错误信息 Map<String, Object> wrongStatistics = null;//错误信息
//无人考试 时封装错误率 //无人考试 时封装错误率
if (answerCount==0) { if (answerCount == 0) {
wrongStatistics = new HashMap<>(); wrongStatistics = new HashMap<>();
@ -106,7 +111,7 @@ public class TeachingGradeController {
maxErrorRateInfo.put("headCount", totalNum); maxErrorRateInfo.put("headCount", totalNum);
maxErrorRateInfo.put("taskName", trainCaseTargetDto.getName()); maxErrorRateInfo.put("taskName", trainCaseTargetDto.getName());
maxErrorRateInfo.put("errorRate", Double.valueOf(100)); maxErrorRateInfo.put("errorRate", Double.valueOf(100));
maxErrorRateInfo.put("projectName",trainCaseTargetDto.getName()); maxErrorRateInfo.put("projectName", trainCaseTargetDto.getName());
maxErrorRateInfo.put("errorCount", totalNum); maxErrorRateInfo.put("errorCount", totalNum);
continue; continue;
} }
@ -147,37 +152,36 @@ 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 totalNum,List<TrainCaseTargetDto> trainCaseTargeList) { 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<StudentTargetErrorStatisticsDto> studentTargetErrorStatisticsDtoLis = this.assessUserTargetService.getStudentTargetErrorStatisticsDtoListByIssueId(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[trainCaseTargeList.size()]; String[] taskNames = new String[trainCaseTargeList.size()];
//记录错误率 //记录错误率
double[] errorRates = new double[trainCaseTargeList.size()]; double[] errorRates = new double[trainCaseTargeList.size()];
int i = 0;
int i=0; for (TrainCaseTargetDto trainCaseTargetDto : trainCaseTargeList) {
for (TrainCaseTargetDto trainCaseTargetDto:trainCaseTargeList) {
String targetName = trainCaseTargetDto.getName(); String targetName = trainCaseTargetDto.getName();
taskNames[i]=targetName ; taskNames[i] = targetName;
//错误人数
//获取该考核点用户的答题情况 int errorCount = 0;
List<Map<String, Object>> userTasks = new ArrayList<Map<String, Object>>(); for (StudentTargetErrorStatisticsDto studentTargetErrorStatisticsDto : studentTargetErrorStatisticsDtoLis) {
int errorCount = 0;//错误人数
for (StudentTargetErrorStatisticsDto studentTargetErrorStatisticsDto:studentTargetErrorStatisticsDtoLis) {
//答题错误记录人数 //答题错误记录人数
if(studentTargetErrorStatisticsDto.getTargetId().equals(trainCaseTargetDto.getId())){ if (studentTargetErrorStatisticsDto.getTargetId().equals(trainCaseTargetDto.getId())) {
errorCount++; errorCount++;
break; break;
} }
} }
//计算错误率
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) {
@ -193,7 +197,7 @@ public class TeachingGradeController {
if (errorRate > prevMaxErrorRate) { if (errorRate > prevMaxErrorRate) {
//本次错误率大于上次,则记录本次信息 //本次错误率大于上次,则记录本次信息
maxErrorRateInfo.put("projectName", targetName); maxErrorRateInfo.put("projectName", targetName);
maxErrorRateInfo.put("taskName",targetName); 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);
@ -202,7 +206,7 @@ public class TeachingGradeController {
if (minErrorRateInfo == null) { if (minErrorRateInfo == null) {
minErrorRateInfo = new HashMap<String, Object>(); minErrorRateInfo = new HashMap<String, Object>();
minErrorRateInfo.put("projectName", targetName); minErrorRateInfo.put("projectName", targetName);
minErrorRateInfo.put("taskName",targetName); 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);
@ -211,7 +215,7 @@ 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",targetName); minErrorRateInfo.put("projectName", targetName);
minErrorRateInfo.put("taskName", targetName); minErrorRateInfo.put("taskName", targetName);
minErrorRateInfo.put("headCount", totalNum); minErrorRateInfo.put("headCount", totalNum);
minErrorRateInfo.put("errorCount", errorCount); minErrorRateInfo.put("errorCount", errorCount);
@ -227,116 +231,79 @@ public class TeachingGradeController {
return wrongStatistics; return wrongStatistics;
} }
/** @PostMapping("/getExamOverview")
* @param [reqType, issueId, userId, stuNo, userName, className, caseId, model] @SuppressWarnings("all")
* @return java.lang.String @ApiOperation(value = TeachingGradeApi.GetExamOverview.METHOD_NAME,
* @description 获取考核详情 notes = TeachingGradeApi.GetExamOverview.METHOD_NOTE)
* @author huan.xu public ResultDTO<OverviewDto> getExamOverview(@ApiParam(TeachingGradeApi.GetExamOverview.METHOD_REEXAMOVERVIEWDTO) ReExamOverviewDto reExamOverviewDto) {
* @date 2019-11-08 18:27:50 OverviewDto overviewDto = new OverviewDto();
**/ try {
@RequestMapping("/studyGrade/mygrade")
@ApiIgnore
public String selectPractiseProList(String reqType, String issueId, String examName, Integer userId, String stuNo, String userName, String className, String caseId, Model model) {
try {/*
AssessUser assessUser = null; AssessUser assessUser = null;
List<String> assessUserIds = new ArrayList<String>(); if ("1".equals(reExamOverviewDto.getReqType())) { //考试
model.addAttribute("assessUserIds", assessUserIds); assessUser = this.assessUserService.getAssessUserByIssueIdAndUserIdForExam(reExamOverviewDto.getIssueId(), reExamOverviewDto.getUserId());
model.addAttribute("reqType", reqType); } else {
model.addAttribute("caseId", caseId); List<AssessUser> assessUserList = this.assessUserService.getAssessUserListByIssueIdAndUserId(reExamOverviewDto.getIssueId(), reExamOverviewDto.getUserId());
if ("1".equals(reqType)) { //考核 List<String> assessUserIdsList = new ArrayList<>();
assessUser = this.assessUserService.selectScore(SYS_CODE, issueId, userId); for (AssessUser assessUserSingle : assessUserList) {
} else {//练习
List<AssessUser> assessUserList = this.assessUserService.selectAssessUserListByIssuerIdAndUserId(issueId, userId);
for (AssessUser assessUserInner : assessUserList) {
if (assessUser == null) { if (assessUser == null) {
//取第一个,最新的 assessUser = assessUserSingle;
assessUser = assessUserInner;
}
assessUserIds.add(assessUserInner.getId());
}
}
if (assessUser != null) { //不为空,说明其做过
cratePractiseProDtosForNotNull(assessUser, model);
} else { //为空,则生成一个,这个可不要,因为考核无答题的话,不会进入详情的页面
List<PractiseProDto> practiseProDtos = new ArrayList<PractiseProDto>();
//交易码
List<TiftrnDto> tiftrnDtoList = JedisUtil.getMapValueForList(JedisUtil.bulidKey(Const.TIFTRN_KEY), caseId, TiftrnDto.class); //获取所有交易关联信息
for (TiftrnDto tiftrnDto : tiftrnDtoList) {
PractiseProDto practiseProDto = new PractiseProDto();
practiseProDto.setId(tiftrnDto.getTrxCode());
practiseProDto.setProjectCaseDesc(String.valueOf(tiftrnDto.getSerNum()));
practiseProDto.setProjectScore(BigDecimal.ZERO);
practiseProDto.setProName(tiftrnDto.getTrxName());
List<TestPointDto> testPoints = tiftrnDto.getTestPoints();
if (testPoints != null && testPoints.size() > 0) {
List<PractiseTaskDto> taskList = new ArrayList<PractiseTaskDto>();
for (TestPointDto testPointDto : testPoints) {
PractiseTaskDto practiseTaskDto = new PractiseTaskDto();
practiseTaskDto.setId(String.valueOf(testPointDto.getPointId()));
practiseTaskDto.setAnswer(1);
practiseTaskDto.setProjectName(tiftrnDto.getTrxName());
practiseTaskDto.setRightAnswer(testPointDto.getTestPointAnswer());
practiseTaskDto.setStuAnswer("-");
practiseTaskDto.setTaskName(testPointDto.getPointName());
practiseTaskDto.setTaskScore(BigDecimal.valueOf(testPointDto.getTestPointScore()));
taskList.add(practiseTaskDto);
}
practiseProDto.setTaskList(taskList);
}
practiseProDtos.add(practiseProDto);
}
model.addAttribute("examDate", "-");
model.addAttribute("useTime", "00:00:00");
model.addAttribute("totalScore", BigDecimal.ZERO);
model.addAttribute("practiseProDtos", practiseProDtos);
}
model.addAttribute("stuNo", stuNo);
model.addAttribute("userName", new String(new BASE64Decoder().decodeBuffer(userName.replaceAll(" ", "+")), "UTF-8"));
model.addAttribute("className", new String(new BASE64Decoder().decodeBuffer(className.replaceAll(" ", "+")), "UTF-8"));
model.addAttribute("examName", new String(new BASE64Decoder().decodeBuffer(examName.replaceAll(" ", "+")), "UTF-8"));
model.addAttribute("caseInfo", JedisUtil.getMapValue(JedisUtil.bulidKey(Const.TIFPRO_KEY), caseId, TifPro.class).getCaseInfo());
*/} catch (Exception e) {
logger.error("获取成绩失败: " + e.getMessage(), e);
}
return "/yyyf/exam_mesaage";
} }
assessUserIdsList.add(assessUserSingle.getId());
/** }
* @param [assessUserId, model] overviewDto.setAssessUserIdsList(assessUserIdsList);
* @return java.lang.String
* @description 练习用于上一次下一次的页面切换
* @author huan.xu
* @date 2019-11-08 18:46:05
**/
@RequestMapping("/studyGrade/examMesaageDetails")
@ApiIgnore
public String examMesaageDetails(String assessUserId, Model model) {
AssessUser assessUser = this.assessUserService.selectAssessUserById(assessUserId.trim());
cratePractiseProDtosForNotNull(assessUser, model);
return "/yyyf/exam_mesaage_details";
} }
double duration = assessUser.getEndTime().getTime() - assessUser.getStartTime().getTime();
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(String.format("%02d", (int) Math.floor(duration / 1000 / 60 / 60)))
.append(":").append(String.format("%02d", (int) Math.floor(duration / 1000 / 60 % 60)))
.append(":").append(String.format("%02d", (int) Math.floor(duration / 1000 % 60)));
//考试花费时间
overviewDto.setUseTime(stringBuilder.toString());
//考试开始时间
overviewDto.setExamDate(new SimpleDateFormat("yyyy/MM/dd").format(assessUser.getStartTime()));
overviewDto.setAssessUserId(assessUser.getId());
//学生姓名
overviewDto.setUserName(new String(new BASE64Decoder().decodeBuffer(reExamOverviewDto.getUserName().replaceAll(" ", "+")), "UTF-8"));
//班级名称
overviewDto.setClassName(new String(new BASE64Decoder().decodeBuffer(reExamOverviewDto.getClassName().replaceAll(" ", "+")), "UTF-8"));
//考试成绩
overviewDto.setTotalScore(assessUser.getTotalScore());
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return ResultDTO.requstSuccess(overviewDto);
}
/** @GetMapping("/getExamDetails")
* @param [assessUser, model] @SuppressWarnings("all")
* @return void @ApiOperation(value = TeachingGradeApi.GetExamDetails.METHOD_NAME,
* @description 封装有成绩的答题详情 notes = TeachingGradeApi.GetExamDetails.METHOD_NOTE)
* @author huan.xu public ResultDTO<ExamDetailsDto> getExamDetails(@ApiParam(TeachingGradeApi.GetExamDetails.METHOD_ASSESSUSER_ID)@RequestParam("assessUserId") String assessUserId,
* @date 2019-11-08 18:38:41 @ApiParam(TeachingGradeApi.GetExamDetails.METHOD_IS_FIRST)@RequestParam("isFirst") int isFirst) {
**/ ExamDetailsDto examDetailsDto = new ExamDetailsDto();
public void cratePractiseProDtosForNotNull(AssessUser assessUser, Model model) { try {
List<PractiseProDto> practiseProDtos = null;//this.assessUserService.selectPractiseProList(assessUser.getId()); if (isFirst != 0) {
AssessUser assessUser = this.assessUserService.selectById(assessUserId);
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)); StringBuilder stringBuilder = new StringBuilder();
String m = String.format("%02d", (int) Math.floor(duration / 1000 / 60 % 60)); stringBuilder.append(String.format("%02d", (int) Math.floor(duration / 1000 / 60 / 60)))
String s = String.format("%02d", (int) Math.floor(duration / 1000 % 60)); .append(":").append(String.format("%02d", (int) Math.floor(duration / 1000 / 60 % 60)))
model.addAttribute("useTime", h + ":" + m + ":" + s); .append(":").append(String.format("%02d", (int) Math.floor(duration / 1000 % 60)));
model.addAttribute("totalScore", assessUser.getTotalScore()); //考试花费时间
model.addAttribute("examDate", new SimpleDateFormat("yyyy/MM/dd").format(assessUser.getStartTime())); examDetailsDto.setUseTime(stringBuilder.toString());
model.addAttribute("practiseProDtos", practiseProDtos); //考试开始时间
model.addAttribute("assessUserId", assessUser.getId()); examDetailsDto.setExamDate(new SimpleDateFormat("yyyy/MM/dd").format(assessUser.getStartTime()));
//考试成绩
examDetailsDto.setTotalScore(assessUser.getTotalScore());
}
examDetailsDto.setAssessUserTargetList(this.assessUserTargetService.selectAssessUserTargetByAssessUserId(assessUserId));
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return ResultDTO.requstSuccess(examDetailsDto);
} }
@ -374,6 +341,7 @@ public class TeachingGradeController {
@GetMapping("/export") @GetMapping("/export")
@ResponseBody @ResponseBody
@ApiIgnore
public void yhExport(HttpServletRequest request, HttpServletResponse response) {/* public void yhExport(HttpServletRequest request, HttpServletResponse response) {/*
String examName = request.getParameter("examName"); String examName = request.getParameter("examName");
String className = request.getParameter("className"); String className = request.getParameter("className");
@ -570,17 +538,17 @@ public class TeachingGradeController {
} }
/** /**
* @param [cell, wb, str, startIndex, endIndex]
* @return void
* @description poi实现单元格中部分字体颜色设定 * @description poi实现单元格中部分字体颜色设定
* @author huan.xu * @author huan.xu
* @date 2019-12-10 16:19:48 * @date 2019-12-10 16:19:48
* @param [cell, wb, str, startIndex, endIndex]
* @return void
**/ **/
private void setFontColor(HSSFWorkbook wb, HSSFCell cell, String str, int startIndex, int endIndex ){ private void setFontColor(HSSFWorkbook wb, HSSFCell cell, String str, int startIndex, int endIndex) {
HSSFFont font=wb.createFont(); HSSFFont font = wb.createFont();
font.setColor(HSSFColor.RED.index); font.setColor(HSSFColor.RED.index);
HSSFRichTextString richString = new HSSFRichTextString(str); HSSFRichTextString richString = new HSSFRichTextString(str);
richString.applyFont(startIndex, endIndex,font); richString.applyFont(startIndex, endIndex, font);
cell.setCellValue(richString); cell.setCellValue(richString);
} }
} }

@ -10,5 +10,25 @@ package com.blockchain.server.yyyf.controller.api;
public class TeachingGradeApi { public class TeachingGradeApi {
public static final String CONTROLLER_API = "项目答题情况控制器"; public static final String CONTROLLER_API = "项目答题情况控制器";
public static class GetGradeData {
public static final String METHOD_NAME = "教师端获取错误率 ";
public static final String METHOD_NOTE = "教师端获取错误率";
public static final String METHOD_ISSUE_ID= "考核id";
public static final String METHOD_TOTAL_NUM= "参加考试的总人数";
public static final String METHOD_CASE_ID="案例id";
}
public static class GetExamOverview {
public static final String METHOD_NAME = "获取考核、练习概况";
public static final String METHOD_NOTE = "获取考核、练习概况";
public static final String METHOD_REEXAMOVERVIEWDTO = "考试详情请求参数封装Dto";
}
public class GetExamDetails {
public static final String METHOD_NAME = "获取考试、练习详情";
public static final String METHOD_NOTE = "获取考试、练习详情";
public static final String METHOD_ASSESSUSER_ID= "成绩id";
public static final String METHOD_IS_FIRST= "练习是否第一次,0否,1是";
}
} }

@ -0,0 +1,32 @@
package com.blockchain.server.yyyf.dto;
import com.blockchain.server.yyyf.entity.AssessUser;
import com.blockchain.server.yyyf.entity.AssessUserTarget;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author huan.xu
* @version 1.0
* @className ExamDetailsDto
* @description
* @date 2020-05-19 9:59
*/
@ApiModel(description = "考试练习详情")
@Data
public class ExamDetailsDto implements Serializable {
private static final long serialVersionUID = 264477801119669580L;
@ApiModelProperty("用时")
private String useTime;
@ApiModelProperty("考试时间")
private String examDate;
@ApiModelProperty("总分")
private Double totalScore;
@ApiModelProperty("学生答题指标集合")
private List<AssessUserTarget> assessUserTargetList;
}

@ -0,0 +1,39 @@
package com.blockchain.server.yyyf.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import sun.misc.BASE64Decoder;
import java.io.Serializable;
import java.util.List;
/**
* @author huan.xu
* @version 1.0
* @className OverviewDto
* @description
* @date 2020-05-19 9:34
*/
@ApiModel(description = "考试练习概览")
@Data
public class OverviewDto implements Serializable {
private static final long serialVersionUID = 8160782885281108469L;
@ApiModelProperty("用时")
private String useTime;
@ApiModelProperty("考试时间")
private String examDate;
@ApiModelProperty("总分")
private Double totalScore;
@ApiModelProperty("练习的成绩的所有id")
private List<String> assessUserIdsList;
@ApiModelProperty("当前assessUserId")
private String assessUserId;
@ApiModelProperty("学生姓名")
private String userName;
@ApiModelProperty("班级名称")
private String className;
}

@ -1,26 +0,0 @@
package com.blockchain.server.yyyf.dto;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
@Data
public class PractiseProDto implements Serializable {
private static final long serialVersionUID = -6726051902592416723L;
//id
private String id;
//项目名称
private String proName;
//考核项目得分
private BigDecimal projectScore;
//项目案例内容
private String projectCaseDesc;
//案例集合
private List<PractiseTaskDto> taskList;
}

@ -1,26 +0,0 @@
package com.blockchain.server.yyyf.dto;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
public class PractiseTaskDto implements Serializable {
private static final long serialVersionUID = 6752155834635874301L;
//id
private String id;
private String projectName;
//考核点名称
private String taskName;
//考核点得分
private BigDecimal taskScore;
//是否正确 0对 1错
private Integer answer;
//考核点正确答案
private String rightAnswer;
//学生答案
private String stuAnswer;
}

@ -1,22 +0,0 @@
package com.blockchain.server.yyyf.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
@ApiModel("练习重新开始参数封装")
@Data
public class PractiseTipDto {
@ApiModelProperty("考试id")
private String examId;
@ApiModelProperty("案例id")
private String examPaperId;
@ApiModelProperty("以渔有方用户id")
private Integer yyyfUserId;
}

@ -0,0 +1,35 @@
package com.blockchain.server.yyyf.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @author huan.xu
* @version 1.0
* @className ReExamOverviewDto
* @description
* @date 2020-05-19 9:11
*/
@ApiModel("考试详情请求参数封装")
@Data
public class ReExamOverviewDto implements Serializable {
private static final long serialVersionUID = -5123296145219460496L;
@ApiModelProperty("考核、练习id")
private String issueId;
@ApiModelProperty("学号")
private String stuNo;
@ApiModelProperty("以渔有方用户id")
private Integer userId;
@ApiModelProperty("用户名称")
private String userName;
@ApiModelProperty("班级名称")
private String className;
@ApiModelProperty("区块链系统案例id")
private String caseId;
@ApiModelProperty("类型:1考试、0练习")
private Integer reqType;
}

@ -1,41 +0,0 @@
package com.blockchain.server.yyyf.dto;
import io.swagger.models.auth.In;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Map;
@Data
public class StudentAnswerDto extends ExamDto {
/**
* 用户id
*/
private Integer userId;
/**
* 用户姓名
*/
private String userName;
/**
* 答题结果,value 是学生的指标
*/
private Map<String, Double> result;
/**
* 总分
*/
private BigDecimal totalScore;
/**
* 班级id
*/
private Integer classId;
/**
* 用户类型
*/
private Integer userType;
/**
* 课程id
*/
private String courseId;
}

@ -1,23 +0,0 @@
package com.blockchain.server.yyyf.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class StudentScoreDto implements Serializable {
private static final long serialVersionUID = 1L;
private String authorization = "87DIVy348Oxzj3ha";
private String sysType = "102";//
private String userId;
private Float totalScore;//分数
private Date startTime;//开始时间
private Date endTime;//结束时间
private String achievementType;//0 练习 1考核
private String assessmentId;//考核id
private String classId;//班级ID
private String courseId;//课程ID
private String caseId;
}

@ -1,19 +0,0 @@
package com.blockchain.server.yyyf.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @author Mr.Xu
* @version 1.0
* @className StudentTrainCaseTargetDto
* @description
* @date 2020-05-07 20:30
*/
@Data
public class StudentTrainCaseTargetDto implements Serializable {
private static final long serialVersionUID = -7079847727022972640L;
}

@ -83,4 +83,10 @@ public interface AssessUserService {
int selectCountByByIssueId(String issueId); int selectCountByByIssueId(String issueId);
AssessUser getAssessUserByIssueIdAndUserIdForExam(String issueId, Integer userId);
List<AssessUser> getAssessUserListByIssueIdAndUserId(String issueId, Integer userId);
AssessUser selectById(String assessUserId);
} }

@ -99,6 +99,7 @@ public class AssessUserServiceImpl implements AssessUserService {
assessUserTarget.setTargetId(trainCaseTargetDto.getId()); assessUserTarget.setTargetId(trainCaseTargetDto.getId());
assessUserTarget.setTargetName(trainCaseTargetDto.getName()); assessUserTarget.setTargetName(trainCaseTargetDto.getName());
assessUserTarget.setSort(j++); assessUserTarget.setSort(j++);
assessUserTarget.setAnswer(1);
list.add(assessUserTarget); list.add(assessUserTarget);
} }
this.assessUserMapper.insert(assessUser); this.assessUserMapper.insert(assessUser);
@ -200,8 +201,9 @@ public class AssessUserServiceImpl implements AssessUserService {
studentOpsForHash.delete(YyyfConstant.JOIN_EXAM_STU_IDS_KEY, issueId); studentOpsForHash.delete(YyyfConstant.JOIN_EXAM_STU_IDS_KEY, issueId);
examDtoOpsForHash.delete(YyyfConstant.EXAM_KEY, issueId); examDtoOpsForHash.delete(YyyfConstant.EXAM_KEY, issueId);
if (updateAssessUserDtoList.size() > 0) if (updateAssessUserDtoList.size() > 0) {
this.assessUserMapper.batchUpdateTotalScoreByAssessUserDtoList(assessUserDtoList); this.assessUserMapper.batchUpdateTotalScoreByAssessUserDtoList(assessUserDtoList);
}
HttpClientUtil.doPostWithJSON(new StringBuilder().append(yyyfUrl).append(assessmentList).toString(), yyyfStudentAnswerDtoList); HttpClientUtil.doPostWithJSON(new StringBuilder().append(yyyfUrl).append(assessmentList).toString(), yyyfStudentAnswerDtoList);
@ -225,5 +227,28 @@ public class AssessUserServiceImpl implements AssessUserService {
return this.assessUserMapper.selectCountByExample(example); return this.assessUserMapper.selectCountByExample(example);
} }
@Override
public AssessUser getAssessUserByIssueIdAndUserIdForExam(String issueId, Integer userId) {
Example example = new Example(AssessUser.class);
Example.Criteria criteria = example.createCriteria();
criteria.andCondition("issue_id = ", issueId)
.andCondition("user_id = ",userId);
return this.assessUserMapper.selectOneByExample(example);
}
@Override
public List<AssessUser> getAssessUserListByIssueIdAndUserId(String issueId, Integer userId) {
Example example = new Example(AssessUser.class);
Example.Criteria criteria = example.createCriteria();
criteria.andCondition("issue_id = ", issueId)
.andCondition("user_id = ",userId);
return this.assessUserMapper.selectByExample(example);
}
@Override
public AssessUser selectById(String assessUserId) {
return this.assessUserMapper.selectByPrimaryKey(assessUserId);
}
} }
Loading…
Cancel
Save