新增成绩相关接口
parent
90cd870ea8
commit
64dd81a874
@ -0,0 +1,126 @@
|
||||
package com.sztzjy.money_management.controller;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.sztzjy.money_management.annotation.AnonymousAccess;
|
||||
import com.sztzjy.money_management.entity.*;
|
||||
import com.sztzjy.money_management.entity.dto.StuTrainingDto;
|
||||
import com.sztzjy.money_management.mapper.StuTrainingMapper;
|
||||
import com.sztzjy.money_management.mapper.StudentScoreWeightMapper;
|
||||
import com.sztzjy.money_management.mapper.TrainingReportMapper;
|
||||
import com.sztzjy.money_management.util.ResultEntity;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@Api(tags = "成绩相关")
|
||||
@RequestMapping("api/ResourceController")
|
||||
public class GradeController {
|
||||
@Autowired
|
||||
StuTrainingMapper trainingMapper;
|
||||
@Autowired
|
||||
StudentScoreWeightMapper studentScoreWeightMapper;
|
||||
@Autowired
|
||||
TrainingReportMapper trainingReportMapper;
|
||||
|
||||
@AnonymousAccess
|
||||
@ApiOperation("得分情况展示")
|
||||
@PostMapping("getScoreInfo")
|
||||
public ResultEntity<StuTrainingDto> getScoreInfo(@RequestParam String userId,
|
||||
@RequestParam String chapterId,
|
||||
@RequestParam String schoolId) {
|
||||
StudentScoreWeight studentScoreWeight=new StudentScoreWeight();
|
||||
//先根据schoolID和chapterId查出学习成绩权重表数据
|
||||
StudentScoreWeightExample studentScoreWeightExample = new StudentScoreWeightExample();
|
||||
studentScoreWeightExample.createCriteria().andSchoolIdEqualTo(schoolId).andChapterIdEqualTo(chapterId);
|
||||
List<StudentScoreWeight> studentScoreWeights = studentScoreWeightMapper.selectByExample(studentScoreWeightExample);
|
||||
if(studentScoreWeights.isEmpty()){ //设置默认权重与计分规则
|
||||
//计分规则
|
||||
studentScoreWeight.setSummaryOfKnowledgeScore(BigDecimal.valueOf(20));
|
||||
studentScoreWeight.setResourceLearningScore(BigDecimal.valueOf(2));
|
||||
studentScoreWeight.setLearningAssessmentScore(BigDecimal.valueOf(10));
|
||||
studentScoreWeight.setExperimentalTrainingScore(BigDecimal.valueOf(20));
|
||||
|
||||
//权重
|
||||
studentScoreWeight.setSummaryOfKnowledgeWeight(BigDecimal.valueOf(0.2));
|
||||
studentScoreWeight.setResourceLearningWeight(BigDecimal.valueOf(0.2));
|
||||
studentScoreWeight.setLearningAssessmentWeight(BigDecimal.valueOf(0.2));
|
||||
studentScoreWeight.setExperimentalTrainingWeight(BigDecimal.valueOf(0.2));
|
||||
studentScoreWeight.setReportWeight(BigDecimal.valueOf(0.2));
|
||||
}else {
|
||||
studentScoreWeight = studentScoreWeights.get(0);
|
||||
}
|
||||
//再根据userid和chapterId查出学生实训表中的数据
|
||||
StuTrainingExample stuTrainingExample = new StuTrainingExample();
|
||||
stuTrainingExample.createCriteria().andUserIdEqualTo(userId).andChapterIdEqualTo(chapterId);
|
||||
List<StuTraining> stuTrainings = trainingMapper.selectByExample(stuTrainingExample);
|
||||
StuTraining stuTraining = stuTrainings.get(0);
|
||||
//进行整合
|
||||
StuTrainingDto stuTrainingDto = new StuTrainingDto();
|
||||
//设置返回对象计分规则
|
||||
stuTrainingDto.setKnowledgeSummaryDefaultRule(studentScoreWeight.getSummaryOfKnowledgeScore());
|
||||
stuTrainingDto.setResourceLearningDefaultRule(studentScoreWeight.getResourceLearningScore());
|
||||
stuTrainingDto.setLearningEvalDefaultRule(studentScoreWeight.getLearningAssessmentScore());
|
||||
stuTrainingDto.setExpTrainingDefautRule(studentScoreWeight.getExperimentalTrainingScore());
|
||||
//设置返回对象权重
|
||||
stuTrainingDto.setKnowledgeSummaryWeight(studentScoreWeight.getSummaryOfKnowledgeWeight());
|
||||
stuTrainingDto.setResourceLearningWeight(studentScoreWeight.getResourceLearningWeight());
|
||||
stuTrainingDto.setLearningEvalWeight(studentScoreWeight.getLearningAssessmentWeight());
|
||||
stuTrainingDto.setExpTrainingWeight(studentScoreWeight.getExperimentalTrainingWeight());
|
||||
stuTrainingDto.setReportWeight(studentScoreWeight.getReportWeight());
|
||||
//设置返回对象完成情况
|
||||
stuTrainingDto.setKnowledgeSummaryCompleteStatus(stuTraining.getKnowledgeSummaryCompleteStatus());
|
||||
stuTrainingDto.setResourceLearningCompleteStatus(stuTraining.getResourceLearningCompleteStatus());
|
||||
stuTrainingDto.setLearningEvalCompleteStatus(stuTraining.getLearningEvalCompleteStatus());
|
||||
stuTrainingDto.setExpTrainingCompleteStatus(stuTraining.getExpTrainingCompleteStatus());
|
||||
TrainingReportExample trainingReportExample = new TrainingReportExample();
|
||||
trainingReportExample.createCriteria().andChapterIdEqualTo(chapterId).andUserIdEqualTo(userId);
|
||||
//设置返回对象得分
|
||||
stuTrainingDto.setKnowledgeSummaryScore(stuTraining.getKnowledgeSummaryScore());
|
||||
stuTrainingDto.setResourceLearningScore(stuTraining.getResourceLearningScore());
|
||||
stuTrainingDto.setLearningEvalScore(stuTraining.getLearningEvalScore());
|
||||
stuTrainingDto.setCaseStuScore(stuTraining.getExpTrainingScore());
|
||||
|
||||
//设置实验报告情况及得分
|
||||
List<TrainingReport> trainingReports = trainingReportMapper.selectByExample(trainingReportExample);
|
||||
if(trainingReports.isEmpty()){
|
||||
stuTrainingDto.setReportCompleteStatus("未提交");
|
||||
stuTrainingDto.setReportScore(null);
|
||||
}else {
|
||||
stuTrainingDto.setReportCompleteStatus("已提交");
|
||||
stuTrainingDto.setReportScore(trainingReports.get(0).getTeacherScore());
|
||||
}
|
||||
return new ResultEntity<>(HttpStatus.OK, "得分情况展示",stuTrainingDto);
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/returnTrainingId")
|
||||
@ApiOperation("第一次进入时创建学生实训对象")
|
||||
@AnonymousAccess
|
||||
public ResultEntity<String> returnTrainingId(@RequestParam String chapterId,
|
||||
@RequestParam String userId) {
|
||||
StuTrainingExample stuTrainingExample = new StuTrainingExample();
|
||||
stuTrainingExample.createCriteria().andChapterIdEqualTo(chapterId).andUserIdEqualTo(userId);
|
||||
List<StuTrainingWithBLOBs> list = trainingMapper.selectByExampleWithBLOBs(stuTrainingExample);
|
||||
if (list.isEmpty()) { //该用户第一次进入这个章节的知识概要 新增
|
||||
StuTrainingWithBLOBs stuTraining = new StuTrainingWithBLOBs();
|
||||
String uuid = IdUtil.randomUUID();
|
||||
stuTraining.setTrainingId(uuid);
|
||||
stuTraining.setChapterId(chapterId);
|
||||
stuTraining.setUserId(userId);
|
||||
trainingMapper.insert(stuTraining);
|
||||
return new ResultEntity<>(uuid);
|
||||
} else {
|
||||
return new ResultEntity<>(list.get(0).getTrainingId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package com.sztzjy.money_management.entity.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class StuTrainingDto {
|
||||
@ApiModelProperty("知识概要默认计分规则")
|
||||
private BigDecimal knowledgeSummaryDefaultRule;
|
||||
|
||||
@ApiModelProperty("资源学习默认计分规则")
|
||||
private BigDecimal resourceLearningDefaultRule;
|
||||
|
||||
@ApiModelProperty("学习测评默认计分规则")
|
||||
private BigDecimal learningEvalDefaultRule;
|
||||
|
||||
@ApiModelProperty("实验实训默认计分规则")
|
||||
private BigDecimal expTrainingDefautRule;
|
||||
|
||||
|
||||
@ApiModelProperty("知识概要权重")
|
||||
private BigDecimal knowledgeSummaryWeight;
|
||||
|
||||
@ApiModelProperty("资源学习权重")
|
||||
private BigDecimal resourceLearningWeight;
|
||||
|
||||
@ApiModelProperty("学习测评权重")
|
||||
private BigDecimal learningEvalWeight;
|
||||
|
||||
@ApiModelProperty("实验实训权重")
|
||||
private BigDecimal expTrainingWeight;
|
||||
|
||||
@ApiModelProperty("实验报告权重")
|
||||
private BigDecimal reportWeight;
|
||||
|
||||
|
||||
@ApiModelProperty("知识概要完成情况")
|
||||
private Integer knowledgeSummaryCompleteStatus;
|
||||
|
||||
@ApiModelProperty("资源学习完成情况")
|
||||
private Integer resourceLearningCompleteStatus;
|
||||
|
||||
@ApiModelProperty("学习评测完成情况")
|
||||
private Integer learningEvalCompleteStatus;
|
||||
|
||||
@ApiModelProperty("实验实训完成情况")
|
||||
private Integer expTrainingCompleteStatus;
|
||||
|
||||
@ApiModelProperty("实验报告完成情况")
|
||||
private String reportCompleteStatus;
|
||||
|
||||
|
||||
|
||||
@ApiModelProperty("知识概要得分")
|
||||
private BigDecimal knowledgeSummaryScore;
|
||||
|
||||
@ApiModelProperty("资源学习得分")
|
||||
private BigDecimal resourceLearningScore;
|
||||
|
||||
@ApiModelProperty("学习评测得分")
|
||||
private BigDecimal learningEvalScore;
|
||||
|
||||
@ApiModelProperty("案例题学生得分")
|
||||
private BigDecimal caseStuScore;
|
||||
|
||||
@ApiModelProperty("实验报告得分")
|
||||
private BigDecimal reportScore;
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue