考核接入理论

成绩管理项目维度扩展接入理论
master
rong.liu 1 month ago
parent 1993aad438
commit eb33d133ea
  1. 10
      exam/src/main/java/com/huoran/exam/controller/ExamPaperController.java
  2. 61
      exam/src/main/java/com/huoran/exam/entity/resp/AssessmentExamResp.java
  3. 6
      exam/src/main/java/com/huoran/exam/mapper/ExamPaperMapper.java
  4. 24
      exam/src/main/java/com/huoran/exam/mapper/xml/ExamPaperMapper.xml
  5. 2
      exam/src/main/java/com/huoran/exam/service/ExamPaperService.java
  6. 172
      exam/src/main/java/com/huoran/exam/service/impl/ExamPaperServiceImpl.java
  7. 150
      occupationlab/src/main/java/com/huoran/occupationlab/controller/AchievementController.java
  8. 4
      occupationlab/src/main/java/com/huoran/occupationlab/entity/Assessment.java
  9. 6
      occupationlab/src/main/java/com/huoran/occupationlab/entity/req/AssessmentReq.java
  10. 25
      occupationlab/src/main/java/com/huoran/occupationlab/entity/req/TheoreticalExerciseDetailsReq.java
  11. 5
      occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/AchievementByPracticeResp.java
  12. 4
      occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/EnterExamResp.java
  13. 16
      occupationlab/src/main/java/com/huoran/occupationlab/mapper/ExperimentalReportMapper.java
  14. 55
      occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/AssessmentMapper.xml
  15. 331
      occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ExperimentalReportMapper.xml
  16. 9
      occupationlab/src/main/java/com/huoran/occupationlab/service/ExperimentalReportService.java
  17. 10
      occupationlab/src/main/java/com/huoran/occupationlab/service/impl/AssessmentServiceImpl.java
  18. 145
      occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ExperimentalReportServiceImpl.java

@ -346,6 +346,16 @@ public class ExamPaperController {
}
@NoRepeatSubmit
@ApiOperation(value = "提交试卷(考核)")
@PostMapping("/submitTheExamPaperForAssessment")
public R submitTheExamPaperForAssessment(@RequestBody @Valid ExamSubmitReq examSubmitReq) throws JsonProcessingException {
String accountId = TokenUtils.getAccountId();
Integer schoolId = TokenUtils.getSchoolId();
examSubmitReq.setAccountId(Integer.valueOf(accountId));
examSubmitReq.setSchoolId(schoolId);
return examPaperService.submitTheExamPaperForAssessment(examSubmitReq);
}
@NoRepeatSubmit

@ -0,0 +1,61 @@
package com.huoran.exam.entity.resp;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 学生考试表(考核)
* </p>
*
* @author lr
* @since 2021-08-19
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("ol_assessment_exam")
@ApiModel(value = "AssessmentExam对象", description = "学生考试表(考核)")
public class AssessmentExamResp implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = " 考试主键id")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "绑定考核id")
private Integer assessmentId;
@ApiModelProperty(value = "绑定用户id")
private Integer accountId;
@ApiModelProperty(value = "用时")
private Integer timeCost;
@ApiModelProperty(value = "得分")
private Double score;
@ApiModelProperty(value = "班级id(用于区分学生端同一考核下,该生在两个不同的班级需要进入两次)")
private Integer classId;
@ApiModelProperty(value = "考试状态(0、未考 1、在考 2、已考)")
private Integer state;
@ApiModelProperty(value = "学生开考时间")
private Date examTime;
@ApiModelProperty(value = "学生结束时间")
private Date stopTime;
}

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.huoran.exam.entity.ExamPaper;
import com.huoran.exam.entity.req.ExamPaperReq;
import com.huoran.exam.entity.req.MockSubmissionReq;
import com.huoran.exam.entity.resp.AssessmentExamResp;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -29,4 +30,9 @@ public interface ExamPaperMapper extends BaseMapper<ExamPaper> {
Integer getPaperId(@Param("reportId") Integer reportId);
List<Integer> selectAllReportIds(@Param("stageId")Integer stageId);
AssessmentExamResp queryItself(@Param("exam") AssessmentExamResp exam);
void editStudentAssessmentStatus(@Param("exam") AssessmentExamResp exam);
}

