重新生成考试表mapper删除classid字段,新增接口

newBigdata
xiaoCJ 12 months ago
parent a5bc00820b
commit 6be68bd284

@ -3,9 +3,11 @@ package com.sztzjy.financial_bigdata.controller.tea;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.sztzjy.financial_bigdata.annotation.AnonymousAccess;
import com.sztzjy.financial_bigdata.entity.*; import com.sztzjy.financial_bigdata.entity.*;
import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExamAndUserDto; import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExamAndUserDto;
import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExamManageCountDto; import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExamManageCountDto;
import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExaminationDetailsDto;
import com.sztzjy.financial_bigdata.entity.tea_dto.TeaTrainingInfoDTO; import com.sztzjy.financial_bigdata.entity.tea_dto.TeaTrainingInfoDTO;
import com.sztzjy.financial_bigdata.mapper.*; import com.sztzjy.financial_bigdata.mapper.*;
import com.sztzjy.financial_bigdata.service.tea.ITeaGradeManageService; import com.sztzjy.financial_bigdata.service.tea.ITeaGradeManageService;
@ -17,14 +19,22 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.poi.xwpf.usermodel.XWPFRun;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
@ -33,8 +43,8 @@ import java.util.*;
* @Date 2024/3/15 * @Date 2024/3/15
*/ */
@RestController @RestController
@RequestMapping @RequestMapping("/tea/score")
@Api("老师端--成绩管理") @Api(tags = "老师端--成绩管理")
public class TeaGradeManageController { public class TeaGradeManageController {
@Autowired @Autowired
private TeaExamManageMapper teaExamManageMapper; private TeaExamManageMapper teaExamManageMapper;
@ -48,7 +58,8 @@ public class TeaGradeManageController {
private ITeaGradeManageService iTeaGradeManageService; private ITeaGradeManageService iTeaGradeManageService;
@Autowired @Autowired
private TrainingReportMapper reportMapper; private TrainingReportMapper reportMapper;
@Autowired
private TeaAndStudentExamMapper teaAndStudentExamMapper;
@PostMapping("/getExamInfo") @PostMapping("/getExamInfo")
@ApiOperation("考试模式--页面展示") @ApiOperation("考试模式--页面展示")
@ -96,7 +107,6 @@ public class TeaGradeManageController {
} }
@PostMapping("/exportExam") @PostMapping("/exportExam")
@ApiOperation("考试模式--页面单个考试导出") @ApiOperation("考试模式--页面单个考试导出")
public void exportExam() { public void exportExam() {
@ -104,19 +114,57 @@ public class TeaGradeManageController {
} }
@AnonymousAccess
@GetMapping("/test")
@ApiOperation("测试导出")
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
response.setHeader("Content-Disposition", "attachment; filename=exam_result.docx");
XWPFDocument document = new XWPFDocument();
XWPFParagraph paragraph = document.createParagraph();
XWPFRun run = paragraph.createRun();
run.setText("Python程序设计2022-2023学年度第一学期期末考试\n"
+ "答题人:沙志梅 学号21200780 课程Python程序设计 班级21金融科技华强2 提交时间2022-12-02 10:42 ip10.100.66.8 考试得分: 82 分\n"
+ "一. 单选题 (共15题,45分\n"
+ "1.赋值语句... (这里是你的题目内容)");
document.write(response.getOutputStream());
}
@PostMapping("/getCountChart") @PostMapping("/getCountChart")
@ApiOperation("考试模式--图表统计接口") //TODO 待写 图表统计接口 @ApiOperation("考试模式--图表统计接口")
public void getCountChart() { public ResultEntity<TeaExaminationDetailsDto> getCountChart(@RequestParam String examManageId,
@RequestParam (required = false)String classId) {
return new ResultEntity<TeaExaminationDetailsDto>(iTeaGradeManageService.getCountChart(examManageId,classId));
}
@PostMapping("/getClassByExamManageId")
@ApiOperation("考试模式--图表统计接口班级下拉框返回classID和班级名") //只显示新建实训时添加的班级
public ResultEntity<Map<String, String>> getClassByExamManageId(@RequestParam String examManageId) {
TeaAndStudentExamExample teaAndStudentExamExample = new TeaAndStudentExamExample();
teaAndStudentExamExample.createCriteria().andExamManageIdEqualTo(examManageId);
List<TeaAndStudentExam> teaAndStudentExams = teaAndStudentExamMapper.selectByExample(teaAndStudentExamExample);
Map<String, String> map = new HashMap<>();
for (TeaAndStudentExam teaAndStudentExam : teaAndStudentExams) {
String classId = teaAndStudentExam.getClassId();
StuClass stuClass = stuClassMapper.selectByPrimaryKey(classId);
String className = stuClass.getClassName();
map.put(classId, className);
}
return new ResultEntity<Map<String, String>>(map);
} }
@PostMapping("/getGradeReport") @PostMapping("/getGradeReport")
@ApiOperation("考试模式--成绩报告接口") //TODO 待写 成绩报告接口 @ApiOperation("考试模式--成绩报告接口") //TODO 待写 成绩报告接口
public void getGradeReport() { public void getGradeReport() {
} }
@PostMapping("/getGradeDetails") @PostMapping("/getGradeDetails")
@ApiOperation("考试模式--成绩详情页面") //TODO 待写 成绩详情页面 @ApiOperation("考试模式--成绩详情页面") //TODO 待写 成绩详情页面
public void getGradeDetails() { public void getGradeDetails() {
@ -124,7 +172,6 @@ public class TeaGradeManageController {
} }
@PostMapping("/exportRank") @PostMapping("/exportRank")
@ApiOperation("考试模式--成绩排名页面导出") @ApiOperation("考试模式--成绩排名页面导出")
public void exportRank(HttpServletResponse response, public void exportRank(HttpServletResponse response,
@ -209,7 +256,6 @@ public class TeaGradeManageController {
} }
@PostMapping("/exportTrainingInfo") @PostMapping("/exportTrainingInfo")
@ApiOperation("练习模式--页面导出") @ApiOperation("练习模式--页面导出")
public void exportTrainingInfo(HttpServletResponse response, public void exportTrainingInfo(HttpServletResponse response,
@ -220,7 +266,6 @@ public class TeaGradeManageController {
} }
@PostMapping("/getTrainingDetailsInfo") @PostMapping("/getTrainingDetailsInfo")
@ApiOperation("练习模式--详情页面展示") @ApiOperation("练习模式--详情页面展示")
public void getTrainingDetailsInfo() { //todo 待写 详情页面展示 public void getTrainingDetailsInfo() { //todo 待写 详情页面展示
@ -246,7 +291,6 @@ public class TeaGradeManageController {
} }
@PostMapping("/getReportCorrect") @PostMapping("/getReportCorrect")
@ApiOperation("练习模式--实训报告评阅页面") @ApiOperation("练习模式--实训报告评阅页面")
public void getReportCorrect() { //todo 待写 实训报告评阅页面 public void getReportCorrect() { //todo 待写 实训报告评阅页面

@ -42,7 +42,6 @@ public class UserController {
private ITeaUserService userService; private ITeaUserService userService;
@PostMapping("/login") @PostMapping("/login")
@ApiOperation("登录接口") @ApiOperation("登录接口")
public ResultEntity login() { //todo 保存日志/与智云打通 public ResultEntity login() { //todo 保存日志/与智云打通
@ -50,7 +49,6 @@ public class UserController {
} }
/* /*
* @author xcj * @author xcj
* @Date 2024/3/11 * @Date 2024/3/11
@ -299,10 +297,10 @@ public class UserController {
@PostMapping("/selectLogs") @PostMapping("/selectLogs")
@ApiOperation("学生管理--日志查询") @ApiOperation("学生管理--日志查询")
public ResultEntity<PageInfo<SysLoginLog>> selectLogs(@RequestParam Integer index, public ResultEntity<PageInfo<SysLoginLog>> selectLogs(@RequestParam Integer index,
@RequestParam Integer size, @RequestParam Integer size,
@RequestParam String schoolId, @RequestParam String schoolId,
@RequestParam(required = false) String studentId, @RequestParam(required = false) String studentId,
@RequestParam(required = false) String classId) { @RequestParam(required = false) String classId) {
return userService.selectLogs(index, size, schoolId, studentId, classId); return userService.selectLogs(index, size, schoolId, studentId, classId);
} }
@ -314,6 +312,6 @@ public class UserController {
@RequestParam String schoolId, @RequestParam String schoolId,
@RequestParam(required = false) String studentId, @RequestParam(required = false) String studentId,
@RequestParam(required = false) String classId) { @RequestParam(required = false) String classId) {
userService.logExport(response,schoolId, studentId, classId); userService.logExport(response, schoolId, studentId, classId);
} }
} }

@ -17,9 +17,6 @@ public class TeaExamManage {
@ApiModelProperty("学校ID") @ApiModelProperty("学校ID")
private String schoolId; private String schoolId;
@ApiModelProperty("中间表ID")
private String teaAndStudentExamId;
@ApiModelProperty("这里为发布考试的人ID") @ApiModelProperty("这里为发布考试的人ID")
private String userId; private String userId;
@ -72,14 +69,6 @@ public class TeaExamManage {
this.schoolId = schoolId == null ? null : schoolId.trim(); this.schoolId = schoolId == null ? null : schoolId.trim();
} }
public String getTeaAndStudentExamId() {
return teaAndStudentExamId;
}
public void setTeaAndStudentExamId(String teaAndStudentExamId) {
this.teaAndStudentExamId = teaAndStudentExamId == null ? null : teaAndStudentExamId.trim();
}
public String getUserId() { public String getUserId() {
return userId; return userId;
} }

@ -246,76 +246,6 @@ public class TeaExamManageExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTeaAndStudentExamIdIsNull() {
addCriterion("tea_and_student_exam_id is null");
return (Criteria) this;
}
public Criteria andTeaAndStudentExamIdIsNotNull() {
addCriterion("tea_and_student_exam_id is not null");
return (Criteria) this;
}
public Criteria andTeaAndStudentExamIdEqualTo(String value) {
addCriterion("tea_and_student_exam_id =", value, "teaAndStudentExamId");
return (Criteria) this;
}
public Criteria andTeaAndStudentExamIdNotEqualTo(String value) {
addCriterion("tea_and_student_exam_id <>", value, "teaAndStudentExamId");
return (Criteria) this;
}
public Criteria andTeaAndStudentExamIdGreaterThan(String value) {
addCriterion("tea_and_student_exam_id >", value, "teaAndStudentExamId");
return (Criteria) this;
}
public Criteria andTeaAndStudentExamIdGreaterThanOrEqualTo(String value) {
addCriterion("tea_and_student_exam_id >=", value, "teaAndStudentExamId");
return (Criteria) this;
}
public Criteria andTeaAndStudentExamIdLessThan(String value) {
addCriterion("tea_and_student_exam_id <", value, "teaAndStudentExamId");
return (Criteria) this;
}
public Criteria andTeaAndStudentExamIdLessThanOrEqualTo(String value) {
addCriterion("tea_and_student_exam_id <=", value, "teaAndStudentExamId");
return (Criteria) this;
}
public Criteria andTeaAndStudentExamIdLike(String value) {
addCriterion("tea_and_student_exam_id like", value, "teaAndStudentExamId");
return (Criteria) this;
}
public Criteria andTeaAndStudentExamIdNotLike(String value) {
addCriterion("tea_and_student_exam_id not like", value, "teaAndStudentExamId");
return (Criteria) this;
}
public Criteria andTeaAndStudentExamIdIn(List<String> values) {
addCriterion("tea_and_student_exam_id in", values, "teaAndStudentExamId");
return (Criteria) this;
}
public Criteria andTeaAndStudentExamIdNotIn(List<String> values) {
addCriterion("tea_and_student_exam_id not in", values, "teaAndStudentExamId");
return (Criteria) this;
}
public Criteria andTeaAndStudentExamIdBetween(String value1, String value2) {
addCriterion("tea_and_student_exam_id between", value1, value2, "teaAndStudentExamId");
return (Criteria) this;
}
public Criteria andTeaAndStudentExamIdNotBetween(String value1, String value2) {
addCriterion("tea_and_student_exam_id not between", value1, value2, "teaAndStudentExamId");
return (Criteria) this;
}
public Criteria andUserIdIsNull() { public Criteria andUserIdIsNull() {
addCriterion("user_id is null"); addCriterion("user_id is null");
return (Criteria) this; return (Criteria) this;

@ -0,0 +1,50 @@
package com.sztzjy.financial_bigdata.entity.tea_dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author xcj
* @Date 2024/4/2
*/
//查看图标按钮
@Data
@NoArgsConstructor
public class TeaExaminationDetailsDto {
@ApiModelProperty("考试名称")
private String examName;
@ApiModelProperty("考试人数")
private Integer examNum;
@ApiModelProperty("实际考试人数")
private Integer examActualNum;
@ApiModelProperty("优秀人数")
private Integer excellentNumber;
@ApiModelProperty("良好人数")
private Integer goodNumber;
@ApiModelProperty("一般人数")
private Integer generalNum;
@ApiModelProperty("及格人数")
private Integer examPassNum;
@ApiModelProperty("不及格人数")
private Integer failingNumber;
@ApiModelProperty("最高分")
private Integer topScore;
@ApiModelProperty("平均分")
private Integer averageScore;
@ApiModelProperty("最低分")
private Integer lossScore;
@ApiModelProperty("错误率最高的三个案例名称")
private String caseName;
}

@ -34,4 +34,19 @@ public interface StuUserMapper {
@Select("select DISTINCT stu_userinfo.school_name from stu_users where school_id =#{schoolId}") @Select("select DISTINCT stu_userinfo.school_name from stu_users where school_id =#{schoolId}")
String selectSchoolNameById(@Param("schoolId")String schoolId); String selectSchoolNameById(@Param("schoolId")String schoolId);
@Select("SELECT SUM(user_count) AS total_user_count " +
"FROM ( " +
" SELECT class_id, COUNT(*) AS user_count " +
" FROM stu_userinfo " +
" WHERE class_id IN (SELECT class_id " +
" FROM tea_and_student_exam " +
" WHERE exam_manage_id = #{examManageId}" +
" <if test='classId != null'>" +
" AND class_id = #{classId}" +
" </if>" +
" ) " +
" GROUP BY class_id " +
") AS subquery;")
int getAllUsersByExamManageId(@Param("examManageId") String examManageId, @Param("classId") String classId);
} }

@ -1,6 +1,7 @@
package com.sztzjy.financial_bigdata.service.tea; package com.sztzjy.financial_bigdata.service.tea;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExaminationDetailsDto;
import com.sztzjy.financial_bigdata.entity.tea_dto.TeaTrainingInfoDTO; import com.sztzjy.financial_bigdata.entity.tea_dto.TeaTrainingInfoDTO;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -14,4 +15,7 @@ public interface ITeaGradeManageService {
PageInfo<TeaTrainingInfoDTO> getTrainingInfo(Integer index, Integer size, String schoolId, String keyWord, String classId); PageInfo<TeaTrainingInfoDTO> getTrainingInfo(Integer index, Integer size, String schoolId, String keyWord, String classId);
void exportTrainingInfo(HttpServletResponse response, String schoolId, String keyWord, String classId); void exportTrainingInfo(HttpServletResponse response, String schoolId, String keyWord, String classId);
TeaExaminationDetailsDto getCountChart(String examManageId,String classId);
} }

@ -1,8 +1,11 @@
package com.sztzjy.financial_bigdata.service.tea.impl; package com.sztzjy.financial_bigdata.service.tea.impl;
import cn.hutool.core.util.IdUtil;
import com.sztzjy.financial_bigdata.entity.TeaAndStudentExam;
import com.sztzjy.financial_bigdata.entity.TeaExamManageWithBLOBs; import com.sztzjy.financial_bigdata.entity.TeaExamManageWithBLOBs;
import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExamManageDto; import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExamManageDto;
import com.sztzjy.financial_bigdata.mapper.SysObjectiveQuestionMapper; import com.sztzjy.financial_bigdata.mapper.SysObjectiveQuestionMapper;
import com.sztzjy.financial_bigdata.mapper.TeaAndStudentExamMapper;
import com.sztzjy.financial_bigdata.mapper.TeaExamManageMapper; import com.sztzjy.financial_bigdata.mapper.TeaExamManageMapper;
import com.sztzjy.financial_bigdata.service.tea.ITeaExamManageService; import com.sztzjy.financial_bigdata.service.tea.ITeaExamManageService;
import com.sztzjy.financial_bigdata.util.ResultEntity; import com.sztzjy.financial_bigdata.util.ResultEntity;
@ -14,6 +17,8 @@ import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.UUID;
/** /**
* @Author xcj * @Author xcj
* @Date 2024/3/14 * @Date 2024/3/14
@ -26,7 +31,8 @@ public class TeaExamManageServiceImpl implements ITeaExamManageService {
private TeaExamManageMapper teaExamManageMapper; private TeaExamManageMapper teaExamManageMapper;
@Autowired @Autowired
private SysObjectiveQuestionMapper sysObjectiveQuestionMapper; private SysObjectiveQuestionMapper sysObjectiveQuestionMapper;
@Autowired
private TeaAndStudentExamMapper teaAndStudentExamMapper;
/* /*
* @author xcj * @author xcj
@ -35,7 +41,7 @@ public class TeaExamManageServiceImpl implements ITeaExamManageService {
@Override @Override
public ResultEntity<HttpStatus> addExam(TeaExamManageDto teaExamManagedto) { public ResultEntity<HttpStatus> addExam(TeaExamManageDto teaExamManagedto) {
TeaExamManageWithBLOBs teaExamManageWithBLOBs = new TeaExamManageWithBLOBs(); TeaExamManageWithBLOBs teaExamManageWithBLOBs = new TeaExamManageWithBLOBs();
BeanUtils.copyProperties(teaExamManagedto, teaExamManageWithBLOBs); //todo 需要修改 classid BeanUtils.copyProperties(teaExamManagedto, teaExamManageWithBLOBs);
//上传图片 //上传图片
if (teaExamManagedto.getFile() != null) { if (teaExamManagedto.getFile() != null) {
MultipartFile file = teaExamManagedto.getFile(); MultipartFile file = teaExamManagedto.getFile();
@ -54,6 +60,17 @@ public class TeaExamManageServiceImpl implements ITeaExamManageService {
if (teaExamManageWithBLOBs.getCaseWeight() == null || teaExamManageWithBLOBs.getObjectiveWeight() == null) { if (teaExamManageWithBLOBs.getCaseWeight() == null || teaExamManageWithBLOBs.getObjectiveWeight() == null) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "请输入题型得分权重!"); return new ResultEntity<>(HttpStatus.BAD_REQUEST, "请输入题型得分权重!");
} }
String examManageId = IdUtil.randomUUID();
//将班级ID新增到中间表
String[] split = teaExamManagedto.getClassId().split(",");
for (String s : split) {
TeaAndStudentExam teaAndStudentExam = new TeaAndStudentExam();
teaAndStudentExam.setExamManageId(examManageId);
teaAndStudentExam.setClassId(s);
teaAndStudentExam.setId(IdUtil.randomUUID());
teaAndStudentExamMapper.insert(teaAndStudentExam);
}
teaExamManageWithBLOBs.setExamManageId(examManageId);
teaExamManageMapper.insert(teaExamManageWithBLOBs); teaExamManageMapper.insert(teaExamManageWithBLOBs);
return new ResultEntity<>(HttpStatus.OK, "添加考试成功!"); return new ResultEntity<>(HttpStatus.OK, "添加考试成功!");
} }

@ -4,6 +4,7 @@ import cn.hutool.core.util.IdUtil;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.sztzjy.financial_bigdata.entity.*; import com.sztzjy.financial_bigdata.entity.*;
import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExamAndUserDto; import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExamAndUserDto;
import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExaminationDetailsDto;
import com.sztzjy.financial_bigdata.entity.tea_dto.TeaTrainingInfoDTO; import com.sztzjy.financial_bigdata.entity.tea_dto.TeaTrainingInfoDTO;
import com.sztzjy.financial_bigdata.mapper.*; import com.sztzjy.financial_bigdata.mapper.*;
import com.sztzjy.financial_bigdata.service.tea.ITeaGradeManageService; import com.sztzjy.financial_bigdata.service.tea.ITeaGradeManageService;
@ -37,13 +38,18 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
private SysWeightMapper sysWeightMapper; private SysWeightMapper sysWeightMapper;
@Autowired @Autowired
private TrainingReportMapper trainingReportMapper; private TrainingReportMapper trainingReportMapper;
@Autowired
private TeaExamManageMapper teaExamManageMapper;
@Autowired
private TeaAndStudentExamMapper teaAndStudentExamMapper;
@Autowired
private StuStudentExamMapper studentExamMapper;
@Override @Override
public PageInfo<TeaTrainingInfoDTO> getTrainingInfo(Integer index, Integer size, String schoolId, String keyWord, String classId) { public PageInfo<TeaTrainingInfoDTO> getTrainingInfo(Integer index, Integer size, String schoolId, String keyWord, String classId) {
List<TeaTrainingInfoDTO> list = getTeaTrainingInfoDTOS(schoolId, keyWord, classId); List<TeaTrainingInfoDTO> list = getTeaTrainingInfoDTOS(schoolId, keyWord, classId);
list.sort(new TotalScoreComparator()); list.sort(new TotalScoreComparator());
int i =0; int i = 0;
for (TeaTrainingInfoDTO teaTrainingInfoDTO : list) { for (TeaTrainingInfoDTO teaTrainingInfoDTO : list) {
i++; i++;
teaTrainingInfoDTO.setRank(i); teaTrainingInfoDTO.setRank(i);
@ -52,12 +58,14 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
} }
/**int % /**
* int %
*
* @author xcj * @author xcj
* @Date 2024/3/19 * @Date 2024/3/19
*/ */
@Override @Override
public void exportTrainingInfo(HttpServletResponse response,String schoolId, String keyWord, String classId) { public void exportTrainingInfo(HttpServletResponse response, String schoolId, String keyWord, String classId) {
List<TeaTrainingInfoDTO> list = getTeaTrainingInfoDTOS(schoolId, keyWord, classId); List<TeaTrainingInfoDTO> list = getTeaTrainingInfoDTOS(schoolId, keyWord, classId);
//导出的表名 //导出的表名
String title = IdUtil.simpleUUID(); String title = IdUtil.simpleUUID();
@ -73,6 +81,86 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
} }
} }
//饼形图
@Override
public TeaExaminationDetailsDto getCountChart(String examManageId,String classId) {
int passNum = 0; //及格人数
int topScore = 0; //最高分
int lowScore = 0; //最低分
int avgScore = 0; //平均分
int excellentNum = 0; //优秀人数 90-100
int goodNum = 0; //良好人数 80-89
int generalNum = 0; //一般人数 60-79
int failNumber = 0; //不及格人数
//根据考试ID查出所有user的数量
int sumUserCount = userMapper.getAllUsersByExamManageId(examManageId,classId); //获取老师指定的参加考试的人数
TeaExaminationDetailsDto teaExaminationDetailsDto = new TeaExaminationDetailsDto();
teaExaminationDetailsDto.setExamNum(sumUserCount);
TeaExamManageWithBLOBs teaExamManageWithBLOBs = teaExamManageMapper.selectByPrimaryKey(examManageId);
teaExaminationDetailsDto.setExamName(teaExamManageWithBLOBs.getExamName());
//实考人数 查出考试ID下有多少条数据
StuStudentExamExample studentExamExample = new StuStudentExamExample();
StuStudentExamExample.Criteria criteria = studentExamExample.createCriteria();
criteria.andExamManageIdEqualTo(examManageId);
if (StringUtils.isNotBlank(classId)){
criteria.andClassIdEqualTo(classId);
}
List<StuStudentExamWithBLOBs> stuStudentExamWithBLOBs = studentExamMapper.selectByExampleWithBLOBs(studentExamExample);
if (stuStudentExamWithBLOBs.isEmpty()) {
teaExaminationDetailsDto.setExamActualNum(0); //为空代表没学生提交考试 实考人数为0
} else {
teaExaminationDetailsDto.setExamActualNum(stuStudentExamWithBLOBs.size()); //否则为集合的长度
for (StuStudentExamWithBLOBs stuStudentExamWithBLOB : stuStudentExamWithBLOBs) { //不为就求分数
BigDecimal score = stuStudentExamWithBLOB.getTotalScore();
int passThreshold = 60; // 60是及格分数
int totalStudents = stuStudentExamWithBLOBs.size();
int totalScore = 0;
totalScore += score.intValue();
if (score.intValue() >= passThreshold) {
passNum++;
}
// 更新最高分和最低分
if (score.intValue() > topScore) {
topScore = score.intValue();
}
if (score.intValue() < lowScore) {
lowScore = score.intValue();
}
// 更新不同成绩等级的学生人数
if (score.intValue() >= 90) {
excellentNum++;
} else if (score.intValue() >= 80) {
goodNum++;
} else if (score.intValue() >= 60) {
generalNum++;
} else {
failNumber++;
}
// 计算平均分
if (totalStudents > 0) {
avgScore = totalScore / totalStudents;
}
// 将计算出的值设置到 TeaExaminationDetailsDto 对象中
teaExaminationDetailsDto.setExamPassNum(passNum);
teaExaminationDetailsDto.setTopScore(topScore);
teaExaminationDetailsDto.setLossScore(lowScore);
teaExaminationDetailsDto.setAverageScore(avgScore);
teaExaminationDetailsDto.setExcellentNumber(excellentNum);
teaExaminationDetailsDto.setGoodNumber(goodNum);
teaExaminationDetailsDto.setGeneralNum(generalNum);
teaExaminationDetailsDto.setFailingNumber(failNumber);
teaExaminationDetailsDto.setCaseName(""); //todo 补充 暂时没有
// 返回填充好数值的 teaExaminationDetailsDto 对象
}
}
return teaExaminationDetailsDto;
}
private List<TeaTrainingInfoDTO> getTeaTrainingInfoDTOS(String schoolId, String keyWord, String classId) { private List<TeaTrainingInfoDTO> getTeaTrainingInfoDTOS(String schoolId, String keyWord, String classId) {
StuUserExample userExample = new StuUserExample(); StuUserExample userExample = new StuUserExample();
@ -114,19 +202,19 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
teaTrainingInfoDTO.setProgress(stuTrainingWithBLOB.getProgress()); teaTrainingInfoDTO.setProgress(stuTrainingWithBLOB.getProgress());
BigDecimal totalScore = BigDecimal.valueOf(0); BigDecimal totalScore = BigDecimal.valueOf(0);
if (reportScore != null && BigDecimal.ZERO.compareTo(reportScore) == 0) { if (reportScore != null && BigDecimal.ZERO.compareTo(reportScore) == 0) {
totalScore = totalScore.add(reportScore.multiply(reportWeight).setScale(2,RoundingMode.HALF_UP)); totalScore = totalScore.add(reportScore.multiply(reportWeight).setScale(2, RoundingMode.HALF_UP));
} }
if (expTrainingScore != null && BigDecimal.ZERO.compareTo(expTrainingScore) == 0) { if (expTrainingScore != null && BigDecimal.ZERO.compareTo(expTrainingScore) == 0) {
totalScore = totalScore.add(expTrainingScore.multiply(expTrainingWeight).setScale(2,RoundingMode.HALF_UP)); totalScore = totalScore.add(expTrainingScore.multiply(expTrainingWeight).setScale(2, RoundingMode.HALF_UP));
} }
if (knowledgeSummaryScore != null && BigDecimal.ZERO.compareTo(knowledgeSummaryScore) == 0) { if (knowledgeSummaryScore != null && BigDecimal.ZERO.compareTo(knowledgeSummaryScore) == 0) {
totalScore = totalScore.add(knowledgeSummaryScore.multiply(knowledgeSummaryWeight).setScale(2,RoundingMode.HALF_UP)); totalScore = totalScore.add(knowledgeSummaryScore.multiply(knowledgeSummaryWeight).setScale(2, RoundingMode.HALF_UP));
} }
if (resourceLearningScore != null && BigDecimal.ZERO.compareTo(resourceLearningScore) == 0) { if (resourceLearningScore != null && BigDecimal.ZERO.compareTo(resourceLearningScore) == 0) {
totalScore = totalScore.add(resourceLearningScore.multiply(resourceLearningWeight).setScale(2,RoundingMode.HALF_UP)); totalScore = totalScore.add(resourceLearningScore.multiply(resourceLearningWeight).setScale(2, RoundingMode.HALF_UP));
} }
if (learningEvalScore != null && BigDecimal.ZERO.compareTo(learningEvalScore) == 0) { if (learningEvalScore != null && BigDecimal.ZERO.compareTo(learningEvalScore) == 0) {
totalScore = totalScore.add(learningEvalScore.multiply(learningEvalWeight).setScale(2,RoundingMode.HALF_UP)); totalScore = totalScore.add(learningEvalScore.multiply(learningEvalWeight).setScale(2, RoundingMode.HALF_UP));
} }
teaTrainingInfoDTO.setTotalScore(totalScore); teaTrainingInfoDTO.setTotalScore(totalScore);
list.add(teaTrainingInfoDTO); list.add(teaTrainingInfoDTO);
@ -137,7 +225,6 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
} }
public class TotalScoreComparator implements Comparator<TeaTrainingInfoDTO> { public class TotalScoreComparator implements Comparator<TeaTrainingInfoDTO> {
@Override @Override
public int compare(TeaTrainingInfoDTO o1, TeaTrainingInfoDTO o2) { public int compare(TeaTrainingInfoDTO o1, TeaTrainingInfoDTO o2) {

@ -4,7 +4,6 @@
<resultMap id="BaseResultMap" type="com.sztzjy.financial_bigdata.entity.TeaExamManage"> <resultMap id="BaseResultMap" type="com.sztzjy.financial_bigdata.entity.TeaExamManage">
<id column="exam_manage_id" jdbcType="VARCHAR" property="examManageId" /> <id column="exam_manage_id" jdbcType="VARCHAR" property="examManageId" />
<result column="school_id" jdbcType="VARCHAR" property="schoolId" /> <result column="school_id" jdbcType="VARCHAR" property="schoolId" />
<result column="tea_and_student_exam_id" jdbcType="VARCHAR" property="teaAndStudentExamId" />
<result column="user_id" jdbcType="VARCHAR" property="userId" /> <result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="exam_name" jdbcType="VARCHAR" property="examName" /> <result column="exam_name" jdbcType="VARCHAR" property="examName" />
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" /> <result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
@ -86,9 +85,9 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
exam_manage_id, school_id, tea_and_student_exam_id, user_id, exam_name, start_time, exam_manage_id, school_id, user_id, exam_name, start_time, end_time, logo_address,
end_time, logo_address, exam_Description, Objective_weight, case_weight, single_score, exam_Description, Objective_weight, case_weight, single_score, many_score, judge_score,
many_score, judge_score, case_score case_score
</sql> </sql>
<sql id="Blob_Column_List"> <sql id="Blob_Column_List">
single_idList, many_idList, judge_idList, case_idList, single_answer, many_answer, single_idList, many_idList, judge_idList, case_idList, single_answer, many_answer,
@ -143,22 +142,22 @@
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="com.sztzjy.financial_bigdata.entity.TeaExamManageWithBLOBs"> <insert id="insert" parameterType="com.sztzjy.financial_bigdata.entity.TeaExamManageWithBLOBs">
insert into tea_exam_manage (exam_manage_id, school_id, tea_and_student_exam_id, insert into tea_exam_manage (exam_manage_id, school_id, user_id,
user_id, exam_name, start_time, exam_name, start_time, end_time,
end_time, logo_address, exam_Description, logo_address, exam_Description, Objective_weight,
Objective_weight, case_weight, single_score, case_weight, single_score, many_score,
many_score, judge_score, case_score, judge_score, case_score, single_idList,
single_idList, many_idList, judge_idList, many_idList, judge_idList, case_idList,
case_idList, single_answer, many_answer, single_answer, many_answer, judge_answer
judge_answer) )
values (#{examManageId,jdbcType=VARCHAR}, #{schoolId,jdbcType=VARCHAR}, #{teaAndStudentExamId,jdbcType=VARCHAR}, values (#{examManageId,jdbcType=VARCHAR}, #{schoolId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR},
#{userId,jdbcType=VARCHAR}, #{examName,jdbcType=VARCHAR}, #{startTime,jdbcType=TIMESTAMP}, #{examName,jdbcType=VARCHAR}, #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP},
#{endTime,jdbcType=TIMESTAMP}, #{logoAddress,jdbcType=VARCHAR}, #{examDescription,jdbcType=VARCHAR}, #{logoAddress,jdbcType=VARCHAR}, #{examDescription,jdbcType=VARCHAR}, #{objectiveWeight,jdbcType=DECIMAL},
#{objectiveWeight,jdbcType=DECIMAL}, #{caseWeight,jdbcType=DECIMAL}, #{singleScore,jdbcType=DECIMAL}, #{caseWeight,jdbcType=DECIMAL}, #{singleScore,jdbcType=DECIMAL}, #{manyScore,jdbcType=DECIMAL},
#{manyScore,jdbcType=DECIMAL}, #{judgeScore,jdbcType=DECIMAL}, #{caseScore,jdbcType=DECIMAL}, #{judgeScore,jdbcType=DECIMAL}, #{caseScore,jdbcType=DECIMAL}, #{singleIdlist,jdbcType=LONGVARCHAR},
#{singleIdlist,jdbcType=LONGVARCHAR}, #{manyIdlist,jdbcType=LONGVARCHAR}, #{judgeIdlist,jdbcType=LONGVARCHAR}, #{manyIdlist,jdbcType=LONGVARCHAR}, #{judgeIdlist,jdbcType=LONGVARCHAR}, #{caseIdlist,jdbcType=LONGVARCHAR},
#{caseIdlist,jdbcType=LONGVARCHAR}, #{singleAnswer,jdbcType=LONGVARCHAR}, #{manyAnswer,jdbcType=LONGVARCHAR}, #{singleAnswer,jdbcType=LONGVARCHAR}, #{manyAnswer,jdbcType=LONGVARCHAR}, #{judgeAnswer,jdbcType=LONGVARCHAR}
#{judgeAnswer,jdbcType=LONGVARCHAR}) )
</insert> </insert>
<insert id="insertSelective" parameterType="com.sztzjy.financial_bigdata.entity.TeaExamManageWithBLOBs"> <insert id="insertSelective" parameterType="com.sztzjy.financial_bigdata.entity.TeaExamManageWithBLOBs">
insert into tea_exam_manage insert into tea_exam_manage
@ -169,9 +168,6 @@
<if test="schoolId != null"> <if test="schoolId != null">
school_id, school_id,
</if> </if>
<if test="teaAndStudentExamId != null">
tea_and_student_exam_id,
</if>
<if test="userId != null"> <if test="userId != null">
user_id, user_id,
</if> </if>
@ -237,9 +233,6 @@
<if test="schoolId != null"> <if test="schoolId != null">
#{schoolId,jdbcType=VARCHAR}, #{schoolId,jdbcType=VARCHAR},
</if> </if>
<if test="teaAndStudentExamId != null">
#{teaAndStudentExamId,jdbcType=VARCHAR},
</if>
<if test="userId != null"> <if test="userId != null">
#{userId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR},
</if> </if>
@ -314,9 +307,6 @@
<if test="record.schoolId != null"> <if test="record.schoolId != null">
school_id = #{record.schoolId,jdbcType=VARCHAR}, school_id = #{record.schoolId,jdbcType=VARCHAR},
</if> </if>
<if test="record.teaAndStudentExamId != null">
tea_and_student_exam_id = #{record.teaAndStudentExamId,jdbcType=VARCHAR},
</if>
<if test="record.userId != null"> <if test="record.userId != null">
user_id = #{record.userId,jdbcType=VARCHAR}, user_id = #{record.userId,jdbcType=VARCHAR},
</if> </if>
@ -383,7 +373,6 @@
update tea_exam_manage update tea_exam_manage
set exam_manage_id = #{record.examManageId,jdbcType=VARCHAR}, set exam_manage_id = #{record.examManageId,jdbcType=VARCHAR},
school_id = #{record.schoolId,jdbcType=VARCHAR}, school_id = #{record.schoolId,jdbcType=VARCHAR},
tea_and_student_exam_id = #{record.teaAndStudentExamId,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR}, user_id = #{record.userId,jdbcType=VARCHAR},
exam_name = #{record.examName,jdbcType=VARCHAR}, exam_name = #{record.examName,jdbcType=VARCHAR},
start_time = #{record.startTime,jdbcType=TIMESTAMP}, start_time = #{record.startTime,jdbcType=TIMESTAMP},
@ -411,7 +400,6 @@
update tea_exam_manage update tea_exam_manage
set exam_manage_id = #{record.examManageId,jdbcType=VARCHAR}, set exam_manage_id = #{record.examManageId,jdbcType=VARCHAR},
school_id = #{record.schoolId,jdbcType=VARCHAR}, school_id = #{record.schoolId,jdbcType=VARCHAR},
tea_and_student_exam_id = #{record.teaAndStudentExamId,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR}, user_id = #{record.userId,jdbcType=VARCHAR},
exam_name = #{record.examName,jdbcType=VARCHAR}, exam_name = #{record.examName,jdbcType=VARCHAR},
start_time = #{record.startTime,jdbcType=TIMESTAMP}, start_time = #{record.startTime,jdbcType=TIMESTAMP},
@ -434,9 +422,6 @@
<if test="schoolId != null"> <if test="schoolId != null">
school_id = #{schoolId,jdbcType=VARCHAR}, school_id = #{schoolId,jdbcType=VARCHAR},
</if> </if>
<if test="teaAndStudentExamId != null">
tea_and_student_exam_id = #{teaAndStudentExamId,jdbcType=VARCHAR},
</if>
<if test="userId != null"> <if test="userId != null">
user_id = #{userId,jdbcType=VARCHAR}, user_id = #{userId,jdbcType=VARCHAR},
</if> </if>
@ -500,7 +485,6 @@
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.sztzjy.financial_bigdata.entity.TeaExamManageWithBLOBs"> <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.sztzjy.financial_bigdata.entity.TeaExamManageWithBLOBs">
update tea_exam_manage update tea_exam_manage
set school_id = #{schoolId,jdbcType=VARCHAR}, set school_id = #{schoolId,jdbcType=VARCHAR},
tea_and_student_exam_id = #{teaAndStudentExamId,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=VARCHAR}, user_id = #{userId,jdbcType=VARCHAR},
exam_name = #{examName,jdbcType=VARCHAR}, exam_name = #{examName,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=TIMESTAMP}, start_time = #{startTime,jdbcType=TIMESTAMP},
@ -525,7 +509,6 @@
<update id="updateByPrimaryKey" parameterType="com.sztzjy.financial_bigdata.entity.TeaExamManage"> <update id="updateByPrimaryKey" parameterType="com.sztzjy.financial_bigdata.entity.TeaExamManage">
update tea_exam_manage update tea_exam_manage
set school_id = #{schoolId,jdbcType=VARCHAR}, set school_id = #{schoolId,jdbcType=VARCHAR},
tea_and_student_exam_id = #{teaAndStudentExamId,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=VARCHAR}, user_id = #{userId,jdbcType=VARCHAR},
exam_name = #{examName,jdbcType=VARCHAR}, exam_name = #{examName,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=TIMESTAMP}, start_time = #{startTime,jdbcType=TIMESTAMP},

Loading…
Cancel
Save