自动生成配置文件和mapper xml

newBigdata
xiaoCJ 11 months ago
parent 2f2e7ed67b
commit cedae41074

@ -210,34 +210,34 @@ public class TeaExamManageController {
List<StuUser> stuUsers = studentExamMapper.getUsersByExamID(examId, keyWord, status);
if (!stuUsers.isEmpty()) {
for (StuUser stuUser : stuUsers) {
if (stuUser.getPhone().equals("true") && stuUser.getEmail().equals("true")) {
stuUser.setMajor("提交");
} else {
stuUser.setMajor("提交");
}
if (StringUtils.isBlank(stuUser.getPhone()) || stuUser.getPhone().equals("false")) {
stuUser.setMajor("提交");
} else {
stuUser.setMajor("提交");
}
}
}
PageInfo pageInfo = new PageInfo(stuUsers);
return new ResultEntity<>(pageInfo);
PageInfo pageInfo = new PageInfo(stuUsers);
return new ResultEntity<>(pageInfo);
}
@AnonymousAccess
@PostMapping("/reloadExamById")
@ApiOperation("考试管理--指定人重考")
public ResultEntity<String> reloadExamById(@ApiParam("考试管理ID") @RequestParam String examId, @RequestParam String userId) {
StuStudentExamExample studentExamExample = new StuStudentExamExample();
studentExamExample.createCriteria().andUseridEqualTo(userId).andExamManageIdEqualTo(examId);
List<StuStudentExamWithBLOBs> stuStudentExamWithBLOBs = studentExamMapper.selectByExampleWithBLOBs(studentExamExample);
if (stuStudentExamWithBLOBs.isEmpty()) {
return new ResultEntity(HttpStatus.BAD_REQUEST, "学生暂未考试,无需重考");
} else {
StuStudentExamWithBLOBs stuStudentExamWithBLOBs1 = stuStudentExamWithBLOBs.get(0);
studentExamMapper.deleteByPrimaryKey(stuStudentExamWithBLOBs1.getStudentExamId());
return new ResultEntity(HttpStatus.OK, "指定重考成功!");
@AnonymousAccess
@PostMapping("/reloadExamById")
@ApiOperation("考试管理--指定人重考")
public ResultEntity<String> reloadExamById (@ApiParam("考试管理ID") @RequestParam String
examId, @RequestParam String userId){
StuStudentExamExample studentExamExample = new StuStudentExamExample();
studentExamExample.createCriteria().andUseridEqualTo(userId).andExamManageIdEqualTo(examId);
List<StuStudentExamWithBLOBs> stuStudentExamWithBLOBs = studentExamMapper.selectByExampleWithBLOBs(studentExamExample);
if (stuStudentExamWithBLOBs.isEmpty()) {
return new ResultEntity(HttpStatus.BAD_REQUEST, "学生暂未考试,无需重考");
} else {
StuStudentExamWithBLOBs stuStudentExamWithBLOBs1 = stuStudentExamWithBLOBs.get(0);
studentExamMapper.deleteByPrimaryKey(stuStudentExamWithBLOBs1.getStudentExamId());
return new ResultEntity(HttpStatus.OK, "指定重考成功!");
}
}
}
}