@ -7,6 +7,20 @@
#{paperId}
</foreach>
</update>
<update id="editStudentAssessmentStatus">
update
occupationlab.ol_assessment_exam
set
state = 2,
stop_time = now(),
time_cost = #{exam.timeCost},
score = #{exam.score}
where
account_id = #{exam.accountId}
and assessment_id = #{exam.assessmentId}
and class_id = #{exam.classId}
</update>
<select id="examPaperList" resultType="com.huoran.exam.entity.ExamPaper">
WITH RECURSIVE ClassificationHierarchy AS (
@ -256,4 +270,14 @@
<select id="selectAllReportIds" resultType="java.lang.Integer">
select DISTINCT report_id from exam_paper_question_user_answer where stage_id = #{stageId}
</select>
<select id="queryItself" resultType="com.huoran.exam.entity.resp.AssessmentExamResp">
SELECT
*
FROM
occupationlab.ol_assessment_exam e
WHERE
e.account_id = #{exam.accountId}
AND e.assessment_id = #{exam.assessmentId}
AND e.class_id =#{exam.classId}
</select>
</mapper>

@ -43,4 +43,6 @@ public interface ExamPaperService extends IService<ExamPaper> {
List<Integer> selectAllReportIds(Integer stageId);
R submitTheExamPaperForAssessment(ExamSubmitReq examSubmitReq) throws JsonProcessingException;
}

@ -21,6 +21,7 @@ import com.huoran.exam.entity.req.ExamPaperReq;
import com.huoran.exam.entity.req.ExamSubmitReq;
import com.huoran.exam.entity.req.MockSubmissionReq;
import com.huoran.exam.entity.req.SubmitJudgeReq;
import com.huoran.exam.entity.resp.AssessmentExamResp;
import com.huoran.exam.entity.resp.GradingResultResp;
import com.huoran.exam.mapper.ExamClassificationMapper;
import com.huoran.exam.mapper.ExamPaperMapper;
@ -246,6 +247,7 @@ public class ExamPaperServiceImpl extends ServiceImpl<ExamPaperMapper, ExamPaper
// 实现输入验证逻辑
return req.getAnswer() != null && req.getAnswerContent() != null && req.getQuestionVersionId() != null;
}
@Override
public R submitTheExamPaperForPractice(ExamSubmitReq examSubmitReq) throws JsonProcessingException {
try {
@ -369,12 +371,15 @@ public class ExamPaperServiceImpl extends ServiceImpl<ExamPaperMapper, ExamPaper
List<ExamPaperQuestionUserAnswer> userAnswerList = examPaperOutline.getUserAnswerList();
for (ExamPaperQuestionUserAnswer examPaperQuestionUserAnswer : userAnswerList) {
// 获取题干信息
addStyledText(document, "宋体", 10, examPaperQuestionUserAnswer.getSerialNumber() + "、" + stripHtml(examPaperQuestionUserAnswer.getStem()) + "(" + examPaperQuestionUserAnswer.getQuestionScore() + "分)");
List<QuestionAnswerVersions> questionAnswerVersionsList = examPaperQuestionUserAnswer.getQuestionAnswerVersionsList();
addStyledText(document, "宋体", 10,
examPaperQuestionUserAnswer.getSerialNumber() + "、" + stripHtml(examPaperQuestionUserAnswer.getStem()) + "(" + examPaperQuestionUserAnswer.getQuestionScore() + "分)");
List<QuestionAnswerVersions> questionAnswerVersionsList =
examPaperQuestionUserAnswer.getQuestionAnswerVersionsList();
// 添加题目选项
for (QuestionAnswerVersions questionAnswerVersions : questionAnswerVersionsList) {
// 添加题目选项
addStyledText(document, "宋体", 10, optionNumber(questionAnswerVersions.getOptionNumber()) + "、" + stripHtml(questionAnswerVersions.getOptionText()));
addStyledText(document, "宋体", 10,
optionNumber(questionAnswerVersions.getOptionNumber()) + "、" + stripHtml(questionAnswerVersions.getOptionText()));
}
}
}
@ -424,19 +429,151 @@ public class ExamPaperServiceImpl extends ServiceImpl<ExamPaperMapper, ExamPaper
return baseMapper.selectAllReportIds(stageId);
}
private static XWPFTable createInfoTable(XWPFDocument document,ExperimentalReport report) {
@Override
public R submitTheExamPaperForAssessment(ExamSubmitReq examSubmitReq) throws JsonProcessingException {
QueryWrapper<ExamPaperQuestionUserAnswer> answerQueryWrapper = new QueryWrapper<>();
//如果是考核提交前校验考核是否已经提交过
if (!ObjectUtils.isEmpty(examSubmitReq.getAssessmentId())) {
answerQueryWrapper.eq("assessment_id", examSubmitReq.getAssessmentId());
answerQueryWrapper.eq("account_id", examSubmitReq.getAccountId());
answerQueryWrapper.eq("is_del",0);
List<ExamPaperQuestionUserAnswer> answerList =
examPaperQuestionUserAnswerMapper.selectList(answerQueryWrapper);
if (!answerList.isEmpty()) {
return R.error("已提交,请勿重复提交!");
}
}
ExperimentalReport report = new ExperimentalReport();
report.setPaperId(examSubmitReq.getPaperId());
report.setCurriculumId(examSubmitReq.getCid());
//试卷成绩报告
report.setType(3);
if (examSubmitReq.getAssessmentId() != null) {//考核
report.setAssessmentId(examSubmitReq.getAssessmentId());
Integer teacherId = occupationlabClient.getTeacherIdByAssessmentId(examSubmitReq.getAssessmentId());
report.setInstructor("超管");
//实验为考核类型时候需读取发布考核的老师
String username = userClient.getUserName(teacherId);
if (username != null) {
report.setInstructor(username);
}
}
BeanUtils.copyProperties(examSubmitReq, report);
//提交时间为当前时间
report.setEndTime(new Date());
report.setScore(0.0);//实验总分
report.setClassName(null);//由于实验报告所在班级需要更改为读取学生管理学生的所在班级,所以此处设置为空
int reportId = occupationlabClient.addExperimentalReport(report);
double totalScoreOfTheExamPaper = 0.0;
List<ExamPaperQuestionUserAnswer> examPaperQuestionUserAnswerList = new ArrayList<>();
for (SubmitJudgeReq submitJudgeReq : examSubmitReq.getExamSubmitJudgeList()) {
ExamPaperQuestionUserAnswer examPaperQuestionUserAnswer = new ExamPaperQuestionUserAnswer();
if (submitJudgeReq.getAnswer().isEmpty()) {
if (submitJudgeReq.getAnswerContent().isEmpty()) {
examPaperQuestionUserAnswer.setAnsweringStatus("未作答");
}
} else {
//评分
GradingResultResp gradingResultResp = questionsService.gradeAnswer(submitJudgeReq);
examPaperQuestionUserAnswer.setDoRight(gradingResultResp.isCorrect());
examPaperQuestionUserAnswer.setAnsweringStatus("已作答");
//统计总得分
totalScoreOfTheExamPaper += gradingResultResp.getTotalScore();
examPaperQuestionUserAnswer.setUserScore(gradingResultResp.getTotalScore());
//增加一个字段备份分数,用于备份系统提交后通过老师评阅改了分数异常后还能回滚到系统提交时候的分数
examPaperQuestionUserAnswer.setBackupScore(gradingResultResp.getTotalScore());
if (gradingResultResp.getBlankGradingInfos() != null && gradingResultResp.getBlankGradingInfos().size() > 0) {
String jsonText = JSON.toJSONString(gradingResultResp.getBlankGradingInfos());
examPaperQuestionUserAnswer.setJsonText(jsonText);
}
}
examPaperQuestionUserAnswer.setReportId(reportId);
examPaperQuestionUserAnswer.setCreateUser(TokenUtils.getUserName());
examPaperQuestionUserAnswer.setPaperId(examSubmitReq.getPaperId());
examPaperQuestionUserAnswer.setQuestionVersionId(submitJudgeReq.getQuestionVersionId());
examPaperQuestionUserAnswer.setSchoolId(examSubmitReq.getSchoolId());
examPaperQuestionUserAnswer.setAccountId(examSubmitReq.getAccountId());
examPaperQuestionUserAnswer.setQuestionType(submitJudgeReq.getQuestionType());
examPaperQuestionUserAnswer.setSerialNumber(submitJudgeReq.getSerialNumber());
examPaperQuestionUserAnswer.setUserAnswer(submitJudgeReq.getAnswer().toString());
examPaperQuestionUserAnswer.setQuestionScore(submitJudgeReq.getSetScore());
examPaperQuestionUserAnswer.setAttachmentUrl(submitJudgeReq.getAttachmentUrl());
examPaperQuestionUserAnswer.setAttachmentName(submitJudgeReq.getAttachmentName());
examPaperQuestionUserAnswer.setAnswerContent(submitJudgeReq.getAnswerContent());
examPaperQuestionUserAnswer.setOutlineId(submitJudgeReq.getOutlineId());
//如果是考核提交前校验考核是否已经提交过
if (examSubmitReq.getAssessmentId() != null) {
examPaperQuestionUserAnswer.setAssessmentId(examSubmitReq.getAssessmentId());
}
if (examSubmitReq.getSystemId() != null) {
examPaperQuestionUserAnswer.setSystemId(examSubmitReq.getSystemId());
}
examPaperQuestionUserAnswerList.add(examPaperQuestionUserAnswer);
}
examPaperQuestionUserAnswerService.saveBatch(examPaperQuestionUserAnswerList);
if (!ObjectUtils.isEmpty(examSubmitReq.getAssessmentId()) && reportId > 0) {
report.setAssessmentId(examSubmitReq.getAssessmentId());
//同时更新当前提交该生的考核状态 提交时间
/*occupationlabClient.submitExam(examSubmitReq.getAssessmentId(), examSubmitReq.getClassId(),
examSubmitReq.getAccountId(), totalScoreOfTheExamPaper);*/
/*QueryWrapper<AssessmentExam> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("assessment_id", assessmentId);
queryWrapper.eq("account_id", accountId);
queryWrapper.eq("class_id", classId);
AssessmentExam exam = examMapper.selectOne(queryWrapper);*/
AssessmentExamResp exam = new AssessmentExamResp();
exam.setAssessmentId(examSubmitReq.getAssessmentId());
exam.setAccountId(examSubmitReq.getAccountId());
exam.setClassId(examSubmitReq.getClassId());
AssessmentExamResp queryItself = baseMapper.queryItself(exam);
if (queryItself != null){
queryItself.setState(2);
queryItself.setStopTime(new Date());
queryItself.setTimeCost(Long.valueOf(((new Date().getTime() - queryItself.getExamTime().getTime()) / 1000 / 60)).intValue());
queryItself.setScore(totalScoreOfTheExamPaper);
baseMapper.editStudentAssessmentStatus(queryItself);
}
}
//0分数据保存
report.setScore(totalScoreOfTheExamPaper);
report.setReportId(reportId);
occupationlabClient.updateExperimentalReport(report);
return R.ok();
}
private static XWPFTable createInfoTable(XWPFDocument document, ExperimentalReport report) {
XWPFTable table = document.createTable(3, 4);
table.getRow(0).getCell(0).addParagraph().createRun().setText("基本信息");
table.getRow(1).getCell(0).addParagraph().createRun().setText("学生姓名:"+report.getUserName());
table.getRow(1).getCell(1).addParagraph().createRun().setText("学生学号:"+report.getWorkNumber());
table.getRow(1).getCell(2).addParagraph().createRun().setText("学生班级:"+report.getClassName());
table.getRow(1).getCell(3).addParagraph().createRun().setText("成绩:"+report.getScore()+ "分");
table.getRow(1).getCell(0).addParagraph().createRun().setText("学生姓名:" + report.getUserName());
table.getRow(1).getCell(1).addParagraph().createRun().setText("学生学号:" + report.getWorkNumber());
table.getRow(1).getCell(2).addParagraph().createRun().setText("学生班级:" + report.getClassName());
table.getRow(1).getCell(3).addParagraph().createRun().setText("成绩:" + report.getScore() + "分");
table.getRow(2).getCell(0).addParagraph().createRun().setText("提交时间:"+report.getSubmitTime());
table.getRow(2).getCell(1).addParagraph().createRun().setText("考试用时:"+report.getTimeSum()+ "分钟");
table.getRow(2).getCell(2).addParagraph().createRun().setText("指导老师:"+report.getTeacherName());
table.getRow(2).getCell(0).addParagraph().createRun().setText("提交时间:" + report.getSubmitTime());
table.getRow(2).getCell(1).addParagraph().createRun().setText("考试用时:" + report.getTimeSum() + "分钟");
table.getRow(2).getCell(2).addParagraph().createRun().setText("指导老师:" + report.getTeacherName());
return table;
}
@ -454,22 +591,21 @@ public class ExamPaperServiceImpl extends ServiceImpl<ExamPaperMapper, ExamPaper
table.getRow(2).getCell(3).addParagraph().createRun().setText("100%");
return table;
}
private static String optionNumber(Integer optionNumber) {
if (optionNumber==1){
if (optionNumber == 1) {
return "A";
}else if (optionNumber==2){
} else if (optionNumber == 2) {
return "B";
}else if (optionNumber==3){
} else if (optionNumber == 3) {
return "C";
}else if (optionNumber==4){
} else if (optionNumber == 4) {
return "D";
}else if (optionNumber==5){
} else if (optionNumber == 5) {
return "E";
}else if (optionNumber==6){
} else if (optionNumber == 6) {
return "F";
}
return "N";

@ -125,7 +125,8 @@ public class AchievementController {
}
});*/
List<Class> classList = new ArrayList<>();
Set set = assessmentService.myClassByStudent(Integer.valueOf(accountId), userClient.getSchoolIdByAccountId(accountId));
Set set = assessmentService.myClassByStudent(Integer.valueOf(accountId),
userClient.getSchoolIdByAccountId(accountId));
Iterator<Object> it = set.iterator();
while (it.hasNext()) {
String classId = (String) it.next();
@ -141,14 +142,30 @@ public class AchievementController {
* @date: 2021/9/8 10:28
*/
@PostMapping("/getPracticeDetail")
@ApiOperation(value = "管理端练习成绩详情", response = AchievementResp.class)
public R getPracticeDetail(@ApiParam(value = "项目id", required = true) @RequestParam("projectId") Integer projectId, @ApiParam(value = "当前页数", required = true) @RequestParam("pageNum") Integer pageNum, @ApiParam(value = "当前页需要显示的数量", required = true) @RequestParam("pageSize") Integer pageSize, @ApiParam(value = "班级id", required = false) @RequestParam("classId") Integer classId, @ApiParam(value = "关键词", required = false) @RequestParam("keyWord") String keyWord, @ApiParam(value = "商品id", required = false) @RequestParam("mallId") Integer mallId, HttpServletRequest request) {
@ApiOperation(value = "管理端练习成绩详情(实操)", response = AchievementResp.class)
public R getPracticeDetail(@ApiParam(value = "项目id", required = false) @RequestParam("projectId") Integer projectId,
@ApiParam(value = "试卷id", required = false) @RequestParam("paperId") Integer paperId,
@ApiParam(value = "当前页数", required = true) @RequestParam("pageNum") Integer pageNum,
@ApiParam(value = "当前页需要显示的数量", required = true) @RequestParam("pageSize") Integer pageSize, @ApiParam(value = "班级id", required = false) @RequestParam("classId") Integer classId, @ApiParam(value = "关键词", required = false) @RequestParam("keyWord") String keyWord, @ApiParam(value = "商品id", required = false) @RequestParam("mallId") Integer mallId, HttpServletRequest request) {
String accountId = TokenUtils.getIdByJwtToken(request);
Integer schoolId = TokenUtils.getSchoolIdByJwtToken(request);
return experimentalReportService.getPracticeDetail(projectId, pageNum, pageSize, schoolId, classId, keyWord, mallId);
return experimentalReportService.getPracticeDetail(projectId, pageNum, pageSize, schoolId, classId, keyWord,
mallId, paperId);
}
/* @PostMapping("/getPracticeDetailByTheory")
@ApiOperation(value = "管理端练习成绩详情(理论)", response = AchievementResp.class)
public R getPracticeDetailByTheory(@RequestBody TheoreticalExerciseDetailsReq req){
String accountId = TokenUtils.getAccountId();
Integer schoolId = TokenUtils.getSchoolId();
req.setSchoolId(schoolId);
req.setAccountId(Integer.valueOf(accountId));
return experimentalReportService.getPracticeDetailByTheory(req);
}*/
/**
* @Description: 管理端考核成绩详情
* @auther: Rong
@ -173,7 +190,8 @@ public class AchievementController {
updateWrapper.set("is_del", 1);
updateWrapper.in("report_id", ids);
boolean ret = experimentalReportService.update(new com.huoran.common.entity.ExperimentalReport(), updateWrapper);
boolean ret = experimentalReportService.update(new com.huoran.common.entity.ExperimentalReport(),
updateWrapper);
return ret ? R.ok() : R.error();
}
@ -184,10 +202,15 @@ public class AchievementController {
*/
@ApiOperation(value = "教师端:批量导出练习成绩")
@GetMapping("/exportPracticeInfo")
public void exportPracticeInfo(@ApiParam(value = "要导出的id", required = false) @RequestParam(value = "ids", required = false) String ids, @RequestParam("projectId") @ApiParam(value = "项目id", required = true) @NotNull(message = "项目id不能为空") Integer projectId, @RequestParam("mallId") @ApiParam(value = "商品id", required = true) @NotNull(message = "商品id不能为空") Integer mallId, HttpServletResponse response, HttpServletRequest request) throws Exception {
public void exportPracticeInfo(@ApiParam(value = "要导出的id", required = false) @RequestParam(value = "ids",
required = false) String ids,
@RequestParam(value = "projectId",required = false) @ApiParam(value = "项目id", required = false) Integer projectId,
@RequestParam("mallId") @ApiParam(value = "商品id", required = true) @NotNull(message = "商品id不能为空") Integer mallId,
@RequestParam(value = " paperId" ,required = false) @ApiParam(value = "试卷id", required = false) Integer paperId,
HttpServletResponse response, HttpServletRequest request) throws Exception {
String accountId = TokenUtils.getIdByJwtToken(request);
Integer schoolId = TokenUtils.getSchoolIdByJwtToken(request);
experimentalReportService.exportPracticeInfo(ids, response, schoolId, projectId, mallId);
experimentalReportService.exportPracticeInfo(ids, response, schoolId, projectId, mallId, paperId);
}
/**
@ -197,7 +220,9 @@ public class AchievementController {
*/
@ApiOperation(value = "教师端:批量导出考核成绩")
@GetMapping("/exportAssessmentInfo")
public void exportAssessmentInfo(@ApiParam(value = "要导出的id", required = false) @RequestParam(value = "ids", required = false) String ids, @RequestParam("assessmentId") @ApiParam(value = "考核id", required = true) @NotNull(message = "考核id不能为空") Integer assessmentId, @RequestParam(value = "classId", required = false) @ApiParam(value = "班级id", required = false) Integer classId, HttpServletResponse response, HttpServletRequest request) throws Exception {
public void exportAssessmentInfo(@ApiParam(value = "要导出的id", required = false) @RequestParam(value = "ids",
required = false) String ids,
@RequestParam("assessmentId") @ApiParam(value = "考核id", required = true) @NotNull(message = "考核id不能为空") Integer assessmentId, @RequestParam(value = "classId", required = false) @ApiParam(value = "班级id", required = false) Integer classId, HttpServletResponse response, HttpServletRequest request) throws Exception {
String accountId = TokenUtils.getIdByJwtToken(request);
Integer schoolId = TokenUtils.getSchoolIdByJwtToken(request);
experimentalReportService.exportAssessmentInfo(ids, response, schoolId, assessmentId, classId);
@ -242,7 +267,8 @@ public class AchievementController {
@ApiParam(value = "当前页需要显示的数量", required = true) @RequestParam("pageSize") Integer pageSize,
HttpServletRequest request) {
String accountId = TokenUtils.getIdByJwtToken(request);
return experimentalReportService.practiceByStudentDetail(curriculumId, projectId, Integer.valueOf(accountId), pageNum, pageSize,paperId);
return experimentalReportService.practiceByStudentDetail(curriculumId, projectId, Integer.valueOf(accountId),
pageNum, pageSize, paperId);
}
/**
@ -252,7 +278,9 @@ public class AchievementController {
*/
@ApiOperation(value = "导出学生端练习实验情况")
@GetMapping("/exportPracticeByStudentDetail")
public void exportPracticeByStudentDetail(@ApiParam(value = "要导出的id(非必填)", required = false) @RequestParam(value = "ids", required = false) String ids, @ApiParam(value = "项目id(必填)") @RequestParam(value = "projectId", required = true) Integer projectId, HttpServletResponse response, HttpServletRequest request) throws Exception {
public void exportPracticeByStudentDetail(@ApiParam(value = "要导出的id(非必填)", required = false) @RequestParam(value
= "ids", required = false) String ids, @ApiParam(value = "项目id(必填)") @RequestParam(value = "projectId",
required = true) Integer projectId, HttpServletResponse response, HttpServletRequest request) throws Exception {
String accountId = TokenUtils.getIdByJwtToken(request);
experimentalReportService.exportPracticeByStudentDetail(ids, projectId, Integer.valueOf(accountId), response);
}
@ -304,7 +332,8 @@ public class AchievementController {
*/
@ApiOperation(value = "学生-批量导出考核成绩")
@GetMapping("/exportAssessmentByStudent")
public void exportAssessmentByStudent(@ApiParam(value = "要导出的id(非必填)") @RequestParam(value = "ids", required = false) String ids, @RequestParam("curriculumId") @ApiParam(value = "课程id", required = true) @NotNull(message = "课程id不能为空") Integer curriculumId, HttpServletResponse response, HttpServletRequest request) throws Exception {
public void exportAssessmentByStudent(@ApiParam(value = "要导出的id(非必填)") @RequestParam(value = "ids", required =
false) String ids, @RequestParam("curriculumId") @ApiParam(value = "课程id", required = true) @NotNull(message = "课程id不能为空") Integer curriculumId, HttpServletResponse response, HttpServletRequest request) throws Exception {
String accountId = TokenUtils.getIdByJwtToken(request);
//Integer accountId,Integer curriculumId,String ids
experimentalReportService.exportAssessmentByStudent(Integer.valueOf(accountId), curriculumId, ids, response);
@ -317,17 +346,14 @@ public class AchievementController {
}
@PostMapping("/batchExportReportsAsZip")
@ApiOperation(value = "批量导出实验报告为ZIP(导出Zip压缩包)", httpMethod = "POST", produces = "application/zip", notes = "根据id导出多个报告为ZIP文件")
public void batchExportReportsAsZip(@RequestBody BulkExportReportReq req, HttpServletResponse response, HttpServletRequest request) throws IOException {
experimentalReportService.exportLabReportsAsZip(req,response, request);
@ApiOperation(value = "批量导出实验报告为ZIP(导出Zip压缩包)", httpMethod = "POST", produces = "application/zip", notes = "根据id" +
"导出多个报告为ZIP文件")
public void batchExportReportsAsZip(@RequestBody BulkExportReportReq req, HttpServletResponse response,
HttpServletRequest request) throws IOException {
experimentalReportService.exportLabReportsAsZip(req, response, request);
}
@ApiOperation(value = "学生-修改成绩报告")
@PostMapping("/updateReport")
public R updateReport(@RequestBody com.huoran.common.entity.ExperimentalReport experimentalReport) {
@ -341,14 +367,16 @@ public class AchievementController {
*/
@PostMapping("/spliceClass")
@ApiOperation(value = "拼接班级", response = Class.class)
public R spliceClass(@RequestParam("assessmentId") @ApiParam(value = "考核id", required = true) @NotNull(message = "考核id不能为空") Integer assessmentId, HttpServletRequest request) {
public R spliceClass(@RequestParam("assessmentId") @ApiParam(value = "考核id", required = true) @NotNull(message =
"考核id不能为空") Integer assessmentId, HttpServletRequest request) {
String accountId = TokenUtils.getIdByJwtToken(request);
return assessmentService.spliceClass(assessmentId);
}
@PostMapping("/exportLabReport")
@ApiOperation(value = "导出实验报告", httpMethod = "POST", produces = "application/json", notes = "导出用户doc", response = ExperimentalReportResp.class)
@ApiOperation(value = "导出实验报告", httpMethod = "POST", produces = "application/json", notes = "导出用户doc", response =
ExperimentalReportResp.class)
public R exportLabReport(@RequestBody ExperimentalReportResp report, HttpServletResponse response) throws IOException, TemplateException {
Configuration configuration = new Configuration(new Version("2.3.28"));
//既能保证本地运行找得到模板文件,又能保证jar包运行能找到得到模板文件
@ -474,17 +502,23 @@ public class AchievementController {
}
public static void main(String[] args) throws IOException {
/* System.out.println("检查网址是否可以成功连接python2:" + isValidAndReachable("https://pytwo.occupationlab.com/pythonPicture/1719387122685171938692694911.png", 5000));
/* System.out.println("检查网址是否可以成功连接python2:" + isValidAndReachable("https://pytwo.occupationlab
.com/pythonPicture/1719387122685171938692694911.png", 5000));
//https://python.occupationlab.com/pythonPicture/17194153984361.png
System.out.println("检查网址是否可以成功连接python1:" + isValidAndReachable("https://python.occupationlab.com/pythonPicture/17194153984361.png", 5000));*/
System.out.println("图片1:" + ImgUtil.imgToBase64("https://huoran.oss-cn-shenzhen.aliyuncs.com/20240703/jpg/1808330074106650624.jpg"));
System.out.println("图片2:" + ImgUtil.imgToBase64("https://huoran.oss-cn-shenzhen.aliyuncs.com/20240703/jpg/1808330074379280384.jpg"));
System.out.println("图片3:" + ImgUtil.imgToBase64("https://huoran.oss-cn-shenzhen.aliyuncs.com/20240703/jpg/1808330074609967104.jpg"));
System.out.println("检查网址是否可以成功连接python1:" + isValidAndReachable("https://python.occupationlab
.com/pythonPicture/17194153984361.png", 5000));*/
System.out.println("图片1:" + ImgUtil.imgToBase64("https://huoran.oss-cn-shenzhen.aliyuncs" +
".com/20240703/jpg/1808330074106650624.jpg"));
System.out.println("图片2:" + ImgUtil.imgToBase64("https://huoran.oss-cn-shenzhen.aliyuncs" +
".com/20240703/jpg/1808330074379280384.jpg"));
System.out.println("图片3:" + ImgUtil.imgToBase64("https://huoran.oss-cn-shenzhen.aliyuncs" +
".com/20240703/jpg/1808330074609967104.jpg"));
}
@SneakyThrows
@PostMapping("/exportBankExperimentReport")
@ApiOperation(value = "导出银行实验报告", httpMethod = "POST", produces = "application/json", notes = "导出银行实验报告doc", response = ExperimentaForBanklReportReq.class)
@ApiOperation(value = "导出银行实验报告", httpMethod = "POST", produces = "application/json", notes = "导出银行实验报告doc",
response = ExperimentaForBanklReportReq.class)
public R exportBankExperimentReport(@RequestBody ExperimentaForBanklReportReq req, HttpServletResponse response) throws IOException {
Configuration configuration = new Configuration(new Version("2.3.28"));
//既能保证本地运行找得到模板文件,又能保证jar包运行能找到得到模板文件
@ -495,7 +529,8 @@ public class AchievementController {
//定义下载的类型,标明是word文件(这种是浏览器下载的方式)
//response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("导出模板", "UTF-8") + ".doc");
//response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("导出模板", "UTF-8") + "
// .doc");
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "实验报告.doc");
Map<String, Object> dataMap = new HashMap<>();
@ -503,7 +538,7 @@ public class AchievementController {
for (BankExperimentDataReq dataReq : req.getExperimentalData()) {
if (dataReq.getReferenceAnswer()!=null){
if (dataReq.getReferenceAnswer() != null) {
dataReq.setReferenceAnswer(DelTagsUtil.sanitizeReferenceAnswer(dataReq.getReferenceAnswer()));
}
@ -560,17 +595,26 @@ public class AchievementController {
@PostMapping("/practiceActivity")
@ApiOperation(value = "管理端练习活跃度列表", response = PerformanceManagementPracticeActivityVO.class)
public R practiceActivity(@ApiParam(value = "项目id", required = true) @RequestParam("projectId") Integer projectId, @ApiParam(value = "当前页数", required = true) @RequestParam("pageNum") Integer pageNum, @ApiParam(value = "当前页需要显示的数量", required = true) @RequestParam("pageSize") Integer pageSize, @ApiParam(value = "班级id", required = false) @RequestParam("classId") Integer classId, @ApiParam(value = "关键词", required = false) @RequestParam("keyWord") String keyWord, @ApiParam(value = "商品id", required = true) @NotNull(message = "商品id不能为空") Integer mallId, HttpServletRequest request) {
public R practiceActivity(@ApiParam(value = "项目id", required = false) @RequestParam(value = "projectId",
required = false) Integer projectId,
@ApiParam(value = "试卷id", required = false) @RequestParam(value = "paperId", required = false) Integer paperId
, @ApiParam(value = "当前页数", required = true) @RequestParam("pageNum") Integer pageNum, @ApiParam(value =
"当前页需要显示的数量", required = true) @RequestParam("pageSize") Integer pageSize, @ApiParam(value = "班级id",
required = false) @RequestParam("classId") Integer classId,
@ApiParam(value = "关键词", required = false) @RequestParam("keyWord") String keyWord,
@ApiParam(value = "商品id", required = true) @NotNull(message = "商品id不能为空") Integer mallId, HttpServletRequest request) {
String accountId = TokenUtils.getIdByJwtToken(request);
Integer schoolId = TokenUtils.getSchoolIdByJwtToken(request);
return experimentalReportService.practiceActivity(projectId, pageNum, pageSize, schoolId, classId, keyWord, mallId);
return experimentalReportService.practiceActivity(projectId, pageNum, pageSize, schoolId, classId, keyWord,
mallId, paperId);
}
@ApiOperation(value = "导出练习活跃度全部数据", response = PerformanceManagementPracticeActivityVO.class)
@GetMapping("/exportAllData")
public void exportAllData(@ApiParam(name = "projectId", value = "项目id", required = true) @RequestParam("projectId") Integer projectId, @ApiParam(name = "mallId", value = "产品id", required = true) @RequestParam("mallId") Integer mallId, @ApiParam(name = "classId", value = "班级id", required = false) @RequestParam("classId") Integer classId, @ApiParam(name = "keyWord", value = "关键词", required = false) @RequestParam("keyWord") String keyWord, HttpServletRequest request, HttpServletResponse response) {
public void exportAllData(@ApiParam(name = "projectId", value = "项目id", required = true) @RequestParam("projectId"
) Integer projectId, @ApiParam(name = "mallId", value = "产品id", required = true) @RequestParam("mallId") Integer mallId, @ApiParam(name = "classId", value = "班级id", required = false) @RequestParam("classId") Integer classId, @ApiParam(name = "keyWord", value = "关键词", required = false) @RequestParam("keyWord") String keyWord, HttpServletRequest request, HttpServletResponse response) {
try {
String accountId = TokenUtils.getIdByJwtToken(request);
Integer schoolId = TokenUtils.getSchoolIdByJwtToken(request);
@ -584,7 +628,8 @@ public class AchievementController {
@ApiOperation(value = "批量练习活跃度导出数据")
@PostMapping(value = "/exportDataInBatches", produces = "application/json;multipart/form-data;charset=utf-8")
public void exportSubscribedRecords(@RequestBody List<ActivityDerivationVO> listOfExportSub, HttpServletResponse response, HttpServletRequest request) throws Exception {
public void exportSubscribedRecords(@RequestBody List<ActivityDerivationVO> listOfExportSub,
HttpServletResponse response, HttpServletRequest request) throws Exception {
experimentalReportService.exportDataInBatches(listOfExportSub, response);
}
@ -618,7 +663,8 @@ public class AchievementController {
QueryWrapper<Architecture> wrapper1 = new QueryWrapper<>();
wrapper1.eq("id", getGrade.getParentId());
Architecture getProfessional = architectureMapper.selectOne(wrapper1);
cla.setClassName(getProfessional.getOrganizationName() + "/" + getGrade.getOrganizationName() + "/" + cla.getClassName());
cla.setClassName(getProfessional.getOrganizationName() + "/" + getGrade.getOrganizationName() +
"/" + cla.getClassName());
}
}*/
@ -654,9 +700,11 @@ public class AchievementController {
//统计内置项目+学校自己创建在产品下的项目
builtInTotalNumberOfExercises = projectManageService.getCurriculumCountByType(proList.getCid(), 0);
totalNumberOfSchoolPracticeProjects = projectManageService.projectCreatedUnderProduct(proList.getMallId(), 0, schoolId);
totalNumberOfSchoolPracticeProjects = projectManageService.projectCreatedUnderProduct(proList.getMallId()
, 0, schoolId);
builtTntotalNumberOfAssessmentItems = projectManageService.getCurriculumCountByType(proList.getCid(), 1);
totalNumberOfSchoolAssessmentItems = projectManageService.projectCreatedUnderProduct(proList.getMallId(), 1, schoolId);
totalNumberOfSchoolAssessmentItems = projectManageService.projectCreatedUnderProduct(proList.getMallId(),
1, schoolId);
proList.setNumberOfPracticeItems(builtInTotalNumberOfExercises + totalNumberOfSchoolPracticeProjects);
proList.setNumberOfAssessmentItems(builtTntotalNumberOfAssessmentItems + totalNumberOfSchoolAssessmentItems);
proList.setClassSize(studentService.countClassSizes(schoolId, proList.getClassId()));
@ -690,7 +738,8 @@ public class AchievementController {
newList = stream.collect(Collectors.toList());
// 处理分页
int total = newList.size();
newList = newList.stream().skip((long) req.getPageSize() * (req.getPageNum() - 1)).limit(req.getPageSize()).collect(Collectors.toList());
newList =
newList.stream().skip((long) req.getPageSize() * (req.getPageNum() - 1)).limit(req.getPageSize()).collect(Collectors.toList());
return R.ok().put("data", newList).put("total", total);
}
@ -752,27 +801,34 @@ public class AchievementController {
@ApiOperation(value = "产品维度下:批量导出产品下的练习成绩")
@PostMapping(value = "/exportProductPracticeResults", produces = "application/json;multipart/form-data;charset=utf-8")
public void exportProductPracticeResults(@RequestBody List<PracticeProjectsUnderTheProductResp> list, HttpServletResponse response) throws Exception {
@PostMapping(value = "/exportProductPracticeResults", produces = "application/json;multipart/form-data;" +
"charset=utf-8")
public void exportProductPracticeResults(@RequestBody List<PracticeProjectsUnderTheProductResp> list,
HttpServletResponse response) throws Exception {
/*for (PracticeProjectsUnderTheProductResp resp : list) {
resp.setTotalNumberOfPractices(resp.getTotalNumberOfPractices() + "/" + resp.getTotalNumberOfExercises());
resp.setTotalNumberOfPractices(resp.getTotalNumberOfPractices() + "/" + resp
.getTotalNumberOfExercises());
}*/
experimentalReportService.exportProductPracticeResults(list, response);
}
@ApiOperation(value = "产品维度下:批量导出产品下的考核成绩")
@PostMapping(value = "/exportProductAssessResults", produces = "application/json;multipart/form-data;charset=utf-8")
public void exportProductAssessResults(@RequestBody List<AssessProjectsUnderTheProductResp> list, HttpServletResponse response) throws Exception {
public void exportProductAssessResults(@RequestBody List<AssessProjectsUnderTheProductResp> list,
HttpServletResponse response) throws Exception {
/*for (AssessProjectsUnderTheProductResp resp : list) {
resp.setTotalNumberOfParticipants(resp.getTotalNumberOfParticipants() + "/" + resp.getTotalAssessment());
resp.setTotalNumberOfParticipants(resp.getTotalNumberOfParticipants() + "/" + resp.getTotalAssessment
());
}*/
experimentalReportService.exportProductAssessResults(list, response);
}
@ApiOperation(value = "产品维度下:批量导出学生练习成绩详情")
@PostMapping(value = "/exportDetailsOfStudentPracticeScores", produces = "application/json;multipart/form-data;charset=utf-8")
public void exportDetailsOfStudentPracticeScores(@RequestBody PerformanceUnderProductReq req, HttpServletResponse response, HttpServletRequest request) throws Exception {
@PostMapping(value = "/exportDetailsOfStudentPracticeScores", produces = "application/json;multipart/form-data;" +
"charset=utf-8")
public void exportDetailsOfStudentPracticeScores(@RequestBody PerformanceUnderProductReq req,
HttpServletResponse response, HttpServletRequest request) throws Exception {
String accountId = TokenUtils.getIdByJwtToken(request);
Integer schoolId = TokenUtils.getSchoolIdByJwtToken(request);
req.setSchoolId(schoolId);
@ -780,8 +836,10 @@ public class AchievementController {
}
@ApiOperation(value = "产品维度下:批量导出学生考核成绩详情")
@PostMapping(value = "/exportDetailsOfStudentAssessmentResults", produces = "application/json;multipart/form-data;charset=utf-8")
public void exportDetailsOfStudentAssessmentResults(@RequestBody PerformanceUnderProductReq req, HttpServletResponse response, HttpServletRequest request) throws Exception {
@PostMapping(value = "/exportDetailsOfStudentAssessmentResults", produces = "application/json;" +
"multipart/form-data;charset=utf-8")
public void exportDetailsOfStudentAssessmentResults(@RequestBody PerformanceUnderProductReq req,
HttpServletResponse response, HttpServletRequest request) throws Exception {
String accountId = TokenUtils.getIdByJwtToken(request);
Integer schoolId = TokenUtils.getSchoolIdByJwtToken(request);
req.setSchoolId(schoolId);

@ -48,6 +48,10 @@ public class Assessment implements Serializable {
@ApiModelProperty(value = "绑定项目id")
private Integer projectId;
//试卷id
@ApiModelProperty(value = "试卷id", name = "paperId", example = "1", required = true)
private Integer paperId;
@ApiModelProperty(value = "实验时长")
private String experimentDuration;

@ -37,9 +37,13 @@ public class AssessmentReq {
private String classId;
@ApiModelProperty(value = "绑定项目id", name = "projectId", example = "1", required = true)
@NotNull(message = "项目id不能为空")
// @NotNull(message = "项目id不能为空")
private Integer projectId;
//试卷id
@ApiModelProperty(value = "试卷id", name = "paperId", example = "1", required = true)
private Integer paperId;
@ApiModelProperty(value = "实验时长", name = "experimentDuration", example = "1", required = true)
@NotEmpty(message = "实验时长不能为空")
private String experimentDuration;

@ -0,0 +1,25 @@
package com.huoran.occupationlab.entity.req;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class TheoreticalExerciseDetailsReq extends PageReq{
@ApiModelProperty(value = "试卷id")
private Integer paperId;
@ApiModelProperty(value = "班级id")
private Integer classId;
@ApiModelProperty(value = "关键词")
private String keyword;
@ApiModelProperty(value = "商品id")
private Integer mallId;
//账号id
@ApiModelProperty(hidden = true)
private Integer accountId;
}

@ -27,6 +27,11 @@ public class AchievementByPracticeResp {
@ApiModelProperty(value = "项目id")
private Integer projectId;
//试卷id
@ApiModelProperty(value = "试卷id")
private Integer paperId;
@ApiModelProperty(value = "项目名称")
private String projectName;

@ -26,4 +26,8 @@ public class EnterExamResp {
@ApiModelProperty(value = "课程id")
private Integer cid;
//试卷id
@ApiModelProperty(value = "试卷id")
private Integer paperId;
}

@ -44,9 +44,9 @@ public interface ExperimentalReportMapper extends BaseMapper<ExperimentalReport>
IPage<AchievementResp> getAssessmentForTeacher(Page<AchievementResp> page, @Param("req") PageAchievementByTeacherReq req);
IPage<AchievementResp> getPracticeDetail(Page<AchievementResp> page, @Param("projectId") Integer projectId,
@Param("schoolId") Integer schoolId, @Param("classId") Integer classId, @Param("keyWord") String keyWord,@Param("mallId")Integer mallId);
@Param("schoolId") Integer schoolId, @Param("classId") Integer classId, @Param("keyWord") String keyWord, @Param("mallId")Integer mallId, @Param("paperId") Integer paperId);
List<ExportPracticeByTeacherResp> exportPracticeInfo(@Param("ids") String ids, @Param("schoolId") Integer schoolId, @Param("projectId") Integer projectId,@Param("mallId")Integer mallId);
List<ExportPracticeByTeacherResp> exportPracticeInfo(@Param("ids") String ids, @Param("schoolId") Integer schoolId, @Param("projectId") Integer projectId,@Param("mallId")Integer mallId,@Param("paperId") Integer paperId);
List<ExportAssessmentByTeacherResp> exportAssessmentInfo(@Param("ids") String ids, @Param("schoolId") Integer schoolId, @Param("assessmentId") Integer assessmentId, @Param("classId") Integer classId);
@ -55,13 +55,13 @@ public interface ExperimentalReportMapper extends BaseMapper<ExperimentalReport>
IPage<AchievementResp> getAssessmentDetailUnspecifiedClass(Page<AchievementResp> page, @Param("assessmentId") Integer assessmentId, @Param("classId") Integer classId,@Param("keyword")String keyword);
FractionalSegmentResp getFractionalSegmentByPractice(@Param("projectId") Integer projectId, @Param("schoolId") Integer schoolId, @Param("classId") Integer classId,@Param("mallId")Integer mallId);
FractionalSegmentResp getFractionalSegmentByPractice(@Param("projectId") Integer projectId, @Param("schoolId") Integer schoolId, @Param("classId") Integer classId, @Param("mallId")Integer mallId,@Param("paperId") Integer paperId);
FractionalSegmentResp getFractionalSegmentByAssessment(@Param("assessmentId") Integer assessmentId, @Param("classId") Integer classId, @Param("schoolId") Integer schoolId);
FractionalSegmentResp getAvgScoreAndPeopleByPractice(@Param("projectId") Integer projectId, @Param("schoolId") Integer schoolId, @Param("classId") Integer classId,@Param("mallId")Integer mallId);
FractionalSegmentResp getAvgScoreAndPeopleByPractice(@Param("projectId") Integer projectId, @Param("schoolId") Integer schoolId, @Param("classId") Integer classId, @Param("mallId")Integer mallId, @Param("paperId")Integer paperId);
Integer countTheTotalNumberOfExercisers(@Param("projectId") Integer projectId, @Param("schoolId") Integer schoolId, @Param("classId") Integer classId,@Param("mallId")Integer mallId);
Integer countTheTotalNumberOfExercisers(@Param("projectId") Integer projectId, @Param("schoolId") Integer schoolId, @Param("classId") Integer classId, @Param("mallId")Integer mallId, @Param("paperId")Integer paperId);
FractionalSegmentResp getAvgScoreAndPeopleByAssessment(@Param("assessmentId") Integer assessmentId, @Param("classId") Integer classId, @Param("schoolId") Integer schoolId);
@ -123,7 +123,7 @@ public interface ExperimentalReportMapper extends BaseMapper<ExperimentalReport>
IPage<PerformanceManagementPracticeActivityVO> practiceActivity(Page<PerformanceManagementPracticeActivityVO> page,
@Param("projectId") Integer projectId, @Param("schoolId") Integer schoolId,
@Param("classId") Integer classId, @Param("keyWord") String keyWord, @Param("mallId")Integer mallId);
@Param("classId") Integer classId, @Param("keyWord") String keyWord, @Param("mallId")Integer mallId,@Param("paperId") Integer paperId);
IPage<ActivityDerivationVO> exportAllData(Page<ActivityDerivationVO> page, @Param("projectId") Integer projectId, @Param("schoolId") Integer schoolId, @Param("mallId")Integer mallId,@Param("classId") Integer classId, @Param("keyWord") String keyWord);
@ -217,4 +217,8 @@ public interface ExperimentalReportMapper extends BaseMapper<ExperimentalReport>
List<LcRuleRecord> getStudentAnswers(@Param("answer")List<String> answer);
HashMap<String, String> getStItemOptionss(@Param("collect1")List<String> collect1);
ScorePointsUnderTheItemResp calculateTheErrorRateOfTestQuestions(@Param("schoolId") Integer schoolId,@Param("paperId") Integer paperId, @Param("mallId") Integer mallId,@Param("sort") String sort);
List<ScorePointsUnderTheItemResp> theErrorRateOfAllWrongQuestions(@Param("schoolId") Integer schoolId,@Param("paperId") Integer paperId, @Param("mallId") Integer mallId);
}

@ -24,7 +24,14 @@
<!--查询条件:老师只能看到自己创建的考核 管理员可以看到全部考核-->
<select id="pageByCondition" resultType="com.huoran.occupationlab.entity.Assessment" parameterType="Map">
SELECT
pro.project_name,
CASE
WHEN
ass.project_id IS NOT NULL THEN
pro.project_name
WHEN ass.paper_id IS NOT NULL THEN
p.NAME ELSE NULL
END AS projectName,
ass.*,
(
SELECT
@ -51,9 +58,10 @@
ol_assessment ass
RIGHT JOIN ol_class c ON c.id = ass.class_id
LEFT JOIN ol_project_manage pro ON ass.project_id = pro.project_id
LEFT JOIN exam.exam_paper p ON p.paper_id = ass.paper_id
WHERE
ass.is_del = 0 and ass.school_id = #{params.schoolId}
ass.is_del = 0
AND ass.school_id = #{params.schoolId}
<if test="params.mallId != null">
and ass.mall_id = #{params.mallId}
@ -81,20 +89,23 @@
<if test="params.type != null">
and type = #{params.type}
and ass.type = #{params.type}
</if>
<if test="params.status != null">
and status = #{params.status}
and ass.status = #{params.status}
</if>
<if test="params.curriculumId != null">
and ass.curriculum_id = #{params.curriculumId}
</if>
<if test="params.keyWord != '' and params.keyWord != null">
AND CONCAT(
experimental_name,
pro.project_name,
(
AND (
experimental_name LIKE CONCAT('%',#{params.keyWord},'%')
OR pro.project_name LIKE CONCAT('%',#{params.keyWord},'%')
OR (
SELECT
GROUP_CONCAT( b.class_name ) className
FROM
@ -102,8 +113,9 @@
INNER JOIN ol_class b ON FIND_IN_SET( b.id, a.class_id )
WHERE
a.id = ass.id
)
) LIKE CONCAT('%',#{params.keyWord},'%')
)
</if>
HAVING
className IS NOT NULL
@ -593,18 +605,23 @@
</select>
<select id="getUrl" resultType="com.huoran.occupationlab.entity.resp.EnterExamResp">
SELECT a.id as assessmentId,
SELECT
a.id AS assessmentId,
c.url,
m.project_id,
p.paper_id,
c.system_id,
a.curriculum_id as cid
from occupationlab.ol_assessment a
inner join occupationlab.ol_project_manage m on a.project_id = m.project_id
inner join nakadai.service_configuration c on c.system_id = m.system_id
WHERE a.is_del = 0
and a.is_del = 0
and c.is_del = 0
and a.id = #{id}
a.curriculum_id AS cid
FROM
occupationlab.ol_assessment a
LEFT JOIN occupationlab.ol_project_manage m ON a.project_id = m.project_id
LEFT JOIN exam.exam_paper p ON a.paper_id = p.paper_id
LEFT JOIN nakadai.service_configuration c ON m.project_id IS NOT NULL
AND c.system_id = m.system_id
AND c.is_del = 0
WHERE
a.is_del = 0
AND a.id = #{id}
</select>
<select id="spliceClass" resultType="java.lang.String">
SELECT GROUP_CONCAT(DISTINCT class_id) as classId

@ -76,7 +76,8 @@
r.report_id,
cu.curriculum_name AS curriculumName,
r.project_id,
m.project_name,
p.paper_id,
IFNULL( m.project_name, p.NAME ) AS projectName,
r.score,
r.time_sum,
r.start_time,
@ -89,7 +90,8 @@
FROM
occupationlab.ol_experimental_report r
INNER JOIN nakadai.curriculum cu ON cu.cid = r.curriculum_id
INNER JOIN occupationlab.ol_project_manage m ON m.project_id = r.project_id
LEFT JOIN occupationlab.ol_project_manage m ON m.project_id = r.project_id
LEFT JOIN exam.exam_paper p ON p.paper_id = r.paper_id
INNER JOIN occupationlab.ol_assessment a ON a.id = r.assessment_id
WHERE
r.is_del = 0 and r.account_id = #{pageReq.accountId} and r.assessment_id is not null
@ -231,12 +233,15 @@
<select id="getPracticeForTeacher" resultType="com.huoran.occupationlab.entity.resp.AchievementByPracticeResp"
parameterType="com.huoran.occupationlab.entity.req.PageAchievementByTeacherReq">
(
SELECT m.project_id,
m.project_name,
m.create_time,
( SELECT
m.project_id,
p.paper_id,
IFNULL( m.project_name, p.NAME ) AS project_name,
IFNULL(m.create_time,p.create_time) as create_time,
1 AS isAdmin,
m.zt_del AS isDel,
IFNULL( m.zt_del, p.is_del ) AS isDel,
(
SELECT c1.is_del
FROM nakadai.curriculum_configure c1
@ -245,35 +250,40 @@
LIMIT 0, 1
)
AS courseDel,
(
SELECT
count( 1 )
FROM
ol_experimental_report r
WHERE
r.project_id = m.project_id
CASE
WHEN cc.paper_id is not null THEN
(SELECT count(1)
FROM ol_experimental_report r
WHERE r.paper_id = cc.paper_id
AND r.school_id = #{req.schoolId}
AND r.is_del = 0
AND r.mall_id = #{req.mallId}
) AS experimentalNumber
AND r.mall_id = #{req.mallId})
WHEN cc.project_id is not null THEN
(SELECT count(1)
FROM ol_experimental_report r
WHERE r.project_id = m.project_id
AND r.school_id = #{req.schoolId}
AND r.is_del = 0
AND r.mall_id = #{req.mallId})
END AS experimentalNumber
FROM
nakadai.curriculum_configure cc
INNER JOIN nakadai.curriculum c ON c.cid = cc.cid
INNER JOIN ol_project_manage m ON m.project_id = cc.project_id
LEFT JOIN ol_project_manage m ON m.project_id = cc.project_id
AND m.founder = 0
LEFT JOIN ol_project_hidden tph ON m.project_id = tph.project_id
WHERE
m.founder = 0
AND m.permissions = 0
AND tph.is_hidden IS NULL
AND cc.is_del = 0
AND tph.is_hidden
IS NULL LEFT JOIN exam.exam_paper p ON p.paper_id = cc.paper_id
WHERE
cc.is_del = 0
<if test="req.curriculumId != ''">
AND FIND_IN_SET( c.cid, #{req.curriculumId} )
</if>
<!--<if test="req.curriculumId == null">
AND FIND_IN_SET( c.cid, -1)
</if>-->
<if test="req.month != '' and req.month != null">
AND DATE_SUB(CURDATE(), INTERVAL #{req.month} month ) &lt;= date(m.create_time)
@ -286,14 +296,13 @@
<if test="req.keyWord != '' and req.keyWord != null">
AND CONCAT( m.project_name ) LIKE CONCAT('%',#{req.keyWord},'%')
</if>
/*GROUP BY
m.project_id*/
ORDER BY
cc.sort ASC
) UNION ALL
(
SELECT
m.project_id,
null as paper_id,
m.project_name,
m.create_time,
0 AS isAdmin,
@ -359,29 +368,42 @@
<!--教师端:成绩管理(考核列表)-->
<select id="getAssessmentForTeacher" resultType="com.huoran.occupationlab.entity.resp.AchievementResp"
parameterType="com.huoran.occupationlab.entity.req.PageAchievementByTeacherReq">
SELECT a.id AS assessmentId,
SELECT
a.id AS assessmentId,
a.class_id,
a.experimental_name,
m.project_name,
IFNULL(m.project_name,p.name) as project_name,
m.permissions,
a.create_time,
(SELECT COUNT(1) FROM ol_experimental_report r WHERE r.assessment_id = a.id AND r.is_del = 0 and r.mall_id = #{req.mallId}) AS
experimentalNumber,
(
SELECT GROUP_CONCAT(b.class_name) className
FROM ol_assessment ass
INNER JOIN ol_class b ON FIND_IN_SET(b.id, ass.class_id)
WHERE a.id = ass.id
) AS className,
COALESCE ( er.count, 0 ) AS experimentalNumber,
GROUP_CONCAT( b.class_name ) AS className,
a.is_del,
a.project_id
FROM ol_assessment a
INNER JOIN ol_project_manage m ON a.project_id = m.project_id
a.project_id,
p.paper_id
FROM
ol_assessment a
LEFT JOIN (
SELECT
r.assessment_id,
COUNT( * ) AS count
FROM
ol_experimental_report r
WHERE
r.is_del = 0
AND r.mall_id = #{req.mallId}
GROUP BY
r.assessment_id
) er ON a.id = er.assessment_id
LEFT JOIN ol_project_manage m ON a.project_id = m.project_id
AND m.permissions = 1
LEFT JOIN ol_project_hidden tph ON a.id = tph.teach_id
WHERE m.permissions = #{req.permissions}
AND tph.is_hidden is NULL
AND tph.is_hidden
IS NULL LEFT JOIN exam.exam_paper p ON p.paper_id = a.paper_id
LEFT JOIN ol_class b ON FIND_IN_SET( b.id, a.class_id )
WHERE
a.school_id = #{req.schoolId}
and a.school_id = #{req.schoolId}
<if test="req.isAdmin!=1">
<if test="req.accountIdList != null and req.accountIdList.size() > 0 ">
@ -397,9 +419,6 @@
and a.mall_id = #{req.mallId}
</if>
<!--<if test="req.month != '' and req.month != null">
AND DATE_SUB(CURDATE(), INTERVAL #{req.month} month ) &lt;= date(a.create_time)
</if>-->
<if test="req.startTime != '' and req.startTime!= null and req.endTime != '' and req.endTime!= null">
AND date_format( a.create_time, '%Y-%m-%d' ) BETWEEN #{req.startTime} AND #{req.endTime}
@ -428,12 +447,28 @@
)
) LIKE CONCAT('%',#{req.keyWord},'%')
</if>
ORDER BY a.id DESC
GROUP BY
a.id,
a.class_id,
a.experimental_name,
m.project_name,
m.permissions,
a.create_time,
er.count,
a.is_del,
a.project_id,
p.paper_id
ORDER BY
a.id DESC
</select>
<select id="getPracticeDetail" resultType="com.huoran.occupationlab.entity.resp.AchievementResp"
parameterType="java.lang.Integer">
SELECT * from (SELECT
SELECT
*
FROM
(
SELECT
r.report_id,
a.id AS accountId,
u.user_name,
@ -441,7 +476,8 @@
r.score,
r.submit_time,
r.project_id,
pm.project_name,
p.paper_id,
IFNULL( pm.project_name,p.name) as project_name ,
r.time_sum,
s.class_id AS classId,
(
@ -460,10 +496,19 @@
INNER JOIN nakadai.hr_mall m ON m.mall_id = r.mall_id
AND m.is_del = 0
LEFT JOIN ol_student s ON s.account_id = r.account_id
INNER JOIN ol_project_manage pm ON pm.project_id = r.project_id
LEFT JOIN ol_project_manage pm ON pm.project_id = r.project_id
LEFT JOIN exam.exam_paper p ON p.paper_id = r.paper_id
WHERE
r.is_del = 0
<if test="paperId != null">
AND r.paper_id = #{paperId}
</if>
<if test="projectId != null">
AND r.project_id = #{projectId}
</if>
AND r.school_id = #{schoolId}
and r.mall_id = #{mallId}
ORDER BY
@ -532,7 +577,7 @@
</select>
<select id="exportPracticeInfo" resultType="com.huoran.occupationlab.entity.resp.ExportPracticeByTeacherResp">
SELECT * from (SELECT
SELECT
r.report_id,
a.id AS accountId,
u.user_name,
@ -540,18 +585,11 @@
r.score,
r.submit_time,
r.project_id,
pm.project_name,
p.paper_id,
IFNULL( pm.project_name, p.NAME ) AS project_name,
r.time_sum,
s.class_id AS classId,
(
SELECT
GROUP_CONCAT( c.class_name )
FROM
ol_class c
WHERE
c.is_del = 0
AND FIND_IN_SET( c.id, s.class_id )
) AS className
GROUP_CONCAT( c.class_name ) AS className
FROM
ol_experimental_report r
INNER JOIN nakadai.hr_user_account a ON a.id = r.account_id
@ -559,29 +597,36 @@
INNER JOIN nakadai.hr_mall m ON m.mall_id = r.mall_id
AND m.is_del = 0
LEFT JOIN ol_student s ON s.account_id = r.account_id
INNER JOIN ol_project_manage pm ON pm.project_id = r.project_id
LEFT JOIN ol_project_manage pm ON pm.project_id = r.project_id
AND pm.is_del = 0
LEFT JOIN exam.exam_paper p ON p.paper_id = r.paper_id
LEFT JOIN ol_class c ON FIND_IN_SET( c.id, s.class_id ) > 0
AND c.is_del = 0
WHERE
r.is_del = 0
AND r.project_id = #{projectId}
AND r.school_id = #{schoolId}
and r.mall_id = #{mallId}
AND r.mall_id = #{mallId}
<if test="projectId!=null">
AND r.project_id = #{projectId}
</if>
<if test="paperId!=null">
AND r.paper_id = #{paperId}
</if>
<if test="ids != '' and ids != null">
AND r.report_id IN ( ${ids} )
</if>
GROUP BY
r.report_id
ORDER BY
r.score DESC,
r.time_sum ASC) t
WHERE
1=1
<!--<if test="classId != null">
AND FIND_IN_SET( #{classId}, classId )
</if>-->
r.time_sum ASC
<!-- <if test="keyWord != null and keyWord != ''">
AND (CONCAT( t.user_name ) LIKE CONCAT('%',#{keyWord},'%') or CONCAT( t.work_number ) LIKE CONCAT('%',#{keyWord},'%'))
</if>-->
<if test="ids != '' and ids != null">
AND report_id IN ( ${ids} )
</if>
</select>
@ -655,12 +700,20 @@
LEFT JOIN ol_student s ON s.account_id = r.account_id AND s.is_del = 0
WHERE
r.is_del = 0
AND r.project_id = #{projectId}
AND r.school_id = #{schoolId}
AND r.mall_id = #{mallId}
<if test="classId!=null">
AND FIND_IN_SET( #{classId}, s.class_id )
</if>
<if test="projectId!=null">
AND r.project_id = #{projectId}
</if>
<if test="paperId!=null">
AND r.paper_id = #{paperId}
</if>
</select>
<select id="getFractionalSegmentByAssessment"
resultType="com.huoran.occupationlab.entity.resp.FractionalSegmentResp">
@ -697,12 +750,20 @@
-- AND s.is_del = 0
WHERE
r.is_del = 0
AND r.project_id = #{projectId}
AND r.school_id = #{schoolId}
AND r.mall_id = #{mallId}
<if test="classId!=null">
AND FIND_IN_SET( #{classId}, s.class_id )
</if>
<if test="projectId!=null">
AND r.project_id = #{projectId}
</if>
<if test="paperId!=null">
AND r.paper_id = #{paperId}
</if>
</select>
<select id="getAvgScoreAndPeopleByAssessment"
@ -1580,7 +1641,7 @@
MAX( r.time_sum ) AS theLongestTime,
MIN( r.time_sum ) AS shortestTime,
MAX( r.submit_time ) AS lastSubmissionTime,
GROUP_CONCAT( c.class_name ORDER BY c.class_name SEPARATOR ', ' ) AS className,
GROUP_CONCAT( DISTINCT c.class_name ORDER BY c.class_name SEPARATOR ', ' ) AS className,
FORMAT( ( SUM( r.score ) / COUNT( r.report_id ) ), 2 ) AS avgScore,
s.class_id
FROM
@ -1594,7 +1655,15 @@
WHERE
r.is_del = 0
AND assessment_id IS NULL
<if test="projectId!=null ">
AND project_id = #{projectId}
</if>
<if test="paperId!=null">
AND r.paper_id = #{paperId}
</if>
AND r.school_id = #{schoolId}
AND r.mall_id = #{mallId}
GROUP BY
@ -1743,7 +1812,14 @@
LEFT JOIN ol_student s ON s.account_id = r.account_id
WHERE
r.is_del = 0
<if test="projectId!=null">
AND r.project_id = #{projectId}
</if>
<if test="paperId!=null">
AND r.paper_id = #{paperId}
</if>
AND r.school_id = #{schoolId}
AND r.mall_id = #{mallId}
<if test="classId!=null">
@ -2921,6 +2997,105 @@
#{ids}
</foreach>
</select>
<select id="calculateTheErrorRateOfTestQuestions"
resultType="com.huoran.occupationlab.entity.resp.ScorePointsUnderTheItemResp">
WITH error_stats AS (
SELECT
question_version_id,
COUNT( DISTINCT account_id ) AS unique_users,
-- 唯一用户的数量
COUNT( * ) AS total_answers,
-- 总答题数
SUM( CASE WHEN user_score IS NOT NULL AND user_score != question_score THEN 1 ELSE 0 END ) AS wrong_count,
-- 错误答案数
( SUM( CASE WHEN user_score IS NOT NULL AND user_score != question_score THEN 1 ELSE 0 END ) / COUNT( * ) ) * 100 AS error_rate -- 错误率
FROM
exam.exam_paper_question_user_answer
WHERE
paper_id = #{paperId}
AND school_id = #{schoolId}
AND is_del = 0
AND stage_id IS NULL
AND assessment_id IS NULL
AND answering_status = '已作答' -- 只考虑已作答的状态
GROUP BY
question_version_id
),
ranked_questions AS (
SELECT
question_version_id,
unique_users,
error_rate,
RANK ( ) OVER ( ORDER BY error_rate DESC ) AS rank_desc,
RANK ( ) OVER ( ORDER BY error_rate ASC ) AS rank_asc
FROM
error_stats
) -- 选择错误率最高和最低的题目
SELECT
q.question_version_id,
q.unique_users,
q.error_rate,
qv.stem as judgmentName
FROM
ranked_questions q
LEFT JOIN exam.q_question_versions qv ON qv.id = q.question_version_id
WHERE
q.rank_desc = 1
OR q.rank_asc = 1
ORDER BY
q.error_rate ${sort}
LIMIT 1
</select>
<select id="theErrorRateOfAllWrongQuestions"
resultType="com.huoran.occupationlab.entity.resp.ScorePointsUnderTheItemResp">
WITH error_stats AS (
SELECT
question_version_id,
COUNT(DISTINCT account_id) AS unique_users, -- 唯一用户的数量
COUNT(*) AS total_answers, -- 总答题数
SUM(CASE WHEN user_score IS NOT NULL AND user_score != question_score THEN 1 ELSE 0 END) AS errorTotal, -- 错误答案数
(SUM(CASE WHEN user_score IS NOT NULL AND user_score != question_score THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS error_rate -- 错误率
FROM
exam.exam_paper_question_user_answer
WHERE
paper_id = #{paperId}
AND school_id = #{schoolId}
AND is_del = 0
AND stage_id IS NULL
AND assessment_id IS NULL
AND answering_status = '已作答' -- 只考虑已作答的状态
GROUP BY
question_version_id
),
ranked_questions AS (
SELECT
question_version_id,
unique_users,
total_answers,
errorTotal,
error_rate,
RANK() OVER (ORDER BY error_rate DESC) AS rank_desc,
RANK() OVER (ORDER BY error_rate ASC) AS rank_asc
FROM
error_stats
)
-- 选择错误率最高和最低的题目
SELECT
q.question_version_id,
q.unique_users,
q.total_answers,
q.errorTotal,
q.error_rate,
qv.stem AS judgmentName -- 题目描述
FROM
ranked_questions q
LEFT JOIN exam.q_question_versions qv ON qv.id = q.question_version_id
WHERE
q.rank_desc = 1 OR q.rank_asc = 1
ORDER BY q.question_version_id asc
</select>
</mapper>

@ -12,7 +12,6 @@ import com.huoran.occupationlab.entity.vo.ProductClassInformationVO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.io.IOException;
import java.util.List;
@ -61,9 +60,10 @@ public interface ExperimentalReportService extends IService<ExperimentalReport>
* @param projectId
* @param pageNum
* @param pageSize
* @param paperId
* @return
*/
R getPracticeDetail(Integer projectId, Integer pageNum, Integer pageSize, Integer schoolId, Integer classId, String keyWord, Integer mallId);
R getPracticeDetail(Integer projectId, Integer pageNum, Integer pageSize, Integer schoolId, Integer classId, String keyWord, Integer mallId, Integer paperId);
/**
* @Description: 管理端考核成绩详情
@ -77,7 +77,7 @@ public interface ExperimentalReportService extends IService<ExperimentalReport>
* @auther: Rong
* @date: 2021/9/8 16:39
*/
void exportPracticeInfo(String ids, HttpServletResponse response, Integer schoolId, Integer projectId, Integer mallId) throws Exception;
void exportPracticeInfo(String ids, HttpServletResponse response, Integer schoolId, Integer projectId, Integer mallId,Integer paperId) throws Exception;
/**
* @Description: 批量导出考核成绩
@ -126,7 +126,7 @@ public interface ExperimentalReportService extends IService<ExperimentalReport>
R reportDetail(Integer reportId);
R practiceActivity(Integer projectId, Integer pageNum, Integer pageSize, Integer schoolId, Integer classId, String keyWord, Integer mallId);
R practiceActivity(Integer projectId, Integer pageNum, Integer pageSize, Integer schoolId, Integer classId, String keyWord, Integer mallId, Integer paperId);
void exportDataInBatches(List<ActivityDerivationVO> list, HttpServletResponse response) throws Exception;
@ -182,4 +182,5 @@ public interface ExperimentalReportService extends IService<ExperimentalReport>
void exportLabReportsAsZip(BulkExportReportReq req, HttpServletResponse response, HttpServletRequest request) throws IOException;
// R getPracticeDetailByTheory(TheoreticalExerciseDetailsReq req);
}

@ -543,10 +543,16 @@ public class AssessmentServiceImpl extends ServiceImpl<AssessmentMapper, Assessm
}
}
EnterExamResp examResp = mapper.getUrl(assessmentId);
// EnterExamResp examResp = mapper.getUrl(assessmentId);
//返回当前项目id及邀请码以及跳转路径
return R.ok().put("projectId", assessment.getProjectId()).put("invitationCode", assessment.getInvitationCode()).put("assessmentInfo", assessment).put("url", examResp.getUrl()).put("info", examResp);
/*return R.ok().put("projectId", assessment.getProjectId())
.put("invitationCode", assessment.getInvitationCode())
.put("assessmentInfo", assessment)
.put("url", examResp.getUrl())
.put("info", examResp);*/
return R.ok().put("assessmentInfo", assessment);
}
@Override

@ -59,11 +59,11 @@ import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
@ -225,27 +225,57 @@ public class ExperimentalReportServiceImpl extends ServiceImpl<ExperimentalRepor
}
@Override
public R getPracticeDetail(Integer projectId, Integer pageNum, Integer pageSize, Integer schoolId,
Integer classId, String keyWord, Integer mallId) {
Page<AchievementResp> page = new Page<AchievementResp>(pageNum, pageSize);
IPage<AchievementResp> iPage = baseMapper.getPracticeDetail(page, projectId, schoolId, classId, keyWord,
mallId);
public R getPracticeDetail(Integer projectId, Integer pageNum, Integer pageSize, Integer schoolId,
Integer classId, String keyWord, Integer mallId, Integer paperId) {
Page<AchievementResp> page = new Page<>(pageNum, pageSize);
IPage<AchievementResp> iPage = baseMapper.getPracticeDetail(page, projectId, schoolId, classId, keyWord, mallId, paperId);
//获取各个分数段人数
FractionalSegmentResp getFractionalSegmentNum = baseMapper.getFractionalSegmentByPractice(projectId, schoolId
, classId, mallId);
//获取平均分和总人数
FractionalSegmentResp getAvgScoreAndPeople = baseMapper.getAvgScoreAndPeopleByPractice(projectId, schoolId,
classId, mallId);
// 获取各个分数段人数
FractionalSegmentResp fractionalSegmentNum = baseMapper.getFractionalSegmentByPractice(projectId, schoolId, classId, mallId, paperId);
// 获取平均分和总人数
FractionalSegmentResp avgScoreAndPeople = baseMapper.getAvgScoreAndPeopleByPractice(projectId, schoolId, classId, mallId, paperId);
//统计当前参加练习的人数 非有实验报告的总数(人数去重)
Integer peopleNum = baseMapper.countTheTotalNumberOfExercisers(projectId, schoolId, classId, mallId);
// 统计当前参加练习的人数(非有实验报告的总数,人数去重)
Integer peopleNum = baseMapper.countTheTotalNumberOfExercisers(projectId, schoolId, classId, mallId, paperId);
//
com.huoran.common.entity.ProjectManage projectManage =
projectManageMapper.undeletedAndDeletedItemDetails(projectId);
ErrorRateAnalysisResp errorRateAnalysisResp = new ErrorRateAnalysisResp();
ScorePointsUnderTheItemResp max = null;
ScorePointsUnderTheItemResp min = null;
if (projectId != null) {
com.huoran.common.entity.ProjectManage projectManage = projectManageMapper.undeletedAndDeletedItemDetails(projectId);
Integer sysType = baseMapper.selectSystemType(projectManage.getSystemId());
//获取项目下的全部判分点(不同系统查询不同)
List<ScorePointsUnderTheItemResp> scoringPointList = getScoringPointList(sysType, projectId, schoolId, classId, mallId, avgScoreAndPeople.getPeopleNum());
if (!scoringPointList.isEmpty()) {
max = Collections.max(scoringPointList, Comparator.comparingDouble(u -> Double.parseDouble(u.getErrorRate())));
min = Collections.min(scoringPointList, Comparator.comparingDouble(u -> Double.parseDouble(u.getErrorRate())));
}
errorRateAnalysisResp.setScoringPointList(scoringPointList);
} else {
max = calculateErrorRateOfTestQuestions(schoolId, paperId, mallId, "desc");
min = calculateErrorRateOfTestQuestions(schoolId, paperId, mallId, "asc");
List<ScorePointsUnderTheItemResp> scoringPointList = baseMapper.theErrorRateOfAllWrongQuestions(schoolId, paperId, mallId);
setPrecisionForErrorRates(scoringPointList);
errorRateAnalysisResp.setScoringPointList(scoringPointList);
}
return R.ok()
.put("page", iPage)
.put("peopleNum", peopleNum)
.put("avgScore", avgScoreAndPeople.getAvgScore())
.put("maxScore", avgScoreAndPeople.getMaxScore())
.put("minScore", avgScoreAndPeople.getMinScore())
.put("getFractionalSegmentNum", fractionalSegmentNum)
.put("errorAnalysis", errorRateAnalysisResp)
.put("highestErrorRate", max)
.put("minimumErrorRate", min);
}
private List<ScorePointsUnderTheItemResp> getScoringPointList(Integer sysType, Integer projectId, Integer schoolId, Integer classId, Integer mallId, Integer peopleNum) {
List<ScorePointsUnderTheItemResp> scoringPointList = null;
if (sysType == PointConstant.PROGRAMMING) {
scoringPointList = baseMapper.errorRateAnalysis(projectId, schoolId, classId, mallId);
@ -254,65 +284,34 @@ public class ExperimentalReportServiceImpl extends ServiceImpl<ExperimentalRepor
}
for (ScorePointsUnderTheItemResp scorePoint : scoringPointList) {
// Integer countError = baseMapper.countError(projectId, schoolId, scorePoint.getJudgmentId());
//当前判分点做错的人数总数
// scorePoint.setErrorTotal(countError);
scorePoint.setPeopleNum(getAvgScoreAndPeople.getPeopleNum());
//设置错误率
BigDecimal errorBigDecimal = new BigDecimal(0);
//除数非0校验
if (getAvgScoreAndPeople.getPeopleNum() != 0) {
errorBigDecimal =
new BigDecimal(scorePoint.getErrorTotal()).divide(new BigDecimal(getAvgScoreAndPeople.getPeopleNum()), 2, ROUND_HALF_DOWN);
scorePoint.setPeopleNum(peopleNum);
BigDecimal errorBigDecimal = BigDecimal.ZERO;
if (peopleNum != 0) {
errorBigDecimal = new BigDecimal(scorePoint.getErrorTotal()).divide(new BigDecimal(peopleNum), 2, RoundingMode.HALF_DOWN);
}
scorePoint.setErrorRate(errorBigDecimal.multiply(new BigDecimal(100)) + "");
scorePoint.setErrorRate(errorBigDecimal.multiply(BigDecimal.valueOf(100)).toString());
}
return scoringPointList;
}
ErrorRateAnalysisResp errorRateAnalysisResp = new ErrorRateAnalysisResp();
errorRateAnalysisResp.setScoringPointList(scoringPointList);
ScorePointsUnderTheItemResp max = null;
ScorePointsUnderTheItemResp min = null;
if (scoringPointList.size() > 0) {
max = Collections.max(scoringPointList, new Comparator<ScorePointsUnderTheItemResp>() {
@Override
public int compare(ScorePointsUnderTheItemResp u1, ScorePointsUnderTheItemResp u2) {
double diff = Double.valueOf(u1.getErrorRate()) - Double.valueOf(u2.getErrorRate());
if (diff > 0) {
return 1;
} else if (diff < 0) {
return -1;
private ScorePointsUnderTheItemResp calculateErrorRateOfTestQuestions(Integer schoolId, Integer paperId, Integer mallId, String sort) {
ScorePointsUnderTheItemResp result = baseMapper.calculateTheErrorRateOfTestQuestions(schoolId, paperId, mallId, sort);
if (result != null) {
BigDecimal errorBigDecimal = new BigDecimal(result.getErrorRate());
result.setErrorRate(errorBigDecimal.setScale(2, RoundingMode.HALF_UP).toString());
}
return 0; //相等为0
return result;
}
});
// System.out.println("最大值" + max.toString());
min = Collections.min(scoringPointList, new Comparator<ScorePointsUnderTheItemResp>() {
@Override
public int compare(ScorePointsUnderTheItemResp u1, ScorePointsUnderTheItemResp u2) {
double diff = Double.valueOf(u1.getErrorRate()) - Double.valueOf(u2.getErrorRate());
if (diff > 0) {
return 1;
} else if (diff < 0) {
return -1;
}
return 0; //相等为0
private void setPrecisionForErrorRates(List<ScorePointsUnderTheItemResp> scoringPointList) {
for (ScorePointsUnderTheItemResp scorePoint : scoringPointList) {
BigDecimal errorBigDecimal = new BigDecimal(scorePoint.getErrorRate());
scorePoint.setErrorRate(errorBigDecimal.setScale(2, RoundingMode.HALF_UP).toString());
}
});
// System.out.println("最小值" + min.toString());
}
return R.ok().put("page", iPage).put("peopleNum", peopleNum).put("avgScore",
getAvgScoreAndPeople.getAvgScore()).put("maxScore", getAvgScoreAndPeople.getMaxScore()).put("minScore"
, getAvgScoreAndPeople.getMinScore()).put("getFractionalSegmentNum", getFractionalSegmentNum).put(
"errorAnalysis", errorRateAnalysisResp).put("highestErrorRate", max).put("minimumErrorRate",
min);
}
@Override
public R getAssessmentDetail(Integer assessmentId, Integer classId, Integer pageNum, Integer pageSize,
String keyword) {
@ -471,8 +470,8 @@ public class ExperimentalReportServiceImpl extends ServiceImpl<ExperimentalRepor
@Override
public void exportPracticeInfo(String ids, HttpServletResponse response, Integer schoolId, Integer projectId,
Integer mallId) throws Exception {
List<ExportPracticeByTeacherResp> retList = baseMapper.exportPracticeInfo(ids, schoolId, projectId, mallId);
Integer mallId,Integer paperId) throws Exception {
List<ExportPracticeByTeacherResp> retList = baseMapper.exportPracticeInfo(ids, schoolId, projectId, mallId,paperId);
// 告诉浏览器用什么软件可以打开此文件
response.setHeader("content-Type", "application/vnd.ms-excel");
@ -762,13 +761,13 @@ public class ExperimentalReportServiceImpl extends ServiceImpl<ExperimentalRepor
@Override
public R practiceActivity(Integer projectId, Integer pageNum, Integer pageSize, Integer schoolId, Integer classId
, String keyWord, Integer mallId) {
, String keyWord, Integer mallId, Integer paperId) {
Page<PerformanceManagementPracticeActivityVO> page =
new Page<PerformanceManagementPracticeActivityVO>(pageNum, pageSize);
IPage<PerformanceManagementPracticeActivityVO> iPage = baseMapper.practiceActivity(page, projectId, schoolId,
classId, keyWord, mallId);
classId, keyWord, mallId,paperId);
return R.ok(iPage);
}
@ -1596,6 +1595,12 @@ public class ExperimentalReportServiceImpl extends ServiceImpl<ExperimentalRepor
}
}
/*@Override
public R getPracticeDetailByTheory(TheoreticalExerciseDetailsReq req) {
return null;
}*/
private Path generateSingleReportFileByPython(Integer reportId, Path tempDir) throws IOException,
TemplateException {

Loading…
Cancel
Save