@ -215,23 +215,27 @@ public class TeaGradeManageController {
@AnonymousAccess
@PostMapping("/getGradeReportCase")
@ApiOperation("考试模式--成绩报告案例题questionOriginal所属章节contentOriginal为考核点数量") //TODO 案例题正确率字段暂无
@ApiOperation("考试模式--成绩报告案例题questionOriginal所属章节contentOriginal为考核点数量,Sort为序号") //TODO 案例题正确率字段暂无
public ResultEntity<PageInfo<SysCaseQuestion>> getGradeReportCase(@RequestParam Integer index,
@RequestParam Integer size,
@RequestParam String examManageId) {
TeaExamManageWithBLOBs teaExamManageWithBLOBs = teaExamManageMapper.selectByPrimaryKey(examManageId);
String caseIdList = teaExamManageWithBLOBs.getCaseIdlist();
List<String> list = Arrays.asList(caseIdList.split(","));
PageHelper.startPage(index, size);
List<SysCaseQuestion> resultList = sysCaseQuestionStepMapper.getGradeReportCase(list);
PageInfo pageInfo = new PageInfo(resultList);
List<SysCaseQuestionStep> resultList = sysCaseQuestionStepMapper.getGradeReportCase(list);
int i = 1;
for (SysCaseQuestionStep sysCaseQuestionStep : resultList) {
sysCaseQuestionStep.setSort(i);
i++;
}
PageInfo pageInfo = PageUtil.pageHelper(resultList, index, size);
return new ResultEntity(pageInfo);
}
@AnonymousAccess
@PostMapping("/getGradeReportObjective")
@ApiOperation("考试模式--成绩报告客观题") //TODO 客观题正确率字段暂无
@ApiOperation("考试模式--成绩报告客观题ObjectiveId为序号") //TODO 客观题正确率字段暂无
public ResultEntity<PageInfo<SysCaseQuestion>> getGradeReportObjective(@RequestParam Integer index,
@RequestParam Integer size,
@RequestParam String examManageId) {
@ -239,7 +243,7 @@ public class TeaGradeManageController {
if (teaExamManageWithBLOBs == null) {
return null;
}
List<String> list = new ArrayList();
List<String> list = new ArrayList<>();
if (StringUtils.isNotBlank(teaExamManageWithBLOBs.getSingleIdlist())) {
String singleIdList = teaExamManageWithBLOBs.getSingleIdlist();
String[] split = singleIdList.split(",");
@ -256,9 +260,16 @@ public class TeaGradeManageController {
list.addAll(Arrays.asList(split));
}
PageHelper.startPage(index, size);
List<SysCaseQuestion> resultList = sysObjectiveQuestionMapper.getGradeReportObjective(list);
PageInfo pageInfo = new PageInfo(resultList);
List<SysObjectiveQuestion> resultList = sysObjectiveQuestionMapper.getGradeReportObjective(list);
if (!resultList.isEmpty()){
int i =0;
for (SysObjectiveQuestion sysObjectiveQuestion : resultList) {
i++;
sysObjectiveQuestion.setObjectiveId(Integer.toString(i));
}
}
PageInfo pageInfo = PageUtil.pageHelper(resultList, index, size);
return new ResultEntity(pageInfo);
}

@ -0,0 +1,17 @@
package com.sztzjy.financial_bigdata.entity.stu_dto;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/**
* @Author xcj
* @Date 2024/4/28
*/
@Data
@NoArgsConstructor
public class ReceiveDto {
private BigDecimal totalScore;
private BigDecimal stuScore;
}

@ -33,6 +33,6 @@ public interface SysCaseQuestionStepMapper {
int updateByPrimaryKey(SysCaseQuestionStep record);
List<SysCaseQuestion> getGradeReportCase(@Param("list") List<String> list);
List<SysCaseQuestionStep> getGradeReportCase(@Param("list") List<String> list);
}

@ -49,5 +49,5 @@ public interface SysObjectiveQuestionMapper {
List<SysObjectiveQuestion> selectRandomObjectiveJudge();
List<SysCaseQuestion> getGradeReportObjective(@Param("list") List<String> list);
List<SysObjectiveQuestion> getGradeReportObjective(@Param("list") List<String> list);
}

@ -8,6 +8,7 @@ import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import com.sztzjy.financial_bigdata.entity.stu_dto.ReceiveDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@ -53,8 +54,5 @@ public interface TeaExamManageMapper {
@Select("select exam_name,exam_manage_id from tea_exam_manage where school_id =#{schoolId}")
List<Map<String, String>> selectNameAndIdBySchoolId(@Param("schoolId")String schoolId);
@Select("select sse.total_score,sum(tam.case_score+tam.single_score+tam.many_score+tam.judge_score) " +
"FROM tea_exam_manage tam JOIN stu_student_exam sse ON tam.exam_manage_id = sse.exam_manage_id" +
" GROUP BY sse.total_score ORDER BY MAX(tam.end_time) limit 1")
Map<BigDecimal,BigDecimal> getLastEaxmScore();
ReceiveDto getLastExamScore(@Param("userId")String userId);
}

@ -2,12 +2,15 @@ package com.sztzjy.financial_bigdata.service.stu.impl;
import com.sztzjy.financial_bigdata.config.Constant;
import com.sztzjy.financial_bigdata.entity.*;
import com.sztzjy.financial_bigdata.entity.stu_dto.ReceiveDto;
import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryIndexInfoDto;
import com.sztzjy.financial_bigdata.mapper.*;
import com.sztzjy.financial_bigdata.service.stu.StuIndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
import java.util.Map;
@ -68,7 +71,13 @@ public class StuIndexServiceImpl implements StuIndexService {
int examSize = stuStudentExamWithBLOBs.size(); //参与考核次数
stuTheoryIndexInfoDto.setTaskNum(examSize);
// Map<BD>teaExamManageMapper.getLastEaxmScore();//拿到最近考试的得分和 老师设置的题目总分 // TODO 最近一次考核正确率
ReceiveDto receiveDto = teaExamManageMapper.getLastExamScore(userId);//拿到最近考试的得分和 老师设置的题目总分
BigDecimal totalScore = receiveDto.getTotalScore();
BigDecimal stuScore = receiveDto.getStuScore();
if (totalScore.intValue()!=0&&stuScore.intValue()!=0){
BigDecimal bigDecimal = totalScore.divide(stuScore,2,RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); //学生得分 / 总分 * 100
stuTheoryIndexInfoDto.setLastTaskAccuracy(bigDecimal); //最近一次考核正确率
}
int lastRank = studentExamMapper.selectLastExamRank(userId); // 最近一次考核排名
@ -97,7 +106,7 @@ public class StuIndexServiceImpl implements StuIndexService {
stuTheoryIndexInfoDto.setAssetNum(num); //资源数量
SysResourceLearning sysResourceLearning = sysResourceLearningMapper.selectByPrimaryKey(schoolId);
if (sysResourceLearning!=null) {
if (sysResourceLearning != null) {
Integer learningNum = sysResourceLearning.getLearningNum();
Integer learningTime = sysResourceLearning.getLearningTime();
stuTheoryIndexInfoDto.setAssetStudyNum(learningNum); //学习人数

@ -113,52 +113,53 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
} 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 (stuStudentExamWithBLOB.getTotalScore()==null){
continue;
}
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 (score.intValue() >= 90) {
excellentNum++;
} else if (score.intValue() >= 80) {
goodNum++;
} else if (score.intValue() >= 60) {
generalNum++;
} else {
failNumber++;
}
// 计算平均分
if (totalStudents > 0) {
avgScore = totalScore / totalStudents;
}
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.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;
}

@ -411,7 +411,6 @@
<result column="class_name" jdbcType="VARCHAR" property="classId"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="exam_end_status" jdbcType="VARCHAR" property="phone"/>
<result column="case_end_status" jdbcType="VARCHAR" property="email"/>
</resultMap>
<select id="getUsersByExamID" parameterType="java.lang.String" resultMap="UserMap">
@ -427,10 +426,10 @@
AND (su.name LIKE CONCAT('%', #{keyWord}, '%') OR su.student_id LIKE CONCAT('%', #{keyWord}, '%'))
</if>
<if test="status == 'true'">
AND sse.case_end_status = 'true' and sse.exam_end_status = 'true'
AND sse.exam_end_status = 'true'
</if>
<if test="status == 'false'">
AND (sse.case_end_status != 'true' OR sse.exam_end_status != 'true')
AND sse.exam_end_status != 'true'
</if>
</where>
</select>

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save